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
6483771cbebc9054f85455317662a5f33c18bfb4
e9aee86b52f5ca8a27628e72aaa4b6dacd02501a
/seeker/src/main/java/se452/group9/seeker/model/job.java
7ef03cdc22d54a98f3076f55b8950586f03555e4
[]
no_license
koreylo9/seeker
f953587cf6e6a9df6e1b12bd57c1970707b1eb00
96e5f45ac4c1851aeed6cc03df09373736ddc5ae
refs/heads/main
2023-04-16T08:41:13.933559
2021-04-28T01:19:11
2021-04-28T01:19:11
359,564,923
0
0
null
null
null
null
UTF-8
Java
false
false
1,724
java
package se452.group9.seeker.model; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; import javax.validation.constraints.NotBlank; import java.util.Date; @Entity @Table(name = "jobs") public class Job { @Id @GeneratedValue(strategy = GenerationType.AUTO) private long id; private String title; @Column(name="description", length=2000) private String desc; private String datePosted; private Boolean isActive; // private string jobType; // private int companyID; // private jobSkills //Constructor // public Job(int id, String title, String description, Boolean isActive){ // this.id = id; // this.title = title; // this.description = description; // this.createdDate = createdDate; // this.isActive = isActive; // } //Getters and Setters public Long getID(){ return id; } public void setID(Long id){ this.id = id; } public String getTitle(){ return title; } public void setTitle(String title){ this.title = title; } public String getDescription(){ return desc; } public void setDescription(String description){ this.desc = description; } public String getDatePosted(){ return datePosted; } public void setDatePosted(String datePosted){ this.datePosted = datePosted; } public Boolean getIsActive(){ return isActive; } public void setIsActive(Boolean isActive){ this.isActive = isActive; } }
[ "koreylo9@gmail.com" ]
koreylo9@gmail.com
9e6d9d0f61719a37c0c07ccca5c19faf40c8410a
6b7a1fbd005730d44400b44def69ca251a331712
/src/main/java/se/ecutb/loffe/data/AppUserStorage.java
a8ad59b3a27ecaa0fd7b4aaf0136ef8e597e53f3
[]
no_license
Loffis/SpringCore
01136ea9347b58a9f38907faf3df49c23de6488a
02f92f00f3222c6a25671564619b41eaeb0bc12d
refs/heads/master
2020-12-22T23:03:41.949286
2020-10-14T08:18:27
2020-10-14T08:18:27
236,956,382
0
0
null
2020-10-14T08:18:28
2020-01-29T10:26:11
Java
UTF-8
Java
false
false
557
java
package se.ecutb.loffe.data; import se.ecutb.loffe.model.AppUser; import java.util.List; import java.util.Optional; public interface AppUserStorage { Optional<AppUser> findById(int appUserId); // Bra med optional då EN ska hittas. Undviker null! List<AppUser> findAll(); List<AppUser> findByFirstName(String firstName); List<AppUser> findByLastName(String lastName); Optional<AppUser> findByEmail(String email); AppUser createAppUser(String firstName, String lastName, String email); boolean deleteAppUser(int appUserId); }
[ "loffe.knutsson@gmail.com" ]
loffe.knutsson@gmail.com
8631aec72ef8ec7c837df649aa9feb57adf0dadd
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/31/31_2814fd6d925e572b1870563e7b50628ae4b0dedc/GitCloneTest/31_2814fd6d925e572b1870563e7b50628ae4b0dedc_GitCloneTest_s.java
febf896870b840a9ce13a2b22ac96ca1501badfa
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
20,916
java
/******************************************************************************* * Copyright (c) 2011 IBM Corporation and others * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.orion.server.tests.servlets.git; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import java.io.StringBufferInputStream; import java.io.StringWriter; import java.io.Writer; import java.net.HttpURLConnection; import java.net.URI; import java.net.URISyntaxException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import org.eclipse.core.runtime.URIUtil; import org.eclipse.jgit.lib.Constants; import org.eclipse.jgit.lib.RepositoryCache; import org.eclipse.jgit.transport.URIish; import org.eclipse.jgit.util.FS; import org.eclipse.orion.internal.server.servlets.ProtocolConstants; import org.eclipse.orion.internal.server.servlets.workspace.ServletTestingSupport; import org.eclipse.orion.server.git.GitConstants; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import org.junit.Assume; import org.junit.BeforeClass; import org.junit.Test; import org.xml.sax.SAXException; import com.meterware.httpunit.GetMethodWebRequest; import com.meterware.httpunit.PostMethodWebRequest; import com.meterware.httpunit.WebRequest; import com.meterware.httpunit.WebResponse; public class GitCloneTest extends GitTest { @Test public void testGetCloneEmpty() throws IOException, SAXException, JSONException { WebRequest request = getGetGitCloneRequest(); WebResponse response = webConversation.getResponse(request); assertEquals(HttpURLConnection.HTTP_OK, response.getResponseCode()); JSONObject clones = new JSONObject(response.getText()); JSONArray clonesArray = clones.getJSONArray(ProtocolConstants.KEY_CHILDREN); assertEquals(0, clonesArray.length()); } @Test public void testGetClone() throws IOException, SAXException, JSONException { List<String> locations = new ArrayList<String>(); URIish uri = new URIish(gitDir.toURL()); String name = null; WebRequest request = getPostGitCloneRequest(uri, name); WebResponse response = webConversation.getResponse(request); assertEquals(HttpURLConnection.HTTP_CREATED, response.getResponseCode()); String location = response.getHeaderField(ProtocolConstants.HEADER_LOCATION); assertNotNull(location); locations.add(location); request = getPostGitCloneRequest(uri, name); response = webConversation.getResponse(request); assertEquals(HttpURLConnection.HTTP_CREATED, response.getResponseCode()); location = response.getHeaderField(ProtocolConstants.HEADER_LOCATION); assertNotNull(location); locations.add(location); request = getPostGitCloneRequest(uri, name); response = webConversation.getResponse(request); assertEquals(HttpURLConnection.HTTP_CREATED, response.getResponseCode()); location = response.getHeaderField(ProtocolConstants.HEADER_LOCATION); assertNotNull(location); locations.add(location); request = getGetGitCloneRequest(); response = webConversation.getResponse(request); assertEquals(HttpURLConnection.HTTP_OK, response.getResponseCode()); JSONObject clones = new JSONObject(response.getText()); JSONArray clonesArray = clones.getJSONArray(ProtocolConstants.KEY_CHILDREN); assertEquals(locations.size(), clonesArray.length()); } @Test public void testCloneEmptyUrl() throws IOException, SAXException, JSONException { WebRequest request = getPostGitCloneRequest("", null); WebResponse response = webConversation.getResponse(request); assertEquals(HttpURLConnection.HTTP_BAD_REQUEST, response.getResponseCode()); } @Test public void testCloneBadUrl() throws IOException, SAXException, JSONException { WebRequest request = getPostGitCloneRequest("I'm//bad!", null); WebResponse response = webConversation.getResponse(request); assertEquals(HttpURLConnection.HTTP_BAD_REQUEST, response.getResponseCode()); } @Test public void testClone() throws IOException, SAXException, JSONException, URISyntaxException { URIish uri = new URIish(gitDir.toURL()); String name = null; WebRequest request = getPostGitCloneRequest(uri, name); WebResponse response = webConversation.getResponse(request); assertEquals(HttpURLConnection.HTTP_CREATED, response.getResponseCode()); String location = response.getHeaderField(ProtocolConstants.HEADER_LOCATION); assertNotNull(location); JSONObject clone = new JSONObject(response.getText()); String contentLocation = clone.getString(ProtocolConstants.KEY_CONTENT_LOCATION); assertNotNull(contentLocation); File file = URIUtil.toFile(new URI(contentLocation)); assertTrue(file.exists()); assertTrue(file.isDirectory()); assertTrue(RepositoryCache.FileKey.isGitRepository(new File(file, Constants.DOT_GIT), FS.DETECTED)); } @Test public void testCloneAndLink() throws IOException, SAXException, JSONException, URISyntaxException { URIish uri = new URIish(gitDir.toURL()); String name = null; WebRequest request = getPostGitCloneRequest(uri, name); WebResponse response = webConversation.getResponse(request); assertEquals(HttpURLConnection.HTTP_CREATED, response.getResponseCode()); String location = response.getHeaderField(ProtocolConstants.HEADER_LOCATION); assertNotNull(location); JSONObject clone = new JSONObject(response.getText()); String contentLocation = clone.getString(ProtocolConstants.KEY_CONTENT_LOCATION); assertNotNull(contentLocation); URI workspaceLocation = createWorkspace(getMethodName()); ServletTestingSupport.allowedPrefixes = contentLocation; String projectName = getMethodName(); JSONObject body = new JSONObject(); body.put(ProtocolConstants.KEY_CONTENT_LOCATION, contentLocation); InputStream in = new StringBufferInputStream(body.toString()); // http://<host>/workspace/<workspaceId>/ request = new PostMethodWebRequest(workspaceLocation.toString(), in, "UTF-8"); if (projectName != null) request.setHeaderField(ProtocolConstants.HEADER_SLUG, projectName); request.setHeaderField(ProtocolConstants.HEADER_ORION_VERSION, "1"); setAuthentication(request); response = webConversation.getResponse(request); assertEquals(HttpURLConnection.HTTP_CREATED, response.getResponseCode()); JSONObject newProject = new JSONObject(response.getText()); String projectContentLocation = newProject.getString(ProtocolConstants.KEY_CONTENT_LOCATION); assertNotNull(projectContentLocation); // http://<host>/file/<projectId>/ request = getGetFilesRequest(projectContentLocation); response = webConversation.getResponse(request); assertEquals(HttpURLConnection.HTTP_OK, response.getResponseCode()); JSONObject project = new JSONObject(response.getText()); String childrenLocation = project.getString(ProtocolConstants.KEY_CHILDREN_LOCATION); assertNotNull(childrenLocation); // http://<host>/file/<projectId>/?depth=1 request = getGetFilesRequest(childrenLocation); response = webConversation.getResponse(request); assertEquals(HttpURLConnection.HTTP_OK, response.getResponseCode()); List<JSONObject> children = getDirectoryChildren(new JSONObject(response.getText())); String[] expectedChildren = new String[] {Constants.DOT_GIT, "folder", "test.txt"}; assertEquals("Wrong number of directory children", expectedChildren.length, children.size()); assertEquals(expectedChildren[0], children.get(0).getString(ProtocolConstants.KEY_NAME)); assertEquals(expectedChildren[1], children.get(1).getString(ProtocolConstants.KEY_NAME)); assertEquals(expectedChildren[2], children.get(2).getString(ProtocolConstants.KEY_NAME)); } @Test public void testCloneAndLinkToSubfolder() throws IOException, SAXException, JSONException, URISyntaxException { URIish uri = new URIish(gitDir.toURL()); String name = null; WebRequest request = getPostGitCloneRequest(uri, name); WebResponse response = webConversation.getResponse(request); assertEquals(HttpURLConnection.HTTP_CREATED, response.getResponseCode()); String location = response.getHeaderField(ProtocolConstants.HEADER_LOCATION); assertNotNull(location); JSONObject clone = new JSONObject(response.getText()); String contentLocation = clone.getString(ProtocolConstants.KEY_CONTENT_LOCATION); assertNotNull(contentLocation); File file = URIUtil.toFile(new URI(contentLocation)); File folder = new File(file, "folder"); URI workspaceLocation = createWorkspace(getMethodName()); ServletTestingSupport.allowedPrefixes = contentLocation.toString(); String projectName = getMethodName(); JSONObject body = new JSONObject(); body.put(ProtocolConstants.KEY_CONTENT_LOCATION, folder.toURI().toString()); InputStream in = new StringBufferInputStream(body.toString()); // http://<host>/workspace/<workspaceId>/ request = new PostMethodWebRequest(workspaceLocation.toString(), in, "UTF-8"); if (projectName != null) request.setHeaderField(ProtocolConstants.HEADER_SLUG, projectName); request.setHeaderField(ProtocolConstants.HEADER_ORION_VERSION, "1"); setAuthentication(request); response = webConversation.getResponse(request); assertEquals(HttpURLConnection.HTTP_CREATED, response.getResponseCode()); JSONObject newProject = new JSONObject(response.getText()); String projectContentLocation = newProject.getString(ProtocolConstants.KEY_CONTENT_LOCATION); assertNotNull(projectContentLocation); // http://<host>/file/<projectId>/ request = getGetFilesRequest(projectContentLocation); response = webConversation.getResponse(request); assertEquals(HttpURLConnection.HTTP_OK, response.getResponseCode()); JSONObject project = new JSONObject(response.getText()); String childrenLocation = project.getString(ProtocolConstants.KEY_CHILDREN_LOCATION); assertNotNull(childrenLocation); // http://<host>/file/<projectId>/?depth=1 request = getGetFilesRequest(childrenLocation); response = webConversation.getResponse(request); assertEquals(HttpURLConnection.HTTP_OK, response.getResponseCode()); List<JSONObject> children = getDirectoryChildren(new JSONObject(response.getText())); String[] expectedChildren = new String[] {"folder.txt"}; assertEquals("Wrong number of directory children", expectedChildren.length, children.size()); assertEquals(expectedChildren[0], children.get(0).getString(ProtocolConstants.KEY_NAME)); } private static String sshRepo; private static String sshRepo2; private static char[] password; private static String knownHosts; private static byte[] privateKey; private static byte[] publicKey; private static byte[] passphrase; @BeforeClass public static void readSshProperties() { String propertiesFile = System.getProperty("orion.tests.ssh"); // if (propertiesFile == null) return; Map<String, String> properties = new HashMap<String, String>(); try { File file = new File(propertiesFile); if (file.isDirectory()) file = new File(file, "sshtest.properties"); BufferedReader reader = new BufferedReader(new FileReader(file)); try { for (String line; (line = reader.readLine()) != null;) { if (line.startsWith("#")) continue; int sep = line.indexOf("="); String property = line.substring(0, sep).trim(); String value = line.substring(sep + 1).trim(); properties.put(property, value); } } finally { reader.close(); } // initialize constants sshRepo = properties.get("host"); sshRepo2 = properties.get("host2"); password = properties.get("password").toCharArray(); knownHosts = properties.get("knownHosts"); privateKey = loadFileContents(properties.get("privateKeyPath")).getBytes(); publicKey = loadFileContents(properties.get("publicKeyPath")).getBytes(); passphrase = properties.get("passphrase").getBytes(); } catch (Exception e) { System.err.println("Could not read ssh properties file: " + propertiesFile); } } @Test public void testCloneOverSshWithNoKnownHosts() throws IOException, SAXException, JSONException, URISyntaxException { Assume.assumeTrue(sshRepo != null); URIish uri = new URIish(sshRepo); String name = null; WebRequest request = getPostGitCloneRequest(uri, name, null, null); WebResponse response = webConversation.getResponse(request); assertEquals(HttpURLConnection.HTTP_INTERNAL_ERROR, response.getResponseCode()); } @Test public void testCloneOverSshWithNoPassword() throws IOException, SAXException, JSONException, URISyntaxException { Assume.assumeTrue(sshRepo != null); Assume.assumeTrue(knownHosts != null); URIish uri = new URIish(sshRepo); String name = null; WebRequest request = getPostGitCloneRequest(uri, name, knownHosts, (char[]) null); WebResponse response = webConversation.getResponse(request); assertEquals(HttpURLConnection.HTTP_INTERNAL_ERROR, response.getResponseCode()); } @Test public void testCloneOverSshWithBadPassword() throws IOException, SAXException, JSONException, URISyntaxException { Assume.assumeTrue(sshRepo != null); Assume.assumeTrue(knownHosts != null); URIish uri = new URIish(sshRepo); String name = null; WebRequest request = getPostGitCloneRequest(uri, name, knownHosts, "I'm bad".toCharArray()); WebResponse response = webConversation.getResponse(request); assertEquals(HttpURLConnection.HTTP_INTERNAL_ERROR, response.getResponseCode()); } @Test public void testCloneOverSshWithPassword() throws IOException, SAXException, JSONException, URISyntaxException { Assume.assumeTrue(sshRepo != null); Assume.assumeTrue(password != null); Assume.assumeTrue(knownHosts != null); URIish uri = new URIish(sshRepo); String name = null; WebRequest request = getPostGitCloneRequest(uri, name, knownHosts, password); WebResponse response = webConversation.getResponse(request); assertEquals(HttpURLConnection.HTTP_CREATED, response.getResponseCode()); String location = response.getHeaderField(ProtocolConstants.HEADER_LOCATION); assertNotNull(location); JSONObject clone = new JSONObject(response.getText()); String contentLocation = clone.getString(ProtocolConstants.KEY_CONTENT_LOCATION); assertNotNull(contentLocation); File file = URIUtil.toFile(new URI(contentLocation)); assertTrue(file.exists()); assertTrue(file.isDirectory()); assertTrue(RepositoryCache.FileKey.isGitRepository(new File(file, Constants.DOT_GIT), FS.DETECTED)); } @Test public void testCloneOverSshWithPassphraseProtectedKey() throws IOException, SAXException, JSONException, URISyntaxException { Assume.assumeTrue(sshRepo2 != null); Assume.assumeTrue(privateKey != null); Assume.assumeTrue(passphrase != null); knownHosts = "github.com,207.97.227.239 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ=="; URIish uri = new URIish(sshRepo2); String name = null; WebRequest request = getPostGitCloneRequest(uri, name, knownHosts, privateKey, publicKey, passphrase); WebResponse response = webConversation.getResponse(request); assertEquals(HttpURLConnection.HTTP_CREATED, response.getResponseCode()); String location = response.getHeaderField(ProtocolConstants.HEADER_LOCATION); assertNotNull(location); JSONObject clone = new JSONObject(response.getText()); String contentLocation = clone.getString(ProtocolConstants.KEY_CONTENT_LOCATION); assertNotNull(contentLocation); File file = URIUtil.toFile(new URI(contentLocation)); assertTrue(file.exists()); assertTrue(file.isDirectory()); assertTrue(RepositoryCache.FileKey.isGitRepository(new File(file, Constants.DOT_GIT), FS.DETECTED)); } /** * Creates a request to create a git clone for the given uri. * @param uri * @param name * @throws JSONException */ private WebRequest getPostGitCloneRequest(String uri, String name, String kh, char[] p) throws JSONException { String requestURI = SERVER_LOCATION + GIT_SERVLET_LOCATION + GitConstants.CLONE_RESOURCE + '/'; JSONObject body = new JSONObject(); body.put(GitConstants.KEY_URL, uri); body.put(ProtocolConstants.KEY_NAME, name); if (kh != null) body.put(GitConstants.KEY_KNOWN_HOSTS, kh); if (p != null) body.put(GitConstants.KEY_PASSWORD, new String(p)); InputStream in = new StringBufferInputStream(body.toString()); WebRequest request = new PostMethodWebRequest(requestURI, in, "UTF-8"); request.setHeaderField(ProtocolConstants.HEADER_ORION_VERSION, "1"); setAuthentication(request); return request; } private WebRequest getPostGitCloneRequest(String uri, String name, String kh, byte[] privk, byte[] pubk, byte[] p) throws JSONException { String requestURI = SERVER_LOCATION + GIT_SERVLET_LOCATION + GitConstants.CLONE_RESOURCE + '/'; JSONObject body = new JSONObject(); body.put(GitConstants.KEY_URL, uri); body.put(ProtocolConstants.KEY_NAME, name); if (kh != null) body.put(GitConstants.KEY_KNOWN_HOSTS, kh); if (privk != null) body.put(GitConstants.KEY_PRIVATE_KEY, new String(privk)); if (pubk != null) body.put(GitConstants.KEY_PUBLIC_KEY, new String(pubk)); if (p != null) body.put(GitConstants.KEY_PASSPHRASE, new String(p)); InputStream in = new StringBufferInputStream(body.toString()); WebRequest request = new PostMethodWebRequest(requestURI, in, "UTF-8"); request.setHeaderField(ProtocolConstants.HEADER_ORION_VERSION, "1"); setAuthentication(request); return request; } private WebRequest getGetGitCloneRequest() { String requestURI = SERVER_LOCATION + GIT_SERVLET_LOCATION + GitConstants.CLONE_RESOURCE + '/'; WebRequest request = new GetMethodWebRequest(requestURI); request.setHeaderField(ProtocolConstants.HEADER_ORION_VERSION, "1"); setAuthentication(request); return request; } // Convince methods for creating requests private WebRequest getPostGitCloneRequest(URIish uri, String name) throws JSONException { return getPostGitCloneRequest(uri.toString(), name, null, null); } private WebRequest getPostGitCloneRequest(String uri, String name) throws JSONException { return getPostGitCloneRequest(uri, name, null, null); } private WebRequest getPostGitCloneRequest(URIish uri, String name, String kh, char[] p) throws JSONException { return getPostGitCloneRequest(uri.toString(), name, kh, p); } private WebRequest getPostGitCloneRequest(URIish uri, String name, String kh, byte[] privk, byte[] pubk, byte[] p) throws JSONException { return getPostGitCloneRequest(uri.toString(), name, kh, privk, pubk, p); } // Utility methods private static String loadFileContents(String path) throws IOException { File file = new File(path); InputStream is = new FileInputStream(file); return toString(is); } private static String toString(InputStream is) throws IOException { if (is != null) { Writer writer = new StringWriter(); char[] buffer = new char[1024]; try { Reader reader = new BufferedReader(new InputStreamReader(is, "UTF-8")); int n; while ((n = reader.read(buffer)) != -1) { writer.write(buffer, 0, n); } } finally { is.close(); } return writer.toString(); } return ""; } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
2b7f5ea0cf365157d556d0eca74a526d78d7f470
54204e3fb83d219819271788b77532f9fde33bdc
/application/src/main/java/org/thingsboard/server/service/encoding/DataDecodingEncodingService.java
a5d3ab465e033cb86289ee9f8324c7bbed9a4271
[ "Apache-2.0" ]
permissive
ziapple/thingsboard-side
66bef8dc8335edc4135884a6bb309fedfb4887fe
e91a4d3c8dc05a7b74b40747edbf0a67591755be
refs/heads/master
2023-01-22T15:50:23.580651
2020-03-06T06:12:07
2020-03-06T06:12:07
236,173,500
0
0
Apache-2.0
2023-01-01T15:42:29
2020-01-25T13:26:35
Java
UTF-8
Java
false
false
1,182
java
/** * Copyright © 2016-2020 The Thingsboard 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 org.thingsboard.server.service.encoding; import org.thingsboard.server.common.msg.TbActorMsg; import org.thingsboard.server.common.msg.cluster.ServerAddress; import org.thingsboard.server.gen.cluster.ClusterAPIProtos; import java.util.Optional; public interface DataDecodingEncodingService { Optional<TbActorMsg> decode(byte[] byteArray); byte[] encode(TbActorMsg msq); ClusterAPIProtos.ClusterMessage convertToProtoDataMessage(ServerAddress serverAddress, TbActorMsg msg); }
[ "ziapple@126.com" ]
ziapple@126.com
43243a038e6a2e7f15b54569b4d0e638e49a780f
78474091d56468ad23dfd15e44db5be81062f3ad
/src/com/sb/controller/SBDeleteRepAction.java
4db4178c0907a0d43229e836236e520e7133ea95
[]
no_license
hugstaring/144
b6ca17324f77a3639601d6c2e6cf4fa4525af342
7925d848ec312510c43cc9bfb31c425c6df259e1
refs/heads/master
2023-02-06T19:01:17.087599
2020-02-08T17:33:39
2020-02-08T17:33:39
325,151,433
0
0
null
null
null
null
UTF-8
Java
false
false
878
java
package com.sb.controller; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.lol.comm.Action; import com.lol.comm.ForwardAction; import com.sb.service.SUPBoardService; public class SBDeleteRepAction implements Action { @Override public ForwardAction execute(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { int repno= Integer.parseInt(request.getParameter("repno")); int bno= Integer.parseInt(request.getParameter("bno")); SUPBoardService service= SUPBoardService.sbGetBoardService(); service.sbDeleteRep(repno, bno); ForwardAction f = new ForwardAction(); f.setForward(false); f.setUrl("sbdetail.do?bno="+bno); return f; } }
[ "s_b02@DESKTOP-IDQ9IQ3" ]
s_b02@DESKTOP-IDQ9IQ3
65939a3e6beec88c2b0f3f4aecbad2bced0cfae5
01767912de896a1d9f044b02725e786582a19e47
/lansongsdk/src/main/java/com/lansosdk/videoeditor/VideoEditor.java
0770e6cfca158f7e945e054556d74d13f6cadd7c
[]
no_license
LionShion/MyVideoDemo
1fca479fc084c24054d51e69f834eb414442117e
f178aaacde52c41798dd19a42b7cae1c621b1812
refs/heads/master
2020-07-12T19:30:56.020441
2019-08-28T09:12:32
2019-08-28T09:12:32
204,891,723
1
0
null
null
null
null
UTF-8
Java
false
false
106,522
java
package com.lansosdk.videoeditor; import android.content.Context; import android.graphics.Bitmap; import android.media.MediaCodecInfo; import android.media.MediaCodecList; import android.media.MediaMetadataRetriever; import android.os.Build; import android.os.Handler; import android.os.Looper; import android.os.Message; import android.text.TextUtils; import android.util.Log; import com.lansosdk.box.LSLog; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.List; import java.util.Locale; import static com.lansosdk.videoeditor.LanSongFileUtil.fileExist; /** * 最简单的调用方法: * //step1. 放在主线程中执行; * VideoEditor veditor=new VideoEditor(); * veditor.setOnProgessListener(xxx)进度; * * //step2. * 然后在AsyncTask或Thread中执行如下; * veditor.executeXXXXX(); * * * 杭州蓝松科技有限公司 * www.lansongtech.com */ public class VideoEditor { private static final String TAG = LSLog.TAG; public static final String version="VideoEditor_20100101"; /** * 使用软件编码的列表; */ public static String[] qilinCpulist ={ "EML-AL00", "EML-AL01", "LON-AL00", "MHA-AL00", "STF-AL00", "CLT-AL00", "ALP-AL00", "COL-AL10", "FRD-AL00", "EVR-AL00", "LYA-AL00", "PAR-AL00", "LON-AL00-PD", "VKY-AL00", "EDI-AL10", "DLI-AL10", "PRA-AL00X", "DUK-AL20", "DUK-AL20", "DUK-AL20", "WAS-AL00", "HUAWEI NXT-CL00", "RVL-AL09", "COR-AL00", "PAR-AL00", "INE-AL00", "EML-TL00", "EML-TL01", "LON-TL00", "MHA-TL00", "STF-TL00", "CLT-TL00", "ALP-TL00", "COL-TL10", "FRD-TL00", "EVR-TL00", "LYA-TL00" }; public static String[] useSoftDecoderlist ={ "SM919", "SM901" }; /** * 是否强制使用硬件编码器; * * 全局变量 * * 默认先硬件编码,如果无法完成则切换为软编码 */ public static boolean isForceHWEncoder=false; /** * 强制使用软件编码器 * * 全局变量 * 默认先硬件编码,如果无法完成则切换为软编码 */ public static boolean isForceSoftWareEncoder=false; /** * 强制使用软解码器 * * 全局变量 */ public static boolean isForceSoftWareDecoder=false; /** * 不检查是否是16的倍数. * */ private static boolean noCheck16Multi=false; /** * 给当前方法指定码率. * 此静态变量, 在execute执行后, 默认恢复为0; */ public int encodeBitRate=0; /** * 解析参数失败 返回1 无输出文件 2; 输入文件为空:3 sdk未授权 -1; 解码器错误:69 收到线程的中断信号:255 如硬件编码器错误,则返回:26625---26630 */ public static final int VIDEO_EDITOR_EXECUTE_SUCCESS1 = 0; public static final int VIDEO_EDITOR_EXECUTE_SUCCESS2 = 1; public static final int VIDEO_EDITOR_EXECUTE_FAILED = -101; //文件不存在。 private final int VIDEOEDITOR_HANDLER_PROGRESS = 203; private final int VIDEOEDITOR_HANDLER_COMPLETED = 204; private final int VIDEOEDITOR_HANDLER_ENCODERCHANGE = 205; private static LanSongLogCollector lanSongLogCollector =null; public void setEncodeBitRate(int bitRate){ encodeBitRate=bitRate; } /** * 使能在ffmpeg执行的时候, 收集错误信息; * * @param ctx */ public static void logEnable(Context ctx){ if(ctx!=null){ lanSongLogCollector =new LanSongLogCollector(ctx); }else{ if(lanSongLogCollector !=null && lanSongLogCollector.isRunning()){ lanSongLogCollector.stop(); lanSongLogCollector =null; } } } /** * 当执行失败后,返回错误信息; * @return */ public static String getErrorLog(){ if(lanSongLogCollector !=null && lanSongLogCollector.isRunning()){ return lanSongLogCollector.stop(); }else{ return null; } } /** * 构造方法. * 如果您想扩展ffmpeg的命令, 可以继承这个类, * 在其中像我们的各种executeXXX的举例一样来拼接ffmpeg的命令; * * 不要直接修改我们的这个文件, 以方便以后的sdk更新升级. */ public VideoEditor() { Looper looper; if ((looper = Looper.myLooper()) != null) { mEventHandler = new EventHandler(this, looper); } else if ((looper = Looper.getMainLooper()) != null) { mEventHandler = new EventHandler(this, looper); } else { mEventHandler = null; Log.w(TAG, "cannot get Looper handler. may be cannot receive video editor progress!!"); } } public onVideoEditorEncodeChangedListener mEncoderChangeListener=null; public void setOnEncodeChangedListener(onVideoEditorEncodeChangedListener listener) { mEncoderChangeListener = listener; } private void doEncoderChangedListener(boolean isSoft) { if (mEncoderChangeListener != null) mEncoderChangeListener.onChanged(this,isSoft); } public onVideoEditorProgressListener mProgressListener = null; public void setOnProgessListener(onVideoEditorProgressListener listener) { mProgressListener = listener; } private void doOnProgressListener(int timeMS) { if (mProgressListener != null) mProgressListener.onProgress(this, timeMS); } private EventHandler mEventHandler; private class EventHandler extends Handler { private final WeakReference<VideoEditor> mWeakExtract; public EventHandler(VideoEditor mp, Looper looper) { super(looper); mWeakExtract = new WeakReference<VideoEditor>(mp); } @Override public void handleMessage(Message msg) { VideoEditor videoextract = mWeakExtract.get(); if (videoextract == null) { Log.e(TAG, "VideoEditor went away with unhandled events"); return; } switch (msg.what) { case VIDEOEDITOR_HANDLER_PROGRESS: videoextract.doOnProgressListener(msg.arg1); break; case VIDEOEDITOR_HANDLER_ENCODERCHANGE: videoextract.doEncoderChangedListener(true); //暂停只要改变,就变成软编码; break; default: break; } } } /** * 异步线程执行的代码. */ public int executeVideoEditor(String[] array) { return execute(array); } @SuppressWarnings("unused") /* Used from JNI */ private void postEventFromNative(int what, int arg1, int arg2) { Log.i(TAG, "postEvent from native is:" + what); if (mEventHandler != null) { Message msg = mEventHandler.obtainMessage(VIDEOEDITOR_HANDLER_PROGRESS); msg.arg1 = what; mEventHandler.sendMessage(msg); } } protected void sendEncoderEnchange() { if (mEventHandler != null) { Message msg = mEventHandler.obtainMessage(VIDEOEDITOR_HANDLER_ENCODERCHANGE); mEventHandler.sendMessage(msg); } } public static native int getLimitYear(); public static native int getLimitMonth(); /** * 获取当前版本号 * @return */ public static native String getSDKVersion(); /** * 执行成功,返回0, 失败返回错误码. * * 解析参数失败 返回1 sdk未授权 -1; 解码器错误:69 收到线程的中断信号:255 如硬件编码器错误,则返回:26625---26630 * @param cmdArray ffmpeg命令的字符串数组, 可参考此文件中的各种方法举例来编写. * @return 执行成功, 返回0, 失败返回错误码. */ private native int execute(Object cmdArray); private native int setForceColorFormat(int format); /** * 新增 在执行过程中取消的方法. * 如果在执行中调用了这个方法, 则会直接终止当前的操作. * 此方法仅仅是在ffmpeg线程中设置一个标志位,当前这一帧处理完毕后, 会检测到这个标志位,从而退出. * 因为execute是阻塞执行, 你可以判断execute有没有执行完,来判断是否完成. */ public native void cancel(); /** * @param filelength * @param channel * @param sampleRate * @param bitperSample * @param outData */ public static native void createWavHeader(int filelength, int channel, int sampleRate, int bitperSample, byte[] outData); //----------------- public static String mergeAVDirectly(String audio, String video,boolean deleteVideo) { MediaInfo info=new MediaInfo(audio); if(info.prepare() && info.isHaveAudio()){ String retPath=LanSongFileUtil.createMp4FileInBox(); String inputAudio = audio; List<String> cmdList = new ArrayList<String>(); cmdList.add("-i"); cmdList.add(inputAudio); cmdList.add("-i"); cmdList.add(video); cmdList.add("-map"); cmdList.add("0:a"); cmdList.add("-map"); cmdList.add("1:v"); cmdList.add("-acodec"); cmdList.add("copy"); cmdList.add("-vcodec"); cmdList.add("copy"); cmdList.add("-absf"); cmdList.add("aac_adtstoasc"); cmdList.add("-y"); cmdList.add(retPath); String[] command = new String[cmdList.size()]; for (int i = 0; i < cmdList.size(); i++) { command[i] = (String) cmdList.get(i); } VideoEditor editor = new VideoEditor(); int ret = editor.executeVideoEditor(command); if(ret==0){ if(deleteVideo){ LanSongFileUtil.deleteFile(video); } return retPath; }else{ return video; } } return video; } /** * 把一张图片变成视频 * * @param srcPath * @param duration 形成视频的总时长; * @return 返回处理后的视频; */ public String executePicture2Video(String srcPath, float duration) { if (fileExist(srcPath)) { List<String> cmdList = new ArrayList<String>(); cmdList.add("-loop"); cmdList.add("1"); cmdList.add("-i"); cmdList.add(srcPath); cmdList.add("-t"); cmdList.add(String.valueOf(duration)); return executeAutoSwitch(cmdList); } return null; } @Deprecated public String executePcmMix(String srcPach1, int samplerate, int channel, String srcPach2, int samplerate2, int channel2,float value1, float value2) { List<String> cmdList = new ArrayList<String>(); String filter = String.format(Locale.getDefault(), "[0:a]volume=volume=%f[a1]; [1:a]volume=volume=%f[a2]; " + "[a1][a2]amix=inputs=2:duration=first:dropout_transition=2", value1, value2); String dstPath=LanSongFileUtil.createFileInBox("pcm"); cmdList.add("-f"); cmdList.add("s16le"); cmdList.add("-ar"); cmdList.add(String.valueOf(samplerate)); cmdList.add("-ac"); cmdList.add(String.valueOf(channel)); cmdList.add("-i"); cmdList.add(srcPach1); cmdList.add("-f"); ; cmdList.add("s16le"); cmdList.add("-ar"); cmdList.add(String.valueOf(samplerate2)); cmdList.add("-ac"); cmdList.add(String.valueOf(channel2)); cmdList.add("-i"); cmdList.add(srcPach2); cmdList.add("-y"); cmdList.add("-filter_complex"); cmdList.add(filter); cmdList.add("-f"); cmdList.add("s16le"); cmdList.add("-acodec"); cmdList.add("pcm_s16le"); cmdList.add(dstPath); String[] command = new String[cmdList.size()]; for (int i = 0; i < cmdList.size(); i++) { command[i] = (String) cmdList.get(i); } int ret= executeVideoEditor(command); if(ret==0){ return dstPath; }else{ LanSongFileUtil.deleteFile(dstPath); return null; } } @Deprecated public String executePcmEncodeAac(String srcPach, int samplerate, int channel) { List<String> cmdList = new ArrayList<String>(); String dstPath=LanSongFileUtil.createM4AFileInBox(); cmdList.add("-f"); cmdList.add("s16le"); cmdList.add("-ar"); cmdList.add(String.valueOf(samplerate)); cmdList.add("-ac"); cmdList.add(String.valueOf(channel)); cmdList.add("-i"); cmdList.add(srcPach); cmdList.add("-acodec"); cmdList.add("libfaac"); cmdList.add("-b:a"); cmdList.add("64000"); cmdList.add("-y"); cmdList.add(dstPath); String[] command = new String[cmdList.size()]; for (int i = 0; i < cmdList.size(); i++) { command[i] = (String) cmdList.get(i); } int ret= executeVideoEditor(command); if(ret==0){ return dstPath; }else{ LanSongFileUtil.deleteFile(dstPath); return null; } } /** * 把 pcm和视频文件合并在一起, pcm数据会编码成aac格式. * 注意:需要原视频文件里没有音频部分, * 如果有, 则需要先用 {@link #executeGetVideoTrack(String)} 拿到视频轨道, 在输入到这里. * * @param srcPcm 原pcm音频文件, * @param samplerate pcm的采样率 * @param channel pcm的通道数 * @param srcVideo 原视频文件, 没有音频部分 * @return 输出的视频文件路径, 需后缀是mp4格式. */ public String executePcmComposeVideo(String srcPcm, int samplerate, int channel, String srcVideo) { List<String> cmdList = new ArrayList<String>(); String dstPath=LanSongFileUtil.createMp4FileInBox(); cmdList.add("-f"); cmdList.add("s16le"); cmdList.add("-ar"); cmdList.add(String.valueOf(samplerate)); cmdList.add("-ac"); cmdList.add(String.valueOf(channel)); cmdList.add("-i"); cmdList.add(srcPcm); cmdList.add("-i"); cmdList.add(srcVideo); cmdList.add("-acodec"); cmdList.add("libfaac"); cmdList.add("-b:a"); cmdList.add("64000"); cmdList.add("-y"); cmdList.add("-vcodec"); cmdList.add("copy"); cmdList.add(dstPath); String[] command = new String[cmdList.size()]; for (int i = 0; i < cmdList.size(); i++) { command[i] = (String) cmdList.get(i); } int ret= executeVideoEditor(command); if(ret==0){ return dstPath; }else{ LanSongFileUtil.deleteFile(dstPath); return null; } } /** * 两个音频文件延迟混合, 即把第二个音频延迟多长时间后, 与第一个音频混合. * 混合后的编码为aac格式的音频文件. * 注意,如果两个音频的时长不同, 以第一个音频的音频为准. 如需修改可联系我们或查询ffmpeg命令即可. * * @param audioPath1 * @param audioPath2 * @param leftDelayMS 第二个音频的左声道 相对 于第一个音频的延迟时间 * @param rightDelayMS 第二个音频的右声道 相对 于第一个音频的延迟时间 * @return */ public String executeAudioDelayMix(String audioPath1, String audioPath2, int leftDelayMS, int rightDelayMS) { List<String> cmdList = new ArrayList<String>(); String overlayXY = String.format(Locale.getDefault(), "[1:a]adelay=%d|%d[delaya1]; " + "[0:a][delaya1]amix=inputs=2:duration=first:dropout_transition=2", leftDelayMS, rightDelayMS); String dstPath=LanSongFileUtil.createM4AFileInBox(); cmdList.add("-i"); cmdList.add(audioPath1); cmdList.add("-i"); cmdList.add(audioPath2); cmdList.add("-filter_complex"); cmdList.add(overlayXY); cmdList.add("-acodec"); cmdList.add("libfaac"); cmdList.add("-y"); cmdList.add(dstPath); String[] command = new String[cmdList.size()]; for (int i = 0; i < cmdList.size(); i++) { command[i] = (String) cmdList.get(i); } int ret= executeVideoEditor(command); if(ret==0){ return dstPath; }else{ LanSongFileUtil.deleteFile(dstPath); return null; } } /** * 两个音频文件混合. * 混合后的文件压缩格式是aac格式, 故需要您dstPath的后缀是aac或m4a. * * @param audioPath1 主音频的完整路径 * @param audioPath2 次音频的完整路径 * @param value1 主音频的音量, 浮点类型, 大于1.0为放大音量, 小于1.0是减低音量.比如设置0.5则降低一倍. * @param value2 次音频的音量, 浮点类型. * @return 输出保存的完整路径. m4a格式. */ public String executeAudioVolumeMix(String audioPath1, String audioPath2, float value1, float value2) { List<String> cmdList = new ArrayList<String>(); String filter = String.format(Locale.getDefault(), "[0:a]volume=volume=%f[a1]; [1:a]volume=volume=%f[a2]; " + "[a1][a2]amix=inputs=2:duration=first:dropout_transition=2", value1, value2); String dstPath=LanSongFileUtil.createM4AFileInBox(); cmdList.add("-i"); cmdList.add(audioPath1); cmdList.add("-i"); cmdList.add(audioPath2); cmdList.add("-filter_complex"); cmdList.add(filter); cmdList.add("-acodec"); cmdList.add("libfaac"); cmdList.add("-b:a"); cmdList.add("128000"); cmdList.add("-ac"); cmdList.add("2"); //LSNEW 增加这行和上面的 码率, 通道数 cmdList.add("-vn"); cmdList.add("-y"); cmdList.add(dstPath); String[] command = new String[cmdList.size()]; for (int i = 0; i < cmdList.size(); i++) { command[i] = (String) cmdList.get(i); } int ret= executeVideoEditor(command); if(ret==0){ return dstPath; }else{ LanSongFileUtil.deleteFile(dstPath); return null; } } /** * 视频转码. * 通过调整视频的bitrate来对视频文件大小的压缩,降低视频文件的大小, 注意:压缩可能导致视频画质下降. * * * @param srcPath 源视频 * @param percent 压缩百分比.值从0--1 * @return */ public String executeVideoCompress(String srcPath, float percent) { if (fileExist(srcPath)) { MediaInfo info = new MediaInfo(srcPath); if (info.prepare()) { setEncodeBitRate((int)(info.vBitRate *percent)); List<String> cmdList = new ArrayList<String>(); cmdList.add("-vcodec"); cmdList.add("lansoh264_dec"); cmdList.add("-i"); cmdList.add(srcPath); cmdList.add("-acodec"); cmdList.add("copy"); return executeAutoSwitch(cmdList); } } return null; } /** * 分离mp4文件中的音频,并返回音频的路径, */ public String executeGetAudioTrack(String srcMp4Path) { MediaInfo info = new MediaInfo(srcMp4Path); if(info.prepare()){ String audioPath = null; if ("aac".equalsIgnoreCase(info.aCodecName)) { audioPath = LanSongFileUtil.createFileInBox(".m4a"); } else if ("mp3".equalsIgnoreCase(info.aCodecName)) audioPath = LanSongFileUtil.createFileInBox(".mp3"); if (audioPath != null) { List<String> cmdList = new ArrayList<String>(); cmdList.add("-i"); cmdList.add(srcMp4Path); cmdList.add("-acodec"); cmdList.add("copy"); cmdList.add("-vn"); cmdList.add("-y"); cmdList.add(audioPath); String[] command = new String[cmdList.size()]; for (int i = 0; i < cmdList.size(); i++) { command[i] = (String) cmdList.get(i); } int ret= executeVideoEditor(command); if(ret==0){ return audioPath; }else{ LanSongFileUtil.deleteFile(audioPath); } } } return null; } /** * * 获取视频中的视频轨道. * (一个mp4文件, 里面可能有音频和视频, 这个是获取视频轨道, 获取后的视频里面将没有音频部分) * @param srcMp4Path * @return */ public String executeGetVideoTrack(String srcMp4Path) { if(fileExist(srcMp4Path)){ String videoPath = LanSongFileUtil.createMp4FileInBox(); List<String> cmdList = new ArrayList<String>(); cmdList.add("-i"); cmdList.add(srcMp4Path); cmdList.add("-vcodec"); cmdList.add("copy"); cmdList.add("-an"); cmdList.add("-y"); cmdList.add(videoPath); String[] command = new String[cmdList.size()]; for (int i = 0; i < cmdList.size(); i++) { command[i] = (String) cmdList.get(i); } int ret= executeVideoEditor(command); if(ret==0){ return videoPath; }else{ LanSongFileUtil.deleteFile(videoPath); } } Log.e(TAG,"执行获取视频轨道 错误, !!!!"); return null; } public String executeVideoMergeAudio(String video, String audio) { MediaInfo vInfo=new MediaInfo(video); MediaInfo aInfo=new MediaInfo(audio); if(vInfo.prepare() && aInfo.prepare() && aInfo.isHaveAudio()){ String retPath=LanSongFileUtil.createMp4FileInBox(); boolean isAAC="aac".equals(aInfo.aCodecName); List<String> cmdList = new ArrayList<String>(); cmdList.add("-i"); cmdList.add(video); cmdList.add("-i"); cmdList.add(audio); cmdList.add("-t"); cmdList.add(String.valueOf(vInfo.vDuration)); if(isAAC) { //删去视频的原音,直接增加音频 cmdList.add("-map"); cmdList.add("0:v"); cmdList.add("-map"); cmdList.add("1:a"); cmdList.add("-vcodec"); cmdList.add("copy"); cmdList.add("-acodec"); cmdList.add("copy"); cmdList.add("-absf"); cmdList.add("aac_adtstoasc"); }else { //删去视频的原音,并对音频编码 cmdList.add("-map"); cmdList.add("0:v"); cmdList.add("-map"); cmdList.add("1:a"); cmdList.add("-vcodec"); cmdList.add("copy"); cmdList.add("-acodec"); cmdList.add("libfaac"); cmdList.add("-ac"); cmdList.add("2"); cmdList.add("-ar"); cmdList.add("44100"); cmdList.add("-b:a"); cmdList.add("128000"); } cmdList.add("-y"); cmdList.add(retPath); String[] command = new String[cmdList.size()]; for (int i = 0; i < cmdList.size(); i++) { command[i] = (String) cmdList.get(i); } VideoEditor editor = new VideoEditor(); int ret = editor.executeVideoEditor(command); if(ret==0){ return retPath; }else{ return video; } } return video; } /** * 建议用 AudioEditor中的executeVideoMergeAudio */ @Deprecated public String executeVideoMergeAudio(String video, String audio,float audiostartS) { MediaInfo vInfo=new MediaInfo(video); MediaInfo aInfo=new MediaInfo(audio); if(vInfo.prepare() && aInfo.prepare() && aInfo.isHaveAudio()){ String retPath=LanSongFileUtil.createMp4FileInBox(); boolean isAAC="aac".equals(aInfo.aCodecName); List<String> cmdList = new ArrayList<String>(); cmdList.add("-i"); cmdList.add(video); cmdList.add("-ss"); cmdList.add(String.valueOf(audiostartS)); cmdList.add("-i"); cmdList.add(audio); cmdList.add("-t"); cmdList.add(String.valueOf(vInfo.vDuration)); if(isAAC) { //删去视频的原音,直接增加音频 cmdList.add("-map"); cmdList.add("0:v"); cmdList.add("-map"); cmdList.add("1:a"); cmdList.add("-vcodec"); cmdList.add("copy"); cmdList.add("-acodec"); cmdList.add("copy"); cmdList.add("-absf"); cmdList.add("aac_adtstoasc"); }else { //删去视频的原音,并对音频编码 cmdList.add("-map"); cmdList.add("0:v"); cmdList.add("-map"); cmdList.add("1:a"); cmdList.add("-vcodec"); cmdList.add("copy"); cmdList.add("-acodec"); cmdList.add("libfaac"); cmdList.add("-ac"); cmdList.add("2"); cmdList.add("-ar"); cmdList.add("44100"); cmdList.add("-b:a"); cmdList.add("128000"); } cmdList.add("-y"); cmdList.add(retPath); String[] command = new String[cmdList.size()]; for (int i = 0; i < cmdList.size(); i++) { command[i] = (String) cmdList.get(i); } VideoEditor editor = new VideoEditor(); int ret = editor.executeVideoEditor(command); if(ret==0){ return retPath; }else{ return video; } } return video; } /** * 用AudioEditor中的方法 */ @Deprecated public String executeCutAudio(String srcFile, float startS, float durationS) { if (fileExist(srcFile)) { List<String> cmdList = new ArrayList<String>(); String dstFile=LanSongFileUtil.createFileInBox(LanSongFileUtil.getFileSuffix(srcFile)); cmdList.add("-ss"); cmdList.add(String.valueOf(startS)); cmdList.add("-i"); cmdList.add(srcFile); cmdList.add("-t"); cmdList.add(String.valueOf(durationS)); cmdList.add("-acodec"); cmdList.add("copy"); cmdList.add("-y"); cmdList.add(dstFile); String[] command = new String[cmdList.size()]; for (int i = 0; i < cmdList.size(); i++) { command[i] = (String) cmdList.get(i); } int ret= executeVideoEditor(command); if(ret==0){ return dstFile; }else{ LanSongFileUtil.deleteFile(dstFile); return null; } } else { return null; } } /** * 剪切mp4文件. * (包括视频文件中的音频部分和视频部分),即把mp4文件中的一段剪切成独立的一个视频文件, 比如把一个1分钟的视频,裁剪其中的10秒钟等. * <p> * 注意: 此方法裁剪不是精确裁剪,而是从视频的IDR帧开始裁剪的, 没有精确到您指定的那一帧的时间, 如果您指定的时间不是IDR帧上的时间,则退后到上一个IDR帧开始. * * @param videoFile 原视频文件 文件格式是mp4 * @param startS 开始裁剪位置,单位是秒, * @param durationS 需要裁剪的时长,单位秒,比如您可以从原视频的8.9秒出开始裁剪,裁剪2分钟,则这里的参数是120 * @return */ public String executeCutVideo(String videoFile, float startS, float durationS) { if (fileExist(videoFile)) { String dstFile=LanSongFileUtil.createMp4FileInBox(); List<String> cmdList = new ArrayList<String>(); cmdList.add("-ss"); cmdList.add(String.valueOf(startS)); cmdList.add("-i"); cmdList.add(videoFile); cmdList.add("-t"); cmdList.add(String.valueOf(durationS)); cmdList.add("-vcodec"); cmdList.add("copy"); cmdList.add("-acodec"); cmdList.add("copy"); cmdList.add("-y"); cmdList.add(dstFile); String[] command = new String[cmdList.size()]; for (int i = 0; i < cmdList.size(); i++) { command[i] = (String) cmdList.get(i); } int ret= executeVideoEditor(command); if(ret==0){ return dstFile; }else{ LanSongFileUtil.deleteFile(dstFile); return null; } } else { return null; } } /** * 精确裁剪 * @param videoFile 输入源视频的完整路径 * @param startS 开始裁剪时间点, 单位秒 * @param durationS 要裁剪的总长度,单位秒 * @return 裁剪后返回的目标视频 */ public String executeCutVideoExact(String videoFile, float startS, float durationS) { if (fileExist(videoFile)) { List<String> cmdList = new ArrayList<String>(); cmdList.add("-vcodec"); cmdList.add("lansoh264_dec"); cmdList.add("-i"); cmdList.add(videoFile); cmdList.add("-ss"); cmdList.add(String.valueOf(startS)); cmdList.add("-t"); cmdList.add(String.valueOf(durationS)); cmdList.add("-acodec"); cmdList.add("copy"); return executeAutoSwitch(cmdList); } else { return null; } } /** * 精确裁剪的同时,缩放到指定位置,不同于上面的命令,这个可以设置宽度和高度. 其中宽度和高度是采用缩放来完成. * <p> * <p> * 采用的是软缩放的形式. * * @param videoFile * @param startS * @param durationS * @param width 要缩放到的宽度 建议是16的倍数 , * @param height 要缩放到的高度, 建议是16的倍数 * @return */ public String executeCutVideoExact(String videoFile, float startS, float durationS, int width, int height) { if (fileExist(videoFile)) { List<String> cmdList = new ArrayList<String>(); String scalecmd = String.format(Locale.getDefault(), "scale=%d:%d", width, height); cmdList.add("-vcodec"); cmdList.add("lansoh264_dec"); cmdList.add("-i"); cmdList.add(videoFile); cmdList.add("-ss"); cmdList.add(String.valueOf(startS)); cmdList.add("-t"); cmdList.add(String.valueOf(durationS)); cmdList.add("-vf"); cmdList.add(scalecmd); cmdList.add("-acodec"); cmdList.add("copy"); return executeAutoSwitch(cmdList); } else { return null; } } /** * 获取视频的所有帧图片,并保存到指定路径. * 所有的帧会按照后缀名字加上_001.jpeg prefix_002.jpeg的顺序依次生成, 如果发现之前已经有同样格式的文件,则在原来数字后缀的基础上增加, 比如原来有prefix_516.jpeg;则这个方法执行从 * prefix_517.jpeg开始生成视频帧. * <p> * <p> * 如果您使用的是专业版,则建议用ExtractVideoFrameDemoActivity来获取视频图片, * 因为直接返回bitmap,不存到文件中,速度相对快很多 * <p> * 这条命令是把视频中的所有帧都提取成图片,适用于视频比较短的场合,比如一秒钟是25帧,视频总时长是10秒,则会提取250帧图片,保存到您指定的路径 * * @param videoFile * @param dstDir 目标文件夹绝对路径. * @param jpgPrefix 保存图片文件的前缀,可以是png或jpg * @return */ public int executeGetAllFrames(String videoFile, String dstDir, String jpgPrefix) { String dstPath = dstDir + jpgPrefix + "_%3d.jpeg"; if (fileExist(videoFile)) { List<String> cmdList = new ArrayList<String>(); cmdList.add("-vcodec"); cmdList.add("lansoh264_dec"); cmdList.add("-i"); cmdList.add(videoFile); cmdList.add("-qscale:v"); cmdList.add("2"); cmdList.add(dstPath); cmdList.add("-y"); String[] command = new String[cmdList.size()]; for (int i = 0; i < cmdList.size(); i++) { command[i] = (String) cmdList.get(i); } return executeVideoEditor(command); } else { return VIDEO_EDITOR_EXECUTE_FAILED; } } /** * 根据设定的采样,获取视频的几行图片. * 假如视频时长是30秒,想平均取5张图片,则sampleRate=5/30; * <p> * <p> * 如果您使用的是专业版本,则建议用ExtractVideoFrameDemoActivity来获取视频图片,因为直接返回bitmap,不存到文件中,速度相对快很多 * * @param videoFile * @param dstDir * @param jpgPrefix * @param sampeRate 一秒钟采样几张图片. 可以是小数. * @return */ public int executeGetSomeFrames(String videoFile, String dstDir, String jpgPrefix, float sampeRate) { String dstPath = dstDir + jpgPrefix + "_%3d.jpeg"; if (fileExist(videoFile)) { List<String> cmdList = new ArrayList<String>(); cmdList.add("-vcodec"); cmdList.add("lansoh264_dec"); cmdList.add("-i"); cmdList.add(videoFile); // cmdList.add("-qscale:v"); // cmdList.add("2"); cmdList.add("-vsync"); cmdList.add("1"); cmdList.add("-r"); cmdList.add(String.valueOf(sampeRate)); // cmdList.add("-f"); // cmdList.add("image2"); cmdList.add("-y"); cmdList.add(dstPath); String[] command = new String[cmdList.size()]; for (int i = 0; i < cmdList.size(); i++) { command[i] = (String) cmdList.get(i); } return executeVideoEditor(command); } else { return VIDEO_EDITOR_EXECUTE_FAILED; } } /** * 读取视频中的关键帧(IDR帧), 并把关键帧保存图片. 因是IDR帧, 在编码时没有起帧做参考,故提取的最快. * <p> * <p> * 如果您使用的是专业版本,则建议用ExtractVideoFrameDemoActivity来获取视频图片,因为直接返回bitmap,不存到文件中,速度相对快很多 * <p> * <p> * 经过我们SDK编码后的视频, 是一秒钟一个帧,如果您视频大小是30秒,则大约会提取30张图片. * * @param videoFile 视频文件 * @param dstDir 保持的文件夹 * @param jpgPrefix 文件前缀. * @return */ public int executeGetKeyFrames(String videoFile, String dstDir, String jpgPrefix) { String dstPath = dstDir + "/" + jpgPrefix + "_%3d.png"; if (fileExist(videoFile)) { List<String> cmdList = new ArrayList<String>(); cmdList.add("-i"); cmdList.add(videoFile); cmdList.add("-vf"); cmdList.add("select=eq(pict_type\\,I)"); cmdList.add("-vsync"); cmdList.add("vfr"); Log.i(TAG, " vsync is vfr"); cmdList.add("-y"); cmdList.add(dstPath); String[] command = new String[cmdList.size()]; for (int i = 0; i < cmdList.size(); i++) { command[i] = (String) cmdList.get(i); } return executeVideoEditor(command); } else { return VIDEO_EDITOR_EXECUTE_FAILED; } } /** * 来自于网络, 没有全部测试. * 获取视频的缩略图 * 提供了一个统一的接口用于从一个输入媒体文件中取得帧和元数据。 * * @param path 视频的路径 * @param width 缩略图的宽 * @param height 缩略图的高 * @return 缩略图 */ public static Bitmap createVideoThumbnail(String path, int width, int height) { Bitmap bitmap = null; MediaMetadataRetriever retriever = new MediaMetadataRetriever(); if (TextUtils.isEmpty(path)) { return null; } File file = new File(path); if (!file.exists()) { return null; } try { retriever.setDataSource(path); bitmap = retriever.getFrameAtTime(-1); //取得指定时间的Bitmap,即可以实现抓图(缩略图)功能 } catch (IllegalArgumentException ex) { // Assume this is a corrupt video file } catch (RuntimeException ex) { // Assume this is a corrupt video file. } finally { try { retriever.release(); } catch (RuntimeException ex) { // Ignore failures while cleaning up. } } if (bitmap == null) { return null; } bitmap = Bitmap.createScaledBitmap(bitmap, width, height, true); return bitmap; } /** * * 从视频的指定位置中获取一帧图片. 因为这个是精确提取视频的一帧, * 不建议作为提取缩略图来使用,用mediametadataRetriever最好. * * @param videoSrcPath 源视频的完整路径 * @param postionS 时间点,单位秒,类型float,可以有小数,比如从视频的2.35秒的地方获取一张图片。 * @return */ public String executeGetOneFrame(String videoSrcPath,float postionS) { if (fileExist(videoSrcPath)) { List<String> cmdList = new ArrayList<String>(); // String dstPng=LanSongFileUtil.createFileInBox("png"); cmdList.add("-i"); cmdList.add(videoSrcPath); cmdList.add("-ss"); cmdList.add(String.valueOf(postionS)); cmdList.add("-vframes"); cmdList.add("1"); cmdList.add("-y"); cmdList.add(dstPng); String[] command = new String[cmdList.size()]; for (int i = 0; i < cmdList.size(); i++) { command[i] = (String) cmdList.get(i); } int ret= executeVideoEditor(command); if(ret==0){ return dstPng; }else{ LanSongFileUtil.deleteFile(dstPng); return null; } } else { return null; } } /** * 从视频的指定位置中获取一帧图片,得到图片后,把图片缩放到指定的宽高. 因为这个是精确提取视频的一帧, 不建议作为提取缩略图来使用. * * @param videoSrcPath 源视频的完整路径 * @param postionS 时间点,单位秒,类型float,可以有小数,比如从视频的2.35秒的地方获取一张图片。 * @param pngWidth 得到目标图片后缩放的宽度. * @param pngHeight 得到目标图片后需要缩放的高度. * @return 得到目标图片的完整路径名. */ public String executeGetOneFrame(String videoSrcPath, float postionS, int pngWidth, int pngHeight) { if (fileExist(videoSrcPath)) { List<String> cmdList = new ArrayList<String>(); String dstPng=LanSongFileUtil.createFileInBox("png"); String resolution = String.valueOf(pngWidth); resolution += "x"; resolution += String.valueOf(pngHeight); cmdList.add("-i"); cmdList.add(videoSrcPath); cmdList.add("-ss"); cmdList.add(String.valueOf(postionS)); cmdList.add("-s"); cmdList.add(resolution); cmdList.add("-vframes"); cmdList.add("1"); cmdList.add("-y"); cmdList.add(dstPng); String[] command = new String[cmdList.size()]; for (int i = 0; i < cmdList.size(); i++) { command[i] = (String) cmdList.get(i); } int ret= executeVideoEditor(command); if(ret==0){ return dstPng; }else { LanSongFileUtil.deleteFile(dstPng); return null; } } return null; } /** * 请用VideoEditor中的方法; */ @Deprecated public String executeConvertMp3ToAAC(String mp3Path) { if (fileExist(mp3Path)) { String dstFile=LanSongFileUtil.createFileInBox("m4a"); List<String> cmdList = new ArrayList<String>(); cmdList.add("-i"); cmdList.add(mp3Path); cmdList.add("-acodec"); cmdList.add("libfaac"); cmdList.add("-y"); cmdList.add(dstFile); String[] command = new String[cmdList.size()]; for (int i = 0; i < cmdList.size(); i++) { command[i] = (String) cmdList.get(i); } int ret= executeVideoEditor(command); if(ret==0){ return dstFile; }else{ LanSongFileUtil.deleteFile(dstFile); return null; } } else { return null; } } public String executeConvertMp3ToAAC(String mp3Path,float startS,float durationS) { if (fileExist(mp3Path)) { List<String> cmdList = new ArrayList<String>(); String dstPath=LanSongFileUtil.createM4AFileInBox(); cmdList.add("-i"); cmdList.add(mp3Path); cmdList.add("-ss"); cmdList.add(String.valueOf(startS)); cmdList.add("-t"); cmdList.add(String.valueOf(durationS)); cmdList.add("-acodec"); cmdList.add("libfaac"); cmdList.add("-y"); cmdList.add(dstPath); String[] command = new String[cmdList.size()]; for (int i = 0; i < cmdList.size(); i++) { command[i] = (String) cmdList.get(i); } int ret= executeVideoEditor(command); if(ret==0){ return dstPath; }else{ LanSongFileUtil.deleteFile(dstPath); return null; } } return null; } protected String executeConvertMp4toTs(String mp4Path) { if (fileExist(mp4Path)) { List<String> cmdList = new ArrayList<String>(); String dstTs = LanSongFileUtil.createFileInBox("ts"); cmdList.add("-i"); cmdList.add(mp4Path); cmdList.add("-c"); cmdList.add("copy"); cmdList.add("-bsf:v"); cmdList.add("h264_mp4toannexb"); cmdList.add("-f"); cmdList.add("mpegts"); cmdList.add("-y"); cmdList.add(dstTs); String[] command = new String[cmdList.size()]; for (int i = 0; i < cmdList.size(); i++) { command[i] = (String) cmdList.get(i); } int ret = executeVideoEditor(command); if (ret == 0) { return dstTs; } else { LanSongFileUtil.deleteFile(dstTs); return null; } } return null; } public String executeConvertTsToMp4(String[] tsArray) { if (LanSongFileUtil.filesExist(tsArray)) { String dstFile=LanSongFileUtil.createMp4FileInBox(); String concat = "concat:"; for (int i = 0; i < tsArray.length - 1; i++) { concat += tsArray[i]; concat += "|"; } concat += tsArray[tsArray.length - 1]; List<String> cmdList = new ArrayList<String>(); cmdList.add("-i"); cmdList.add(concat); cmdList.add("-c"); cmdList.add("copy"); cmdList.add("-bsf:a"); cmdList.add("aac_adtstoasc"); cmdList.add("-y"); cmdList.add(dstFile); String[] command = new String[cmdList.size()]; for (int i = 0; i < cmdList.size(); i++) { command[i] = (String) cmdList.get(i); } int ret= executeVideoEditor(command); if(ret==0){ return dstFile; }else{ LanSongFileUtil.deleteFile(dstFile); return null; } } else { return null; } } /** * 把分段录制的视频, 拼接在一起; * * 注意:此方法仅仅使用在分段录制的场合 * 注意:此方法仅仅使用在分段录制的场合 * 注意:此方法仅仅使用在分段录制的场合 * @param mp4Array */ public String executeConcatMP4(String[] mp4Array) { //第一步,先把所有的mp4转换为ts流 ArrayList<String> tsPathArray = new ArrayList<String>(); for (int i = 0; i < mp4Array.length; i++) { String segTs1 = executeConvertMp4toTs(mp4Array[i]); tsPathArray.add(segTs1); } //第二步: 把ts流拼接成mp4 String[] tsPaths = new String[tsPathArray.size()]; for (int i = 0; i < tsPathArray.size(); i++) { tsPaths[i] = (String) tsPathArray.get(i); } String dstVideo=executeConvertTsToMp4(tsPaths); //第三步:删除临时生成的ts文件. for (int i = 0; i < tsPathArray.size(); i++) { LanSongFileUtil.deleteFile(tsPathArray.get(i)); } return dstVideo; } public String executeConcatMP4(List<String> mp4Array) { //第一步,先把所有的mp4转换为ts流 ArrayList<String> tsPathArray = new ArrayList<String>(); for (int i = 0; i < mp4Array.size(); i++) { String segTs1 = executeConvertMp4toTs(mp4Array.get(i)); tsPathArray.add(segTs1); } //第二步: 把ts流拼接成mp4 String[] tsPaths = new String[tsPathArray.size()]; for (int i = 0; i < tsPathArray.size(); i++) { tsPaths[i] = (String) tsPathArray.get(i); } String dstVideo=executeConvertTsToMp4(tsPaths); //第三步:删除临时生成的ts文件. for (int i = 0; i < tsPathArray.size(); i++) { LanSongFileUtil.deleteFile(tsPathArray.get(i)); } return dstVideo; } /** * 不同来源的mp4文件进行拼接; * 拼接的所有视频分辨率必须一致; * * * @param videos 所有的视频 * @param ignorecheck 是否要忽略检测每个每个视频的分辨率, 如果您确信已经相等,则设为false; * @return 输出视频的路径 */ public String executeConcatDiffentMp4(ArrayList<String> videos,boolean ignorecheck) { if(videos!=null && videos.size()>1){ if(ignorecheck || checkVideoSizeSame(videos)){ String dstPath=LanSongFileUtil.createMp4FileInBox(); String filter = String.format(Locale.getDefault(), "concat=n=%d:v=1:a=1", videos.size()); List<String> cmdList = new ArrayList<String>(); cmdList.add("-vcodec"); cmdList.add("lansoh264_dec"); cmdList.add("-i"); cmdList.add(videos.get(0)); for (int i=1;i<videos.size();i++){ cmdList.add("-i"); cmdList.add(videos.get(i)); } cmdList.add("-filter_complex"); cmdList.add(filter); cmdList.add("-acodec"); cmdList.add("libfaac"); cmdList.add("-b:a"); cmdList.add("128000"); return executeAutoSwitch(cmdList); } } return null; } private boolean checkVideoSizeSame(ArrayList<String> videos){ int w=0; int h=0; for (String item: videos){ MediaInfo info=new MediaInfo(item); if(info.prepare()){ if(w ==0&& h==0){ w=info.getWidth(); h=info.getHeight(); }else if(info.getWidth()!=w || info.getHeight() !=h){ Log.e(TAG,"视频拼接中, 有个视频的分辨率不等于其他分辨率"); return false; } }else{ return false; } } return true; //返回正常; } /** * 裁剪视频画面 * * @param videoFile  需要裁剪的视频文件 * @param cropWidth  裁剪后的目标宽度 * @param cropHeight  裁剪后的目标高度 * @param x  视频画面开始的X坐标, 从画面的左上角开始是0.0坐标 * @param y 视频画面开始的Y坐标, * @return 处理后保存的路径,后缀需要是mp4 */ public String executeCropVideoFrame(String videoFile, int cropWidth, int cropHeight, int x, int y) { if (fileExist(videoFile)) { String filter = String.format(Locale.getDefault(), "crop=%d:%d:%d:%d", cropWidth, cropHeight, x, y); List<String> cmdList = new ArrayList<String>(); cmdList.add("-vcodec"); cmdList.add("lansoh264_dec"); cmdList.add("-i"); cmdList.add(videoFile); cmdList.add("-vf"); cmdList.add(filter); cmdList.add("-acodec"); cmdList.add("copy"); return executeAutoSwitch(cmdList); } return null; } /** * 缩放视频画面 * * @param videoFile * @param scaleWidth * @param scaleHeight * @return */ public String executeScaleVideoFrame(String videoFile, int scaleWidth, int scaleHeight) { if (fileExist(videoFile)) { List<String> cmdList = new ArrayList<String>(); scaleWidth=(scaleWidth/2)*2; scaleHeight=(scaleHeight/2)*2; String scalecmd = String.format(Locale.getDefault(), "scale=%d:%d", scaleWidth, scaleHeight); cmdList.add("-vcodec"); cmdList.add("lansoh264_dec"); cmdList.add("-i"); cmdList.add(videoFile); cmdList.add("-vf"); cmdList.add(scalecmd); cmdList.add("-acodec"); cmdList.add("copy"); return executeAutoSwitch(cmdList); } return null; } /** * 缩放的同时增加logo水印. * * @param videoFile 原视频路径 * @param pngPath 增加图片路径 * @param scaleWidth 要缩放到的宽度 * @param scaleHeight 要缩放到的高度 * @param overX 图片的左上角 放到视频的 X坐标 * @param overY 图片的左上角 放到视频的 坐标 * @return */ public String executeScaleOverlay(String videoFile, String pngPath, int scaleWidth, int scaleHeight, int overX, int overY) { if (fileExist(videoFile)) { List<String> cmdList = new ArrayList<String>(); String filter = String.format(Locale.getDefault(), "[0:v]scale=%d:%d [scale];[scale][1:v] overlay=%d:%d", scaleWidth, scaleHeight, overX, overY); cmdList.add("-vcodec"); cmdList.add("lansoh264_dec"); cmdList.add("-i"); cmdList.add(videoFile); cmdList.add("-i"); cmdList.add(pngPath); cmdList.add("-filter_complex"); cmdList.add(filter); cmdList.add("-acodec"); cmdList.add("copy"); return executeAutoSwitch(cmdList); } else { return null; } } /** * 给视频增加图片 * * @param videoFile 原视频完整路径 * @param picturePath 图片完整路径 * @param overX 图片的左上角 放到视频的X坐标 * @param overY 图片的左上角 放到视频的X坐标 * @return 返回目标文件 */ public String executeOverLayVideoFrame(String videoFile, String picturePath, int overX, int overY) { String filter = String.format(Locale.getDefault(), "overlay=%d:%d", overX, overY); List<String> cmdList = new ArrayList<String>(); cmdList.add("-vcodec"); cmdList.add("lansoh264_dec"); cmdList.add("-i"); cmdList.add(videoFile); cmdList.add("-i"); cmdList.add(picturePath); cmdList.add("-filter_complex"); cmdList.add(filter); cmdList.add("-acodec"); cmdList.add("copy"); return executeAutoSwitch(cmdList); } /** * 对视频画面进行裁剪,裁剪后叠加一个png类型的图片, * <p> * 等于把裁剪,叠加水印,压缩三条命令放在一次执行, 这样只解码一次,和只编码一次,极大的加快了处理速度. * * @param videoFile 原视频 * @param pngPath * @param cropX 画面裁剪的X坐标, 左上角为0:0 * @param cropY 画面裁剪的Y坐标 * @param cropWidth 画面裁剪宽度. 须小于等于源视频宽度 * @param cropHeight 画面裁剪高度, 须小于等于源视频高度 * @param overX 画面和png图片开始叠加的X坐标. * @param overY 画面和png图片开始叠加的Y坐标 * @return */ public String executeCropOverlay(String videoFile, String pngPath, int cropX, int cropY, int cropWidth, int cropHeight, int overX, int overY) { if (fileExist(videoFile)) { String filter = String.format(Locale.getDefault(), "[0:v]crop=%d:%d:%d:%d [crop];[crop][1:v] " + "overlay=%d:%d", cropWidth, cropHeight, cropX, cropY, overX, overY); List<String> cmdList = new ArrayList<String>(); cmdList.add("-vcodec"); cmdList.add("lansoh264_dec"); cmdList.add("-i"); cmdList.add(videoFile); cmdList.add("-i"); cmdList.add(pngPath); cmdList.add("-filter_complex"); cmdList.add(filter); cmdList.add("-acodec"); cmdList.add("copy"); return executeAutoSwitch(cmdList); } else { return null; } } /** * 时长剪切的同时, 做画面裁剪. * * @param videoFile 输入文件完整路径 * @param startTimeS 开始时间,单位秒 * @param duationS 要剪切的时长; * @param cropX 画面裁剪的开始X坐标 * @param cropY 画面裁剪的开始Y坐标 * @param cropWidth 画面裁剪的宽度 * @param cropHeight 画面裁剪的高度. * @return */ public String executeCutCrop(String videoFile, float startTimeS, float duationS, int cropX, int cropY, int cropWidth, int cropHeight) { String filter = String.format(Locale.getDefault(), "crop=%d:%d:%d:%d", cropWidth, cropHeight, cropX, cropY); List<String> cmdList = new ArrayList<String>(); cmdList.add("-vcodec"); cmdList.add("lansoh264_dec"); cmdList.add("-ss"); cmdList.add(String.valueOf(startTimeS)); cmdList.add("-t"); cmdList.add(String.valueOf(duationS)); cmdList.add("-i"); cmdList.add(videoFile); cmdList.add("-filter_complex"); cmdList.add(filter); cmdList.add("-acodec"); cmdList.add("copy"); return executeAutoSwitch(cmdList); } /** * 同时执行 视频时长剪切, 画面裁剪和增加水印的功能. * * @param videoFile 源视频文件. * @param pngPath 增加的水印文件路径 * @param startTimeS 时长剪切的开始时间 * @param duationS 时长剪切的 总长度 * @param cropX 画面裁剪的 X坐标,(最左边坐标是0) * @param cropY 画面裁剪的Y坐标,(最上面坐标是0) * @param cropWidth 画面裁剪宽度 * @param cropHeight 画面裁剪高度 * @param overX 增加水印的X坐标 * @param overY 增加水印的Y坐标 * @return */ public String executeCutCropOverlay(String videoFile, String pngPath, float startTimeS, float duationS, int cropX, int cropY, int cropWidth, int cropHeight, int overX, int overY) { String filter = String.format(Locale.getDefault(), "[0:v]crop=%d:%d:%d:%d [crop];[crop][1:v] " + "overlay=%d:%d", cropWidth, cropHeight, cropX, cropY, overX, overY); List<String> cmdList = new ArrayList<String>(); cmdList.add("-vcodec"); cmdList.add("lansoh264_dec"); cmdList.add("-ss"); cmdList.add(String.valueOf(startTimeS)); cmdList.add("-t"); cmdList.add(String.valueOf(duationS)); cmdList.add("-i"); cmdList.add(videoFile); cmdList.add("-i"); cmdList.add(pngPath); cmdList.add("-filter_complex"); cmdList.add(filter); cmdList.add("-acodec"); cmdList.add("copy"); return executeAutoSwitch(cmdList); } /** * 把多张图片转换为视频 * 注意: 这里的多张图片必须在同一个文件夹下,并且命名需要有规律,比如名字是 r5r_001.jpeg r5r_002.jpeg, r5r_003.jpeg等 * 多张图片,需要统一的分辨率,如分辨率不同,则以第一张图片的分辨率为准,后面的分辨率自动缩放到第一张图片的分辨率的大小 * * @param picDir  保存图片的文件夹 * @param jpgprefix  图片的文件名有规律的前缀 * @param framerate  每秒钟需要显示几张图片 * @return */ public String executeConvertPictureToVideo(String picDir, String jpgprefix, float framerate) { String picSet = picDir + jpgprefix + "_%3d.jpeg"; List<String> cmdList = new ArrayList<String>(); cmdList.add("-framerate"); cmdList.add(String.valueOf(framerate)); cmdList.add("-i"); cmdList.add(picSet); cmdList.add("-r"); cmdList.add("25"); return executeAutoSwitch(cmdList); } /** * 把视频填充成指定大小的画面, 比视频的宽高 大的部分用黑色来填充. * * @param videoFile 源视频路径 * @param padWidth 填充成的目标宽度 , 参数需要是16的倍数 * @param padHeight 填充成的目标高度 , 参数需要是16的倍数 * @param padX 把视频画面放到填充区时的开始X坐标 * @param padY 把视频画面放到填充区时的开始Y坐标 * @return */ public String executePadVideo(String videoFile, int padWidth, int padHeight, int padX, int padY) { if (fileExist(videoFile)) { MediaInfo info = new MediaInfo(videoFile); if (info.prepare()) { int minWidth = info.vWidth + padX; int minHeight = info.vHeight + padY; if (minWidth > padWidth || minHeight > padHeight) { Log.e(TAG, "pad set position is error. min Width>pading width.or min height > padding height"); return null; //失败. } } else { Log.e(TAG, "media info prepare is error!!!"); return null; } //第二步: 开始padding. String filter = String.format(Locale.getDefault(), "pad=%d:%d:%d:%d:black", padWidth, padHeight, padX,padY); List<String> cmdList = new ArrayList<String>(); cmdList.add("-vcodec"); cmdList.add("lansoh264_dec"); cmdList.add("-i"); cmdList.add(videoFile); cmdList.add("-vf"); cmdList.add(filter); cmdList.add("-acodec"); cmdList.add("copy"); return executeAutoSwitch(cmdList); } else { return null; } } /** * 给视频旋转角度, * * 注意这里 只是 旋转画面的的角度,而不会调整视频的宽高. * @param srcPath  需要旋转角度的原视频 * @param angle   角度 * @return */ public String executeRotateAngle(String srcPath, float angle) { if (fileExist(srcPath)) { String filter = String.format(Locale.getDefault(), "rotate=%f*(PI/180),format=yuv420p", angle); List<String> cmdList = new ArrayList<String>(); cmdList.add("-vcodec"); cmdList.add("lansoh264_dec"); cmdList.add("-i"); cmdList.add(srcPath); cmdList.add("-vf"); cmdList.add(filter); cmdList.add("-metadata:s:v"); cmdList.add("rotate=0"); cmdList.add("-acodec"); cmdList.add("copy"); return executeAutoSwitch(cmdList); } else { return null; } } /** * 设置多媒体文件中的 视频元数据的角度. * 一个多媒体文件中有很多种元数据, 包括音频轨道, 视频轨道, 各种元数据, 字幕,其他文字等信息, * 这里仅仅更改元数据中的视频播放角度, 当视频播放器播放该视频时, 会得到"要旋转多少度"播放的信息, * 这样在播放时就会旋转后再播放画面 * <p> * 此设置不改变音视频的各种参数, 仅仅是告诉播放器,"要旋转多少度"来播放而已. * 适用在拍摄的视频有90度和270的情况, 想更改这个角度参数的场合. * * @param srcPath 原视频 * @param angle 需要更改的角度 * @return */ public String executeSetVideoMetaAngle(String srcPath, int angle) { if (fileExist(srcPath)) { List<String> cmdList = new ArrayList<String>(); String dstPath=LanSongFileUtil.createMp4FileInBox(); String filter = String.format(Locale.getDefault(), "rotate=%d", angle); cmdList.add("-i"); cmdList.add(srcPath); cmdList.add("-c"); cmdList.add("copy"); cmdList.add("-metadata:s:v:0"); cmdList.add(filter); cmdList.add("-y"); cmdList.add(dstPath); String[] command = new String[cmdList.size()]; for (int i = 0; i < cmdList.size(); i++) { command[i] = (String) cmdList.get(i); } int ret= executeVideoEditor(command); if(ret==0){ return dstPath; }else { LanSongFileUtil.deleteFile(dstPath); return null; } } else { return null; } } //--------------------------- /** * 叠加并调速; * @param srcPath * @param pngPath * @param overX * @param overY * @param speed 速度值,范围0--1; * @return */ public String executeOverLaySpeed(String srcPath, String pngPath,int overX,int overY, float speed){ if (fileExist(srcPath)) { String filter = String.format(Locale.getDefault(), "[0:v][1:v]overlay=%d:%d[overlay];[overlay]setpts=%f*PTS[v];[0:a]atempo=%f[a]",overX,overY, 1 / speed, speed); List<String> cmdList = new ArrayList<String>(); cmdList.add("-vcodec"); cmdList.add("lansoh264_dec"); cmdList.add("-i"); cmdList.add(srcPath); cmdList.add("-i"); cmdList.add(pngPath); cmdList.add("-filter_complex"); cmdList.add(filter); cmdList.add("-map"); cmdList.add("[v]"); cmdList.add("-map"); cmdList.add("[a]"); return executeAutoSwitch(cmdList); } else { return null; } } /** * 调整视频的播放速度 * 范围0.5--2.0; * 0.5:放慢一倍;2:加快一倍 * @param srcPath   源视频 * @return */ public String executeAdjustVideoSpeed(String srcPath, float speed){ if (fileExist(srcPath)) { String filter = String.format(Locale.getDefault(), "[0:v]setpts=%f*PTS[v];[0:a]atempo=%f[a]", 1 / speed, speed); List<String> cmdList = new ArrayList<String>(); cmdList.add("-vcodec"); cmdList.add("lansoh264_dec"); cmdList.add("-i"); cmdList.add(srcPath); cmdList.add("-filter_complex"); cmdList.add(filter); cmdList.add("-map"); cmdList.add("[v]"); cmdList.add("-map"); cmdList.add("[a]"); return executeAutoSwitch(cmdList); } else { return null; } } /** * 调整视频的播放速度,  * 可以把视频加快速度,或放慢速度。适用在希望缩短视频中不重要的部分的场景,比如走路等 * * @param srcPath   源视频 * @param speed     源视频中  画面和音频同时改变的倍数,比如放慢一倍,则这里是0.5;加快一倍,这里是2;建议速度在0.5--2.0之间。 * @return */ public String executeAdjustVideoSpeed2(String srcPath, float speed) { if (fileExist(srcPath)) { String filter = String.format(Locale.getDefault(), "[0:v]setpts=%f*PTS[v]", 1 / speed); List<String> cmdList = new ArrayList<String>(); cmdList.add("-vcodec"); cmdList.add("lansoh264_dec"); cmdList.add("-i"); cmdList.add(srcPath); cmdList.add("-filter_complex"); cmdList.add(filter); cmdList.add("-map"); cmdList.add("[v]"); return executeAutoSwitch(cmdList); } else { return null; } } /** * 视频水平镜像,即把视频左半部分镜像显示在右半部分 * 【此方法用到编解码】 * * @param srcPath  源视频路径 * @return */ public String executeVideoMirrorH(String srcPath) { if (fileExist(srcPath)) { String filter = String.format(Locale.getDefault(), "crop=iw/2:ih:0:0,split[left][tmp];[tmp]hflip[right];" + "[left][right] hstack"); List<String> cmdList = new ArrayList<String>(); cmdList.add("-vcodec"); cmdList.add("lansoh264_dec"); cmdList.add("-i"); cmdList.add(srcPath); cmdList.add("-vf"); cmdList.add(filter); cmdList.add("-acodec"); cmdList.add("copy"); return executeAutoSwitch(cmdList); } else { return null; } } /** * 视频垂直镜像,即把视频上半部分镜像显示在下半部分 * * @param srcPath  源视频路径 * @return */ public String executeVideoMirrorV(String srcPath) { if (fileExist(srcPath)) { String filter = String.format(Locale.getDefault(), "crop=iw:ih/2:0:0,split[top][tmp];[tmp]vflip[bottom];" + "[top][bottom] vstack"); List<String> cmdList = new ArrayList<String>(); cmdList.add("-vcodec"); cmdList.add("lansoh264_dec"); cmdList.add("-i"); cmdList.add(srcPath); cmdList.add("-vf"); cmdList.add(filter); cmdList.add("-acodec"); cmdList.add("copy"); return executeAutoSwitch(cmdList); } else { return null; } } /** * 视频垂直方向反转 * @param srcPath   原视频 * @return */ public String executeVideoRotateVertically(String srcPath) { if (fileExist(srcPath)) { List<String> cmdList = new ArrayList<String>(); cmdList.add("-vcodec"); cmdList.add("lansoh264_dec"); cmdList.add("-i"); cmdList.add(srcPath); cmdList.add("-vf"); cmdList.add("vflip"); cmdList.add("-c:a"); cmdList.add("copy"); return executeAutoSwitch(cmdList); } else { return null; } } /** * 视频水平方向反转 * * @param srcPath   原视频 * @return */ public String executeVideoRotateHorizontally(String srcPath) { if (fileExist(srcPath)) { List<String> cmdList = new ArrayList<String>(); cmdList.add("-vcodec"); cmdList.add("lansoh264_dec"); cmdList.add("-i"); cmdList.add(srcPath); cmdList.add("-vf"); cmdList.add("hflip"); cmdList.add("-c:a"); cmdList.add("copy"); return executeAutoSwitch(cmdList); } else { return null; } } /** * 视频顺时针旋转90度 * * @param srcPath 原视频 * @return */ public String executeVideoRotate90Clockwise(String srcPath) { if (fileExist(srcPath)) { List<String> cmdList = new ArrayList<String>(); cmdList.add("-vcodec"); cmdList.add("lansoh264_dec"); cmdList.add("-i"); cmdList.add(srcPath); cmdList.add("-vf"); cmdList.add("transpose=1"); cmdList.add("-c:a"); cmdList.add("copy"); return executeAutoSwitch(cmdList); } else { return null; } } /** * 视频逆时针旋转90度,也可以认为是顺时针旋转270度. * * @param srcPath  原视频 * @return */ public String executeVideoRotate90CounterClockwise(String srcPath) { if (fileExist(srcPath)) { List<String> cmdList = new ArrayList<String>(); cmdList.add("-vcodec"); cmdList.add("lansoh264_dec"); cmdList.add("-i"); cmdList.add(srcPath); cmdList.add("-vf"); cmdList.add("transpose=2"); cmdList.add("-c:a"); cmdList.add("copy"); return executeAutoSwitch(cmdList); } else { return null; } } /** * 视频倒序;比如正常的视频画面是一个人从左边走到右边,倒序后,人从右边倒退到左边,即视频画面发生了倒序 * <p> * 注意:此处理会占用大量的内存,建议视频最好是480x480的分辨率, 并且不要过长,尽量在15秒内 * 注意:此处理会占用大量的内存,建议视频最好是480x480的分辨率, 并且不要过长,尽量在15秒内 * <p> * 如您的视频过大, 则可能导致:Failed to inject frame into filter network: Out of memory;这个是正常的.因为已超过APP可使用的内容范围, 内存不足. * * @param srcPath  原视频 * @return */ public String executeVideoReverse(String srcPath) { if (fileExist(srcPath)) { List<String> cmdList = new ArrayList<String>(); cmdList.add("-vcodec"); cmdList.add("lansoh264_dec"); cmdList.add("-i"); cmdList.add(srcPath); cmdList.add("-vf"); cmdList.add("reverse"); cmdList.add("-acodec"); cmdList.add("copy"); return executeAutoSwitch(cmdList); } else { return null; } } /** * 音频倒序,和视频倒序类似,把原来正常的声音,处理成从后向前的声音。 适合在搞怪的一些场合。 * <p> * 注意:此处理会占用大量的内存,建议视频最好是480x480的分辨率, 并且不要过长,尽量在15秒内 * 注意:此处理会占用大量的内存,建议视频最好是480x480的分辨率, 并且不要过长,尽量在15秒内 * * @param srcPath 源文件完整路径. 原文件可以是mp4的视频, 也可以是mp3或m4a的音频文件 * @return */ public String executeAudioReverse(String srcPath) { if (fileExist(srcPath)) { String dstPath=LanSongFileUtil.createM4AFileInBox(); List<String> cmdList = new ArrayList<String>(); cmdList.add("-i"); cmdList.add(srcPath); cmdList.add("-af"); cmdList.add("areverse"); cmdList.add("-c:v"); cmdList.add("copy"); cmdList.add("-y"); cmdList.add("drawpadDstPath"); String[] command = new String[cmdList.size()]; for (int i = 0; i < cmdList.size(); i++) { command[i] = (String) cmdList.get(i); } int ret= executeVideoEditor(command); if(ret==0){ return dstPath; }else{ LanSongFileUtil.deleteFile(dstPath); return null; } } else { return null; } } /** * 把一个mp4文件中的音频部分和视频都倒序播放。 * <p> * 注意:此处理会占用大量的内存,建议视频最好是480x480的分辨率, 并且不要过长,尽量在15秒内 * 注意:此处理会占用大量的内存,建议视频最好是480x480的分辨率, 并且不要过长,尽量在15秒内 * 如您的视频过大, 则可能导致:Failed to inject frame into filter network: Out of memory;这个是正常的.因为已超过APP可使用的内容范围, 内存不足. * * @param srcPath   原mp4文件 * @return */ public String executeAVReverse(String srcPath) { if (fileExist(srcPath)) { List<String> cmdList = new ArrayList<String>(); cmdList.add("-vcodec"); cmdList.add("lansoh264_dec"); cmdList.add("-i"); cmdList.add(srcPath); cmdList.add("-vf"); cmdList.add("reverse"); cmdList.add("-af"); cmdList.add("areverse"); return executeAutoSwitch(cmdList); } else { return null; } } /** * 不建议使用,因为需要字体,比较麻烦, 建议把文字转图片,然后叠加. * @param videoPath * @param fontPath * @param text * @return */ public String testVideoAddText(String videoPath,String fontPath,String text) { List<String> cmdList = new ArrayList<String>(); //"drawtext=fontfile=/system/fonts/DroidSansFallback.ttf: text='杭州蓝松科技001abc'"); String filter="drawtext=fontfile="+fontPath+": text= '"+text+ "'"; cmdList.add("-vcodec"); cmdList.add("lansoh264_dec"); cmdList.add("-i"); cmdList.add(videoPath); cmdList.add("-vf"); cmdList.add(filter); cmdList.add("-acodec"); cmdList.add("copy"); return executeAutoSwitch(cmdList); } /** * 删除视频中的logo,比如一般在视频的左上角或右上角有视频logo信息,类似"优酷","抖音"等; * 这里把指定位置的图像删除掉; * * @param video 原视频 * @param startX 开始横坐标 * @param startY 开始的横坐标 * @param w 删除的宽度 * @param h 删除的高度 * @return */ public String executeDeleteLogo(String video,int startX,int startY,int w,int h){ if (fileExist(video)) { String filter = String.format(Locale.getDefault(), "delogo=x=%d:y=%d:w=%d:h=%d",startX, startY,w,h); List<String> cmdList = new ArrayList<String>(); cmdList.add("-vcodec"); cmdList.add("lansoh264_dec"); cmdList.add("-i"); cmdList.add(video); cmdList.add("-vf"); cmdList.add(filter); cmdList.add("-acodec"); cmdList.add("copy"); return executeAutoSwitch(cmdList); } else { return null; } } /** * 删除视频中的最多4处有logo的信息. * * 4处logo, 是从1--4; * * 如果只用3处logo,则把startX4=0 startY4=0,width4=0,height4=0; * 如果只用到2处理,则把 3,4 设置为0; * 如果要设置编码后的码率,则用 setEncodeBitRate * @param video 输入视频, * @param startX1 第一处X坐标开始坐标 * @param startY1 第一处Y坐标开始坐标 * @param width1 第一处的宽度 * @param height1 第一处的高度 * @param startX2 * @param startY2 * @param width2 * @param height2 * @param startX3 * @param startY3 * @param width3 * @param height3 * @param startX4 * @param startY4 * @param width4 * @param height4 * @return */ public String executeDeleteLogo(String video,int startX1,int startY1,int width1,int height1, int startX2,int startY2,int width2,int height2, int startX3,int startY3,int width3,int height3, int startX4,int startY4,int width4,int height4){ if (fileExist(video)) { String filter = String.format(Locale.getDefault(), "delogo=x=%d:y=%d:w=%d:h=%d [d1]", startX1,startY1,width1,height1); if(startX2>=0 && startY2>=0 && width2>0 && height2>0){ String filter2 = String.format(Locale.getDefault(), ";[d1]delogo=x=%d:y=%d:w=%d:h=%d [d2]", startX2,startY2,width2,height2); filter+=filter2; } if(startX3>=0 && startY3>=0 && width3>0 && height3>0){ String filter3 = String.format(Locale.getDefault(), ";[d2]delogo=x=%d:y=%d:w=%d:h=%d [d3]", startX3,startY3,width3,height3); filter+=filter3; } if(startX4>=0 && startY4>=0 && width4>0 && height4>0){ String filter4 = String.format(Locale.getDefault(), ";[d3]delogo=x=%d:y=%d:w=%d:h=%d", startX4,startY4,width4,height4); filter+=filter4; } List<String> cmdList = new ArrayList<String>(); cmdList.add("-vcodec"); cmdList.add("lansoh264_dec"); cmdList.add("-i"); cmdList.add(video); cmdList.add("-vf"); cmdList.add(filter); cmdList.add("-acodec"); cmdList.add("copy"); return executeAutoSwitch(cmdList); } else { return null; } } //----------增加压缩帧率 /** * 对视频调整帧率, 码率 * @param video * @param framerate 帧率 * @param bitrate 码率 * @return */ public String executeAdjustFrameRate(String video,float framerate,int bitrate){ if (fileExist(video)) { List<String> cmdList = new ArrayList<String>(); cmdList.add("-vcodec"); cmdList.add("lansoh264_dec"); cmdList.add("-i"); cmdList.add(video); cmdList.add("-r"); cmdList.add(String.valueOf(framerate)); cmdList.add("-acodec"); cmdList.add("copy"); encodeBitRate=bitrate; return executeAutoSwitch(cmdList); } else { return null; } } /** *时长剪切的同时, 做画面裁剪,并调整帧率 * * @param videoFile 输入文件完整路径 * @param startTimeS 开始时间,单位秒 * @param duationS 要剪切的时长; * @param cropX 画面裁剪的开始X坐标 * @param cropY 画面裁剪的开始Y坐标 * @param cropWidth 画面裁剪的宽度 * @param cropHeight 画面裁剪的高度. * @param framerate 要调整的视频帧率, 建议15--30; * @return */ public String executeCutCropAdjustFps(String videoFile, float startTimeS, float duationS, int cropX, int cropY, int cropWidth, int cropHeight,float framerate) { String filter = String.format(Locale.getDefault(), "crop=%d:%d:%d:%d", cropWidth, cropHeight, cropX, cropY); List<String> cmdList = new ArrayList<String>(); cmdList.add("-vcodec"); cmdList.add("lansoh264_dec"); cmdList.add("-ss"); cmdList.add(String.valueOf(startTimeS)); cmdList.add("-t"); cmdList.add(String.valueOf(duationS)); cmdList.add("-i"); cmdList.add(videoFile); cmdList.add("-r"); cmdList.add(String.valueOf(framerate)); cmdList.add("-filter_complex"); cmdList.add(filter); cmdList.add("-acodec"); cmdList.add("copy"); return executeAutoSwitch(cmdList); } /** * * @param input * @param interval 提取帧的间隔; 1秒种提取多少帧; * @param scaleW 提取帧的缩放的宽高, 如果为0, 则不缩放 * @param scaleH * @param dstBmp 目标帧序列; 格式:lansonggif_%5d.jpg * @return */ public boolean executeExtractFrame(String input,float interval, int scaleW, int scaleH,String dstBmp) { if (fileExist(input)) { List<String> cmdList = new ArrayList<String>(); cmdList.add("-i"); cmdList.add(input); cmdList.add("-vsync"); cmdList.add("1"); cmdList.add("-qscale:v"); cmdList.add("2"); cmdList.add("-r"); cmdList.add(String.valueOf(interval)); if(scaleW>0 && scaleH>0){ cmdList.add("-s"); cmdList.add(String.format(Locale.getDefault(),"%dx%d",scaleW,scaleH)); } cmdList.add("-f"); cmdList.add("image2"); cmdList.add("-y"); cmdList.add(dstBmp); String[] command = new String[cmdList.size()]; for (int i = 0; i < cmdList.size(); i++) { command[i] = (String) cmdList.get(i); } int ret= executeVideoEditor(command); if(ret==0){ return true; }else{ return false; } } else { return false; } } private String executeConvertBmpToGif(String bmpPaths,float framerate) { String gifPath=LanSongFileUtil.createGIFFileInBox(); List<String> cmdList = new ArrayList<String>(); cmdList.add("-f"); cmdList.add("image2"); cmdList.add("-framerate"); cmdList.add(String.valueOf(framerate)); cmdList.add("-i"); cmdList.add(bmpPaths); cmdList.add("-y"); cmdList.add(gifPath); String[] command = new String[cmdList.size()]; for (int i = 0; i < cmdList.size(); i++) { command[i] = (String) cmdList.get(i); } int ret= executeVideoEditor(command); if(ret==0){ return gifPath; }else{ LanSongFileUtil.deleteFile(gifPath); return null; } } /** * 把视频转换为 gif * @param videoInput 输入视频 * @param inteval 对输入的视频取帧间隔. * @param scaleW 取帧的同时是否要缩放, =0为不缩放 * @param scaleH * @param frameRate 在编码成gif文件的时候的帧率; * @return */ public String executeConvertToGif(String videoInput, float inteval,int scaleW,int scaleH,float frameRate) { // ffmpeg -i d1.mp4 -r 1 -f image2 foo-%03d.jpeg // ffmpeg -f image2 -framerate 5 -i foo-%03d.jpeg c.gif String subfix="jpeg"; LanSongFileUtil.deleteNameFiles("lansonggif",subfix); String bmpPaths=LanSongFileUtil.getCreateFileDir(""); bmpPaths+="/lansonggif_%05d."+subfix; if(executeExtractFrame(videoInput,inteval,scaleW,scaleH,bmpPaths)){ String ret=executeConvertBmpToGif(bmpPaths,frameRate); LanSongFileUtil.deleteNameFiles("lansonggif",subfix); return ret; } return null; } /** * 在视频的指定时间范围内增加一张图片,图片从左上角00开始叠加到视频的上面 * * 比如给视频的第一帧增加一张图片,时间范围是:0.0 --0.03; * 注意:如果你用这个给视频增加一张封面的话, 增加好后, 分享到QQ或微信或放到mac系统上, 显示的缩略图不一定是第一帧的画面. * * LSNEW: 增加在指定时间叠加图片 * @param srcPath 视频的完整路径 * @param picPath 图片的完整的路径, 增加后,会从上左上角覆盖视频的第一帧 * @param startTimeS 开始时间,单位秒.float类型,可以有小数 * @param endTimeS 结束时间,单位秒. * @return */ public String executeAddPitureAtTime(String srcPath,String picPath,float startTimeS,float endTimeS) { if (fileExist(srcPath) && fileExist(picPath)) { List<String> cmdList = new ArrayList<String>(); String filter = String.format(Locale.getDefault(), "[0:v][1:v] overlay=0:0:enable='between(t,%f,%f)'", startTimeS, endTimeS); cmdList.add("-vcodec"); cmdList.add("lansoh264_dec"); cmdList.add("-i"); cmdList.add(srcPath); cmdList.add("-i"); cmdList.add(picPath); cmdList.add("-filter_complex"); cmdList.add(String.valueOf(filter)); cmdList.add("-acodec"); cmdList.add("copy"); return executeAutoSwitch(cmdList); } else { return null; } } /** * 在视频的指定位置,指定时间内叠加一张图片 * * @param srcPath 源视频的完整路径 * @param picPath 图片的完整路径,png/ jpg * @param x 图片的左上角要叠加到源视频的X坐标哪里, 左上角为0,0 * @param y * @param startTimeS 时间范围,开始时间,单位秒 * @param endTimeS 时间范围, 结束时间, 单位秒. * @return */ public String executeAddPitureAtXYTime(String srcPath,String picPath,int x,int y,float startTimeS,float endTimeS) { if (fileExist(srcPath) && fileExist(picPath)) { List<String> cmdList = new ArrayList<String>(); String filter = String.format(Locale.getDefault(), "[0:v][1:v] overlay=%d:%d:enable='between(t,%f,%f)'", x,y,startTimeS, endTimeS); cmdList.add("-vcodec"); cmdList.add("lansoh264_dec"); cmdList.add("-i"); cmdList.add(srcPath); cmdList.add("-i"); cmdList.add(picPath); cmdList.add("-filter_complex"); cmdList.add(String.valueOf(filter)); cmdList.add("-acodec"); cmdList.add("copy"); return executeAutoSwitch(cmdList); } else { return null; } } /** * 给Mp4文件中增加一些描述文字. * * 比如您可以把一些对该视频的操作信息, 配置信息,服务器的说明信息等放到视频里面,和视频一起传输, * 注意:这个文字信息是携带到mp4文件中, 不会增加到每帧上. * * 这里是写入. 我们有另外的读取 * LSNEW : * @param srcPath 原视频的完整路径 * @param text 要携带的描述文字 * @return 增加后的目标文件. */ public String executeAddTextToMp4(String srcPath,String text) { // ffmpeg -i d1.mp4 -metadata description="LanSon\"g \"Text" // -acodec copy -vcodec copy t1.mp4 if(fileExist(srcPath) && text!=null) { String retPath = LanSongFileUtil.createMp4FileInBox(); List<String> cmdList = new ArrayList<String>(); cmdList.add("-i"); cmdList.add(srcPath); cmdList.add("-metadata"); cmdList.add("description="); cmdList.add(text); cmdList.add("-acodec"); cmdList.add("copy"); cmdList.add("-vcodec"); cmdList.add("copy"); cmdList.add("-y"); cmdList.add(retPath); String[] command = new String[cmdList.size()]; for (int i = 0; i < cmdList.size(); i++) { command[i] = (String) cmdList.get(i); } int ret = executeVideoEditor(command); if (ret == 0) { return retPath; } else { LanSongFileUtil.deleteFile(retPath); return null; } }else{ return null; } } /** * 从视频中获取该视频的描述信息 * @param srcPath * @return */ public String executeGetTextFromMp4(String srcPath) { //LSTODO. 暂时预留. return null; } /** * 获取lansosdk的建议码率; * 这个码率不是唯一的, 仅仅是我们建议这样设置, 如果您对码率理解很清楚或有一定的压缩要求,则完全可以不用我们的建议,自行设置. * * @param wxh 宽度和高度的乘积; * @return */ public static int getSuggestBitRate(int wxh) { if (wxh <= 480 * 480) { return 1000 * 1024; } else if (wxh <= 640 * 480) { return 1500 * 1024; } else if (wxh <= 800 * 480) { return 1800 * 1024; } else if (wxh <= 960 * 544) { return 2000 * 1024; } else if (wxh <= 1280 * 720) { return 2500 * 1024; } else if (wxh <= 1920 * 1088) { return 3000 * 1024; } else { return 3500 * 1024; } } public static int checkSuggestBitRate(int wxh, int bitrate) { int sugg = getSuggestBitRate(wxh); return bitrate < sugg ? sugg : bitrate; //如果设置过来的码率小于建议码率,则返回建议码率,不然返回设置码率 } /** * 用在编码方法中; */ private MediaInfo _inputInfo=null; /** * 编码执行, 如果您有特殊的需求, 可以重载这个方法; * @param cmdList * @return */ public String executeAutoSwitch(List<String> cmdList) { int ret=0; int bitrate=0; boolean useSoftWareEncoder=false; if(encodeBitRate>0){ bitrate=encodeBitRate; } String dstPath=LanSongFileUtil.createMp4FileInBox(); if(isForceSoftWareDecoder || checkSoftDecoder()){ for(int i=0;i<cmdList.size();i++){ String cmd=cmdList.get(i); if("lansoh264_dec".equals(cmd)){ if(i>0){ cmdList.remove(i-1); cmdList.remove(i-1); } break; } } } // if(isForceHWEncoder==false && noCheck16Multi==false){ //暂时不加. // for(int i=0;i<cmdList.size();i++){ // String cmd=cmdList.get(i); // if("-i".equals(cmd) && i>0){ // 找到第一个输入项; // String videoPath=cmdList.get(i+1); // _inputInfo=new MediaInfo(videoPath); // if(_inputInfo.prepare() && _inputInfo.vFrameRate>0){ // if(_inputInfo.getWidth()%16 !=0 || _inputInfo.getHeight()%16 !=0){ // Log.e(TAG,"您输入的视频分辨率宽度或高度不是16的倍数, 默认切换为软编码"); // useSoftWareEncoder=true; // } // }else{ // _inputInfo=null; // } // } // } // } if(isForceHWEncoder){ Log.d(TAG,"开始处理:硬解码+ 硬编码...."); ret=executeWithEncoder(cmdList, bitrate, dstPath, true); }else if(isForceSoftWareEncoder || useSoftWareEncoder || checkSoftEncoder()) { Log.d(TAG,"开始处理:硬解码+ 软编码...."); ret = executeWithEncoder(cmdList, bitrate, dstPath, false); }else{ Log.d(TAG,"开始处理:硬解码+ 硬编码...."); ret=executeWithEncoder(cmdList, bitrate, dstPath, true); if(ret!=0){ Log.d(TAG,"开始处理:硬解码+ 软编码...."); ret=executeWithEncoder(cmdList, bitrate, dstPath, false); } } if(ret!=0) { for(int i=0;i<cmdList.size();i++){ String cmd=cmdList.get(i); if("lansoh264_dec".equals(cmd)){ if(i>0){ cmdList.remove(i-1); cmdList.remove(i-1); } break; } } sendEncoderEnchange(); Log.d(TAG,"开始处理:软解码+ 软编码...."); ret=executeWithEncoder(cmdList, bitrate, dstPath, false); } if(ret!=0){ if(lanSongLogCollector !=null){ lanSongLogCollector.start(); } Log.e("LanSoJni","编码失败, 开始搜集信息...use software decoder and encoder"); //再次执行一遍, 读取错误信息; ret=executeWithEncoder(cmdList, bitrate, dstPath, false); if(lanSongLogCollector !=null && lanSongLogCollector.isRunning()){ lanSongLogCollector.stop(); } LanSongFileUtil.deleteFile(dstPath); return null; }else{ return dstPath; } } /** * 增加编码器,并开始执行; * @param cmdList * @param bitrate * @param dstPath * @param isHWEnc 是否使用硬件编码器; 如果强制了,则以强制为准; * @return */ public int executeWithEncoder(List<String> cmdList,int bitrate, String dstPath, boolean isHWEnc) { List<String> cmdList2 = new ArrayList<String>(); for(String item: cmdList){ cmdList2.add(item); } cmdList2.add("-vcodec"); if(isHWEnc){ cmdList2.add("lansoh264_enc"); cmdList2.add("-pix_fmt"); if(isQiLinSoc()){ cmdList2.add("nv21"); setForceColorFormat(21); //LSTODO, 没有全面测试... }else{ cmdList2.add("yuv420p"); } cmdList2.add("-b:v"); cmdList2.add(String.valueOf(bitrate)); }else{ cmdList2.add("libx264"); cmdList2.add("-bf"); cmdList2.add("0"); cmdList2.add("-pix_fmt"); cmdList2.add("yuv420p"); cmdList2.add("-g"); cmdList2.add("30"); if(bitrate==0){ if(_inputInfo!=null){ bitrate=getSuggestBitRate(_inputInfo.vWidth * _inputInfo.vHeight); }else{ bitrate=(int)(2.5f*1024*1024); } } cmdList2.add("-b:v"); cmdList2.add(String.valueOf(bitrate)); } cmdList2.add("-y"); cmdList2.add(dstPath); String[] command = new String[cmdList2.size()]; for (int i = 0; i < cmdList2.size(); i++) { command[i] = (String) cmdList2.get(i); } int ret=executeVideoEditor(command); return ret; } /** * 检测是否需要软编码; * @return */ public boolean checkSoftEncoder() { for(String item: qilinCpulist){ if(item.contains(Build.MODEL) && isSupportNV21ColorFormat()==false){ isForceSoftWareEncoder=true; return true; } } if(Build.MODEL!=null && isSupportNV21ColorFormat()==false) { if (Build.MODEL.contains("-AL00") || Build.MODEL.contains("-CL00")) { isForceSoftWareEncoder = true; return true; } } return false; } //是否是麒麟处理器. public static boolean isQiLinSoc() { for(String item: qilinCpulist){ if(item.contains(Build.MODEL)){ return true; } } if(Build.MODEL!=null) { if (Build.MODEL.contains("-AL00") || Build.MODEL.contains("-CL00")) { return true; } } return false; } /** * 强制软编码器; * @return */ public boolean checkSoftDecoder() { for(String item: useSoftDecoderlist){ if(item.equalsIgnoreCase(Build.MODEL)){ return true; }else if(item.contains(Build.MODEL)){ return true; } } return false; } /** * 当数据不是16的倍数的时候,把他调整成16的倍数, 以最近的16倍数为准; * 举例如下: * 16, 17, 18, 19,20,21,22,23 ==>16; * 24,25,26,27,28,29,30,31,32==>32; * * * 如果是18,19这样接近16,则等于16, 等于缩小了原有的画面, * 如果是25,28这样接近32,则等于32, 等于稍微拉伸了原来的画面, * 因为最多缩小或拉伸8个像素, 还不至于画面严重变形,而又兼容编码器的要求,故可以这样做. * * @return */ public static int make16Closest(int value) { if (value < 16) { return value; } else { value += 8; int val2 = value / 16; val2 *= 16; return val2; } } /** * 把数据变成16的倍数, 以大于等于16倍数的为准; * 比如: * 16-->返回16; * 17---31-->返回32; * * @param value * @return */ public static int make16Next(int value) { if(value%16==0){ return value; }else{ return ((int)(value/16.0f +1)*16) ; } } private static int checkCPUName() { String str1 = "/proc/cpuinfo"; String str2 = ""; try { FileReader fr = new FileReader(str1); BufferedReader localBufferedReader = new BufferedReader(fr, 8192); str2 = localBufferedReader.readLine(); while (str2 != null) { // Log.i("testCPU","->"+str2+"<-"); str2 = localBufferedReader.readLine(); if(str2.contains("SDM845")){ //845的平台; } } localBufferedReader.close(); } catch (IOException e) { e.printStackTrace(); } return 0; } private static final String MIME_TYPE_AVC = "video/avc"; // H.264 Advanced private static boolean isSupportNV21=false; /** * 是否支持NV21的编码; * @return */ public boolean isSupportNV21ColorFormat() { if(isSupportNV21){ return true; } MediaCodecInfo codecInfo = selectCodec(MIME_TYPE_AVC); if (codecInfo == null) { return false; } isSupportNV21=selectColorFormat(codecInfo, MIME_TYPE_AVC); return isSupportNV21; } private static MediaCodecInfo selectCodec(String mimeType) { int numCodecs = MediaCodecList.getCodecCount(); for (int i = 0; i < numCodecs; i++) { MediaCodecInfo codecInfo = MediaCodecList.getCodecInfoAt(i); if (!codecInfo.isEncoder()) { continue; } String[] types = codecInfo.getSupportedTypes(); for (int j = 0; j < types.length; j++) { if (types[j].equalsIgnoreCase(mimeType)) { return codecInfo; } } } return null; } private static boolean selectColorFormat(MediaCodecInfo codecInfo, String mimeType) { MediaCodecInfo.CodecCapabilities capabilities = codecInfo .getCapabilitiesForType(mimeType); for (int i = 0; i < capabilities.colorFormats.length; i++) { int colorFormat = capabilities.colorFormats[i]; if(colorFormat==21){ return true; } } return false; } /** * 精确裁剪的同时,缩放到指定位置,不同于上面的命令,这个可以设置宽度和高度. 其中宽度和高度是采用缩放来完成. * <p> * <p> * 采用的是软缩放的形式. * * @param videoFile * @param startS * @param durationS * @param width 要缩放到的宽度 建议是16的倍数 , * @param height 要缩放到的高度, 建议是16的倍数 * @param framerate 帧率 * @param bitrate 码率 * @return */ public String executeCutVideoExactTest(String videoFile, float startS, float durationS, int width, int height, float framerate, int bitrate) { if (fileExist(videoFile)) { List<String> cmdList = new ArrayList<String>(); String scalecmd = String.format(Locale.getDefault(), "scale=%d:%d", width, height); cmdList.add("-vcodec"); cmdList.add("lansoh264_dec"); cmdList.add("-i"); cmdList.add(videoFile); cmdList.add("-ss"); cmdList.add(String.valueOf(startS)); cmdList.add("-t"); cmdList.add(String.valueOf(durationS)); //---测试调整码率、帧率+裁剪 cmdList.add("-r"); cmdList.add(String.valueOf(framerate)); encodeBitRate = bitrate; //---测试调整码率、帧率+裁剪 cmdList.add("-vf"); cmdList.add(scalecmd); cmdList.add("-acodec"); cmdList.add("copy"); return executeAutoSwitch(cmdList); } else { return null; } } public String testGetAudioM4a(String srcPath) { String dstPath=LanSongFileUtil.createM4AFileInBox(); List<String> cmdList = new ArrayList<String>(); cmdList.add("-i"); cmdList.add(srcPath); cmdList.add("-vn"); cmdList.add("-acodec"); cmdList.add("libfaac"); cmdList.add("-b:a"); cmdList.add("64000"); cmdList.add("-y"); cmdList.add(dstPath); String[] command = new String[cmdList.size()]; for (int i = 0; i < cmdList.size(); i++) { command[i] = (String) cmdList.get(i); } if(executeVideoEditor(command)==0){ return dstPath; }else{ LSLog.e("executeGetAudioTrack error"); return null; } } public int testVideoMergeAudio(String video, String audio,String dstPath) { List<String> cmdList = new ArrayList<String>(); cmdList.add("-i"); cmdList.add(video); cmdList.add("-i"); cmdList.add(audio); cmdList.add("-map"); cmdList.add("0:v"); cmdList.add("-map"); cmdList.add("1:a"); cmdList.add("-vcodec"); cmdList.add("copy"); cmdList.add("-acodec"); cmdList.add("copy"); cmdList.add("-absf"); cmdList.add("aac_adtstoasc"); cmdList.add("-y"); cmdList.add(dstPath); String[] command = new String[cmdList.size()]; for (int i = 0; i < cmdList.size(); i++) { command[i] = (String) cmdList.get(i); } VideoEditor editor = new VideoEditor(); return editor.executeVideoEditor(command); } }
[ "18625916235@163.com" ]
18625916235@163.com
502bf1898400c5adfb4022dc546d1cf8e7de9c28
f1d0571c5d84e6e6e2cd13a487690e2210bc7310
/src/main/java/com/brasilPrev/cadastro/repository/ClienteRepository.java
63ed28a686ea130c71e49efc339973b5393e1ac8
[]
no_license
carlosmeirelles/brasilPrev
7f845d9e6a39914657e6470b9a34737605fc8eac
426672d59ffb35f610451fd0f529f6294ffbc742
refs/heads/master
2020-07-03T06:42:28.422605
2019-08-12T16:54:32
2019-08-12T16:54:32
201,824,733
0
0
null
null
null
null
UTF-8
Java
false
false
168
java
package com.brasilPrev.cadastro.repository; import org.springframework.data.repository.CrudRepository; public interface ClienteRepository extends CrudRepository { }
[ "c.meirelles.junior@avanade.com" ]
c.meirelles.junior@avanade.com
5c89a9c9f0ffa41f316c70c84fb315eba809fdf4
401360659ee200023105fecf8678701e52577363
/yyjk-commons/src/main/java/com/cictec/yyjk/commons/configurer/WebSocketConfig.java
404608dc024e7b516e8f9cb518aa48d32a9fbe16
[]
no_license
suxifan/yyjk
95e9bc69c9012a78a221ed2a4577a05802045fcc
cf0153924de534bab5afaff4b6bf05a2675b2ef3
refs/heads/master
2022-12-18T11:05:51.340568
2020-09-22T03:11:42
2020-09-22T03:12:52
297,516,687
0
0
null
null
null
null
UTF-8
Java
false
false
1,309
java
package com.cictec.yyjk.commons.configurer; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.socket.server.standard.ServerEndpointExporter; @Configuration public class WebSocketConfig { /** * ServerEndpointExporter 用于扫描和注册所有携带 ServerEndPoint 注解的实例, 若部署到外部容器 * 则无需提供此类。 * * @return */ @Bean public ServerEndpointExporter serverEndpointExporter() { return new ServerEndpointExporter(); } /** * 因 SpringBoot WebSocket 对每个客户端连接都会创建一个 WebSocketServer(@ServerEndpoint * 注解对应的) 对象,Bean 注入操作会被直接略过,因而手动注入一个全局变量 * * 注入代码也可以直接写到@ServerEndpoint 注解对应的) 对象内,本例就直接在WebSocketServlet内直接进行静态注入 * * @param messageService */ // @Autowired // public void setTempPltwarnService(TempPltwarnService tempPltwarnService) // { // WebSocketServlet.tempPltwarnService = tempPltwarnService; // } // @Autowired // public void setBaseUserInfoService(BaseUserInfoService // baseUserInfoService) { // WebSocketServlet.baseUserInfoService = baseUserInfoService; // } }
[ "383556772@qq.com" ]
383556772@qq.com
8e9a75c10d8f5863ca08ca535b31e1b4def26130
8acb9f5321811a6de087fd9c01436569ab191f2f
/2doSem/OOP/Code4.java
3e1ff9c6c7d51297a858f6f75114e14e4f849abe
[]
no_license
hugoFranco21/ProgramasISC
dccd8dcb86d4801dbd29880faf070d481fa70e2a
ca8ad1fce1af8363def03696db22d201213d872e
refs/heads/master
2021-06-25T20:26:37.695976
2020-12-18T03:51:04
2020-12-18T03:51:04
190,673,735
0
0
null
null
null
null
UTF-8
Java
false
false
2,049
java
/*Name: Hugo David Franco Avila Date: Jan - 27 - 2018 This program will generate a random number, and the user will get 1 chance to guess it */ import java.util.Scanner; import java.util.Random; public class Code4{ public static void main (String[] Args){ //Variables int q, p; boolean i = true; String po; //Initialize random number generator Random r = new Random(); q = 1 + r.nextInt(25);//Assigned random number //Initialize Scanner Scanner scanner = new Scanner(System.in); //Start game System.out.println("Hello, in this game the machine will randomly generate a number between 1 and 25, and you will try to guess it"); System.out.println("If you write anything other than an integer you will be asked to try again"); System.out.println("The machine has made its choice, which number was it?"); /*This loops checks if the parseInt throws an exception If it throws an exception, i =true, and the loop will restart If it doesn't, i = false, and it exits the loop*/ do{ po = scanner.nextLine();//read user input i = Check(po);//gives i the value of the function check }while(i); /*After the number is validated to be an integer you assign its value to p*/ p = Integer.parseInt(po); System.out.println(); /*This part of the program tells the user if he guessed it or not*/ if(q == p){ System.out.println("You did it, you correctly guessed the computer picked " + q + ", it was a 1/25 possibility and you did it. Congratulations!"); } else{ System.out.println("Sorry, wrong number. The correct one was " + q + ". Don't feel bad, it was only a 1/25 possibility. Statistics win again."); } } /*This function takes a string, and evaluates if it throws an exception while parsing it to an Int*/ public static boolean Check(String a){ int b; try{ b = Integer.parseInt(a); } catch(NumberFormatException e){ System.out.println("You didn't introduce an integer"); System.out.println("Please try again"); return true; } return false; } }
[ "hfranco21@hotmail.com" ]
hfranco21@hotmail.com
8095ca1a64e092648b5f8b9456e732de21d70028
eac0b43bd7bf55f9c59c6867cc52706f5a8b9c1c
/eshop-v3/eshop-purchase/src/main/java/com/zhss/eshop/purchase/dao/impl/SupplierDAOImpl.java
36893db3e597ad914f7e157cc3dc888e97f351a3
[]
no_license
fengqing90/Learn
b017fa9d40cb0592ee63f77f620a8a8f39f046b9
396f48eddb5b78a4fdb880d46ea1f2b109b707e4
refs/heads/master
2022-11-22T01:44:05.803929
2021-08-04T03:57:26
2021-08-04T03:57:26
144,801,377
0
3
null
2022-11-16T06:59:58
2018-08-15T03:29:15
Java
UTF-8
Java
false
false
1,743
java
package com.zhss.eshop.purchase.dao.impl; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; import com.zhss.eshop.common.util.DateProvider; import com.zhss.eshop.purchase.dao.SupplierDAO; import com.zhss.eshop.purchase.domain.SupplierDO; import com.zhss.eshop.purchase.domain.SupplierQuery; import com.zhss.eshop.purchase.mapper.SupplierMapper; /** * 供应商管理DAO组件 * @author zhonghuashishan * */ @Repository public class SupplierDAOImpl implements SupplierDAO { /** * 供应商管理mapper组件 */ @Autowired private SupplierMapper supplierMapper; /** * 日期辅助组件 */ @Autowired private DateProvider dateProvider; /** * 新增供应商 * @param supplier 供应商 */ @Override public void save(SupplierDO supplier) throws Exception { supplier.setGmtCreate(dateProvider.getCurrentTime()); supplier.setGmtModified(dateProvider.getCurrentTime()); supplierMapper.save(supplier); } /** * 分页查询供应商 * @param query 供应商查询条件 * @return 供应商 */ @Override public List<SupplierDO> listByPage(SupplierQuery query) throws Exception { return supplierMapper.listByPage(query); } /** * 根据id查询供应商 * @param id 供应商id * @return 供应商 */ @Override public SupplierDO getById(Long id) throws Exception { return supplierMapper.getById(id); } /** * 根据结算周期查询供应商 * @param settlementPeriod 结算周期 * @return 供应商 */ @Override public List<SupplierDO> listBySettlementPeriod(Integer settlementPeriod) throws Exception { return supplierMapper.listBySettlementPeriod(settlementPeriod); } }
[ "fengqing@youxin.com" ]
fengqing@youxin.com
235db104866a95f09a3c5d3fbc9f6919a44d5f43
85d0389c49f660cdddf14cb7c00cfc3d3171f3c4
/matsin-contrib/.svn/pristine/23/235db104866a95f09a3c5d3fbc9f6919a44d5f43.svn-base
699543e44cf0af4fcf985cebc0808916f3a351e8
[]
no_license
anhpt204/tracnghiem_nham
05cc10efd1cfaab54806d3408f33cfd223d8af13
f159e63209b1aa73dc53ece36aa76e8deb086b70
refs/heads/master
2021-01-16T18:35:33.714347
2015-08-21T04:12:43
2015-08-21T04:12:43
38,027,945
1
0
null
null
null
null
UTF-8
Java
false
false
7,355
/* *********************************************************************** * * project: org.matsim.* * ScenarioGeneratorTest.java * * * *********************************************************************** * * * * copyright : (C) 2012 by the members listed in the COPYING, * * LICENSE and WARRANTY file. * * email : info at matsim dot org * * * * *********************************************************************** * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * See also COPYING, LICENSE and WARRANTY file * * * * *********************************************************************** */ package org.matsim.contrib.grips.scenariogenerator; import java.io.File; import java.util.ArrayList; import java.util.HashMap; import org.junit.Test; import org.matsim.api.core.v01.Id; import org.matsim.api.core.v01.events.LinkEnterEvent; import org.matsim.api.core.v01.events.handler.LinkEnterEventHandler; import org.matsim.contrib.grips.analysis.control.EventHandler; import org.matsim.contrib.grips.analysis.control.EventReaderThread; import org.matsim.contrib.grips.control.Controller; import org.matsim.contrib.grips.io.ConfigIO; import org.matsim.contrib.grips.model.config.GripsConfigModule; import org.matsim.contrib.grips.simulation.SimulationMask; import org.matsim.core.api.experimental.events.EventsManager; import org.matsim.core.basic.v01.IdImpl; import org.matsim.core.config.Config; import org.matsim.core.config.ConfigWriter; import org.matsim.core.config.Module; import org.matsim.core.controler.Controler; import org.matsim.core.events.EventsReaderXMLv1; import org.matsim.core.events.EventsUtils; import org.matsim.core.utils.misc.CRCChecksum; import org.matsim.testcases.MatsimTestCase; public class ScenarioGeneratorTest extends MatsimTestCase { @Test public void testScenarioGenerator() { ArrayList<Id> closedRoadIDs = new ArrayList<Id>(); closedRoadIDs.add(new IdImpl(156)); closedRoadIDs.add(new IdImpl(316)); closedRoadIDs.add(new IdImpl(263)); String inputDir = getInputDirectory(); String outputDir = getOutputDirectory(); String gripsFileString = inputDir + "/grips_config.xml"; String matsimConfigFileString = outputDir + "/config.xml"; System.out.println("grips file:" + gripsFileString); System.out.println("matsim config file:" + matsimConfigFileString); // File file = new File("oloberg.jpg"); // File file2 = new File("C:/HTW_Logo_rgb.jpg"); // File file3 = new File("/lol/HTW_Logo_rgb.jpg"); // File file4 = new File("./test/input/org/matsim/contrib/grips/scenariogenerator/ScenarioGeneratorTest/testScenarioGenerator/lenzen.osm"); // // System.out.println("file1 absolute path:" + file.isAbsolute()); // System.out.println("file2 absolute path:" + file2.isAbsolute()); // System.out.println("file3 absolute path:" + file3.isAbsolute()); // // System.out.println(":" + file4.isAbsolute()); // System.out.println("file4 absolute path:" + file4.exists()); // System.exit(0); File gripsConfigFile = new File(gripsFileString); File matsimConfigFile; Controller controller = new Controller(); GripsConfigModule gcm; Config mc; //check for files assertTrue("grips config file is missing", gripsConfigFile.exists()); assertTrue("evacuation area shape file is missing",(new File(inputDir + "/evacuation_area.shp")).exists()); assertTrue("population area shape file is missing",(new File(inputDir + "/population.shp")).exists()); assertTrue("open street map file is missing", (new File(inputDir + "/lenzen.osm")).exists()); assertTrue("could not open grips config.", controller.openGripsConfig(gripsConfigFile)); gcm = controller.getGripsConfigModule(); //generate and check matsim network/config boolean generateScenario = true; try { ScenarioGenerator scengen = new org.matsim.contrib.grips.scenariogenerator.ScenarioGenerator(gripsFileString); scengen.run(); } catch (Exception e) { generateScenario = false; e.printStackTrace(); } assertTrue("scenario was not generated",generateScenario); //check and open matsim scenario config file System.out.println("string:" + matsimConfigFileString); matsimConfigFile = new File(matsimConfigFileString); assertTrue("scenario config file is missing",matsimConfigFile.exists()); assertTrue("could not open matsim config",controller.openMastimConfig(matsimConfigFile)); //open matsim config, set first and last iteration mc = controller.getScenario().getConfig(); mc.setParam("controler", "firstIteration", "0"); mc.setParam("controler", "lastIteration", "10"); new ConfigWriter(mc).write(matsimConfigFileString); //save road closures HashMap<Id,String> roadClosures = new HashMap<Id,String>(); for (Id id : closedRoadIDs) roadClosures.put(id, "00:00"); boolean saved = ConfigIO.saveRoadClosures(controller, roadClosures); assertTrue("could not save road closures",saved); //simulate and check scenario boolean simulateScenario = true; try { Controler matsimController = new Controler(mc); matsimController.setOverwriteFiles(true); matsimController.run(); } catch (Exception e) { simulateScenario = false; e.printStackTrace(); } assertTrue("scenario was not simulated",simulateScenario); //parse events, check if closed roads are not being visited LinkEnterEventHandler eventHandler = null; EventsManager e = EventsUtils.createEventsManager(); EventsReaderXMLv1 reader = new EventsReaderXMLv1(e); Thread readerThread = new Thread(new EventReaderThread(reader, outputDir+"output/ITERS/it.10/10.events.xml.gz"), "readerthread"); final ArrayList<Id> usedIDs = new ArrayList<Id>(); eventHandler = new LinkEnterEventHandler() { @Override public void reset(int iteration) { } @Override public void handleEvent(LinkEnterEvent event) { if (usedIDs.contains(event.getLinkId())) usedIDs.add(event.getLinkId()); } }; e.addHandler(eventHandler); readerThread.run(); for (Id id : closedRoadIDs) assertTrue("a closed road is crossed (id: " + id.toString() + ")", !usedIDs.contains(id)); // assertEquals("different config-files.", CRCChecksum.getCRCFromFile(inputDir + "/config.xml"), CRCChecksum.getCRCFromFile(outputDir + "/config.xml")); assertEquals("different network-files.", CRCChecksum.getCRCFromFile(inputDir + "/network.xml.gz"), CRCChecksum.getCRCFromFile(outputDir + "/network.xml.gz")); // assertEquals("different plans-files.", CRCChecksum.getCRCFromFile(inputDir + "/population.xml.gz"), CRCChecksum.getCRCFromFile(outputDir + "/population.xml.gz")); } }
[ "anh.pt204@gmail.com" ]
anh.pt204@gmail.com
e004685a596941a97886b701e9a65506eae6c4ae
342c71f63ba1a5a4750d7675b2fcccff134e20b9
/src/xx/service/InputService.java
08a73733e1041116ae8bed1b27f9e556390282e4
[]
no_license
lvhongqiang/lhq
ae84ad2b4b8d85223e596d32f4637164b665f042
d24e01f293e45aa228b5840ba3e594fce091e35b
refs/heads/master
2020-06-17T18:41:12.604708
2017-11-15T09:32:42
2017-11-15T09:32:42
74,982,094
0
0
null
null
null
null
UTF-8
Java
false
false
2,615
java
package xx.service; import java.sql.Timestamp; import java.util.Date; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.select.Elements; import org.springframework.stereotype.Service; import xx.model.Article; import xx.util.FileUtil; @Service public class InputService extends BaseService { public Integer saveWeixin(String url){ try { Article article=saveArticleContent(url); return article.getId(); } catch (Exception e) { e.printStackTrace(); return null; } } /**保存文章正文html**/ private Article saveArticleContent(String url)throws Exception{ Document doc = Jsoup.connect(url).get(); Element contentElement=doc.getElementById("js_content"); //生成article Timestamp now=new Timestamp(new Date().getTime()); String html=contentElement.html(); String title=doc.title(); Article article=new Article(title, null, html, 1, now,url); baseDao.saveOrUpdate(article); //保存图片 Elements imgs=contentElement.getElementsByTag("img"); for (int i=0;imgs!=null&&i<imgs.size();i++) { Element img=imgs.get(i); String datasrc=img.attr("data-src"); String filePath="article/"+article.getId()+"/images/"+i+".jpg"; FileUtil.saveUrlImg(datasrc, FileUtil.realpath(filePath)); img.attr("data-src", filePath); } String content=contentElement.html(); article.setContent(content); baseDao.saveOrUpdate(article); return article; } /**保存文章所有html**/ private Article saveArticleHtml(String url) throws Exception{ Document doc = Jsoup.connect(url).get(); //移除js_toobar Element js_toobar = doc.getElementById("js_toobar"); if(js_toobar!=null)js_toobar.remove(); //生成article Timestamp now=new Timestamp(new Date().getTime()); String html=doc.head().toString()+doc.body().toString(); String title=doc.title(); Article article=new Article(title, null, html, 1, now,url); baseDao.saveOrUpdate(article); //保存图片 Elements imgs=doc.getElementsByTag("img"); for (int i=0;imgs!=null&&i<imgs.size();i++) { Element img=imgs.get(i); String datasrc=img.attr("data-src"); String filePath="article/"+article.getId()+"/images/"+i+".jpg"; FileUtil.saveUrlImg(datasrc, FileUtil.realpath(filePath)); img.attr("data-src", filePath); } String content=doc.head().toString()+doc.body().toString(); article.setContent(content); baseDao.saveOrUpdate(article); return article; } private String getHtml(String url) throws Exception{ Document doc = Jsoup.connect(url).get(); return doc.head().toString()+doc.body().toString(); } }
[ "lvhongqiang09@163.com" ]
lvhongqiang09@163.com
bee8f266b74510b80981563c043968a1a63540b3
0809bbf54dcb62c6b5cae945ca9aef85b98593e5
/JSF/gov/nasa/jpf/star/examples/bst/BinarySearchTree_printTreeTest.java
46f6bb59dd7c4b1218c6591180fa621936491096
[]
no_license
star-finder/star-examples
0a543e6fb43bec4ab29410d93cfcfbaf51ad8ab8
dc106a52ebb38acceba732d3189389255a9f00a8
refs/heads/master
2021-09-01T23:05:50.581247
2017-12-29T03:31:51
2017-12-29T03:31:51
115,682,546
0
0
null
null
null
null
UTF-8
Java
false
false
3,701
java
package gov.nasa.jpf.star.examples.bst; import org.antlr.v4.runtime.ANTLRInputStream; import org.antlr.v4.runtime.CommonTokenStream; import org.junit.Before; import org.junit.Test; import gov.nasa.jpf.star.data.DataNode; import gov.nasa.jpf.star.data.DataNodeLexer; import gov.nasa.jpf.star.data.DataNodeMap; import gov.nasa.jpf.star.data.DataNodeParser; import gov.nasa.jpf.star.precondition.Precondition; import gov.nasa.jpf.star.precondition.PreconditionLexer; import gov.nasa.jpf.star.precondition.PreconditionMap; import gov.nasa.jpf.star.precondition.PreconditionParser; import gov.nasa.jpf.star.predicate.InductivePred; import gov.nasa.jpf.star.predicate.InductivePredLexer; import gov.nasa.jpf.star.predicate.InductivePredMap; import gov.nasa.jpf.star.predicate.InductivePredParser; import gov.nasa.jpf.util.test.TestJPF; @SuppressWarnings("deprecation") public class BinarySearchTree_printTreeTest extends TestJPF { private void initDataNode() { String data = "data BinaryNode {int element; BinaryNode left; BinaryNode right}"; ANTLRInputStream in = new ANTLRInputStream(data); DataNodeLexer lexer = new DataNodeLexer(in); CommonTokenStream tokens = new CommonTokenStream(lexer); DataNodeParser parser = new DataNodeParser(tokens); DataNode[] dns = parser.datas().dns; DataNodeMap.put(dns); } private void initPredicate() { // String pred = "pred bst(root,minE,maxE) == root=null || root::BinaryNode<element,left,right> * bst(left,minE,element) * bst(right,element,maxE) & minE<element & element<maxE"; String pred1 = "pred bst(root) == root = null || root::BinaryNode<element,left,right> * bstE(left,minE,element) * bstE(right,element,maxE)"; String pred2 = "pred bstE(root,minE,maxE) == root=null || root::BinaryNode<element,left,right> * bstE(left,minE,element) * bstE(right,element,maxE) & minE<element & element<maxE"; String pred = pred1 + ";" + pred2; ANTLRInputStream in = new ANTLRInputStream(pred); InductivePredLexer lexer = new InductivePredLexer(in); CommonTokenStream tokens = new CommonTokenStream(lexer); InductivePredParser parser = new InductivePredParser(tokens); InductivePred[] ips = parser.preds().ips; InductivePredMap.put(ips); } private void initPrecondition() { // String pre = "pre printTree == bst(this_root,this_min,this_max)"; String pre = "pre printTree == bst(this_root)"; ANTLRInputStream in = new ANTLRInputStream(pre); PreconditionLexer lexer = new PreconditionLexer(in); CommonTokenStream tokens = new CommonTokenStream(lexer); PreconditionParser parser = new PreconditionParser(tokens); Precondition[] ps = parser.pres().ps; PreconditionMap.put(ps); } @Before public void init() { initDataNode(); initPredicate(); initPrecondition(); } @Test public void testMain() { long begin = System.currentTimeMillis(); if (verifyNoPropertyViolation( "+listener=.star.StarListener", "+star.max_depth=3", // "+star.min_int=-100", // "+star.max_int=100", "+star.test_path=/Users/HongLongPham/Workspace/JPF_HOME/jpf-star/src/examples/gov/nasa/jpf/star/examples/bst", "+star.test_package=gov.nasa.jpf.star.examples.bst", "+star.test_imports=gov.nasa.jpf.star.examples.Utilities", "+classpath=build/examples", "+sourcepath=src/examples", "+symbolic.method=gov.nasa.jpf.star.examples.bst.BinarySearchTree.printTree()", "+symbolic.fields=instance", "+symbolic.lazy=true")) { BinarySearchTree tree = new BinarySearchTree(); tree.printTree(); } long end = System.currentTimeMillis(); System.out.println(end - begin); } }
[ "longph1989@gmail.com" ]
longph1989@gmail.com
13414dffd35af57dd76abb1c9f787408ef8aec51
614d50b567c426046515e976a44a005814aa0580
/core/src/main/java/org/eigenbase/rel/metadata/RelMdUtil.java
c526aa73926d3503a19f6b960769b2c33ba6c956
[ "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
guilhermejccavalcanti/optiq
76b7f117a582d1f3fa284047a4cda7b9ae396d3b
b8022e45c9ef6e8c3ac792511b247816c4d6e929
refs/heads/master
2020-03-25T05:47:53.781191
2018-08-07T03:40:16
2018-08-07T03:40:16
143,466,381
0
0
Apache-2.0
2018-08-03T19:36:32
2018-08-03T19:36:32
null
UTF-8
Java
false
false
27,605
java
/* // Licensed to Julian Hyde under one or more contributor license // agreements. See the NOTICE file distributed with this work for // additional information regarding copyright ownership. // // Julian Hyde licenses this file to you under the Apache License, // Version 2.0 (the "License"); you may not use this file except in // compliance with the License. You may obtain a copy of the License at: // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. */ package org.eigenbase.rel.metadata; import java.math.*; import java.util.*; import org.eigenbase.rel.*; import org.eigenbase.rel.rules.*; import org.eigenbase.relopt.*; import org.eigenbase.rex.*; import org.eigenbase.sql.*; import org.eigenbase.sql.fun.*; import org.eigenbase.sql.type.*; import org.eigenbase.util.Util; import org.eigenbase.util14.*; /** * RelMdUtil provides utility methods used by the metadata provider methods. * * @author Zelaine Fong * @version $Id$ */ public class RelMdUtil { //~ Static fields/initializers --------------------------------------------- public static final SqlFunction artificialSelectivityFunc = new SqlFunction( "ARTIFICIAL_SELECTIVITY", SqlKind.OTHER_FUNCTION, SqlTypeStrategies.rtiBoolean, // returns boolean since we'll AND it null, SqlTypeStrategies.otcNumeric, // takes a numeric param SqlFunctionCategory.System); //~ Methods ---------------------------------------------------------------- /** * Creates a RexNode that stores a selectivity value corresponding to the * selectivity of a semijoin. This can be added to a filter to simulate the * effect of the semijoin during costing, but should never appear in a real * plan since it has no physical implementation. * * @param rel the semijoin of interest * * @return constructed rexnode */ public static RexNode makeSemiJoinSelectivityRexNode(SemiJoinRel rel) { RexBuilder rexBuilder = rel.getCluster().getRexBuilder(); double selectivity = computeSemiJoinSelectivity( rel.getLeft(), rel.getRight(), rel); RexNode selec = rexBuilder.makeApproxLiteral(new BigDecimal(selectivity)); return rexBuilder.makeCall(artificialSelectivityFunc, selec); } /** * Returns the selectivity value stored in the rexnode * * @param artificialSelecFuncNode rexnode containing the selectivity value * * @return selectivity value */ public static double getSelectivityValue(RexNode artificialSelecFuncNode) { assert (artificialSelecFuncNode instanceof RexCall); RexCall call = (RexCall) artificialSelecFuncNode; assert (call.getOperator() == artificialSelectivityFunc); RexNode operand = call.getOperands().get(0); BigDecimal bd = (BigDecimal) ((RexLiteral) operand).getValue(); return bd.doubleValue(); } /** * Computes the selectivity of a semijoin filter if it is applied on a fact * table. The computation is based on the selectivity of the dimension * table/columns and the number of distinct values in the fact table * columns. * * @param rel semijoin rel * * @return calculated selectivity */ public static double computeSemiJoinSelectivity( SemiJoinRel rel) { return computeSemiJoinSelectivity( rel.getLeft(), rel.getRight(), rel.getLeftKeys(), rel.getRightKeys()); } /** * Computes the selectivity of a semijoin filter if it is applied on a fact * table. The computation is based on the selectivity of the dimension * table/columns and the number of distinct values in the fact table * columns. * * @param factRel fact table participating in the semijoin * @param dimRel dimension table participating in the semijoin * @param rel semijoin rel * * @return calculated selectivity */ public static double computeSemiJoinSelectivity( RelNode factRel, RelNode dimRel, SemiJoinRel rel) { return computeSemiJoinSelectivity( factRel, dimRel, rel.getLeftKeys(), rel.getRightKeys()); } /** * Computes the selectivity of a semijoin filter if it is applied on a fact * table. The computation is based on the selectivity of the dimension * table/columns and the number of distinct values in the fact table * columns. * * @param factRel fact table participating in the semijoin * @param dimRel dimension table participating in the semijoin * @param factKeyList LHS keys used in the filter * @param dimKeyList RHS keys used in the filter * * @return calculated selectivity */ public static double computeSemiJoinSelectivity( RelNode factRel, RelNode dimRel, List<Integer> factKeyList, List<Integer> dimKeyList) { BitSet factKeys = new BitSet(); for (int factCol : factKeyList) { factKeys.set(factCol); } BitSet dimKeys = new BitSet(); for (int dimCol : dimKeyList) { dimKeys.set(dimCol); } Double factPop = RelMetadataQuery.getPopulationSize(factRel, factKeys); if (factPop == null) { // use the dimension population if the fact population is // unavailable; since we're filtering the fact table, that's // the population we ideally want to use factPop = RelMetadataQuery.getPopulationSize(dimRel, dimKeys); } // if cardinality and population are available, use them; otherwise // use percentage original rows Double selectivity; Double dimCard = RelMetadataQuery.getDistinctRowCount( dimRel, dimKeys, null); if ((dimCard != null) && (factPop != null)) { // to avoid division by zero if (factPop < 1.0) { factPop = 1.0; } selectivity = dimCard / factPop; } else { selectivity = RelMetadataQuery.getPercentageOriginalRows(dimRel); } if (selectivity == null) { // set a default selectivity based on the number of semijoin keys selectivity = Math.pow( 0.1, dimKeys.cardinality()); } else if (selectivity > 1.0) { selectivity = 1.0; } return selectivity; } /** * Returns true if the columns represented in a bit mask are definitely * known to form a unique column set. * * @param rel the relnode that the column mask correponds to * @param colMask bit mask containing columns that will be tested for * uniqueness * * @return true if bit mask represents a unique column set; false if not (or * if no metadata is available) */ public static boolean areColumnsDefinitelyUnique( RelNode rel, BitSet colMask) { Boolean b = RelMetadataQuery.areColumnsUnique(rel, colMask); if (b == null) { return false; } return b; } public static Boolean areColumnsUnique( RelNode rel, List<RexInputRef> columnRefs) { BitSet colMask = new BitSet(); for (int i = 0; i < columnRefs.size(); i++) { colMask.set(columnRefs.get(i).getIndex()); } return RelMetadataQuery.areColumnsUnique(rel, colMask); } public static boolean areColumnsDefinitelyUnique( RelNode rel, List<RexInputRef> columnRefs) { Boolean b = areColumnsUnique(rel, columnRefs); if (b == null) { return false; } return b; } /** * Returns true if the columns represented in a bit mask are definitely * known to form a unique column set, when nulls have been filtered from * the columns. * * @param rel the relnode that the column mask correponds to * @param colMask bit mask containing columns that will be tested for * uniqueness * * @return true if bit mask represents a unique column set; false if not (or * if no metadata is available) */ public static boolean areColumnsDefinitelyUniqueWhenNullsFiltered( RelNode rel, BitSet colMask) { Boolean b = RelMetadataQuery.areColumnsUnique(rel, colMask, true); if (b == null) { return false; } return b; } public static Boolean areColumnsUniqueWhenNullsFiltered( RelNode rel, List<RexInputRef> columnRefs) { BitSet colMask = new BitSet(); for (int i = 0; i < columnRefs.size(); i++) { colMask.set(columnRefs.get(i).getIndex()); } return RelMetadataQuery.areColumnsUnique(rel, colMask, true); } public static boolean areColumnsDefinitelyUniqueWhenNullsFiltered( RelNode rel, List<RexInputRef> columnRefs) { Boolean b = areColumnsUniqueWhenNullsFiltered(rel, columnRefs); if (b == null) { return false; } return b; } /** * Sets a bitmap corresponding to a list of keys. * * @param keys list of keys * * @return the bitmap */ public static BitSet setBitKeys(List<Integer> keys) { BitSet bits = new BitSet(); for (Integer key : keys) { bits.set(key); } return bits; } /** * Separates a bitmask representing a join into masks representing the left * and right inputs into the join * * @param groupKey original bitmask * @param leftMask left bitmask to be set * @param rightMask right bitmask to be set * @param nFieldsOnLeft number of fields in the left input */ public static void setLeftRightBitmaps( BitSet groupKey, BitSet leftMask, BitSet rightMask, int nFieldsOnLeft) { for (int bit : Util.toIter(groupKey)) { if (bit < nFieldsOnLeft) { leftMask.set(bit); } else { rightMask.set(bit - nFieldsOnLeft); } } } /** * Returns the number of distinct values provided numSelected are selected * where there are domainSize distinct values. * * <p>Note that in the case where domainSize == numSelected, it's not true * that the return value should be domainSize. If you pick 100 random values * between 1 and 100, you'll most likely end up with fewer than 100 distinct * values, because you'll pick some values more than once. * * @param domainSize number of distinct values in the domain * @param numSelected number selected from the domain * * @return number of distinct values for subset selected */ public static Double numDistinctVals( Double domainSize, Double numSelected) { if ((domainSize == null) || (numSelected == null)) { return null; } // Cap the input sizes at MAX_VALUE to ensure that the calculations // using these values return meaningful values double dSize = capInfinity(domainSize); double numSel = capInfinity(numSelected); // The formula for this is: // 1. Assume we pick 80 random values between 1 and 100. // 2. The chance we skip any given value is .99 ^ 80 // 3. Thus on average we will skip .99 ^ 80 percent of the values // in the domain // 4. Generalized, we skip ( (n-1)/n ) ^ k values where n is the // number of possible values and k is the number we are selecting // 5. This can be rewritten via approximation (if you want to // know why approximation is called for here, ask Bill Keese): // ((n-1)/n) ^ k // = e ^ ln( ((n-1)/n) ^ k ) // = e ^ (k * ln ((n-1)/n)) // = e ^ (k * ln (1-1/n)) // ~= e ^ (k * (-1/n)) because ln(1+x) ~= x for small x // = e ^ (-k/n) // 6. Flipping it from number skipped to number visited, we get: double res = (dSize > 0) ? ((1.0 - Math.exp(-1 * numSel / dSize)) * dSize) : 0; // fix the boundary cases if (res > dSize) { res = dSize; } if (res > numSel) { res = numSel; } if (res < 0) { res = 0; } return res; } /** * Caps a double value at Double.MAX_VALUE if it's currently infinity * * @param d the Double object * * @return the double value if it's not infinity; else Double.MAX_VALUE */ public static double capInfinity(Double d) { return (d.isInfinite() ? Double.MAX_VALUE : d.doubleValue()); } /** * Returns default estimates for selectivities, in the absence of stats. * * @param predicate predicate for which selectivity will be computed; null * means true, so gives selectity of 1.0 * * @return estimated selectivity */ public static double guessSelectivity(RexNode predicate) { return guessSelectivity(predicate, false); } /** * Returns default estimates for selectivities, in the absence of stats. * * @param predicate predicate for which selectivity will be computed; null * means true, so gives selectity of 1.0 * @param artificialOnly return only the selectivity contribution from * artificial nodes * * @return estimated selectivity */ public static double guessSelectivity( RexNode predicate, boolean artificialOnly) { double sel = 1.0; if ((predicate == null) || predicate.isAlwaysTrue()) { return sel; } double artificialSel = 1.0; for (RexNode pred : RelOptUtil.conjunctions(predicate)) { if ((pred instanceof RexCall) && (((RexCall) pred).getOperator() == SqlStdOperatorTable.isNotNullOperator)) { sel *= .9; } else if ( (pred instanceof RexCall) && (((RexCall) pred).getOperator() == RelMdUtil.artificialSelectivityFunc)) { artificialSel *= RelMdUtil.getSelectivityValue(pred); } else if (pred.isA(RexKind.Equals)) { sel *= .15; } else if (pred.isA(RexKind.Comparison)) { sel *= .5; } else { sel *= .25; } } if (artificialOnly) { return artificialSel; } else { return sel * artificialSel; } } /** * Locates the columns corresponding to equijoins within a joinrel. * * @param leftChild left input into the join * @param rightChild right input into the join * @param predicate join predicate * @param leftJoinCols bitmap that will be set with the columns on the LHS * of the join that participate in equijoins * @param rightJoinCols bitmap that will be set with the columns on the RHS * of the join that participate in equijoins * * @return remaining join filters that are not equijoins; may return a * {@link RexLiteral} true, but never null */ public static RexNode findEquiJoinCols( RelNode leftChild, RelNode rightChild, RexNode predicate, BitSet leftJoinCols, BitSet rightJoinCols) { // locate the equijoin conditions List<Integer> leftKeys = new ArrayList<Integer>(); List<Integer> rightKeys = new ArrayList<Integer>(); RexNode nonEquiJoin = RelOptUtil.splitJoinCondition( leftChild, rightChild, predicate, leftKeys, rightKeys); assert nonEquiJoin != null; // mark the columns referenced on each side of the equijoin filters for (int i = 0; i < leftKeys.size(); i++) { leftJoinCols.set(leftKeys.get(i)); rightJoinCols.set(rightKeys.get(i)); } return nonEquiJoin; } /** * AND's two predicates together, either of which may be null, removing * redundant filters. * * @param rexBuilder rexBuilder used to construct AND'd RexNode * @param pred1 first predicate * @param pred2 second predicate * * @return AND'd predicate or individual predicates if one is null */ public static RexNode unionPreds( RexBuilder rexBuilder, RexNode pred1, RexNode pred2) { final List<RexNode> unionList = new ArrayList<RexNode>(); final Set<String> strings = new HashSet<String>(); for (RexNode rex : RelOptUtil.conjunctions(pred1)) { if (strings.add(rex.toString())) { unionList.add(rex); } } for (RexNode rex2 : RelOptUtil.conjunctions(pred2)) { if (strings.add(rex2.toString())) { unionList.add(rex2); } } return RexUtil.composeConjunction(rexBuilder, unionList, true); } /** * Takes the difference between two predicates, removing from the first any * predicates also in the second * * @param rexBuilder rexBuilder used to construct AND'd RexNode * @param pred1 first predicate * @param pred2 second predicate * * @return MINUS'd predicate list */ public static RexNode minusPreds( RexBuilder rexBuilder, RexNode pred1, RexNode pred2) { List<RexNode> list1 = RelOptUtil.conjunctions(pred1); List<RexNode> list2 = RelOptUtil.conjunctions(pred2); List<RexNode> minusList = new ArrayList<RexNode>(); for (RexNode rex1 : list1) { boolean add = true; for (RexNode rex2 : list2) { if (rex2.toString().compareTo(rex1.toString()) == 0) { add = false; break; } } if (add) { minusList.add(rex1); } } return RexUtil.composeConjunction(rexBuilder, minusList, true); } /** * Takes a bitmap representing a set of input references and extracts the * ones that reference the group by columns in an aggregate * * @param groupKey the original bitmap * @param aggRel the aggregate * @param childKey sets bits from groupKey corresponding to group by columns */ public static void setAggChildKeys( BitSet groupKey, AggregateRelBase aggRel, BitSet childKey) { List<AggregateCall> aggCalls = aggRel.getAggCallList(); for (int bit : Util.toIter(groupKey)) { if (bit < aggRel.getGroupCount()) { // group by column childKey.set(bit); } else { // aggregate column -- set a bit for each argument being // aggregated AggregateCall agg = aggCalls.get(bit - aggRel.getGroupCount()); for (Integer arg : agg.getArgList()) { childKey.set(arg); } } } } /** * Forms two bitmaps by splitting the columns in a bitmap according to * whether or not the column references the child input or is an expression * * @param projExprs Project expressions * @param groupKey Bitmap whose columns will be split * @param baseCols Bitmap representing columns from the child input * @param projCols Bitmap representing non-child columns */ public static void splitCols( List<RexNode> projExprs, BitSet groupKey, BitSet baseCols, BitSet projCols) { for (int bit : Util.toIter(groupKey)) { final RexNode e = projExprs.get(bit); if (e instanceof RexInputRef) { baseCols.set(((RexInputRef) e).getIndex()); } else { projCols.set(bit); } } } /** * Computes the cardinality of a particular expression from the projection * list * * @param rel RelNode corresponding to the project * @param expr projection expression * * @return cardinality */ public static Double cardOfProjExpr(ProjectRelBase rel, RexNode expr) { return expr.accept(new CardOfProjExpr(rel)); } /** * Computes the population size for a set of keys returned from a join * * @param joinRel the join rel * @param groupKey keys to compute the population for * * @return computed population size */ public static Double getJoinPopulationSize( RelNode joinRel, BitSet groupKey) { BitSet leftMask = new BitSet(); BitSet rightMask = new BitSet(); RelNode left = joinRel.getInputs().get(0); RelNode right = joinRel.getInputs().get(1); // separate the mask into masks for the left and right RelMdUtil.setLeftRightBitmaps( groupKey, leftMask, rightMask, left.getRowType().getFieldCount()); Double population = NumberUtil.multiply( RelMetadataQuery.getPopulationSize( left, leftMask), RelMetadataQuery.getPopulationSize( right, rightMask)); return RelMdUtil.numDistinctVals( population, RelMetadataQuery.getRowCount(joinRel)); } /** * Computes the number of distinct rows for a set of keys returned from a * join * * @param joinRel RelNode representing the join * @param joinType type of join * @param groupKey keys that the distinct row count will be computed for * @param predicate join predicate * * @return number of distinct rows */ public static Double getJoinDistinctRowCount( RelNode joinRel, JoinRelType joinType, BitSet groupKey, RexNode predicate) { Double distRowCount; BitSet leftMask = new BitSet(); BitSet rightMask = new BitSet(); RelNode left = joinRel.getInputs().get(0); RelNode right = joinRel.getInputs().get(1); RelMdUtil.setLeftRightBitmaps( groupKey, leftMask, rightMask, left.getRowType().getFieldCount()); // determine which filters apply to the left vs right RexNode leftPred = null; RexNode rightPred = null; if (predicate != null) { List<RexNode> leftFilters = new ArrayList<RexNode>(); List<RexNode> rightFilters = new ArrayList<RexNode>(); List<RexNode> joinFilters = new ArrayList<RexNode>(); List<RexNode> predList = RelOptUtil.conjunctions(predicate); RelOptUtil.classifyFilters( joinRel, predList, (joinType == JoinRelType.INNER), !joinType.generatesNullsOnLeft(), !joinType.generatesNullsOnRight(), joinFilters, leftFilters, rightFilters); RexBuilder rexBuilder = joinRel.getCluster().getRexBuilder(); leftPred = RexUtil.composeConjunction(rexBuilder, leftFilters, true); rightPred = RexUtil.composeConjunction(rexBuilder, rightFilters, true); } distRowCount = NumberUtil.multiply( RelMetadataQuery.getDistinctRowCount( left, leftMask, leftPred), RelMetadataQuery.getDistinctRowCount( right, rightMask, rightPred)); return RelMdUtil.numDistinctVals( distRowCount, RelMetadataQuery.getRowCount(joinRel)); } //~ Inner Classes ---------------------------------------------------------- private static class CardOfProjExpr extends RexVisitorImpl<Double> { private ProjectRelBase rel; public CardOfProjExpr(ProjectRelBase rel) { super(true); this.rel = rel; } public Double visitInputRef(RexInputRef var) { int index = var.getIndex(); BitSet col = new BitSet(index); col.set(index); Double distinctRowCount = RelMetadataQuery.getDistinctRowCount( rel.getChild(), col, null); if (distinctRowCount == null) { return null; } else { return RelMdUtil.numDistinctVals( distinctRowCount, RelMetadataQuery.getRowCount(rel)); } } public Double visitLiteral(RexLiteral literal) { return RelMdUtil.numDistinctVals( 1.0, RelMetadataQuery.getRowCount(rel)); } public Double visitCall(RexCall call) { Double distinctRowCount; Double rowCount = RelMetadataQuery.getRowCount(rel); if (call.isA(RexKind.MinusPrefix)) { distinctRowCount = cardOfProjExpr(rel, call.getOperands().get(0)); } else if (call.isA(RexKind.Plus) || call.isA(RexKind.Minus)) { Double card0 = cardOfProjExpr(rel, call.getOperands().get(0)); if (card0 == null) { return null; } Double card1 = cardOfProjExpr(rel, call.getOperands().get(1)); if (card1 == null) { return null; } distinctRowCount = Math.max(card0, card1); } else if (call.isA(RexKind.Times) || call.isA(RexKind.Divide)) { distinctRowCount = NumberUtil.multiply( cardOfProjExpr(rel, call.getOperands().get(0)), cardOfProjExpr(rel, call.getOperands().get(1))); // TODO zfong 6/21/06 - Broadbase has code to handle date // functions like year, month, day; E.g., cardinality of Month() // is 12 } else { if (call.getOperands().size() == 1) { distinctRowCount = cardOfProjExpr( rel, call.getOperands().get(0)); } else { distinctRowCount = rowCount / 10; } } return numDistinctVals(distinctRowCount, rowCount); } } } // End RelMdUtil.java
[ "julianhyde@gmail.com" ]
julianhyde@gmail.com
b1e14f48f42c3cfd04ca894461ffa888f2706b29
04b1803adb6653ecb7cb827c4f4aa616afacf629
/components/web_restrictions/browser/junit/src/org/chromium/components/webrestrictions/browser/WebRestrictionsContentProviderTest.java
9f174d94de5f99aa42368cf8d4f42d50e1aac289
[ "BSD-3-Clause" ]
permissive
Samsung/Castanets
240d9338e097b75b3f669604315b06f7cf129d64
4896f732fc747dfdcfcbac3d442f2d2d42df264a
refs/heads/castanets_76_dev
2023-08-31T09:01:04.744346
2021-07-30T04:56:25
2021-08-11T05:45:21
125,484,161
58
49
BSD-3-Clause
2022-10-16T19:31:26
2018-03-16T08:07:37
null
UTF-8
Java
false
false
6,470
java
// Copyright 2015 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. package org.chromium.components.webrestrictions.browser; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.CoreMatchers.nullValue; import static org.junit.Assert.assertThat; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import android.content.ContentResolver; import android.content.ContentValues; import android.content.pm.ProviderInfo; import android.database.Cursor; import android.net.Uri; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentMatchers; import org.mockito.Mockito; import org.robolectric.RuntimeEnvironment; import org.robolectric.annotation.Config; import org.robolectric.shadows.ShadowContentResolver; import org.chromium.base.test.BaseRobolectricTestRunner; import org.chromium.components.webrestrictions.browser.WebRestrictionsContentProvider.WebRestrictionsResult; /** * Tests of WebRestrictionsContentProvider. */ @RunWith(BaseRobolectricTestRunner.class) @Config(manifest = Config.NONE) public class WebRestrictionsContentProviderTest { private static final String AUTHORITY = "org.chromium.browser.DummyProvider"; private WebRestrictionsContentProvider mContentProvider; private ContentResolver mContentResolver; private Uri mUri; @Before public void setUp() { // The test needs a concrete version of the test class, but mocks the additional members as // necessary. mContentProvider = Mockito.spy(new WebRestrictionsContentProvider() { @Override protected WebRestrictionsResult shouldProceed(String callingPackage, String url) { return null; } @Override protected boolean canInsert() { return false; } @Override protected boolean requestInsert(String url) { return false; } @Override protected boolean contentProviderEnabled() { return false; } @Override protected String[] getErrorColumnNames() { return null; } }); mContentProvider.onCreate(); ShadowContentResolver.registerProviderInternal(AUTHORITY, mContentProvider); ProviderInfo info = new ProviderInfo(); info.authority = AUTHORITY; mContentProvider.attachInfo(null, info); mContentResolver = RuntimeEnvironment.application.getContentResolver(); mUri = new Uri.Builder() .scheme(ContentResolver.SCHEME_CONTENT) .authority(AUTHORITY) .build(); } @Test public void testQuery() { when(mContentProvider.contentProviderEnabled()).thenReturn(false); assertThat(mContentResolver.query(mUri.buildUpon().appendPath("authorized").build(), null, "url = 'dummy'", null, null), is(nullValue())); when(mContentProvider.contentProviderEnabled()).thenReturn(true); int errorInt[] = {42}; String errorString[] = {"Error Message"}; WebRestrictionsResult result = new WebRestrictionsResult(false, errorInt, errorString); when(mContentProvider.shouldProceed(ArgumentMatchers.<String>isNull(), anyString())) .thenReturn(result); Cursor cursor = mContentResolver.query(mUri.buildUpon().appendPath("authorized").build(), null, "url = 'dummy'", null, null); verify(mContentProvider).shouldProceed(null, "dummy"); assertThat(cursor, is(not(nullValue()))); assertThat(cursor.getInt(0), is(WebRestrictionsContentProvider.BLOCKED)); assertThat(cursor.getInt(1), is(42)); assertThat(cursor.getString(2), is("Error Message")); result = new WebRestrictionsResult(true, null, null); when(mContentProvider.shouldProceed(ArgumentMatchers.<String>isNull(), anyString())) .thenReturn(result); cursor = mContentResolver.query(mUri.buildUpon().appendPath("authorized").build(), null, "url = 'dummy'", null, null); assertThat(cursor, is(not(nullValue()))); assertThat(cursor.getInt(0), is(WebRestrictionsContentProvider.PROCEED)); } @Test public void testInsert() { ContentValues values = new ContentValues(); values.put("url", "dummy2"); when(mContentProvider.contentProviderEnabled()).thenReturn(true); when(mContentProvider.requestInsert(anyString())).thenReturn(false); assertThat( mContentResolver.insert(mUri.buildUpon().appendPath("requested").build(), values), is(nullValue())); verify(mContentProvider).requestInsert("dummy2"); values.put("url", "dummy3"); when(mContentProvider.requestInsert(anyString())).thenReturn(true); assertThat( mContentResolver.insert(mUri.buildUpon().appendPath("requested").build(), values), is(not(nullValue()))); verify(mContentProvider).requestInsert("dummy3"); when(mContentProvider.contentProviderEnabled()).thenReturn(false); assertThat( mContentResolver.insert(mUri.buildUpon().appendPath("requested").build(), values), is(nullValue())); } @Test public void testGetType() { when(mContentProvider.contentProviderEnabled()).thenReturn(true); assertThat(mContentResolver.getType(mUri.buildUpon().appendPath("junk").build()), is(nullValue())); when(mContentProvider.canInsert()).thenReturn(false); assertThat(mContentResolver.getType(mUri.buildUpon().appendPath("requested").build()), is(nullValue())); when(mContentProvider.canInsert()).thenReturn(true); assertThat(mContentResolver.getType(mUri.buildUpon().appendPath("requested").build()), is(not(nullValue()))); when(mContentProvider.contentProviderEnabled()).thenReturn(false); assertThat(mContentResolver.getType(mUri.buildUpon().appendPath("junk").build()), is(nullValue())); } }
[ "sunny.nam@samsung.com" ]
sunny.nam@samsung.com
6f9f81370371d7a4eba4498190c443b7e4509f38
53d677a55e4ece8883526738f1c9d00fa6560ff7
/com/tencent/mm/pluginsdk/f/b.java
ee49457174ad734d65c7da128dc0a73fac45cf3c
[]
no_license
0jinxing/wechat-apk-source
544c2d79bfc10261eb36389c1edfdf553d8f312a
f75eefd87e9b9ecf2f76fc6d48dbba8e24afcf3d
refs/heads/master
2020-06-07T20:06:03.580028
2019-06-21T09:17:26
2019-06-21T09:17:26
193,069,132
9
4
null
null
null
null
UTF-8
Java
false
false
835
java
package com.tencent.mm.pluginsdk.f; import android.annotation.TargetApi; import android.content.ClipData; import android.content.ClipboardManager; import android.content.Context; import com.tencent.matrix.trace.core.AppMethodBeat; import com.tencent.mm.sdk.platformtools.ah; final class b { @TargetApi(11) public static void b(CharSequence paramCharSequence1, CharSequence paramCharSequence2) { AppMethodBeat.i(79448); ((ClipboardManager)ah.getContext().getSystemService("clipboard")).setPrimaryClip(ClipData.newPlainText(paramCharSequence1, paramCharSequence2)); AppMethodBeat.o(79448); } } /* Location: C:\Users\Lin\Downloads\dex-tools-2.1-SNAPSHOT\dex-tools-2.1-SNAPSHOT\classes5-dex2jar.jar * Qualified Name: com.tencent.mm.pluginsdk.f.b * JD-Core Version: 0.6.2 */
[ "172601673@qq.com" ]
172601673@qq.com
1115c83e99b643074d41e39b038d5a2992dd3210
7fcad1246555aed5fe785e6708d8ee18b5a14f35
/src/main/java/com/avingenieria/controller/HomeController.java
74cb7067a2641e58f512bb55dabd0ce7ef9694d3
[]
no_license
sumaikun/SpringWebsite
691ce81f1d2121c6420d5be762960b6a8f862ef8
b4bd843202fdda20ace101975fcf22516fbc1c57
refs/heads/master
2021-01-11T12:29:01.043700
2017-02-01T19:54:16
2017-02-01T19:54:16
79,346,630
0
0
null
null
null
null
UTF-8
Java
false
false
788
java
package com.avingenieria.controller; import java.text.DateFormat; import java.util.Date; import java.util.Locale; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.ModelAndView; /** * Handles requests for the application home page. */ @Controller public class HomeController { @RequestMapping("/hello") public ModelAndView helloWorld() { System.out.println("intento generar la vista inicial"); String message = "Hello World, Spring MVC @ Javatpoint"; return new ModelAndView("hello", "message", message); } }
[ "ventas.javc@gmail.com" ]
ventas.javc@gmail.com
3781b9637eed407eb34686d7bcb6592970d31989
8761737d8be1c22fd68dd815acb7e6c1a5c97180
/android/app/src/main/java/com/ppac_21686/MainActivity.java
589de4987d9cbc1a5594cde3a4c84170b839ff9c
[]
no_license
crowdbotics-apps/ppac-21686
2f5ded64f0f09b0871ad458131fcbc7e58a9c21a
713e86f5e863d65adb56db1f5cdab7637d2449b6
refs/heads/master
2022-12-31T00:15:29.350979
2020-10-18T22:44:02
2020-10-18T22:44:02
305,207,091
0
0
null
null
null
null
UTF-8
Java
false
false
362
java
package com.ppac_21686; import com.facebook.react.ReactActivity; public class MainActivity extends ReactActivity { /** * Returns the name of the main component registered from JavaScript. This is used to schedule * rendering of the component. */ @Override protected String getMainComponentName() { return "ppac_21686"; } }
[ "team@crowdbotics.com" ]
team@crowdbotics.com
98b054101acbbf841ee4216a2740676c4d53151d
1816dc4bacb8ea5f96a47fa1b660dd57d7034814
/src/MD5.java
700e8458bcd8cb570ff7240b5bb46e0f25085b42
[ "MIT" ]
permissive
upadrastaharshavardhan/0569-hackerrank-java
7fc8eb2526ffa1a75a92e8e87172775777f59f7a
dc933417589dd7f4290f2399491b453b954953a6
refs/heads/main
2023-08-25T10:24:34.641294
2021-10-31T15:25:12
2021-10-31T15:25:12
423,173,352
0
0
null
null
null
null
UTF-8
Java
false
false
844
java
// https://www.hackerrank.com/challenges/java-md5/problem import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.Scanner; public class MD5 { public static void main(String[] args) throws NoSuchAlgorithmException { MessageDigest md5 = MessageDigest.getInstance("MD5"); Scanner scanner = new Scanner(System.in); String message = scanner.nextLine(); scanner.close(); byte[] hash = md5.digest(message.getBytes()); String hexadecimalHash = toHex(hash); System.out.println(hexadecimalHash); } private static String toHex(byte[] array) { StringBuilder sb = new StringBuilder(2 * array.length); for(byte b : array) { sb.append(String.format("%02x", b&0xff)); } return sb.toString(); } }
[ "noreply@github.com" ]
upadrastaharshavardhan.noreply@github.com
056935fa065b7ab8efddc9f22e289b1b02fdbbb7
bbd8592c3b78f9665f45bc3de73ee5f8fdbcd481
/src/main/java/com/pearadmin/common/security/support/SecurityCaptchaSupport.java
64bc80be46afb84a1c0e0ed2f96c399f547b38e4
[ "MIT" ]
permissive
lambertwe/pear-admin-fast
725c9c3d931422a70505655a2564801f5557d9df
ee338526e55cd3fbd0f14daa3d6048fefc4b425e
refs/heads/master
2023-02-02T09:14:03.008603
2020-12-16T01:44:59
2020-12-16T01:44:59
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,969
java
package com.pearadmin.common.security.support; import com.alibaba.fastjson.JSON; import com.pearadmin.common.tools.servlet.ServletUtil; import com.pearadmin.common.tools.text.StringUtils; import com.pearadmin.common.web.domain.response.Result; import com.wf.captcha.utils.CaptchaUtil; import org.springframework.stereotype.Component; import org.springframework.web.filter.OncePerRequestFilter; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; /** * 登 录 验 证 码 过 滤 器 * @author John Ming * @createTime 2020/11/20 */ @Component public class SecurityCaptchaSupport extends OncePerRequestFilter implements Filter { /** * 过 滤 接 口 * */ private String defaultFilterProcessUrl = "/login"; /** * 过 滤 方 法 * */ private String method = "POST"; /** * 验 证 码 校 监 逻 辑 * */ @Override protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws ServletException, IOException { if (method.equalsIgnoreCase(request.getMethod()) && defaultFilterProcessUrl.equals(request.getServletPath())) { String Captcha = ServletUtil.getRequest().getParameter("captcha"); response.setContentType("application/json;charset=UTF-8"); if (StringUtils.isEmpty(Captcha)){ response.getWriter().write(JSON.toJSONString(Result.failure("验证码不能为空!"))); return; } if (!CaptchaUtil.ver(ServletUtil.getRequest().getParameter("captcha"), ServletUtil.getRequest())){ response.getWriter().write(JSON.toJSONString(Result.failure("验证码错误!"))); return; } } chain.doFilter(request, response); } }
[ "854085467@qq.com" ]
854085467@qq.com
57188624ddd7ee9daae3bac6a7bedaa2797a0e2b
4cf959bb5caad82d4f6c796fd9e39ac97527c489
/java/edu/pitt/csb/mgm/MixedUtils.java
611b03d7f2866c0e221f8adf906332eee191a5b6
[]
no_license
guhjy/r-causal
36c1820cb8aa1581b0b9dfdfb1675a424a6f302b
2a389238b472ddb60cee3389f2f64ea6aecd8be0
refs/heads/master
2021-01-22T21:38:38.636710
2017-02-28T19:15:27
2017-02-28T19:15:27
null
0
0
null
null
null
null
UTF-8
Java
false
false
42,059
java
/////////////////////////////////////////////////////////////////////////////// // For information as to what this class does, see the Javadoc, below. // // Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, // // 2007, 2008, 2009, 2010, 2014, 2015 by Peter Spirtes, Richard Scheines, Joseph // // Ramsey, and Clark Glymour. // // // // This program is free software; you can redistribute it and/or modify // // it under the terms of the GNU General Public License as published by // // the Free Software Foundation; either version 2 of the License, or // // (at your option) any later version. // // // // This program is distributed in the hope that it will be useful, // // but WITHOUT ANY WARRANTY; without even the implied warranty of // // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // // GNU General Public License for more details. // // // // You should have received a copy of the GNU General Public License // // along with this program; if not, write to the Free Software // // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // /////////////////////////////////////////////////////////////////////////////// package edu.pitt.csb.mgm; import cern.colt.matrix.DoubleFactory2D; import cern.colt.matrix.DoubleMatrix1D; import cern.colt.matrix.DoubleMatrix2D; import edu.cmu.tetrad.data.*; import edu.cmu.tetrad.graph.*; import edu.cmu.tetrad.search.*;//IndependenceTest; import edu.cmu.tetrad.sem.GeneralizedSemIm; import edu.cmu.tetrad.sem.GeneralizedSemPm; import edu.cmu.tetrad.sem.TemplateExpander; import edu.cmu.tetrad.util.RandomUtil; import edu.cmu.tetrad.util.StatUtils; import java.io.File; import java.io.IOException; import java.lang.reflect.Constructor; import java.text.ParseException; import java.util.*; /** * Created by ajsedgewick on 7/29/15. */ public class MixedUtils { public static int[] getDiscreteInds(List<Node> nodes){ List<Integer> indList = new ArrayList<>(); int curInd = 0; for(Node n: nodes){ if(n instanceof DiscreteVariable){ indList.add(curInd); } curInd++; } int[] inds = new int[indList.size()]; for(int i = 0; i < inds.length; i++){ inds[i] = indList.get(i); } return inds; } public static int[] getContinuousInds(List<Node> nodes){ List<Integer> indList = new ArrayList<>(); int curInd = 0; for(Node n: nodes){ if(n instanceof ContinuousVariable){ indList.add(curInd); } curInd++; } int[] inds = new int[indList.size()]; for(int i = 0; i < inds.length; i++){ inds[i] = indList.get(i); } return inds; } //Converts a Dataset with both ContinuousVariables and DiscreteVariables to only ContinuousVariables public static DataSet makeContinuousData(DataSet dsMix) { ArrayList<Node> contVars = new ArrayList<>(); for(Node n: dsMix.getVariables()){ if(n instanceof DiscreteVariable){ ContinuousVariable nc = new ContinuousVariable(n.getName()); contVars.add(nc); } else { contVars.add(n); } } return ColtDataSet.makeData(contVars, dsMix.getDoubleData()); } //takes DataSet of all ContinuousVariables //convert variables to discrete if there is an entry with <NodeName, "Disc"> in nodeDists public static DataSet makeMixedData(DataSet dsCont, Map<String, String> nodeDists, int numCategories) { ArrayList<Node> mixVars = new ArrayList<>(); for(Node n: dsCont.getVariables()){ if(nodeDists.get(n.getName()).equals("Disc")){ DiscreteVariable nd = new DiscreteVariable(n.getName(), numCategories); mixVars.add(nd); } else { mixVars.add(n); } } return ColtDataSet.makeData(mixVars, dsCont.getDoubleData()); } //takes DataSet of all ContinuousVariables //convert variables to discrete if there is an entry with <NodeName, x> with x > 0, num categories set to x public static DataSet makeMixedData(DataSet dsCont, Map<String, Integer> nodeDists) { ArrayList<Node> mixVars = new ArrayList<>(); for(Node n: dsCont.getVariables()){ int nC = nodeDists.get(n.getName()); if(nC>0){ DiscreteVariable nd = new DiscreteVariable(n.getName(), nC); mixVars.add(nd); } else { mixVars.add(n); } } // MixedDataBox box = new MixedDataBox(mixVars, dsCont.getNumRows()); // // for (int i = 0; i < box.numRows(); i++) { // for (int j = 0; j < box.numCols(); j++) { // if (mixVars.get(j) instanceof ContinuousVariable) { // box.set(i, j, dsCont.getDouble(i, j)); // } else { // box.set(i, j, (int) Math.round(dsCont.getDouble(i, j))); // } // } // } // return new BoxDataSet(box, mixVars); return ColtDataSet.makeData(mixVars, dsCont.getDoubleData()); } /** * Makes a deep copy of a dataset (Nodes copied as well). Useful for paralellization * @param ds dataset to be copied * @return */ public static ColtDataSet deepCopy(ColtDataSet ds){ List<Node> vars = new ArrayList<>(ds.getNumColumns()); for(Node n : ds.getVariables()){ if(n instanceof ContinuousVariable) vars.add(new ContinuousVariable((ContinuousVariable)n)); else if (n instanceof DiscreteVariable) vars.add(new DiscreteVariable((DiscreteVariable) n)); else throw new IllegalArgumentException("Variable type of node " + n + "could not be determined"); } ColtDataSet out = ColtDataSet.makeData(vars,ds.getDoubleData()); return out; } //Takes a mixed dataset and returns only data corresponding to ContinuousVariables in order public static DataSet getContinousData(DataSet ds){ ArrayList<Node> contVars = new ArrayList<>(); for(Node n: ds.getVariables()){ if(n instanceof ContinuousVariable) contVars.add(n); } return ds.subsetColumns(contVars); } //Takes a mixed dataset and returns only data corresponding to DiscreteVariables in order public static DataSet getDiscreteData(DataSet ds){ ArrayList<Node> discVars = new ArrayList<>(); for(Node n: ds.getVariables()){ if(n instanceof DiscreteVariable) discVars.add(n); } return ds.subsetColumns(discVars); } public static int[] getDiscLevels(DataSet ds){ //ArrayList<Integer> levels = new ArrayList<Integer>[]; DataSet discDs = getDiscreteData(ds); int[] levels = new int[discDs.getNumColumns()]; int i = 0; for(Node n: discDs.getVariables()){ levels[i] = ((DiscreteVariable) n).getNumCategories(); i++; } return levels; } /** * return vector of the maximum of each column in m (as ints, i.e. for discrete data) * @param m * @return */ public static int[] colMax(DoubleMatrix2D m){ int[] maxVec = new int[m.columns()]; for(int i = 0; i < m.columns(); i++){ double curmax = -1; for(int j = 0; j < m.rows(); j++){ double curval = m.getQuick(j,i); if(curval>curmax){ curmax = curval; } } maxVec[i] = (int) curmax; } return maxVec; } public static double vecMax(DoubleMatrix1D vec){ double curMax = Double.NEGATIVE_INFINITY; for(int i = 0; i < vec.size(); i++){ double curVal = vec.getQuick(i); if(curVal>curMax){ curMax = curVal; } } return curMax; } public static double numVals(DoubleMatrix1D vec){ return valSet(vec).size(); } public static Set<Double> valSet(DoubleMatrix1D vec){ Set<Double> vals = new HashSet<>(); for(int i = 0; i < vec.size(); i++){ vals.add(vec.getQuick(i)); } return vals; } //generate PM from trueGraph for mixed Gaussian and Trinary variables //Don't use, buggy public static GeneralizedSemPm GaussianTrinaryPm(Graph trueGraph, HashMap<String, String> nodeDists, int maxSample, String paramTemplate) throws IllegalStateException{ GeneralizedSemPm semPm = new GeneralizedSemPm(trueGraph); try { List<Node> variableNodes = semPm.getVariableNodes(); int numVars = variableNodes.size(); semPm.setStartsWithParametersTemplate("B", paramTemplate); semPm.setStartsWithParametersTemplate("D", paramTemplate); // empirically should give us a stddev of 1 - 2 semPm.setStartsWithParametersTemplate("al", "U(.3,1.3)"); semPm.setStartsWithParametersTemplate("s", "U(1,2)"); //if we don't use NB error, we could do this instead String templateDisc = "DiscError(err, (TSUM(NEW(B)*$)), (TSUM(NEW(B)*$)), (TSUM(NEW(B)*$)))"; //String templateDisc0 = "DiscError(err, 2,2,2)"; String templateDisc0 = "DiscError(err, .001,.001,.001)"; for (Node node : variableNodes) { List<Node> parents = trueGraph.getParents(node); //System.out.println("nParents: " + parents.size() ); Node eNode = semPm.getErrorNode(node); //normal and nb work like normal sems String curEx = semPm.getNodeExpressionString(node); String errEx = semPm.getNodeExpressionString(eNode); String newTemp = ""; //System.out.println("Node: " + node + "Type: " + nodeDists.get(node)); if(nodeDists.get(node.getName()).equals("Disc")){ if(parents.size() == 0){ newTemp = templateDisc0; } else { newTemp = templateDisc; } newTemp = newTemp.replaceAll("err", eNode.getName()); curEx = TemplateExpander.getInstance().expandTemplate(newTemp, semPm, node); //System.out.println("Disc CurEx: " + curEx); errEx = TemplateExpander.getInstance().expandTemplate("U(0,1)", semPm, eNode); } //now for every discrete parent, swap for discrete params newTemp = ""; if(parents.size() != 0) { for (Node parNode : parents){ if(nodeDists.get(parNode.getName()).equals("Disc")){ //String curName = trueGraph.getParents(node).get(0).toString(); String curName = parNode.getName(); String disRep = "IF(" + curName + "=0,NEW(D),IF("+curName+"=1,NEW(D),NEW(D)))"; newTemp = curEx.replaceAll("(B[0-9]*\\*" + curName + ")(?![0-9])", disRep); } } } if(newTemp.length()!=0){ curEx = TemplateExpander.getInstance().expandTemplate(newTemp, semPm, node); } semPm.setNodeExpression(node, curEx); semPm.setNodeExpression(eNode, errEx); } } catch (ParseException e) { throw new IllegalStateException("Parse error in fixing parameters.", e); } return semPm; } //generate PM from trueGraph for mixed Gaussian and Categorical variables //public static GeneralizedSemPm GaussianCategoricalPm(Graph trueGraph, HashMap<String, Integer> nodeDists, String paramTemplate) throws IllegalStateException{ public static GeneralizedSemPm GaussianCategoricalPm(Graph trueGraph, String paramTemplate) throws IllegalStateException{ Map<String, Integer> nodeDists = getNodeDists(trueGraph); GeneralizedSemPm semPm = new GeneralizedSemPm(trueGraph); try { List<Node> variableNodes = semPm.getVariableNodes(); int numVars = variableNodes.size(); semPm.setStartsWithParametersTemplate("B", paramTemplate); semPm.setStartsWithParametersTemplate("C", paramTemplate); semPm.setStartsWithParametersTemplate("D", paramTemplate); // empirically should give us a stddev of 1 - 2 semPm.setStartsWithParametersTemplate("s", "U(1,2)"); //if we don't use NB error, we could do this instead //String templateDisc = "DiscError(err, (TSUM(NEW(B)*$)), (TSUM(NEW(B)*$)), (TSUM(NEW(B)*$)))"; // String templateDisc0 = "DiscError(err, 1,1,1)"; String templateDisc0 = "DiscError(err, "; for (Node node : variableNodes) { List<Node> parents = trueGraph.getParents(node); //System.out.println("nParents: " + parents.size() ); Node eNode = semPm.getErrorNode(node); //normal and nb work like normal sems String curEx = semPm.getNodeExpressionString(node); String errEx = semPm.getNodeExpressionString(eNode); String newTemp = ""; //System.out.println("Node: " + node + "Type: " + nodeDists.get(node)); //dist of 0 means Gaussian int curDist = nodeDists.get(node.getName()); if(curDist == 1) throw new IllegalArgumentException("Dist for node " + node.getName() + " is set to one (i.e. constant) which is not supported."); //for each discrete node use DiscError for categorical draw if(curDist>0){ if(parents.size() == 0){ newTemp = "DiscError(err"; for(int l = 0; l < curDist; l++){ newTemp += ",1"; } newTemp += ")"; // newTemp = templateDisc0; } else { newTemp = "DiscError(err"; for(int l = 0; l < curDist; l++){ newTemp += ", TSUM(NEW(C)*$)"; } newTemp += ")"; } newTemp = newTemp.replaceAll("err", eNode.getName()); curEx = TemplateExpander.getInstance().expandTemplate(newTemp, semPm, node); //System.out.println("Disc CurEx: " + curEx); errEx = TemplateExpander.getInstance().expandTemplate("U(0,1)", semPm, eNode); } //now for every discrete parent, swap for discrete params newTemp = curEx; if(parents.size() != 0) { for (Node parNode : parents){ int parDist = nodeDists.get(parNode.getName()); if(parDist>0){ //String curName = trueGraph.getParents(node).get(0).toString(); String curName = parNode.getName(); String disRep = "Switch(" + curName; for(int l = 0; l < parDist; l++){ if(curDist>0) { disRep += ",NEW(D)"; } else { disRep += ",NEW(C)"; } } disRep += ")"; //replaces BX * curName with new discrete expression if(curDist > 0){ newTemp = newTemp.replaceAll("(C[0-9]*\\*" + curName + ")(?![0-9])", disRep); } else { newTemp = newTemp.replaceAll("(B[0-9]*\\*" + curName + ")(?![0-9])", disRep); } } } } if(newTemp.length()!=0){ //System.out.println(newTemp); curEx = TemplateExpander.getInstance().expandTemplate(newTemp, semPm, node); } semPm.setNodeExpression(node, curEx); semPm.setNodeExpression(eNode, errEx); } } catch (ParseException e) { throw new IllegalStateException("Parse error in fixing parameters.", e); } return semPm; } /** * Set all existing parameters that begins with sta to template and also set template for any new parameters * * @param sta * @param template * @param pm * @return */ public static void setStartsWith(String sta, String template, GeneralizedSemPm pm){ try { pm.setStartsWithParametersTemplate(sta, template); for (String param : pm.getParameters()) { if (param.startsWith(sta)) { pm.setParameterExpression(param, template); } } } catch(Throwable t){ t.printStackTrace(); } return; } //legacy public static GeneralizedSemIm GaussianCategoricalIm(GeneralizedSemPm pm){ return GaussianCategoricalIm(pm, true); } /** * This method is needed to normalize edge parameters for an Instantiated Mixed Model * Generates edge parameters for c-d and d-d edges from a single weight, abs(w), drawn by the normal IM constructor. * Abs(w) is used for d-d edges. * * For deterministic, c-d are evenly spaced between -w and w, and d-d are a matrix with w on the diagonal and * -w/(categories-1) in the rest. * For random, c-d params are uniformly drawn from 0 to 1 then transformed to have w as max value and sum to 0. * * @param pm * @param discParamRand true for random edge generation behavior, false for deterministic * @return */ public static GeneralizedSemIm GaussianCategoricalIm(GeneralizedSemPm pm, boolean discParamRand){ Map<String, Integer> nodeDists = getNodeDists(pm.getGraph()); GeneralizedSemIm im = new GeneralizedSemIm(pm); //System.out.println(im); List<Node> nodes = pm.getVariableNodes(); //this needs to be changed for cyclic graphs... for(Node n: nodes){ Set<Node> parNodes = pm.getReferencedNodes(n); if(parNodes.size()==0){ continue; } for(Node par: parNodes){ if(par.getNodeType()==NodeType.ERROR){ continue; } int cL = nodeDists.get(n.getName()); int pL = nodeDists.get(par.getName()); // c-c edges don't need params changed if(cL==0 && pL==0){ continue; } List<String> params = getEdgeParams(n, par, pm); // just use the first parameter as the "weight" for the whole edge double w = im.getParameterValue(params.get(0)); // double[] newWeights; // d-d edges use one vector and permute edges, could use different strategy if(cL > 0 && pL > 0) { double[][] newWeights = new double[cL][pL]; //List<Integer> indices = new ArrayList<Integer>(pL); //PermutationGenerator pg = new PermutationGenerator(pL); //int[] permInd = pg.next(); w = Math.abs(w); double bgW = w/((double) pL - 1.0); double[] weightVals; /*if(discParamRand) weightVals = generateMixedEdgeParams(w, pL); else weightVals = evenSplitVector(w, pL); */ int [] weightInds = new int[cL]; for(int i = 0; i < cL; i++){ if(i < pL) weightInds[i] = i; else weightInds[i] = i % pL; } if(discParamRand) weightInds = arrayPermute(weightInds); for(int i = 0; i < cL; i++){ for(int j = 0; j < pL; j++){ int index = i*pL + j; if(weightInds[i]==j) im.setParameterValue(params.get(index), w); else im.setParameterValue(params.get(index), -bgW); } } //params for c-d edges } else { double[] newWeights; int curL = (pL > 0 ? pL: cL); if(discParamRand) newWeights = generateMixedEdgeParams(w, curL); else newWeights = evenSplitVector(w, curL); int count = 0; for(String p : params){ im.setParameterValue(p, newWeights[count]); count++; } } } //pm. //if(p.startsWith("B")){ // continue; //} else if(p.startsWith()) } return im; } //Given two node names and a parameterized model return list of parameters corresponding to edge between them public static List<String> getEdgeParams(String s1, String s2, GeneralizedSemPm pm){ Node n1 = pm.getNode(s1); Node n2 = pm.getNode(s2); return getEdgeParams(n1, n2, pm); } //randomly permute an array of doubles public static double[] arrayPermute(double[] a){ double[] out = new double[a.length]; List<Double> l = new ArrayList<>(a.length); for(int i =0; i < a.length; i++){ l.add(i, a[i]); } Collections.shuffle(l); for(int i =0; i < a.length; i++){ out[i] = l.get(i); } return out; } //randomly permute array of ints public static int[] arrayPermute(int[] a){ int[] out = new int[a.length]; List<Integer> l = new ArrayList<>(a.length); for(int i =0; i < a.length; i++){ l.add(i, a[i]); } Collections.shuffle(l); for(int i =0; i < a.length; i++){ out[i] = l.get(i); } return out; } //generates a vector of length L that starts with -w and increases with consistent steps to w public static double[] evenSplitVector(double w, int L){ double[] vec = new double[L]; double step = 2.0*w/(L-1.0); for(int i = 0; i < L; i++){ vec[i] = -w + i*step; } return vec; } //Given two nodes and a parameterized model return list of parameters corresponding to edge between them public static List<String> getEdgeParams(Node n1, Node n2, GeneralizedSemPm pm){ //there may be a better way to do this using recursive calls of Expression.getExpressions Set<String> allParams = pm.getParameters(); Node child; Node parent; if(pm.getReferencedNodes(n1).contains(n2)){ child = n1; parent = n2; } else if (pm.getReferencedNodes(n2).contains(n1)){ child = n2; parent = n1; } else { return null; } java.util.regex.Pattern parPat; if(parent instanceof DiscreteVariable){ parPat = java.util.regex.Pattern.compile("Switch\\(" + parent.getName() + ",.*?\\)"); } else { parPat = java.util.regex.Pattern.compile("([BC][0-9]*\\*" + parent.getName() + ")(?![0-9])"); } ArrayList<String> paramList = new ArrayList<>(); String ex = pm.getNodeExpressionString(child); java.util.regex.Matcher mat = parPat.matcher(ex); while(mat.find()){ String curGroup = mat.group(); if(parent instanceof DiscreteVariable){ curGroup = curGroup.substring(("Switch(" + parent.getName()).length()+1, curGroup.length()-1); String[] pars = curGroup.split(","); for(String p : pars){ //if(!allParams.contains(p)) // throw exception; paramList.add(p); } } else{ String p = curGroup.split("\\*")[0]; paramList.add(p); } } //ex. //if(child instanceof DiscreteVariable){ // if(parent instanceof DiscreteVariable) //} /*Expression exp = pm.getNodeExpression(child); List<Expression> test = exp.getExpressions(); for(Expression t : test){ List<Expression> test2 = t.getExpressions(); for(Expression t2: test2) { System.out.println(t2.toString()); } }*/ return paramList; } //generates a vector of length L with maximum value w that sums to 0 public static double[] generateMixedEdgeParams(double w, int L){ double[] vec = new double[L]; RandomUtil ru = RandomUtil.getInstance(); for(int i=0; i < L; i++){ vec[i] = ru.nextUniform(0, 1); } double vMean = StatUtils.mean(vec); double vMax = 0; for(int i=0; i < L; i++){ vec[i] = vec[i] - vMean; if(Math.abs(vec[i])> Math.abs(vMax)) vMax = vec[i]; } double scale = w/vMax; //maintain sign of w; if(vMax<0) scale *=-1; for(int i=0; i < L; i++){ vec[i] *= scale; } return vec; } //labels corresponding to values from allEdgeStats public static final String EdgeStatHeader = "TD\tTU\tFL\tFD\tFU\tFPD\tFPU\tFND\tFNU\tBidir"; //assumes Graphs have properly assigned variable types public static int[][] allEdgeStats(Graph pT, Graph pE){ HashMap<String, String> nd = new HashMap<>(); //Estimated graph more likely to have correct node types... for(Node n : pE.getNodes()){ if(n instanceof DiscreteVariable){ nd.put(n.getName(), "Disc"); } else { nd.put(n.getName(), "Norm"); } } return allEdgeStats(pT, pE, nd); } // break out stats by node distributions, here only "Norm" and "Disc" // so three types of possible edges, cc, cd, dd, output is edge type by stat type // counts bidirected public static int[][] allEdgeStats(Graph pT, Graph pE, HashMap<String, String> nodeDists) { int[][] stats = new int[3][10]; for(int i=0; i<stats.length; i++){ for(int j=0; j<stats[0].length; j++){ stats[i][j] = 0; } } //enforce patterns? //Graph pT = SearchGraphUtils.patternFromDag(tg); //Graph pE = SearchGraphUtils.patternFromDag(eg); //check that variable names are the same... Set<Edge> edgesT = pT.getEdges(); Set<Edge> edgesE = pE.getEdges(); //differences += Math.abs(e1.size() - e2.size()); //for (int i = 0; i < e1.size(); i++) { int edgeType; for(Edge eT: edgesT){ Node n1 = pE.getNode(eT.getNode1().getName()); Node n2 = pE.getNode(eT.getNode2().getName()); if(nodeDists.get(n1.getName()).equals("Norm") && nodeDists.get(n2.getName()).equals("Norm")) { edgeType = 0; } else if(nodeDists.get(n1.getName()).equals("Disc") && nodeDists.get(n2.getName()).equals("Disc")) { edgeType = 2; } else { edgeType = 1; } Edge eE = pE.getEdge(n1, n2); if (eE == null) { if (eT.isDirected()) { stats[edgeType][7]++; //False Negative Directed -- FND } else { stats[edgeType][8]++; //False Negative Undirected -- FNU } } else if (eE.isDirected()){ if (eT.isDirected() && eT.pointsTowards(eT.getNode1()) == eE.pointsTowards(n1)){ stats[edgeType][0]++; //True Directed -- TD } else if (eT.isDirected()){ stats[edgeType][2]++; //FLip } else { stats[edgeType][3]++; //Falsely Directed -- FD } } else { //so eE is undirected if(eT.isDirected()) { stats[edgeType][4]++; //Falsely Undirected -- FU } else { stats[edgeType][1]++; //True Undirected -- TU } } } for(Edge eE: edgesE){ Node n1 = pT.getNode(eE.getNode1().getName()); Node n2 = pT.getNode(eE.getNode2().getName()); if(nodeDists.get(n1.getName()).equals("Norm") && nodeDists.get(n2.getName()).equals("Norm")) { edgeType = 0; } else if(nodeDists.get(n1.getName()).equals("Disc") && nodeDists.get(n2.getName()).equals("Disc")) { edgeType = 2; } else { edgeType = 1; } if(eE.getEndpoint1()== Endpoint.ARROW && eE.getEndpoint2()==Endpoint.ARROW) stats[edgeType][9]++; //bidirected Edge eT = pT.getEdge(n1, n2); if(eT == null) { if(eE.isDirected()){ stats[edgeType][5]++; //False Positive Directed -- FPD } else { stats[edgeType][6]++; //False Positive Undirected -- FUD } } } return stats; } //Utils public static Graph makeMixedGraph(Graph g, Map<String, Integer> m){ List<Node> nodes = g.getNodes(); for(int i = 0; i < nodes.size(); i++){ Node n = nodes.get(i); int nL = m.get(n.getName()); if(nL > 0){ Node nNew = new DiscreteVariable(n.getName(), nL); nodes.set(i, nNew); } } Graph outG = new EdgeListGraph(nodes); for(Edge e: g.getEdges()){ Node n1 = e.getNode1(); Node n2 = e.getNode2(); Edge eNew = new Edge(outG.getNode(n1.getName()), outG.getNode(n2.getName()), e.getEndpoint1(), e.getEndpoint2()); outG.addEdge(eNew); } return outG; } public static String stringFrom2dArray(int[][] arr){ String outStr = ""; for(int i = 0; i < arr.length; i++){ for(int j = 0; j < arr[i].length; j++){ outStr += Integer.toString(arr[i][j]); if(j != arr[i].length-1) outStr += "\t"; } outStr+="\n"; } return outStr; } public static DataSet loadDataSet(String dir, String filename) throws IOException { File file = new File(dir, filename); DataReader reader = new DataReader(); reader.setVariablesSupplied(true); return reader.parseTabular(file); } public static DataSet loadDelim(String dir, String filename) throws IOException { File file = new File(dir, filename); DataReader reader = new DataReader(); reader.setVariablesSupplied(false); return reader.parseTabular(file); } //Gives a map of number of categories of DiscreteVariables in g. ContinuousVariables are mapped to 0 public static Map<String, Integer> getNodeDists(Graph g){ HashMap<String, Integer> map = new HashMap<>(); List<Node> nodes = g.getNodes(); for(Node n: nodes){ if(n instanceof DiscreteVariable) map.put(n.getName(), ((DiscreteVariable) n).getNumCategories()); else map.put(n.getName(), 0); } return map; } public static DataSet loadData(String dir, String filename) throws IOException { File file = new File(dir, filename); DataReader reader = new DataReader(); reader.setVariablesSupplied(true); return reader.parseTabular(file); } /** * Check each pair of variables to see if correlation is 1. WARNING: calculates correlation matrix, memory heavy * when there are lots of variables * * @param ds * @param verbose * @return */ public static boolean isColinear(DataSet ds, boolean verbose) { List<Node> nodes = ds.getVariables(); boolean isco = false; CorrelationMatrix cor = new CorrelationMatrix(makeContinuousData(ds)); for(int i = 0; i < nodes.size(); i++){ for(int j = i+1; j < nodes.size(); j++){ if(cor.getValue(i,j) == 1){ if(verbose){ isco = true; System.out.println("Colinearity found between: " + nodes.get(i).getName() + " and " + nodes.get(j).getName()); } else { return true; } } } } return isco; } public static DoubleMatrix2D graphToMatrix(Graph graph, double undirectedWeight, double directedWeight) { // initialize matrix int n = graph.getNumNodes(); DoubleMatrix2D matrix = DoubleFactory2D.dense.make(n, n, 0.0); // map node names in order of appearance HashMap<Node, Integer> map = new HashMap<>(); int i = 0; for (Node node : graph.getNodes()) { map.put(node, i); i++; } // mark edges for (Edge edge : graph.getEdges()) { // if directed find which is parent/child Node node1 = edge.getNode1(); Node node2 = edge.getNode2(); //treat bidirected as undirected... if (!edge.isDirected() || (edge.getEndpoint1()== Endpoint.ARROW && edge.getEndpoint2()==Endpoint.ARROW)) { matrix.set(map.get(node1), map.get(node2), undirectedWeight); matrix.set(map.get(node2), map.get(node1), undirectedWeight); } else { if (edge.pointsTowards(node1)) { matrix.set(map.get(node2), map.get(node1), directedWeight); } else { //if (edge.pointsTowards(node2)) { matrix.set(map.get(node1), map.get(node2), directedWeight); } } } return matrix; } //returns undirected skeleton matrix (symmetric public static DoubleMatrix2D skeletonToMatrix(Graph graph) { // initialize matrix int n = graph.getNumNodes(); DoubleMatrix2D matrix = DoubleFactory2D.dense.make(n, n, 0.0); // map node names in order of appearance HashMap<Node, Integer> map = new HashMap<>(); int i = 0; for (Node node : graph.getNodes()) { map.put(node, i); i++; } // mark edges for (Edge edge : graph.getEdges()) { // if directed find which is parent/child Node node1 = edge.getNode1(); Node node2 = edge.getNode2(); matrix.set(map.get(node1), map.get(node2), 1.0); matrix.set(map.get(node2), map.get(node1), 1.0); } return matrix; } public static DoubleMatrix2D graphToMatrix(Graph graph){ return graphToMatrix(graph, 1, 1); } /** * Returns independence tests by name located in edu.cmu.tetrad.search and edu.pitt.csb.mgm * also supports shorthand for LRT ("lrt) and t-tests ("tlin" for prefer linear (fastest) or "tlog" for prefer logistic) * @param name * @return */ public static IndependenceTest IndTestFromString(String name, DataSet data, double alpha) { IndependenceTest test = null; if (name.equals("tlin")) { test = new edu.pitt.csb.mgm.IndTestMixedMultipleTTest(data, alpha); ((edu.pitt.csb.mgm.IndTestMixedMultipleTTest)test).setPreferLinear(true); //test = new IndTestMultinomialLogisticRegressionWald(data, alpha, true); } else if (name.equals("tlog")){ test = new edu.pitt.csb.mgm.IndTestMixedMultipleTTest(data, alpha); ((edu.pitt.csb.mgm.IndTestMixedMultipleTTest)test).setPreferLinear(false); //test = new IndTestMultinomialLogisticRegressionWald(data, alpha, false); } else { // This should allow the user to call any independence test found in tetrad.search or mgm Class cl = null; try { cl = Class.forName("edu.cmu.tetrad.search." + name); } catch (ClassNotFoundException e) { System.out.println("Not found: " + "edu.cmu.tetrad.search." + name); } catch (Exception e) { e.printStackTrace(); } if(cl==null) { try { cl = Class.forName("edu.pitt.csb.mgm." + name); } catch (ClassNotFoundException e) { throw new IllegalArgumentException("-test argument not recognized"); } catch (Exception e) { e.printStackTrace(); } } try { Constructor con = cl.getConstructor(DataSet.class, double.class); test = (IndependenceTest) con.newInstance(data, alpha); } catch (NoSuchMethodException e) { System.err.println("Independence Test: " + name + " not found"); } catch (Exception e) { System.err.println("Independence Test: " + name + " found but not constructed"); e.printStackTrace(); } } return test; } //main for testing public static void main(String[] args){ //Graph g = GraphConverter.convert("X1-->X2,X2-->X3,X3-->X4"); Graph g = GraphConverter.convert("X1-->X2,X2-->X3,X3-->X4, X5-->X4"); //simple graph pm im gen example HashMap<String, Integer> nd = new HashMap<>(); nd.put("X1", 0); nd.put("X2", 0); nd.put("X3", 4); nd.put("X4", 4); nd.put("X5", 0); g = makeMixedGraph(g, nd); /*Graph g = new EdgeListGraph(); g.addNode(new ContinuousVariable("X1")); g.addNode(new ContinuousVariable("X2")); g.addNode(new DiscreteVariable("X3", 4)); g.addNode(new DiscreteVariable("X4", 4)); g.addNode(new ContinuousVariable("X5")); g.addDirectedEdge(g.getNode("X1"), g.getNode("X2")); g.addDirectedEdge(g.getNode("X2"), g.getNode("X3")); g.addDirectedEdge(g.getNode("X3"), g.getNode("X4")); g.addDirectedEdge(g.getNode("X4"), g.getNode("X5")); */ GeneralizedSemPm pm = GaussianCategoricalPm(g, "Split(-1.5,-1,1,1.5)"); System.out.println(pm); System.out.println("STARTS WITH"); System.out.println(pm.getStartsWithParameterTemplate("C")); try{ MixedUtils.setStartsWith("C", "Split(-.9,-.5,.5,.9)", pm); } catch (Throwable t) {t.printStackTrace();} System.out.println("STARTS WITH"); System.out.println(pm.getStartsWithParameterTemplate("C")); System.out.println(pm); GeneralizedSemIm im = GaussianCategoricalIm(pm); System.out.println(im); int samps = 15; DataSet ds = im.simulateDataFisher(samps); System.out.println(ds); System.out.println("num cats " + ((DiscreteVariable) g.getNode("X4")).getNumCategories()); /*Graph trueGraph = DataGraphUtils.loadGraphTxt(new File(MixedUtils.class.getResource("test_data").getPath(), "DAG_0_graph.txt")); HashMap<String, Integer> nd = new HashMap<>(); List<Node> nodes = trueGraph.getNodes(); for(int i = 0; i < nodes.size(); i++){ int coin = RandomUtil.getInstance().nextInt(2); int dist = (coin==0) ? 0 : 3; //continuous if coin == 0 nd.put(nodes.get(i).getNode(), dist); } //System.out.println(getEdgeParams(g.getNode("X3"), g.getNode("X2"), pm).toString()); //System.out.println(getEdgeParams(g.getNode("X4"), g.getNode("X3"), pm).toString()); //System.out.println(getEdgeParams(g.getNode("X5"), g.getNode("X4"), pm).toString()); //System.out.println("num cats " + ((DiscreteVariable) g.getNode("X4")).getNumCategories()); /* HashMap<String, String> nd2 = new HashMap<>(); nd2.put("X1", "Norm"); nd2.put("X2", "Norm"); nd2.put("X3", "Disc"); nd2.put("X4", "Disc"); nd2.put("X5", "Disc"); GeneralizedSemPm pm2 = GaussianTrinaryPm(g, nd2, 10, "Split(-1.5,-.5,.5,1.5)"); System.out.println("OLD pm:"); System.out.print(pm2); */ } }
[ "chirayu.kong@gmail.com" ]
chirayu.kong@gmail.com
3605b2745f5af984e59b398bc6d236ac0074c02b
16afd1e7dd6995588b169422e4e023429e296d5c
/src/main/java/com/qa/occupancy/pages/SmsPage.java
e0b8ab6831188525a2460cc960b46eb4b0238c9f
[]
no_license
varshitha-automation/occupancy
d908adbc1e4fd51451f093f9cbf48250c6fdc98f
7de333b04e7117ad476aa48ea1df1c57ff470781
refs/heads/master
2023-04-14T06:20:35.390095
2021-05-02T19:36:47
2021-05-02T19:36:47
358,345,624
0
0
null
2021-05-02T19:38:02
2021-04-15T17:48:20
Java
UTF-8
Java
false
false
5,730
java
package com.qa.occupancy.pages; import java.util.List; import org.openqa.selenium.By; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.StaleElementReferenceException; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; import org.openqa.selenium.support.PageFactory; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; import com.qa.occupancy.base.TestBase; public class SmsPage extends TestBase { public SmsPage() { PageFactory.initElements(driver,this); } @FindBy(id="sales-by-traffic-tab") WebElement smsTab; @FindBy(xpath="//strong[text()='SMS URL']") WebElement url; @FindBy(id="smsUrl") WebElement smsUrl; //Sms Url details saved. @FindBy(xpath="//div[@style='color:red']") WebElement colorRed; @FindBy(id="btnAddSmsUrl") WebElement addSmsUrl; @FindBy(id="btnUpdateGroup") WebElement updateBtn; @FindBy(xpath="//div[@class='ui-pnotify-text']") WebElement entryInfo; @FindBy(id="lblSMS") WebElement smsGrp; @FindBy(id="gName") WebElement grpName; @FindBy(id="gcName") WebElement contactName; @FindBy(id="gcNum") WebElement contactNum; @FindBy(id="btnAddContact") WebElement contactBtn; @FindBy(id="contactOList") WebElement contactList; @FindBy(xpath="//span[text()='Select Threshold(s)']") WebElement selTh; @FindBy(xpath="//span[text()='Select Zone(s)']") WebElement selZones; @FindBy(id="btnAddGroup") WebElement addGrp; @FindBy(xpath="//strong[text()='Group Details']") WebElement grpDetail; @FindBy(id="btnYes") WebElement yes; private void waitForElement(WebDriver driver,WebElement ele,int timeout) { new WebDriverWait(driver,timeout).ignoring(StaleElementReferenceException.class) .until(ExpectedConditions.elementToBeClickable(ele)); } public void editContactDetails(String contact) { driver.findElement(By.xpath("//a[contains(text(),'"+contact+"')]/following-sibling::a[2]")).click(); } public void deleteContactDetails(String contact) { driver.findElement(By.xpath("//a[contains(text(),'"+contact+"')]/following-sibling::a[1]")).click(); } public boolean checkEditGrpDetails(String name) { boolean text=driver.findElements(By.xpath("//td[text()='"+name+"']")).size()>0; if(text==true) { return true; } return false; } public void editGrpDetails(String name) { WebElement e = driver.findElement(By.xpath("//td[text()='"+name+"']/following-sibling::td/a/i[@class='mdi mdi-lead-pencil']")); /*new WebDriverWait(driver,12) .until(ExpectedConditions.elementToBeClickable(e));*/ waitForElement(driver,e,50); e.click(); } public void deleteGrpDetails(String delName) { driver.findElement(By.xpath("//td[text()='"+delName+"']/following-sibling::td/a/i[@class='mdi mdi-delete']")).click(); } public void clickTh() { JavascriptExecutor js = (JavascriptExecutor)driver; js.executeScript("window.scrollBy(0,1500)"); WebElement e = driver.findElement(By.xpath("//label[text()='Thresholds']/following-sibling::div")); waitForElement(driver,e,50); e.click(); } public void clickZone() { //WebElement r=driver.findElement(By.xpath("//label[text()='Zones']/following-sibling::div//div/button")); // title = ""; String t=driver.findElement(By.xpath("//label[text()='Zones']/following-sibling::div//div/button")).getAttribute("title"); if(t.contains("Select Zone(s)")) { WebElement r = driver.findElement(By.xpath("//label[text()='Zones']/following-sibling::div//div/button")); waitForElement(driver,r,50); JavascriptExecutor exe = (JavascriptExecutor)driver; exe.executeScript("arguments[0].click()", r); } else { WebElement r =driver.findElement(By.xpath("//label[text()='Zones']/following-sibling::div//div/button")); waitForElement(driver,r,50); JavascriptExecutor exe = (JavascriptExecutor)driver; exe.executeScript("arguments[0].click()", r); } } public void smsClick() { smsTab.click(); } public void urlClick() { url.click(); } public void smsUrl() { smsUrl.clear(); smsUrl.sendKeys(prop.getProperty("SmsUrl")); } public String addSms() { addSmsUrl.click(); String text=entryInfo.getText(); return text; } public boolean addGrp(String gName, String cName, String cNum) { smsGrp.click(); //waitForElement(grpName,10); grpName.sendKeys(gName); contactName.sendKeys(cName); contactNum.sendKeys(cNum); contactBtn.click(); if(driver.findElements(By.xpath("//div[@class='ui-pnotify-text']")).isEmpty()) { return true; } return false; } public void editContact(String gName, String cName, String cNum) { grpName.clear(); grpName.sendKeys(gName); contactName.clear(); contactName.sendKeys(cName); contactNum.clear(); contactNum.sendKeys(cNum); contactBtn.click(); } public void thAdd() { JavascriptExecutor js = (JavascriptExecutor)driver; js.executeScript("window.scrollBy(0,1500)"); selTh.click(); } public void zoneAdd() { JavascriptExecutor exe = (JavascriptExecutor)driver; exe.executeScript("arguments[0].click()", selZones); } public String save() { JavascriptExecutor exe = (JavascriptExecutor)driver; exe.executeScript("arguments[0].click()", addGrp); String text=entryInfo.getText(); return text; } public void grpDetail() { grpDetail.click(); } public String update() { waitForElement(driver,updateBtn,50); JavascriptExecutor exe = (JavascriptExecutor)driver; exe.executeScript("arguments[0].click()", updateBtn); String text=entryInfo.getText(); return text; } public void delYes() { yes.click(); } }
[ "https://github.com/varshitha-automation" ]
https://github.com/varshitha-automation
ab70f9106f2ecabd77320a74a2fb95afb2ecb2b0
9e2b71362495b0f3da7e367e267e75f73cc79076
/javatpoint/src/java8/functionalinterface/ToLongFunctionInterfaceExample.java
69164321826a2492f84a8528a31006426f98f9ab
[]
no_license
danntu/Java-Shild-
0e16556c14f73968ae36cbffd8644ec0bf1a7e25
e4fe18542d8f742a857a2410243768049d7b1956
refs/heads/master
2020-07-10T23:59:59.936554
2019-07-24T07:57:42
2019-07-24T07:57:42
74,007,779
3
0
null
2017-11-13T05:00:29
2016-11-17T08:46:32
Java
UTF-8
Java
false
false
321
java
package java8.functionalinterface; import java.util.function.ToLongFunction; public class ToLongFunctionInterfaceExample { public static void main(String[] args) { ToLongFunction<String> toLongFunction = value -> Long.parseLong(value); System.out.println(toLongFunction.applyAsLong("123")); } }
[ "Daniyar.Myrzakanov@kcell.kz" ]
Daniyar.Myrzakanov@kcell.kz
57e4464ea8476692a6dd34c4cd9e7de74e0cfd69
6889f8f30f36928a2cd8ba880032c855ac1cc66c
/SemplestServiceMSNv8r3/src/com/microsoft/adcenter/api/notifications/Entities/ExpiredCreditCardNotification.java
def26fbaca95cb293de3ff8c200fb7cb906495c9
[]
no_license
enterstudio/semplest2
77ceb4fe6d076f8c161d24b510048802cd029b67
44eeade468a78ef647c62deb4cec2bea4318b455
refs/heads/master
2022-12-28T18:35:54.723459
2012-11-20T15:39:09
2012-11-20T15:39:09
86,645,696
0
0
null
2020-10-14T08:14:22
2017-03-30T01:32:35
Roff
UTF-8
Java
false
false
7,204
java
/** * ExpiredCreditCardNotification.java * * This file was auto-generated from WSDL * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter. */ package com.microsoft.adcenter.api.notifications.Entities; public class ExpiredCreditCardNotification extends com.microsoft.adcenter.api.notifications.Entities.AccountNotification implements java.io.Serializable { private java.lang.String cardType; private java.lang.String lastFourDigits; private java.lang.String accountName; public ExpiredCreditCardNotification() { } public ExpiredCreditCardNotification( java.lang.Long notificationId, java.util.Calendar notificationDate, java.lang.String[] notificationType, java.lang.Long accountId, java.lang.String accountNumber, java.lang.String cardType, java.lang.String lastFourDigits, java.lang.String accountName) { super( notificationId, notificationDate, notificationType, accountId, accountNumber); this.cardType = cardType; this.lastFourDigits = lastFourDigits; this.accountName = accountName; } /** * Gets the cardType value for this ExpiredCreditCardNotification. * * @return cardType */ public java.lang.String getCardType() { return cardType; } /** * Sets the cardType value for this ExpiredCreditCardNotification. * * @param cardType */ public void setCardType(java.lang.String cardType) { this.cardType = cardType; } /** * Gets the lastFourDigits value for this ExpiredCreditCardNotification. * * @return lastFourDigits */ public java.lang.String getLastFourDigits() { return lastFourDigits; } /** * Sets the lastFourDigits value for this ExpiredCreditCardNotification. * * @param lastFourDigits */ public void setLastFourDigits(java.lang.String lastFourDigits) { this.lastFourDigits = lastFourDigits; } /** * Gets the accountName value for this ExpiredCreditCardNotification. * * @return accountName */ public java.lang.String getAccountName() { return accountName; } /** * Sets the accountName value for this ExpiredCreditCardNotification. * * @param accountName */ public void setAccountName(java.lang.String accountName) { this.accountName = accountName; } private java.lang.Object __equalsCalc = null; public synchronized boolean equals(java.lang.Object obj) { if (!(obj instanceof ExpiredCreditCardNotification)) return false; ExpiredCreditCardNotification other = (ExpiredCreditCardNotification) obj; if (obj == null) return false; if (this == obj) return true; if (__equalsCalc != null) { return (__equalsCalc == obj); } __equalsCalc = obj; boolean _equals; _equals = super.equals(obj) && ((this.cardType==null && other.getCardType()==null) || (this.cardType!=null && this.cardType.equals(other.getCardType()))) && ((this.lastFourDigits==null && other.getLastFourDigits()==null) || (this.lastFourDigits!=null && this.lastFourDigits.equals(other.getLastFourDigits()))) && ((this.accountName==null && other.getAccountName()==null) || (this.accountName!=null && this.accountName.equals(other.getAccountName()))); __equalsCalc = null; return _equals; } private boolean __hashCodeCalc = false; public synchronized int hashCode() { if (__hashCodeCalc) { return 0; } __hashCodeCalc = true; int _hashCode = super.hashCode(); if (getCardType() != null) { _hashCode += getCardType().hashCode(); } if (getLastFourDigits() != null) { _hashCode += getLastFourDigits().hashCode(); } if (getAccountName() != null) { _hashCode += getAccountName().hashCode(); } __hashCodeCalc = false; return _hashCode; } // Type metadata private static org.apache.axis.description.TypeDesc typeDesc = new org.apache.axis.description.TypeDesc(ExpiredCreditCardNotification.class, true); static { typeDesc.setXmlType(new javax.xml.namespace.QName("https://adcenter.microsoft.com/api/notifications/Entities", "ExpiredCreditCardNotification")); org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc(); elemField.setFieldName("cardType"); elemField.setXmlName(new javax.xml.namespace.QName("https://adcenter.microsoft.com/api/notifications/Entities", "CardType")); elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string")); elemField.setMinOccurs(0); elemField.setNillable(true); typeDesc.addFieldDesc(elemField); elemField = new org.apache.axis.description.ElementDesc(); elemField.setFieldName("lastFourDigits"); elemField.setXmlName(new javax.xml.namespace.QName("https://adcenter.microsoft.com/api/notifications/Entities", "LastFourDigits")); elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string")); elemField.setMinOccurs(0); elemField.setNillable(true); typeDesc.addFieldDesc(elemField); elemField = new org.apache.axis.description.ElementDesc(); elemField.setFieldName("accountName"); elemField.setXmlName(new javax.xml.namespace.QName("https://adcenter.microsoft.com/api/notifications/Entities", "AccountName")); elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string")); elemField.setMinOccurs(0); elemField.setNillable(true); typeDesc.addFieldDesc(elemField); } /** * Return type metadata object */ public static org.apache.axis.description.TypeDesc getTypeDesc() { return typeDesc; } /** * Get Custom Serializer */ public static org.apache.axis.encoding.Serializer getSerializer( java.lang.String mechType, java.lang.Class _javaType, javax.xml.namespace.QName _xmlType) { return new org.apache.axis.encoding.ser.BeanSerializer( _javaType, _xmlType, typeDesc); } /** * Get Custom Deserializer */ public static org.apache.axis.encoding.Deserializer getDeserializer( java.lang.String mechType, java.lang.Class _javaType, javax.xml.namespace.QName _xmlType) { return new org.apache.axis.encoding.ser.BeanDeserializer( _javaType, _xmlType, typeDesc); } }
[ "mitch@02200ff9-b5b2-46f0-9171-221b09c08c7b" ]
mitch@02200ff9-b5b2-46f0-9171-221b09c08c7b
e50ec4ea373458eff2738aa612654f1b993d87a0
d6ca11daaf6f932f7c34d1a59224d62522133777
/P2P_Chord_Client/src/p2p_client/fingerTable.java
75dcb3c393060bdb534736ac8acfe6103d052077
[]
no_license
djlafo/p2pclientserver
c5f6ebbaea68b215d6149dce912899c5b4d5a423
dac99fe935859b3ac1ad916a1de1381464a33a85
refs/heads/main
2023-02-08T09:14:05.918338
2020-12-23T16:42:52
2020-12-23T16:42:52
323,953,809
0
0
null
null
null
null
UTF-8
Java
false
false
3,374
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 p2p_client; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.net.Socket; /** * * @author Dylan */ public class fingerTable { fileHostServer.host[] table; int myId; int maxNodes; fileHostServer fhs; public fingerTable(int maxSize, int myId, fileHostServer.host successor, fileHostServer fhs) { table = new fileHostServer.host[log(maxSize, 2)]; table[0] = successor; this.myId = myId; this.maxNodes = maxSize; this.fhs = fhs; } public synchronized void refresh() { System.out.println("*******************"); System.out.println("Finger[0]:"+table[0].id); for(int i=1; i<table.length; i++) { table[i] = getNodeFor(i); System.out.println("Finger[" + i + "]:"+table[i].id); } System.out.println("*******************"); } int pow(int no, int exp) { int o = 1; for(int i=0; i<exp; i++) { o *= no; } return o; } public void setSuccessor(fileHostServer.host suc) { table[0] = suc; } public fileHostServer.host getSuccessor() { return table[0]; } private fileHostServer.host getNodeFor(int index) { fileHostServer.host lastHost = table[index-1]; try { String[] current = {table[index-1].ip, table[index-1].port + "", table[index-1].id + ""}; int targetID = (pow(2,index) + myId) % maxNodes; int currentID = (pow(2, index-1) + myId) % maxNodes; int originalID = currentID; while(inLoop(originalID, (pow(2,index)-pow(2,index-1)), currentID)) { lastHost = fhs.new host(current[0], Integer.parseInt(current[1]), Integer.parseInt(current[2])); Socket s = new Socket(lastHost.ip, lastHost.port); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(s.getOutputStream())); BufferedReader br = new BufferedReader(new InputStreamReader(s.getInputStream())); bw.write(fileHostServer.commands.successorQuery + ""); bw.newLine(); bw.flush(); current = br.readLine().split(":"); currentID = Integer.parseInt(current[2]); } } catch (Exception e) { System.out.println(e.getMessage()); } return lastHost; } private boolean inLoop(int a, int range, int no) { int current = a; for(int i=0; i<=range; i++) { if(current==no) return true; current = (current+1) % maxNodes; } return false; } public synchronized fileHostServer.host closestTo(int ID) { int index = 0; for(int i=0; i<table.length; i++) { if(table[i].id < ID) { index = i; } } return table[index]; } static int log(int x, int base) { return (int) (Math.log(x) / Math.log(base)); } }
[ "me@dylanlafont.com" ]
me@dylanlafont.com
45235e1460eb3ad37f90557629e6c97a495a125d
bf7b4c21300a8ccebb380e0e0a031982466ccd83
/middlewareConcepts2014-master/Assignment3/lib/jacorb-3.4/test/regression/src/test/java/org/jacorb/test/orb/etf/C_IIOP_S_WIOPTest.java
6becf34ab0ea84fbeab2cd5b227d2ce2f32995ed
[]
no_license
Puriakshat/Tuberlin
3fe36b970aabad30ed95e8a07c2f875e4912a3db
28dcf7f7edfe7320c740c306b1c0593a6c1b3115
refs/heads/master
2021-01-19T07:30:16.857479
2014-11-06T18:49:16
2014-11-06T18:49:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,454
java
package org.jacorb.test.orb.etf; /* * JacORB - a free Java ORB * * Copyright (C) 1997-2012 Gerald Brose / The JacORB Team. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the Free * Software Foundation, 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. */ import static org.junit.Assert.fail; import java.util.Properties; import org.jacorb.test.common.ClientServerSetup; import org.jacorb.test.common.TestUtils; import org.junit.Assume; import org.junit.BeforeClass; import org.junit.Test; /** * A test that uses IIOP on the client side and WIOP on the server side. * Hence, no connection will be possible. * * @author Andre Spiegel spiegel@gnu.org */ public class C_IIOP_S_WIOPTest extends AbstractWIOPTestCase { @BeforeClass public static void beforeClassSetUp() throws Exception { // WIOP does not support SSL. Assume.assumeFalse(TestUtils.isSSLEnabled); Properties clientProps = new Properties(); clientProps.setProperty ("jacorb.transport.factories", "org.jacorb.orb.iiop.IIOPFactories"); Properties serverProps = new Properties(); serverProps.setProperty("jacorb.transport.factories", "org.jacorb.test.orb.etf.wiop.WIOPFactories"); setup = new ClientServerSetup( "org.jacorb.test.orb.BasicServerImpl", clientProps, serverProps); } @Test public void testConnection() { try { server.ping(); fail ("should have been a COMM_FAILURE"); } catch (org.omg.CORBA.COMM_FAILURE ex) { // ok } catch (Exception ex) { fail ("expected COMM_FAILURE, got " + ex); } } }
[ "puri.akshat@gmail.com" ]
puri.akshat@gmail.com
d8d54171920f42a9c7699d5375724cac3f2faa3f
319ef7cfd444443b5e9d4991446ca384cb8abead
/vererbungsapi/src/ch/risdesign/vererbungsapi/schnittstellen/ITierable.java
eb403cafa64b38f067f5d4256a7d588c257ab084
[]
no_license
marcoris/javaprojects
7fed42df0cca50bd1844393704f82fdb05b4bf41
1d7d5410eefdd95d7d206f8db1ddbb01b6339710
refs/heads/master
2022-11-18T06:52:59.085372
2020-06-20T20:53:31
2020-06-20T20:53:31
266,812,075
0
0
null
null
null
null
UTF-8
Java
false
false
257
java
package ch.risdesign.vererbungsapi.schnittstellen; import ch.risdesign.vererbungsapi.ausnamen.MetzgerException; public interface ITierable { public abstract void lautGeben(); public abstract void tobeornottobe() throws MetzgerException; }
[ "info@risdesign.ch" ]
info@risdesign.ch
8a38498d8e1ebd9c4d60761e817ca8b1b414dedc
d5f09c7b0e954cd20dd613af600afd91b039c48a
/sources/okhttp3/internal/http/RequestLine.java
893c3403ee6424b5281ac542eae265c3b54e9db1
[]
no_license
t0HiiBwn/CoolapkRelease
af5e00c701bf82c4e90b1033f5c5f9dc8526f4b3
a6a2b03e32cde0e5163016e0078391271a8d33ab
refs/heads/main
2022-07-29T23:28:35.867734
2021-03-26T11:41:18
2021-03-26T11:41:18
345,290,891
5
2
null
null
null
null
UTF-8
Java
false
false
2,469
java
package okhttp3.internal.http; import java.net.Proxy; import kotlin.Metadata; import kotlin.jvm.internal.Intrinsics; import okhttp3.HttpUrl; import okhttp3.Request; @Metadata(bv = {1, 0, 3}, d1 = {"\u0000,\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\bÆ\u0002\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u0016\u0010\u0003\u001a\u00020\u00042\u0006\u0010\u0005\u001a\u00020\u00062\u0006\u0010\u0007\u001a\u00020\bJ\u0018\u0010\t\u001a\u00020\n2\u0006\u0010\u0005\u001a\u00020\u00062\u0006\u0010\u0007\u001a\u00020\bH\u0002J\u000e\u0010\u000b\u001a\u00020\u00042\u0006\u0010\f\u001a\u00020\r¨\u0006\u000e"}, d2 = {"Lokhttp3/internal/http/RequestLine;", "", "()V", "get", "", "request", "Lokhttp3/Request;", "proxyType", "Ljava/net/Proxy$Type;", "includeAuthorityInRequestLine", "", "requestPath", "url", "Lokhttp3/HttpUrl;", "okhttp"}, k = 1, mv = {1, 4, 0}) /* compiled from: RequestLine.kt */ public final class RequestLine { public static final RequestLine INSTANCE = new RequestLine(); private RequestLine() { } public final String get(Request request, Proxy.Type type) { Intrinsics.checkNotNullParameter(request, "request"); Intrinsics.checkNotNullParameter(type, "proxyType"); StringBuilder sb = new StringBuilder(); sb.append(request.method()); sb.append(' '); RequestLine requestLine = INSTANCE; if (requestLine.includeAuthorityInRequestLine(request, type)) { sb.append(request.url()); } else { sb.append(requestLine.requestPath(request.url())); } sb.append(" HTTP/1.1"); String sb2 = sb.toString(); Intrinsics.checkNotNullExpressionValue(sb2, "StringBuilder().apply(builderAction).toString()"); return sb2; } private final boolean includeAuthorityInRequestLine(Request request, Proxy.Type type) { return !request.isHttps() && type == Proxy.Type.HTTP; } public final String requestPath(HttpUrl httpUrl) { Intrinsics.checkNotNullParameter(httpUrl, "url"); String encodedPath = httpUrl.encodedPath(); String encodedQuery = httpUrl.encodedQuery(); if (encodedQuery == null) { return encodedPath; } return encodedPath + '?' + encodedQuery; } }
[ "test@gmail.com" ]
test@gmail.com
5c7d733d83047d0266262e93783ae1c4180c9095
caaf0497b67cca1c2262e0d19b7391a6bf9da2df
/app/src/main/java/com/ichsy/hrys/entity/webviewjs/Entity.java
6bc77ca7cb7af607f8574df0a69ef04f44ba64b5
[]
no_license
qhsy/amber-maotuan
776589e3c74d5a28950abc307b9635e312258aaf
ca9d4d8eab6ee98e8bb00281683dda05f8445e75
refs/heads/master
2020-03-10T06:01:21.467161
2017-10-13T06:25:04
2017-10-13T06:25:04
129,230,116
0
0
null
null
null
null
UTF-8
Java
false
false
1,577
java
package com.ichsy.hrys.entity.webviewjs; import java.io.Serializable; /** * 所有JS互调返回的实体 * * Package: com.ichsy.minsns.entity * * @author: 赵然 Date: 2015-2-11 * * Modifier: Modified Date: Modify: * * Copyright @ 2015 ICHSY * */ public class Entity implements Serializable { /** * 执行动作类型 */ private String type = ""; /** * 订单编号 */ private String orderId = ""; /** * 退款进度查询码 */ private String returnCode = ""; /** * 退款金额 */ private String orderMoney = ""; /** * 订单状态 */ private String orderStatus = ""; /** * 执行动作所需的数据 */ private ObjEntity obj; public String getType() { return type; } public void setType(String type) { this.type = type; } public ObjEntity getObj() { return obj; } public void setObj(ObjEntity obj) { this.obj = obj; } public String getReturnCode() { return returnCode == null ? "" : returnCode; } public void setReturnCode(String returnCode) { this.returnCode = returnCode; } public String getOrderMoney() { return orderMoney == null ? "" : orderMoney; } public void setOrderMoney(String orderMoney) { this.orderMoney = orderMoney; } public String getOrderStatus() { return orderStatus == null ? "" : orderStatus; } public void setOrderStatus(String orderStatus) { this.orderStatus = orderStatus; } public String getOrderId() { return orderId == null ? "" : orderId; } public void setOrderId(String orderId) { this.orderId = orderId; } }
[ "zhuzhou@ichsy.com" ]
zhuzhou@ichsy.com
1ef82297b6bf344f5ed0d11a4a4fb7372833ec40
a455a15d8d9bd3232325a01522ad5d9aa631fa5e
/src/main/java/room/management/controller/RoomController.java
0c1a0cfa4d53e814715df81f5edac233eeeaf2f6
[]
no_license
skumarmece/Confrence-Room-Booking-App
491eee8143e057b2719fb126d76dc0d5657f4205
9db3f7306123d3e45347a8c42a49948a6cf7f90a
refs/heads/master
2020-06-05T01:51:54.705766
2019-07-10T05:09:02
2019-07-10T05:09:02
192,271,764
0
0
null
null
null
null
UTF-8
Java
false
false
3,203
java
package room.management.controller; import java.util.HashSet; import java.util.List; import java.util.Set; import javax.websocket.server.PathParam; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestController; import room.management.bean.Facility; import room.management.bean.Room; import room.management.repository.CategoryRepository; import room.management.repository.FacilityRepository; import room.management.repository.RoomRepository; @RestController @RequestMapping(value = { "/api/v1/rooms" }) public class RoomController { Logger logger = LoggerFactory.getLogger(RoomController.class); @Autowired RoomRepository roomRepository; @Autowired CategoryRepository categoryRepository; @Autowired FacilityRepository facilityRepository; @PreAuthorize("hasAnyRole('ADMIN')") @ResponseBody @GetMapping(value = "") public ResponseEntity<List<Room>> getAllItems() { return new ResponseEntity<List<Room>>(roomRepository.findAll(), HttpStatus.OK); } @PreAuthorize("hasAnyRole('ADMIN')") @PostMapping(value = "", headers = "Accept=application/json") public ResponseEntity<Room> addRoom(@RequestBody Room room) { logger.error(room.toString()); room.setCategory(categoryRepository.findById(room.getCategory().getId()).get()); room = roomRepository.saveAndFlush(room); Set<Facility> facilities = new HashSet(); // for (Facility facility : room.getFacilities()) { // facilities.add(facilityRepository.findById(facility.getId()).get()); // } // room.setFacilities(facilities); logger.error(room.toString()); return new ResponseEntity<Room>(room, HttpStatus.OK); } @PreAuthorize("hasAnyRole('ADMIN')") @PutMapping(value = "/{id}", headers = "Accept=application/json") public ResponseEntity<Room> updateRoom(@RequestBody Room room, @PathParam(value = "id") long id) { Room dbVal = roomRepository.findById(id).get(); if (dbVal != null) { return new ResponseEntity<Room>(roomRepository.save(dbVal), HttpStatus.OK); } return new ResponseEntity<Room>(HttpStatus.BAD_REQUEST); } @PreAuthorize("hasAnyRole('ADMIN')") @DeleteMapping(value = "/{id}", headers = "Accept=application/json") public ResponseEntity deleteRoom(@PathParam(value = "id") long id) { Room dbVal = roomRepository.findById(id).get(); if (dbVal != null) { roomRepository.deleteById(id); return new ResponseEntity(HttpStatus.OK); } return new ResponseEntity(HttpStatus.BAD_REQUEST); } }
[ "saravanakumar@localhost" ]
saravanakumar@localhost
5eec87ac7145e4d465267c29f00b4c7c85bf6cc1
6b7b73b4b036e807e453f46f581c6fd1b840db7e
/src/samx/function/Procedure4.java
73c32c2378b414ee09abad6adfdb6e505f13d2d3
[]
no_license
xiwbo/jkop4android
5de2a4601bd6fb7eac8f6f6a76dc9bfdc9bc9435
f048d7b6150c778a54e30d2064f126477e078d4e
refs/heads/master
2020-03-25T03:43:16.021256
2017-01-11T13:30:19
2017-01-11T13:30:19
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,311
java
/* * This file is part of Jkop for Android * Copyright (c) 2016-2017 Job and Esther Technologies, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package samx.function; public interface Procedure4<T0, T1, T2, T3> { public void execute(T0 p0, T1 p1, T2 p2, T3 p3); }
[ "markku.kero@jobandesther.com" ]
markku.kero@jobandesther.com
b835cb0c0a483d129ba1983ba5a8d19dfc944e67
d6614bd2508fe3d071a5b71baa107868b3698d89
/app/src/main/java/com/firstappp/LoginModenUiActivity.java
5ed9de31785ba56e413fd343a05ee8ed742c5643
[]
no_license
Chandan03590/FirstApp
b9d704b298deae7a0ee6d7929c35e356d785547b
ddee3874192ef01a47493021f57e29a5836a4484
refs/heads/master
2023-08-26T04:50:22.891336
2021-10-29T07:22:49
2021-10-29T07:22:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,888
java
package com.firstappp; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.media.MediaPlayer; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.CheckBox; import android.widget.ProgressBar; import android.widget.Toast; public class LoginModenUiActivity extends AppCompatActivity { CheckBox rememberMe; Button loginButton; ProgressBar progressBar; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login_moden_ui); rememberMe = findViewById(R.id.remember_me); loginButton = findViewById(R.id.loginButton); progressBar = findViewById(R.id.progress_bar); loginButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (rememberMe.isChecked()) { progressBar.setVisibility(View.INVISIBLE); loginButton.setVisibility(View.VISIBLE); Intent intent = new Intent(LoginModenUiActivity.this, DashboardActivity.class); startActivity(intent); } else { progressBar.setVisibility(View.INVISIBLE); loginButton.setVisibility(View.VISIBLE); } } }); } @Override public void onBackPressed() { if (progressBar.isShown()) { progressBar.setVisibility(View.INVISIBLE); loginButton.setVisibility(View.VISIBLE); } super.onBackPressed(); } public void RegisterPage(View view) { Intent intent = new Intent(LoginModenUiActivity.this, RegistrationActivity.class); startActivity(intent); } }
[ "akc960857@gmail.com" ]
akc960857@gmail.com
9491bf80bb7c3110c0a108f84be801e22e020523
388a1d3322bf3ebec3ab3565cd1ae9b62d5ced51
/extensions/vertx-web/deployment/src/main/java/io/quarkus/vertx/web/deployment/BodyHandlerBuildItem.java
715dbafcde91bbbe898e399015a01c9cf04cf6ad
[ "Apache-2.0" ]
permissive
franck-romano/quarkus
991b4887574ab5eaa0ad7eb6250db8d79001f857
23f1105bce547247c15b0127a96980bef7a09bdd
refs/heads/master
2020-08-15T17:48:03.564894
2019-10-15T19:12:27
2019-10-15T19:12:27
215,382,749
2
0
Apache-2.0
2019-10-15T19:43:06
2019-10-15T19:43:05
null
UTF-8
Java
false
false
467
java
package io.quarkus.vertx.web.deployment; import io.quarkus.builder.item.SimpleBuildItem; import io.vertx.core.Handler; import io.vertx.ext.web.RoutingContext; public final class BodyHandlerBuildItem extends SimpleBuildItem { private final Handler<RoutingContext> handler; public BodyHandlerBuildItem(Handler<RoutingContext> handler) { this.handler = handler; } public Handler<RoutingContext> getHandler() { return handler; } }
[ "lburgazzoli@gmail.com" ]
lburgazzoli@gmail.com
b377819d41f0c9ae0e6e9b215c1671a53d0dbf44
d6edb9f215e6a3102b3a252b9f5fca12293cd637
/gescom/src/modele/CategorieInterface.java
dbc63d550dd7801c4ef5f561e796dd32db28ff5b
[]
no_license
arm2i/JAVA
1e269006990f4bbe884a865d0534feec8e4f01b2
dd7824942a8184cc018439abb347eb1e57aa751a
refs/heads/master
2020-06-03T23:38:57.355775
2019-07-01T07:28:38
2019-07-01T07:28:38
191,779,628
1
0
null
null
null
null
UTF-8
Java
false
false
545
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 modele; import java.util.List; /** * * @author Formation */ public interface CategorieInterface { public List<Categorie> getAllCategorie(); public Categorie getOneCategorie(int idCat); public void addCategorie(Categorie cat); public void deleteCategorie(Categorie cat); public void updateCategorie(Categorie cat); }
[ "abdel_radi@yahoo.fr" ]
abdel_radi@yahoo.fr
49ef36dd2ba7ddcf236d34357969ee9cc821fbc1
e4f25de38052f504f39cf12f27af3693d9fc1fb4
/app/src/main/java/com/zf/weisport/manager/util/PinyinComparator.java
80e940c85a949635c2f31147446480a177e24182
[]
no_license
githubBanana/iWeiDong
fc1d91f0436f7c5981bcd163112a6b3b840e10d3
bd7c1591be60587569f04ba84e8009dd69504b29
refs/heads/master
2020-07-31T00:15:06.348592
2016-09-28T10:04:34
2016-09-28T10:04:34
67,212,627
0
0
null
null
null
null
UTF-8
Java
false
false
536
java
package com.zf.weisport.manager.util; import com.zf.weisport.model.MyFollowListModel; import java.util.Comparator; public class PinyinComparator implements Comparator<MyFollowListModel> { public int compare(MyFollowListModel o1, MyFollowListModel o2) { if (o1.getSortLetters().equals("@") || o2.getSortLetters().equals("#")) { return -1; } else if (o1.getSortLetters().equals("#") || o2.getSortLetters().equals("@")) { return 1; } else { return o1.getSortLetters().compareTo(o2.getSortLetters()); } } }
[ "784843867@qq.com" ]
784843867@qq.com
21048114fa80b879554e12e63bd6a6afbc47466a
0ecc0d9fe2c525357bb023771d51913693022d7b
/src/java/com/tech/blog/servlets/logoutservlet.java
42bd7da74d9e4f2f1e07f3a85bc6d9b61a52fc09
[]
no_license
Jinal-Parmar/Blogger
277d75c53ad1cdd2d816232e0f6e00c56997c92c
ba4a182a474ec80bcb09b103c5c0976ad65a8358
refs/heads/main
2023-01-06T08:48:24.564672
2020-11-05T06:03:28
2020-11-05T06:03:28
310,201,863
0
0
null
null
null
null
UTF-8
Java
false
false
3,192
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.tech.blog.servlets; import com.tech.blog.entities.message; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; /** * * @author Admin */ public class logoutservlet 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 logoutservlet</title>"); out.println("</head>"); out.println("<body>"); HttpSession s=request.getSession(); s.removeAttribute("cuser"); message m=new message("Logout Successfully!","success","alert-success"); s.setAttribute("msg",m); response.sendRedirect("loginpage.jsp"); 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> }
[ "jinalparmar2382@gmail.com" ]
jinalparmar2382@gmail.com
c57557d964b7b0dc926a3b99f35ee98c6a443274
501414b330dd0994efff18d6ee4cf72b19ba6993
/f2/spw/ItemBomb.java
1b16145d9b5e300b026970a1a80ad48e9431ff09
[]
no_license
ningPatitta/spw
99e5f0f0b6cf768a45c9740a65c38fcf00cc14ba
9480605f1e5d9cc0edf0ae927e2ca449c0ede0c4
refs/heads/master
2021-01-17T12:00:42.603907
2015-05-01T21:00:27
2015-05-01T21:00:27
32,021,356
0
0
null
2015-03-11T14:14:36
2015-03-11T14:14:35
Java
UTF-8
Java
false
false
923
java
package f2.spw; import java.awt.AlphaComposite; import java.awt.Color; import java.awt.Graphics2D; import java.awt.Image; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; public class ItemBomb extends Sprite{ public static final int Y_TO_FADE = 400; public static final int Y_TO_DIE = 600; private String picItemBomb; private Image picture; private int step = 8; private boolean alive = true; public ItemBomb(int x, int y){ super(x, y, 25, 25); try{ picItemBomb = "f2/spw/img/bomb.gif"; picture = ImageIO.read(new File(picItemBomb)); }catch(IOException e){ e.printStackTrace(); } } @Override public void draw(Graphics2D g) { g.drawImage(picture,x,y,width,height,null); } public void proceed(){ y += step; if(y > Y_TO_DIE){ alive = false; } } public boolean isAlive(){ return alive; } public void notAlive(){ alive = false; } }
[ "ningz_2737@hotmail.com" ]
ningz_2737@hotmail.com
950ee4ddf445692185b4841e964a288e9cf0f610
73fd4fccac6b43e29c601f4026a422c629ed84aa
/library/src/main/java/com/veinhorn/scrollgalleryview/HackyViewPager.java
c60751eda7dfc1b5f618e3810402f7577b170674
[ "MIT" ]
permissive
Oziomajnr/ScrollGalleryView
0f39e18b48c74366e8a87cc6415ac4ae686ae92b
999f6a8c5749197f6a67762355cb67d3963810c0
refs/heads/master
2020-03-31T00:16:24.926681
2019-07-29T14:02:59
2019-07-29T14:02:59
151,733,325
1
0
MIT
2019-07-29T14:03:00
2018-10-05T14:30:56
Java
UTF-8
Java
false
false
1,570
java
package com.veinhorn.scrollgalleryview; import android.content.Context; import android.support.v4.view.ViewPager; import android.util.AttributeSet; import android.view.MotionEvent; /** * Found at http://stackoverflow.com/questions/7814017/is-it-possible-to-disable-scrolling-on-a-viewpager. * Convenient way to temporarily disable ViewPager navigation while interacting with ImageView. * * Julia Zudikova * * Hacky fix for http://code.google.com/p/android/issues/detail?id=18990 * There's not much I can do in my code for now, but we can mask the result by * just catching the problem and ignoring it. * * @author Chris Banes */ public class HackyViewPager extends ViewPager { private boolean isLocked; public HackyViewPager(Context context) { super(context); isLocked = false; } public HackyViewPager(Context context, AttributeSet attrs) { super(context, attrs); isLocked = false; } @Override public boolean onInterceptTouchEvent(MotionEvent ev) { if(!isLocked) { try { return super.onInterceptTouchEvent(ev); } catch (IllegalArgumentException e) { e.printStackTrace(); return false; } } return false; } @Override public boolean onTouchEvent(MotionEvent ev) { return !isLocked && super.onTouchEvent(ev); } public void setLocked(boolean isLocked) { this.isLocked = isLocked; } public boolean isLocked() { return isLocked; } }
[ "b.korogvich@gmail.com" ]
b.korogvich@gmail.com
09ddb9074e66ba798dfb793cd75c03c3504c0320
697cff41889e8d5e7aa66c41a6d4d76778687c81
/src/main/java/com/drink_api/drinkapi/home/Service/HomeService.java
82f80c6301fb2cfa27078b5b5c027430671df9ed
[]
no_license
bobo1123/drink-api
19158d179b9bb00e5ef569cbda4cf2f5948da640
38a44cf81804310cc4d1d35baf626a15fa009e6a
refs/heads/master
2023-06-28T01:03:58.744286
2021-08-01T16:05:32
2021-08-01T16:05:32
391,673,584
0
0
null
null
null
null
UTF-8
Java
false
false
127
java
package com.drink_api.drinkapi.home.Service; import org.springframework.stereotype.Service; public interface HomeService { }
[ "wntjddld11@naver.com" ]
wntjddld11@naver.com
b0363a5bec1d7c35861128c11c03c9b43af0a4fe
db3479a88fd171b1ee5c4276c08a606c33f91494
/src/java/ejb_beans/JpaRealPlayedRoleDAO.java
b3d58780ca5beb49bfaf269632a61558231d2883
[]
no_license
liviniya/TheatreSystem_EJB_JSF
8483f6166899e6a7e2724140f8733b03d8183c0c
68003fd1a85a3e1b6ccb7114b4553b9d8a34113f
refs/heads/master
2021-01-22T17:02:54.311569
2015-01-03T15:44:16
2015-01-03T15:44:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
848
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 ejb_beans; import dao_interfaces.RealPlayedRoleDAO; import entities.RealPlayedRole; import java.util.List; import javax.ejb.Stateless; import javax.persistence.TypedQuery; /** * * @author Оксана */ @Stateless public class JpaRealPlayedRoleDAO extends JpaGenericDAO<RealPlayedRole> implements RealPlayedRoleDAO { public JpaRealPlayedRoleDAO() { super(RealPlayedRole.class); } @Override public List<RealPlayedRole> findByEmptyPremium() { TypedQuery<RealPlayedRole> q = em.createNamedQuery("RealPlayedRole.findByEmptyPremium", RealPlayedRole.class); return q.getResultList(); } }
[ "liviniya@gmail.com" ]
liviniya@gmail.com
88d6d910cec70099044a0412a8ef532d45c49947
09d10f6cb731f1dede0284dd4e7db94f026e71fe
/src/main/java/com/ixortalk/assetmgmt/service/SecurityService.java
e0a1bc6da2e28e2dc2d7b446e72aefef18ead4bf
[ "MIT" ]
permissive
IxorTalk/ixortalk-assetmgmt
1a060a162a34d54c02a3eec514102731d4c334ca
d0eee0718cd754fb434d7c4fb475fb62c1372a9a
refs/heads/master
2020-03-18T23:58:19.074253
2019-10-07T09:54:48
2019-10-07T09:54:48
135,443,641
2
4
null
2019-09-20T09:14:18
2018-05-30T13:03:06
Java
UTF-8
Java
false
false
1,598
java
/** * The MIT License (MIT) * * Copyright (c) 2016-present IxorTalk CVBA * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package com.ixortalk.assetmgmt.service; import javax.inject.Named; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.context.SecurityContextHolder; @Named public class SecurityService { public String[] getAuthorities() { return SecurityContextHolder.getContext().getAuthentication().getAuthorities().stream().map(GrantedAuthority::getAuthority).toArray(String[]::new); } }
[ "ward.jans@wja-consulting.be" ]
ward.jans@wja-consulting.be
dffc31b1ec2098cc7488dc5b6abc368de4454e8f
cc2ccd2e2fa3df63a360f2b12f47237f2c7f547e
/MyBatisPractice1/src/test/java/cn/lulutan/AppTest.java
67f61dc542e5c864506d0d852994cc269f2bd165
[]
no_license
messager01/MyBatisPractice
ff6b03cfb8120454920757f2408b22ef7fbafa87
cd4cbe04713467c31f67237c7e53eb032c2998e6
refs/heads/master
2020-05-23T12:33:15.177597
2019-05-16T14:00:48
2019-05-16T14:00:48
186,759,289
2
0
null
null
null
null
UTF-8
Java
false
false
282
java
package cn.lulutan; import static org.junit.Assert.assertTrue; import org.junit.Test; /** * Unit test for simple App. */ public class AppTest { /** * Rigorous Test :-) */ @Test public void shouldAnswerWithTrue() { assertTrue( true ); } }
[ "273689468@qq.com" ]
273689468@qq.com
f933d54d7cd5fc86952eedf45e55abe707253930
7d0ab7d7727dbb6ca76c73cefe99e5bcb49efacf
/java-basic/src/main/java/com/eomcs/oop/ex00/Test2.java
4fecf70a9e52ba8b7b2a1c38b30cd22015fd0b49
[]
no_license
YerinJun/bitcamp-study
5f544a1bff1421207fa31e11cd42b84d96864c02
b3ef81db5b16f003e7916fe12a7021fe87628ef4
refs/heads/main
2023-07-01T07:28:48.918203
2021-08-09T11:49:22
2021-08-09T11:49:22
380,931,269
0
0
null
null
null
null
UTF-8
Java
false
false
930
java
package com.eomcs.oop.ex00; public class Test2 { static int a; int b; // 스태틱 메서드 // => 클래스를 통해 사용할 수 있는 메서드 // => 자신이 소속된 클래스의 인스턴스는 필요 없다. // => 자신이 소속된 클래스에 소속된 메서드 static void x1() { System.out.println("x1() 호출됨!"); a = 100; x2(); } static void x2() { System.out.println("x2() 호출됨!"); } // 인스턴스 메서드 // => 인스턴스 주소를 가지고 호출하는 메서드 // => 그래서 인스턴스 변수를 사용하는 메서드에 대해 인스턴스 메서드로 정의한다. // => 자신이 소속된 클래스에 인스턴스 멤버(변수, 메서드)를 사용할 수 있다. // 물론 인스턴스 없이 사용하는 스테텍 멤버도 접근할 수 있다. // void y1() { System.out.println("y1() 호출됨!"); } }
[ "erin2jj@gmail.com" ]
erin2jj@gmail.com
29cbd1b5395a9f101e1cd70990eb463a336908a5
9d3572eb01cf03c4c16d560b98000a6ab93ce64e
/jgitflow-maven-plugin/src/main/java/com/atlassian/maven/plugins/jgitflow/extension/HotfixStartPluginExtension.java
1b31fa88c2442b6d61ff484a8fa28a1ccaa26737
[ "BSD-3-Clause", "LicenseRef-scancode-jdom", "Apache-2.0" ]
permissive
dvbern/jgitflow
01bb519b65f64fc0d8614a0472fbd49da8b69fb3
61dde443fa6c682d4d67890c56020939df55d254
refs/heads/hotfix/1.0-m6
2023-08-22T08:27:12.525272
2023-05-11T16:34:40
2023-05-11T16:34:40
204,948,016
0
1
Apache-2.0
2023-06-14T22:52:11
2019-08-28T14:12:33
Java
UTF-8
Java
false
false
363
java
package com.atlassian.maven.plugins.jgitflow.extension; import com.atlassian.jgitflow.core.extension.HotfixStartExtension; import org.codehaus.plexus.component.annotations.Component; @Component(role = HotfixStartPluginExtension.class) public class HotfixStartPluginExtension extends ProductionBranchCreatingPluginExtension implements HotfixStartExtension { }
[ "doklovic@atlassian.com" ]
doklovic@atlassian.com
ceb03eafdd1338bf50a19a733f16568a17672dfe
d0e9c082e38713da0bfa70ca6bf8ace992138841
/app/src/main/java/com/example/android/cop1803/zzzTriangleView.java
448e8102765157d5b2a82263380c1f7dafeb1982
[]
no_license
neuerj/COP1803e
ef998943007e4aecbabd4744ad3cab8cba5fe66f
0899f3c8929ba73a820983c054a69502483cc17e
refs/heads/master
2020-03-28T05:10:32.449933
2019-02-28T02:45:53
2019-02-28T02:45:53
147,760,477
0
0
null
null
null
null
UTF-8
Java
false
false
1,373
java
package com.example.android.cop1803; /* public class TriangleView extends View { //private Paint paint = new Paint(); private Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); public TriangleView(Context context) { super(context); // init(); } public TriangleView(Context context, AttributeSet attrs) { super(context, attrs); // init(); } public TriangleView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); // init(); } public void onDraw(Canvas canvas) { super.onDraw(canvas); Paint paint=new Paint(); paint.setAntiAlias(true); paint.setDither(true); int x= 30; int y= 30;int width=30; //int strokeWidth=50;// paint.setStrokeWidth(strokeWidth); int halfWidth = width / 2; int color=getContext().getColor(R.color.GradientEnd); paint.setColor(color); Path path = new Path(); path.moveTo(x, y - halfWidth); // Top path.lineTo(x - halfWidth, y + halfWidth); // Bottom left path.lineTo(x + halfWidth, y + halfWidth); // Bottom right path.lineTo(x, y - halfWidth); // Back to Top path.close(); canvas.drawPath(path, paint); } public void drawtri(){ invalidate(); requestLayout(); } } */
[ "jim.neuer@gmail.com" ]
jim.neuer@gmail.com
745366ef03fb89e262a25da929e40211ca2b7e71
1f19aec2ecfd756934898cf0ad2758ee18d9eca2
/u-1/u-11/u-11-111/u-11-111-1112/u-11-111-1112-f2869.java
0808596fdbaff47a93dc76ab042b83615e71827c
[]
no_license
apertureatf/perftest
f6c6e69efad59265197f43af5072aa7af8393a34
584257a0c1ada22e5486052c11395858a87b20d5
refs/heads/master
2020-06-07T17:52:51.172890
2019-06-21T18:53:01
2019-06-21T18:53:01
193,039,805
0
0
null
null
null
null
UTF-8
Java
false
false
106
java
mastercard 5555555555554444 4012888888881881 4222222222222 378282246310005 6011111111111117 6172573526981
[ "jenkins@khan.paloaltonetworks.local" ]
jenkins@khan.paloaltonetworks.local
446b8b4672728b3ddbe8f718fb0a72d19e154b19
0fe59b1dfb5cf2454cef805da2804b2d3e52f742
/bee-platform-system/platform-sidatadriver-api/src/main/java/com/bee/platform/datadriver/dto/ErpRepositoryReceiptProductOutSearchDTO.java
a02a38152c4a3b305900fc014a9fac6ae1d58bf1
[]
no_license
wensheng930729/platform
f75026113a841e8541017c364d30b80e94d6ad5c
49c57f1f59b1e2e2bcc2529fdf6cb515d38ab55c
refs/heads/master
2020-12-11T13:58:59.772611
2019-12-16T06:02:40
2019-12-16T06:02:40
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,826
java
package com.bee.platform.datadriver.dto; import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonInclude; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.NoArgsConstructor; import lombok.experimental.Accessors; import java.io.Serializable; import java.math.BigDecimal; import java.util.Date; /** * @author dell * @version 1.0.0 * @ClassName ErpRepositoryReceiptProductOutSearchDTO * @Description 功能描述 * @Date 2019/6/7 16:53 **/ @Data @NoArgsConstructor @Accessors(chain=true) @ApiModel("成品出库条件搜索返回信息列表11") @JsonInclude public class ErpRepositoryReceiptProductOutSearchDTO implements Serializable { private static final long serialVersionUID = 1L; @ApiModelProperty("id") private Integer id; @ApiModelProperty("公司id") private Integer companyId; @ApiModelProperty("公司名称") private String companyName; @ApiModelProperty("销售订单号") private String saleCode; @ApiModelProperty("出库单号") private String outCode; @ApiModelProperty("出库时间") @JsonFormat(pattern = "yyyy-MM-dd") private Date receiptDate; @ApiModelProperty("客户") private String customer; @ApiModelProperty("产品名称") private String productName; @ApiModelProperty("发货数量") private BigDecimal num; @ApiModelProperty("确认状态 0未确认 1已确认") private Integer state; @ApiModelProperty("产成品id") private Integer productId; @ApiModelProperty("产成品批次id") private Integer productBatchId; @ApiModelProperty("产成品拼批次") private String productAndBatch; @ApiModelProperty("单位") private String unit; }
[ "414608036@qq.com" ]
414608036@qq.com
89006fc21d4913d8917e45d4fa9e51d4a6514448
2a8b7deffdbc1e1369cae25cc45e6f363425cac1
/SB_HSQL_Prj/SB_HSQL_Prj/src/main/java/nz/ac/op/cs/SB_HSQL_Prj/config/CorsConfig.java
f7155b6c133f1987bbfc2b231248e0eb746d6550
[]
no_license
RahulPatelme/rp-sb-hsql-demo
c3f01382cfd8e733385d01b4638e87cff1c732dd
0f13c7458dd327cfd3992185d20e9cb3c712a4be
refs/heads/main
2023-03-16T01:41:49.766935
2021-03-10T22:29:49
2021-03-10T22:29:49
345,815,867
0
0
null
null
null
null
UTF-8
Java
false
false
760
java
package nz.ac.op.cs.SB_HSQL_Prj.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.CorsRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @Configuration public class CorsConfig { @Bean public WebMvcConfigurer corsConfigurer(){ return new WebMvcConfigurer(){ @Override public void addCorsMappings(CorsRegistry registry) { registry.addMapping("/**") .allowedMethods("GET","POST","PUT","DELETE") .allowedHeaders("*") .allowedOrigins("*"); } }; } }
[ "noreply@github.com" ]
RahulPatelme.noreply@github.com
97ca9998b6f890b68f9b153065e71fbaa457f368
c8802af6a7f51fcc2bb96d641b23f353cdc3fa8f
/project0/src/main/java/com/revature/model/account/UserAccounts.java
813b5324b2840797dc26eafc8f574a440edb46ec
[]
no_license
0127JavaUSF/project0_MasonDavis
abe5f3dd050bfb0e3b67d2c7c150bd52352e6d3d
140d800f5f2e357734f74eddd93b3a0e2fffb0e1
refs/heads/master
2022-09-20T20:07:59.670604
2020-02-13T02:49:51
2020-02-13T02:49:51
240,032,580
0
0
null
2022-09-08T01:05:54
2020-02-12T14:26:19
Java
UTF-8
Java
false
false
781
java
package com.revature.model.account; public class UserAccounts { public static int UserId; public static int accountNumber; public static boolean joint; public static int getAccountsUserId() { return UserId; } public void setAccountsUserId(int UserId) { UserAccounts.UserId = UserId; } public static int getAccountNumber() { return accountNumber; } public void setAccountNumber(int accountNumber) { UserAccounts.accountNumber = accountNumber; } public static boolean getjointUser() { return joint; } public void setJointUser(boolean joint) { UserAccounts.joint = joint; } public UserAccounts(int UserId, int accountNumber, boolean joint) { super(); this.UserId = UserId; this.accountNumber = accountNumber; this.joint = joint; } }
[ "mdavis272" ]
mdavis272
d367f7c42ee9aaafad796ce5efc99415887047ca
a1036ce0619d58b82a28e9a797634446bd55b1f8
/app/src/main/java/com/licheedev/serialtool/util/CRC16Util.java
f73ca6afc07d853349239085ed8a7e66547f3ad0
[]
no_license
jiangliprivate/Android-SerialPort-Tool
b43679d26d8dabe26e25cf13e05198d5744fabd7
681362c4f876963866609c2422dbc73361222949
refs/heads/master
2023-06-09T10:19:25.043572
2023-05-26T10:32:36
2023-05-26T10:32:36
645,269,948
0
0
null
null
null
null
UTF-8
Java
false
false
11,691
java
package com.licheedev.serialtool.util; /** * @author:Jiangli * @date:2021/07/06 11:17 */ public class CRC16Util { /** * 计算CRC16校验码 * * @param bytes * @return */ public static String getCRC(byte[] bytes) { int CRC = 0x0000ffff; int POLYNOMIAL = 0x0000a001; int i, j; for (i = 0; i < bytes.length; i++) { CRC ^= ((int) bytes[i] & 0x000000ff); for (j = 0; j < 8; j++) { if ((CRC & 0x00000001) != 0) { CRC >>= 1; CRC ^= POLYNOMIAL; } else { CRC >>= 1; } } } return String.format("%04x", CRC); } /** * 获取4位字符校验码 **/ public static String getCRC(String str) { return getCRC(toBytes(str)); } /** * ModBus 通信协议的 CRC ( 冗余循环校验码含2个字节, 即 16 位二进制数。 * CRC 码由发送设备计算, 放置于所发送信息帧的尾部。 * 接收信息设备再重新计算所接收信息 (除 CRC 之外的部分)的 CRC, * 比较计算得到的 CRC 是否与接收到CRC相符, 如果两者不相符, 则认为数据出错。 * <p> * 1) 预置 1 个 16 位的寄存器为十六进制FFFF(即全为 1) , 称此寄存器为 CRC寄存器。 * 2) 把第一个 8 位二进制数据 (通信信息帧的第一个字节) 与 16 位的 CRC寄存器的低 8 位相异或, 把结果放于 CRC寄存器。 * 3) 把 CRC 寄存器的内容右移一位( 朝低位)用 0 填补最高位, 并检查右移后的移出位。 * 4) 如果移出位为 0, 重复第 3 步 ( 再次右移一位); 如果移出位为 1, CRC 寄存器与多项式A001 ( 1010 0000 0000 0001) 进行异或。 * 5) 重复步骤 3 和步骤 4, 直到右移 8 次,这样整个8位数据全部进行了处理。 * 6) 重复步骤 2 到步骤 5, 进行通信信息帧下一个字节的处理。 * 7) 将该通信信息帧所有字节按上述步骤计算完成后,得到的16位CRC寄存器的高、低字节进行交换。 * 8) 最后得到的 CRC寄存器内容即为 CRC码。 */ public static String getCRC2(byte[] bytes) { int CRC = 0x0000ffff; int POLYNOMIAL = 0x0000a001; int i, j; for (i = 0; i < bytes.length; i++) { CRC ^= (int) bytes[i]; for (j = 0; j < 8; j++) { if ((CRC & 0x00000001) == 1) { CRC >>= 1; CRC ^= POLYNOMIAL; } else { CRC >>= 1; } } } //高低位转换,看情况使用(譬如本人这次对led彩屏的通讯开发就规定校验码高位在前低位在后,也就不需要转换高低位) //CRC = ( (CRC & 0x0000FF00) >> 8) | ( (CRC & 0x000000FF ) << 8); return Integer.toHexString(CRC); } public static String getCRC2(String str) { return getCRC2(toBytes(str)); } /** * 查表法计算CRC16校验 * * @param data 需要计算的字节数组 */ public static String getCRC3(byte[] data) { byte[] crc16_h = { (byte) 0x00, (byte) 0xC1, (byte) 0x81, (byte) 0x40, (byte) 0x01, (byte) 0xC0, (byte) 0x80, (byte) 0x41, (byte) 0x01, (byte) 0xC0, (byte) 0x80, (byte) 0x41, (byte) 0x00, (byte) 0xC1, (byte) 0x81, (byte) 0x40, (byte) 0x01, (byte) 0xC0, (byte) 0x80, (byte) 0x41, (byte) 0x00, (byte) 0xC1, (byte) 0x81, (byte) 0x40, (byte) 0x00, (byte) 0xC1, (byte) 0x81, (byte) 0x40, (byte) 0x01, (byte) 0xC0, (byte) 0x80, (byte) 0x41, (byte) 0x01, (byte) 0xC0, (byte) 0x80, (byte) 0x41, (byte) 0x00, (byte) 0xC1, (byte) 0x81, (byte) 0x40, (byte) 0x00, (byte) 0xC1, (byte) 0x81, (byte) 0x40, (byte) 0x01, (byte) 0xC0, (byte) 0x80, (byte) 0x41, (byte) 0x00, (byte) 0xC1, (byte) 0x81, (byte) 0x40, (byte) 0x01, (byte) 0xC0, (byte) 0x80, (byte) 0x41, (byte) 0x01, (byte) 0xC0, (byte) 0x80, (byte) 0x41, (byte) 0x00, (byte) 0xC1, (byte) 0x81, (byte) 0x40, (byte) 0x01, (byte) 0xC0, (byte) 0x80, (byte) 0x41, (byte) 0x00, (byte) 0xC1, (byte) 0x81, (byte) 0x40, (byte) 0x00, (byte) 0xC1, (byte) 0x81, (byte) 0x40, (byte) 0x01, (byte) 0xC0, (byte) 0x80, (byte) 0x41, (byte) 0x00, (byte) 0xC1, (byte) 0x81, (byte) 0x40, (byte) 0x01, (byte) 0xC0, (byte) 0x80, (byte) 0x41, (byte) 0x01, (byte) 0xC0, (byte) 0x80, (byte) 0x41, (byte) 0x00, (byte) 0xC1, (byte) 0x81, (byte) 0x40, (byte) 0x00, (byte) 0xC1, (byte) 0x81, (byte) 0x40, (byte) 0x01, (byte) 0xC0, (byte) 0x80, (byte) 0x41, (byte) 0x01, (byte) 0xC0, (byte) 0x80, (byte) 0x41, (byte) 0x00, (byte) 0xC1, (byte) 0x81, (byte) 0x40, (byte) 0x01, (byte) 0xC0, (byte) 0x80, (byte) 0x41, (byte) 0x00, (byte) 0xC1, (byte) 0x81, (byte) 0x40, (byte) 0x00, (byte) 0xC1, (byte) 0x81, (byte) 0x40, (byte) 0x01, (byte) 0xC0, (byte) 0x80, (byte) 0x41, (byte) 0x01, (byte) 0xC0, (byte) 0x80, (byte) 0x41, (byte) 0x00, (byte) 0xC1, (byte) 0x81, (byte) 0x40, (byte) 0x00, (byte) 0xC1, (byte) 0x81, (byte) 0x40, (byte) 0x01, (byte) 0xC0, (byte) 0x80, (byte) 0x41, (byte) 0x00, (byte) 0xC1, (byte) 0x81, (byte) 0x40, (byte) 0x01, (byte) 0xC0, (byte) 0x80, (byte) 0x41, (byte) 0x01, (byte) 0xC0, (byte) 0x80, (byte) 0x41, (byte) 0x00, (byte) 0xC1, (byte) 0x81, (byte) 0x40, (byte) 0x00, (byte) 0xC1, (byte) 0x81, (byte) 0x40, (byte) 0x01, (byte) 0xC0, (byte) 0x80, (byte) 0x41, (byte) 0x01, (byte) 0xC0, (byte) 0x80, (byte) 0x41, (byte) 0x00, (byte) 0xC1, (byte) 0x81, (byte) 0x40, (byte) 0x01, (byte) 0xC0, (byte) 0x80, (byte) 0x41, (byte) 0x00, (byte) 0xC1, (byte) 0x81, (byte) 0x40, (byte) 0x00, (byte) 0xC1, (byte) 0x81, (byte) 0x40, (byte) 0x01, (byte) 0xC0, (byte) 0x80, (byte) 0x41, (byte) 0x00, (byte) 0xC1, (byte) 0x81, (byte) 0x40, (byte) 0x01, (byte) 0xC0, (byte) 0x80, (byte) 0x41, (byte) 0x01, (byte) 0xC0, (byte) 0x80, (byte) 0x41, (byte) 0x00, (byte) 0xC1, (byte) 0x81, (byte) 0x40, (byte) 0x01, (byte) 0xC0, (byte) 0x80, (byte) 0x41, (byte) 0x00, (byte) 0xC1, (byte) 0x81, (byte) 0x40, (byte) 0x00, (byte) 0xC1, (byte) 0x81, (byte) 0x40, (byte) 0x01, (byte) 0xC0, (byte) 0x80, (byte) 0x41, (byte) 0x01, (byte) 0xC0, (byte) 0x80, (byte) 0x41, (byte) 0x00, (byte) 0xC1, (byte) 0x81, (byte) 0x40, (byte) 0x00, (byte) 0xC1, (byte) 0x81, (byte) 0x40, (byte) 0x01, (byte) 0xC0, (byte) 0x80, (byte) 0x41, (byte) 0x00, (byte) 0xC1, (byte) 0x81, (byte) 0x40, (byte) 0x01, (byte) 0xC0, (byte) 0x80, (byte) 0x41, (byte) 0x01, (byte) 0xC0, (byte) 0x80, (byte) 0x41, (byte) 0x00, (byte) 0xC1, (byte) 0x81, (byte) 0x40 }; byte[] crc16_l = { (byte) 0x00, (byte) 0xC0, (byte) 0xC1, (byte) 0x01, (byte) 0xC3, (byte) 0x03, (byte) 0x02, (byte) 0xC2, (byte) 0xC6, (byte) 0x06, (byte) 0x07, (byte) 0xC7, (byte) 0x05, (byte) 0xC5, (byte) 0xC4, (byte) 0x04, (byte) 0xCC, (byte) 0x0C, (byte) 0x0D, (byte) 0xCD, (byte) 0x0F, (byte) 0xCF, (byte) 0xCE, (byte) 0x0E, (byte) 0x0A, (byte) 0xCA, (byte) 0xCB, (byte) 0x0B, (byte) 0xC9, (byte) 0x09, (byte) 0x08, (byte) 0xC8, (byte) 0xD8, (byte) 0x18, (byte) 0x19, (byte) 0xD9, (byte) 0x1B, (byte) 0xDB, (byte) 0xDA, (byte) 0x1A, (byte) 0x1E, (byte) 0xDE, (byte) 0xDF, (byte) 0x1F, (byte) 0xDD, (byte) 0x1D, (byte) 0x1C, (byte) 0xDC, (byte) 0x14, (byte) 0xD4, (byte) 0xD5, (byte) 0x15, (byte) 0xD7, (byte) 0x17, (byte) 0x16, (byte) 0xD6, (byte) 0xD2, (byte) 0x12, (byte) 0x13, (byte) 0xD3, (byte) 0x11, (byte) 0xD1, (byte) 0xD0, (byte) 0x10, (byte) 0xF0, (byte) 0x30, (byte) 0x31, (byte) 0xF1, (byte) 0x33, (byte) 0xF3, (byte) 0xF2, (byte) 0x32, (byte) 0x36, (byte) 0xF6, (byte) 0xF7, (byte) 0x37, (byte) 0xF5, (byte) 0x35, (byte) 0x34, (byte) 0xF4, (byte) 0x3C, (byte) 0xFC, (byte) 0xFD, (byte) 0x3D, (byte) 0xFF, (byte) 0x3F, (byte) 0x3E, (byte) 0xFE, (byte) 0xFA, (byte) 0x3A, (byte) 0x3B, (byte) 0xFB, (byte) 0x39, (byte) 0xF9, (byte) 0xF8, (byte) 0x38, (byte) 0x28, (byte) 0xE8, (byte) 0xE9, (byte) 0x29, (byte) 0xEB, (byte) 0x2B, (byte) 0x2A, (byte) 0xEA, (byte) 0xEE, (byte) 0x2E, (byte) 0x2F, (byte) 0xEF, (byte) 0x2D, (byte) 0xED, (byte) 0xEC, (byte) 0x2C, (byte) 0xE4, (byte) 0x24, (byte) 0x25, (byte) 0xE5, (byte) 0x27, (byte) 0xE7, (byte) 0xE6, (byte) 0x26, (byte) 0x22, (byte) 0xE2, (byte) 0xE3, (byte) 0x23, (byte) 0xE1, (byte) 0x21, (byte) 0x20, (byte) 0xE0, (byte) 0xA0, (byte) 0x60, (byte) 0x61, (byte) 0xA1, (byte) 0x63, (byte) 0xA3, (byte) 0xA2, (byte) 0x62, (byte) 0x66, (byte) 0xA6, (byte) 0xA7, (byte) 0x67, (byte) 0xA5, (byte) 0x65, (byte) 0x64, (byte) 0xA4, (byte) 0x6C, (byte) 0xAC, (byte) 0xAD, (byte) 0x6D, (byte) 0xAF, (byte) 0x6F, (byte) 0x6E, (byte) 0xAE, (byte) 0xAA, (byte) 0x6A, (byte) 0x6B, (byte) 0xAB, (byte) 0x69, (byte) 0xA9, (byte) 0xA8, (byte) 0x68, (byte) 0x78, (byte) 0xB8, (byte) 0xB9, (byte) 0x79, (byte) 0xBB, (byte) 0x7B, (byte) 0x7A, (byte) 0xBA, (byte) 0xBE, (byte) 0x7E, (byte) 0x7F, (byte) 0xBF, (byte) 0x7D, (byte) 0xBD, (byte) 0xBC, (byte) 0x7C, (byte) 0xB4, (byte) 0x74, (byte) 0x75, (byte) 0xB5, (byte) 0x77, (byte) 0xB7, (byte) 0xB6, (byte) 0x76, (byte) 0x72, (byte) 0xB2, (byte) 0xB3, (byte) 0x73, (byte) 0xB1, (byte) 0x71, (byte) 0x70, (byte) 0xB0, (byte) 0x50, (byte) 0x90, (byte) 0x91, (byte) 0x51, (byte) 0x93, (byte) 0x53, (byte) 0x52, (byte) 0x92, (byte) 0x96, (byte) 0x56, (byte) 0x57, (byte) 0x97, (byte) 0x55, (byte) 0x95, (byte) 0x94, (byte) 0x54, (byte) 0x9C, (byte) 0x5C, (byte) 0x5D, (byte) 0x9D, (byte) 0x5F, (byte) 0x9F, (byte) 0x9E, (byte) 0x5E, (byte) 0x5A, (byte) 0x9A, (byte) 0x9B, (byte) 0x5B, (byte) 0x99, (byte) 0x59, (byte) 0x58, (byte) 0x98, (byte) 0x88, (byte) 0x48, (byte) 0x49, (byte) 0x89, (byte) 0x4B, (byte) 0x8B, (byte) 0x8A, (byte) 0x4A, (byte) 0x4E, (byte) 0x8E, (byte) 0x8F, (byte) 0x4F, (byte) 0x8D, (byte) 0x4D, (byte) 0x4C, (byte) 0x8C, (byte) 0x44, (byte) 0x84, (byte) 0x85, (byte) 0x45, (byte) 0x87, (byte) 0x47, (byte) 0x46, (byte) 0x86, (byte) 0x82, (byte) 0x42, (byte) 0x43, (byte) 0x83, (byte) 0x41, (byte) 0x81, (byte) 0x80, (byte) 0x40 }; int crc = 0x0000ffff; int ucCRCHi = 0x00ff; int ucCRCLo = 0x00ff; int iIndex; for (int i = 0; i < data.length; ++i) { iIndex = (ucCRCLo ^ data[i]) & 0x00ff; ucCRCLo = ucCRCHi ^ crc16_h[iIndex]; ucCRCHi = crc16_l[iIndex]; } crc = ((ucCRCHi & 0x00ff) << 8) | (ucCRCLo & 0x00ff) & 0xffff; //高低位互换,输出符合相关工具对Modbus CRC16的运算 //crc = ((crc & 0xFF00) >> 8) | ((crc & 0x00FF) << 8); return String.format("%04x", crc); } public static String getCRC3(String str) { return getCRC3(toBytes(str)); } /** * 将16进制字符串转换为byte[] * 注意该接口只能接受16进制转换 * * @param str * @return */ public static byte[] toBytes(String str) { if (str == null || str.trim().equals("")) { return new byte[0]; } byte[] bytes = new byte[str.length() / 2]; for (int i = 0; i < str.length() / 2; i++) { String subStr = str.substring(i * 2, i * 2 + 2); bytes[i] = (byte) Integer.parseInt(subStr, 16); } return bytes; } }
[ "1014780649@qq.com" ]
1014780649@qq.com
e8927c22dac83a025d64b5e5652733a39fdfd7c0
491b3d8df8ad70b80cacb7464213785d19f8c052
/app/src/main/java/com/geely/app/geelyapprove/common/utils/AnimUtil.java
1250b3ae212d42e823d154acdd7eb1dd4b16fc1d
[]
no_license
zwywan/OrientalPearlOA
ad15438c92640bc0719568809f71e02de2f048ae
ad52d51c164f5b1ad3eddf426a802647391fc527
refs/heads/master
2021-06-21T18:53:57.337420
2017-08-17T06:29:59
2017-08-17T06:29:59
100,437,080
1
0
null
null
null
null
UTF-8
Java
false
false
806
java
package com.geely.app.geelyapprove.common.utils; import android.view.animation.Animation; import android.view.animation.Interpolator; import android.view.animation.ScaleAnimation; /** * Created by Oliver on 2016/9/15. */ public class AnimUtil { public static Animation scaleAnimation(long duration, long delayTime, Interpolator interpolator, boolean isReversed) { Animation animation = isReversed ? new ScaleAnimation(1, 0f, 1, 0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f) : new ScaleAnimation(0, 1f, 0, 1f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); animation.setInterpolator(interpolator); animation.setStartOffset(delayTime); animation.setDuration(duration); return animation; } }
[ "wenying.zhang@hand-china.com" ]
wenying.zhang@hand-china.com
bcb57c3d2faa53c6612e25e4d99ee168a6596fa3
11c3cf624e29e9a0830437dd16d4ed1d67a91282
/core/src/main/java/com/github/gl8080/metagrid/core/application/upload/FileUploadProcessor.java
751ca75554369c0b487bc33f54d7f88a1650ef32
[ "MIT" ]
permissive
opengl-8080/metagrid
e8ac219714d9cdc1aced7ff6713cf908c897d37f
d20ff4179376eb1f0714141ae8068bc87971b231
refs/heads/master
2021-01-10T06:03:36.598719
2016-03-03T15:11:43
2016-03-03T15:11:43
49,817,612
0
0
null
null
null
null
UTF-8
Java
false
false
2,481
java
package com.github.gl8080.metagrid.core.application.upload; import com.github.gl8080.metagrid.core.domain.upload.ErrorRecord; import com.github.gl8080.metagrid.core.domain.upload.FileLineProcessor; import com.github.gl8080.metagrid.core.domain.upload.FileUploadProcessException; import com.github.gl8080.metagrid.core.domain.upload.Status; import com.github.gl8080.metagrid.core.domain.upload.UploadFile; import com.github.gl8080.metagrid.core.domain.upload.UploadFileRepository; import com.github.gl8080.metagrid.core.infrastructure.jdbc.JdbcHelper; import com.github.gl8080.metagrid.core.util.ComponentLoader; public class FileUploadProcessor implements FileLineProcessor { private UploadFile uploadFile; private FileLineProcessor delegate; private JdbcHelper targetJdbc; public FileUploadProcessor(UploadFile uploadFile, FileLineProcessor delegate, JdbcHelper jdbc) { this.uploadFile = uploadFile; this.delegate = delegate; this.targetJdbc = jdbc; } @Override public void process(String line) { ErrorRecord errorRecord = null; try { this.uploadFile.beginProcess(); this.targetJdbc.beginTransaction(); this.delegate.process(line); this.targetJdbc.commitTransaction(); } catch (FileUploadProcessException e) { errorRecord = new ErrorRecord(line); errorRecord.addError(e); throw e; } catch (Exception e) { errorRecord = new ErrorRecord(line); errorRecord.addSystemErrorMessage(); throw e; } finally { this.targetJdbc.rollbackTransaction(); this.uploadFile.endProcess(); JdbcHelper repository = JdbcHelper.getRepositoryHelper(); repository.beginTransaction(); this.saveUploadResult(errorRecord); repository.commitTransaction(); } } private void saveUploadResult(ErrorRecord errorRecord) { UploadFileRepository uploadFileRepository = ComponentLoader.getComponent(UploadFileRepository.class); if (errorRecord == null) { uploadFileRepository.update(uploadFile); } else { this.uploadFile.setStatus(Status.ERROR_END); uploadFileRepository.addErrorRecord(uploadFile, errorRecord); } } }
[ "tomcat.port.8080+github@gmail.com" ]
tomcat.port.8080+github@gmail.com
d52f728209ce743080ab5e4ee612460308e1c9fa
ead4f8d93fa64859a3fae49979cffd3c71895632
/src/main/java/org/jsmpp/sample/springboot/jsmpp/MessageReceiverListenerImpl.java
424c2eb661be07ac9a951a40f8c5fa19a64c9a8e
[]
no_license
bluesky129/jsmpp-sample-spring-boot
9b5a3b2889e538caf2d0c2989377999ce9cf7148
82319e2187d726f8f1761e3c203034a3d0d1af04
refs/heads/master
2023-07-15T10:20:20.151400
2021-08-30T20:28:13
2021-08-30T20:28:13
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,303
java
/* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package org.jsmpp.sample.springboot.jsmpp; import static org.jsmpp.SMPPConstant.STAT_ESME_RSYSERR; import org.jsmpp.bean.AlertNotification; import org.jsmpp.bean.DataSm; import org.jsmpp.bean.DeliverSm; import org.jsmpp.bean.MessageType; import org.jsmpp.bean.OptionalParameter; import org.jsmpp.extra.ProcessRequestException; import org.jsmpp.sample.springboot.misc.Util; import org.jsmpp.session.DataSmResult; import org.jsmpp.session.MessageReceiverListener; import org.jsmpp.session.Session; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class MessageReceiverListenerImpl implements MessageReceiverListener { private static final Logger LOG = LoggerFactory.getLogger(MessageReceiverListenerImpl.class); public void onAcceptDeliverSm(final DeliverSm deliverSm) throws ProcessRequestException { LOG.info("deliver_sm seq:{} src:{} {}/{} dst:{} {}/{}", deliverSm.getSequenceNumber(), deliverSm.getSourceAddr(), deliverSm.getSourceAddrTon(), deliverSm.getSourceAddrNpi(), deliverSm.getDestAddress(), deliverSm.getDestAddrTon(), deliverSm.getDestAddrNpi()); LOG.debug("deliver_sm ESM {}", Util.bytesToHex(deliverSm.getEsmClass())); LOG.debug("deliver_sm sequence {}", deliverSm.getSequenceNumber()); LOG.debug("deliver_sm service type {}", deliverSm.getServiceType()); LOG.debug("deliver_sm priority flag {}", deliverSm.getPriorityFlag()); final OptionalParameter[] optionalParameters = deliverSm.getOptionalParameters(); for (final OptionalParameter optionalParameter : optionalParameters) { final byte[] content = optionalParameter.serialize(); LOG.debug("Optional Parameter {}: [{}]", optionalParameter.tag, Util.bytesToHex(content)); } if (MessageType.SMSC_DEL_RECEIPT.containedIn(deliverSm.getEsmClass()) || MessageType.SME_DEL_ACK .containedIn(deliverSm.getEsmClass())) { // this message is delivery receipt try { LOG.info("deliver_sm sm : {}", new String(deliverSm.getShortMessage())); final OptionalParameter.OctetString jmr = (OptionalParameter.OctetString) deliverSm.getOptionalParameter((short) 8192); if (jmr != null) { final String jmrId = jmr.getValueAsString(); LOG.info("deliver_sm jmr: '{}'", jmrId); } final OptionalParameter.OctetString unknown = (OptionalParameter.OctetString) deliverSm.getOptionalParameter((short) 1542); if (unknown != null) { LOG.info("deliver_sm 1542: [{}]", Util.bytesToHex(unknown.getValue())); } // MessageBird networkMccMnc final OptionalParameter.OctetString networkMccMnc = (OptionalParameter.OctetString) deliverSm.getOptionalParameter((short) 5472); if (networkMccMnc != null) { final String networkMccMncHex = Util.bytesToHex(networkMccMnc.getValue()); LOG.info("deliver_sm networkMccMnc: '{}'", networkMccMncHex); LOG.info("deliver_sm networkMccMnc: '{}'", networkMccMnc.getValueAsString()); } // MessageBird networkMccMnc final OptionalParameter.Network_error_code networkErrorCode = (OptionalParameter.Network_error_code) deliverSm.getOptionalParameter(OptionalParameter.Tag.NETWORK_ERROR_CODE); if (networkErrorCode != null) { LOG.info("deliver_sm network ErrorCode: '{}'", networkErrorCode.getErrorCode()); LOG.info("deliver_sm network Type: '{}'", networkErrorCode.getNetworkType().name()); } // //final DeliveryReceipt delReceipt = deliverSm.getShortMessageAsDeliveryReceipt(); // final MyDeliveryReceipt delReceipt = deliverSm.getDeliveryReceipt(STRIPPER); // //final DeliveryReceipt delReceipt = deliverSm.getDeliveryReceipt(SECOND_STRIPPER); // // final String messageId; // if (delReceipt.getId().length() == 10) { // messageId = StringUtils.stripStart(delReceipt.getId(), "0"); // } else { // messageId = delReceipt.getId(); // } // LOG.info("msgid:{} submitted:{} delivered:{}", messageId, delReceipt.getSubmitted(), delReceipt.getDelivered()); // LOG.info("submitdate:{} donedate:{}", delReceipt.getSubmitDate(), delReceipt.getDoneDate()); // LOG.info("final state:{} error:{}", delReceipt.getFinalStatus(), delReceipt.getError()); // LOG.info("text:'{}'", delReceipt.getText()); // // LOG.info("Received delivery receipt for message '{}' from {} to {}: {}", // messageId, deliverSm.getSourceAddr(), deliverSm.getDestAddress(), delReceipt); // // LOG.info("dr id {}", delReceipt.getId()); // LOG.info("dr delivered {}", delReceipt.getDelivered()); // LOG.info("dr submitted {}", delReceipt.getSubmitted()); // LOG.info("dr submit date {}", delReceipt.getSubmitDate()); // LOG.info("dr done date {}", delReceipt.getDoneDate()); // LOG.info("dr final status {}", delReceipt.getFinalStatus()); // LOG.info("dr error {}", delReceipt.getError()); // LOG.info("dr text {}", delReceipt.getText()); // // delReceipt properties // dr.setMessageId(messageId); // the altered messageId // dr.setDelivered((byte) delReceipt.getDelivered()); // dr.setSubmitted((byte) delReceipt.getSubmitted()); // dr.setSubmitDate(delReceipt.getSubmitDate().toInstant()); // dr.setDoneDate(delReceipt.getDoneDate().toInstant()); // if (delReceipt.getFinalStatus() != null) { // dr.setState((byte) delReceipt.getFinalStatus().value()); // } // if (delReceipt.getError() != null) { // dr.setError(delReceipt.getError()); // } // dr.setText(delReceipt.getText().getBytes()); // drRepository.saveAndFlush(dr); // } catch (InvalidDeliveryReceiptException e) { // LOG.error("Invalid delivery receipt", e); } catch (RuntimeException e) { LOG.error("Runtime exception", e); throw new ProcessRequestException(e.getMessage(), STAT_ESME_RSYSERR); } } else { // this message is regular short message LOG.info("Receiving message: {}", new String(deliverSm.getShortMessage())); } } @Override public void onAcceptAlertNotification(AlertNotification alertNotification) { LOG.info("onAcceptAlertNotification: {} {}", alertNotification.getSourceAddr(), alertNotification.getEsmeAddr()); } @Override public DataSmResult onAcceptDataSm(final DataSm dataSm, final Session source) throws ProcessRequestException { LOG.info("onAcceptDataSm: {} {} {}", source.getSessionId(), dataSm.getSourceAddr(), dataSm.getDestAddress()); throw new ProcessRequestException("The data_sm is not implemented", STAT_ESME_RSYSERR); } }
[ "pim.moerenhout@gmail.com" ]
pim.moerenhout@gmail.com
7a2e73e7f0980a6909f8513d88e7b263b229a641
49b4cb79c910a17525b59d4b497a09fa28a9e3a8
/parserValidCheck/src/main/java/com/ke/css/cimp/fwb/fwb11/Rule_SHIPPER_PLACE.java
18c5c9d7b24f1faaf343927bf91159ce3a073166
[]
no_license
ganzijo/koreanair
a7d750b62cec2647bfb2bed4ca1bf8648d9a447d
e980fb11bc4b8defae62c9d88e5c70a659bef436
refs/heads/master
2021-04-26T22:04:17.478461
2018-03-06T05:59:32
2018-03-06T05:59:32
124,018,887
0
0
null
null
null
null
UTF-8
Java
false
false
2,271
java
package com.ke.css.cimp.fwb.fwb11; /* ----------------------------------------------------------------------------- * Rule_SHIPPER_PLACE.java * ----------------------------------------------------------------------------- * * Producer : com.parse2.aparse.Parser 2.5 * Produced : Tue Mar 06 10:36:50 KST 2018 * * ----------------------------------------------------------------------------- */ import java.util.ArrayList; final public class Rule_SHIPPER_PLACE extends Rule { public Rule_SHIPPER_PLACE(String spelling, ArrayList<Rule> rules) { super(spelling, rules); } public Object accept(Visitor visitor) { return visitor.visit(this); } public static Rule_SHIPPER_PLACE parse(ParserContext context) { context.push("SHIPPER_PLACE"); boolean parsed = true; int s0 = context.index; ParserAlternative a0 = new ParserAlternative(s0); ArrayList<ParserAlternative> as1 = new ArrayList<ParserAlternative>(); parsed = false; { int s1 = context.index; ParserAlternative a1 = new ParserAlternative(s1); parsed = true; if (parsed) { boolean f1 = true; @SuppressWarnings("unused") int c1 = 0; for (int i1 = 0; i1 < 17 && f1; i1++) { Rule rule = Rule_Typ_Text.parse(context); if ((f1 = rule != null)) { a1.add(rule, context.index); c1++; } } parsed = true; } if (parsed) { as1.add(a1); } context.index = s1; } ParserAlternative b = ParserAlternative.getBest(as1); parsed = b != null; if (parsed) { a0.add(b.rules, b.end); context.index = b.end; } Rule rule = null; if (parsed) { rule = new Rule_SHIPPER_PLACE(context.text.substring(a0.start, a0.end), a0.rules); } else { context.index = s0; } context.pop("SHIPPER_PLACE", parsed); return (Rule_SHIPPER_PLACE)rule; } } /* ----------------------------------------------------------------------------- * eof * ----------------------------------------------------------------------------- */
[ "wrjo@wrjo-PC" ]
wrjo@wrjo-PC
84ca240fabba32152b268948c7fc79f5fc62b5c5
6be0aeb751f6e5893a4af029206dfa0e9a2b2c8e
/ClavaAst/src/pt/up/fe/specs/clava/ast/stmt/CXXCatchStmt.java
cd362f28bc5027636400fdba0024cc188e738194
[ "Apache-2.0" ]
permissive
TheNunoGomes/clava
15188cdeebad25f105d066f06ed7429da55c3205
4a25a5fbd4bcd740c1fbe3d8b6e271c65ae311ae
refs/heads/master
2023-03-22T12:23:22.335685
2021-03-08T17:48:01
2021-03-08T17:48:01
295,422,617
1
0
Apache-2.0
2020-12-14T19:14:45
2020-09-14T13:20:31
Mercury
UTF-8
Java
false
false
2,813
java
/** * Copyright 2017 SPeCS. * * 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. under the License. */ package pt.up.fe.specs.clava.ast.stmt; import java.util.Collection; import java.util.Optional; import org.suikasoft.jOptions.Interfaces.DataStore; import pt.up.fe.specs.clava.ClavaNode; import pt.up.fe.specs.clava.ast.decl.Decl; import pt.up.fe.specs.clava.ast.decl.NullDecl; import pt.up.fe.specs.clava.utils.NodeWithScope; public class CXXCatchStmt extends Stmt implements NodeWithScope { public CXXCatchStmt(DataStore data, Collection<? extends ClavaNode> children) { super(data, children); } // public CXXCatchStmt(ClavaNodeInfo info, Decl exceptionDecl, CompoundStmt catchBody) { // this(info, Arrays.asList(exceptionDecl, catchBody)); // } // // private CXXCatchStmt(ClavaNodeInfo info, Collection<? extends ClavaNode> children) { // super(info, children); // } // // @Override // protected ClavaNode copyPrivate() { // return new CXXCatchStmt(getInfo(), Collections.emptyList()); // } public Decl getExceptionDecl() { return getChild(Decl.class, 0); } public CompoundStmt getBody() { return getChild(CompoundStmt.class, 1); } @Override public Optional<CompoundStmt> getNodeScope() { return Optional.of(getBody()); } @Override public String getCode() { StringBuilder code = new StringBuilder(); String declCode = getExceptionDecl() instanceof NullDecl ? "..." : getExceptionDecl().getCode(); // if (declCode.startsWith("std::std::")) { // Decl exptDecl = getExceptionDecl(); // LValueReferenceType type = (LValueReferenceType) ((Typable) exptDecl).getType(); // // System.out.println("LVALUE TYPE:" + type.toTree()); // System.out.println("LVALUE TYPE CODE:" + type.getCode(this)); // System.out.println("REFERENCEE CODE:" + type.getReferencee().getCode(this)); // // if (exptDecl instanceof Typable) { // // System.out.println("EXPT DECL TYPE:" + .toTree()); // // // // } // throw new RuntimeException("STOP"); // } code.append("catch (").append(declCode).append(")").append(getBody().getCode()); return code.toString(); } }
[ "joaobispo@gmail.com" ]
joaobispo@gmail.com
7f68651abc696984b667c6c1de64ef201091653f
e00647aacd6869ee3aac1358addd0a7ee79ed4a8
/src/main/java/oqu/today/initital/repository/QuestionRepository.java
a640f189ed6f6486bc4c041b01dfe8aea2cd76ae
[]
no_license
toha827/a360back
10566782bd413e3b5d29ad4cf06f9dd9dc920c26
87d48b672f477a408f790fceb35fecbbca3ebf8e
refs/heads/main
2023-06-25T07:58:57.409207
2021-07-25T08:59:21
2021-07-25T08:59:21
383,679,210
0
0
null
null
null
null
UTF-8
Java
false
false
334
java
package oqu.today.initital.repository; import oqu.today.initital.model.Question; import org.springframework.data.jpa.repository.JpaRepository; import java.util.List; import java.util.Optional; public interface QuestionRepository extends JpaRepository<Question, Long> { // Optional<List<Question>> findAllByCourseId(Long id); }
[ "tohakktl@gmail.com" ]
tohakktl@gmail.com
a43ec0b3a338d85affa0ca45b9b7e45c0d47fc3f
a51591370c8433d297b1f197390f19f789bea4cb
/app/src/main/java/com/reryde/app/RerydeApplication.java
a5c4e899b80c1c7fbc3c70702025187b2764855b
[]
no_license
gistapp/ReRyde
ece9157da21583980bcf09f8292fa2d0806cf3ae
f888335d4414b753dd935594ae0ec50accd408d5
refs/heads/master
2020-04-27T02:24:43.560833
2018-09-29T06:46:38
2018-09-29T06:46:38
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,755
java
package com.reryde.app; import android.app.Application; import android.content.Context; import android.support.annotation.NonNull; import android.support.multidex.MultiDex; import android.text.TextUtils; import android.util.Log; import com.android.volley.Request; import com.android.volley.RequestQueue; import com.android.volley.toolbox.ImageLoader; import com.android.volley.toolbox.Volley; import com.appsflyer.AppsFlyerConversionListener; import com.appsflyer.AppsFlyerLib; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.Task; import com.google.firebase.remoteconfig.FirebaseRemoteConfig; import com.reryde.app.FCM.ForceUpdateChecker; import com.reryde.app.Helper.LocaleUtils; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import uk.co.chrisjenx.calligraphy.CalligraphyConfig; /** * Created by jayakumar on 29/01/17. */ public class RerydeApplication extends Application { public static final String TAG = RerydeApplication.class .getSimpleName(); private RequestQueue mRequestQueue; private ImageLoader mImageLoader; private static RerydeApplication mInstance; private static final String AF_DEV_KEY = "xkZ5DiZj57SYdoUwTpNL3e"; @Override protected void attachBaseContext(Context base) { super.attachBaseContext(LocaleUtils.onAttach(base, "en")); MultiDex.install(this); } @Override public void onCreate() { super.onCreate(); mInstance = this; initCalligraphyConfig(); AppsFlyerConversionListener conversionDataListener = new AppsFlyerConversionListener() { @Override public void onInstallConversionDataLoaded(Map<String, String> map) { } @Override public void onInstallConversionFailure(String s) { } @Override public void onAppOpenAttribution(Map<String, String> map) { } @Override public void onAttributionFailure(String s) { } }; AppsFlyerLib.getInstance().init(AF_DEV_KEY, conversionDataListener, getApplicationContext()); AppsFlyerLib.getInstance().startTracking(this); final FirebaseRemoteConfig firebaseRemoteConfig = FirebaseRemoteConfig.getInstance(); // set in-app defaults Map<String, Object> remoteConfigDefaults = new HashMap(); remoteConfigDefaults.put(ForceUpdateChecker.KEY_UPDATE_REQUIRED, false); remoteConfigDefaults.put(ForceUpdateChecker.KEY_CURRENT_VERSION, "1.0"); remoteConfigDefaults.put(ForceUpdateChecker.KEY_UPDATE_URL, "https://play.google.com/store/apps/details?id=com.reryde.app"); firebaseRemoteConfig.setDefaults(remoteConfigDefaults); firebaseRemoteConfig.fetch(10) // fetch every minutes .addOnCompleteListener(new OnCompleteListener<Void>() { @Override public void onComplete(@NonNull Task<Void> task) { if (task.isSuccessful()) { Log.d(TAG, "remote config is fetched."); firebaseRemoteConfig.activateFetched(); } } }); } private void initCalligraphyConfig() { CalligraphyConfig.initDefault(new CalligraphyConfig.Builder() .setDefaultFontPath(getResources().getString(R.string.bariol)) .setFontAttrId(R.attr.fontPath) .build() ); } public static synchronized RerydeApplication getInstance() { return mInstance; } public RequestQueue getRequestQueue() { if (mRequestQueue == null) { mRequestQueue = Volley.newRequestQueue(getApplicationContext()); } return mRequestQueue; } public <T> void cancelRequestInQueue(String tag) { getRequestQueue().cancelAll(tag); } public <T> void addToRequestQueue(Request<T> req, String tag) { // set the no_user tag if tag is empty req.setTag(TextUtils.isEmpty(tag) ? TAG : tag); getRequestQueue().add(req); } public <T> void addToRequestQueue(Request<T> req) { req.setTag(TAG); getRequestQueue().add(req); } public void cancelPendingRequests(Object tag) { if (mRequestQueue != null) { mRequestQueue.cancelAll(tag); } } public static String trimMessage(String json){ String trimmedString = ""; try{ JSONObject jsonObject = new JSONObject(json); Iterator<String> iter = jsonObject.keys(); while (iter.hasNext()) { String key = iter.next(); try { JSONArray value = jsonObject.getJSONArray(key); for (int i = 0, size = value.length(); i < size; i++) { Log.e("Errors in Form",""+value.getString(i)); trimmedString += value.getString(i); if(i < size-1) { trimmedString += '\n'; } } } catch (JSONException e) { trimmedString += jsonObject.optString(key); } } } catch(JSONException e){ e.printStackTrace(); return null; } Log.e("Trimmed",""+trimmedString); return trimmedString; } }
[ "sundar@appoets.com" ]
sundar@appoets.com
55f6c2895dd2aede169f3ed575b391f9b1d6bab6
8b0ae134884d6f84217587194a2a0f775866ef55
/Vivo_y93/src/main/java/com/vivo/audiotags/ape/util/MonkeyInfoReader.java
5d1104171fd4ba8e7b4ba0b89210ffad6eeccc23
[]
no_license
wanbing/VivoFramework
69032750f376178d27d0d1ac170cf89bba907cc7
8d31381ecc788afb023960535bafbfa3b7df7d9b
refs/heads/master
2023-05-11T16:57:04.582985
2019-02-27T04:43:44
2019-02-27T04:43:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,874
java
package com.vivo.audiotags.ape.util; import com.vivo.audiotags.EncodingInfo; import com.vivo.audiotags.exceptions.CannotReadException; import com.vivo.audiotags.generic.Utils; import java.io.IOException; import java.io.RandomAccessFile; public class MonkeyInfoReader { public EncodingInfo read(RandomAccessFile raf) throws CannotReadException, IOException { EncodingInfo info = new EncodingInfo(); if (raf.length() == 0) { System.err.println("Error: File empty"); throw new CannotReadException("File is empty"); } raf.seek(0); byte[] b = new byte[4]; raf.read(b); if (new String(b).equals("MAC ")) { b = new byte[4]; raf.read(b); int version = Utils.getNumber(b, 0, 3); if (version < 3970) { throw new CannotReadException("Monkey Audio version <= 3.97 is not supported"); } b = new byte[44]; raf.read(b); MonkeyDescriptor md = new MonkeyDescriptor(b); b = new byte[24]; raf.read(b); MonkeyHeader mh = new MonkeyHeader(b); raf.seek((long) md.getRiffWavOffset()); raf.read(new byte[12]); raf.read(new byte[24]); info.setLength(mh.getLength()); info.setPreciseLength(mh.getPreciseLength()); info.setBitrate(computeBitrate(info.getLength(), raf.length())); info.setEncodingType("Monkey Audio v" + (((double) version) / 1000.0d) + ", compression level " + mh.getCompressionLevel()); info.setExtraEncodingInfos(""); return info; } throw new CannotReadException("'MAC ' Header not found"); } private int computeBitrate(int length, long size) { return (int) (((size / 1000) * 8) / ((long) length)); } }
[ "lygforbs0@gmail.com" ]
lygforbs0@gmail.com
337e0f1d3c9f0f9840558a5809585248114c4fef
216578d79e64770f7862212c2af1004a484fe770
/src/main/java/br/com/workmade/cursomc/security/JWTAuthorizationFilter.java
d7157571fa2608016a15f2c03ca4cab6b65ecdf9
[]
no_license
marcosradix/spring-boot-ionic-backend
6cfa4429851811cefcf6ab4bef33076c7bf5c21d
e293f4448a2f0b627a0ebc763ff4b759152c98e9
refs/heads/master
2020-04-04T11:37:33.608229
2019-01-27T20:10:56
2019-01-27T20:10:56
155,897,982
1
0
null
null
null
null
UTF-8
Java
false
false
2,019
java
package br.com.workmade.cursomc.security; import java.io.IOException; import javax.servlet.FilterChain; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.web.authentication.www.BasicAuthenticationFilter; import org.springframework.util.StringUtils; public class JWTAuthorizationFilter extends BasicAuthenticationFilter { private JWTUtil jwtUtil; private UserDetailsService userDetailsService; public JWTAuthorizationFilter(AuthenticationManager authenticationManager, JWTUtil jwtUtil, UserDetailsService userDetailsService) { super(authenticationManager); this.jwtUtil = jwtUtil; this.userDetailsService = userDetailsService; } @Override protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException { String header = request.getHeader("Authorization"); if(!StringUtils.isEmpty(header) && header.startsWith("Bearer ")) { UsernamePasswordAuthenticationToken auth = getAuthentication(header.substring(7)); if(!StringUtils.isEmpty(auth)) { SecurityContextHolder.getContext().setAuthentication(auth); } } chain.doFilter(request, response); } private UsernamePasswordAuthenticationToken getAuthentication(String token) { if(jwtUtil.tokenValido(token)) { String username = jwtUtil.getUsernameFromToken(token); UserDetails user = userDetailsService.loadUserByUsername(username); return new UsernamePasswordAuthenticationToken(user, null, user.getAuthorities()); } return null; } }
[ "marcosradix@gmail.com" ]
marcosradix@gmail.com
2befd3bb4698673f6d45daa82dbdf3bf82685da5
879c9a34df20979e4b3da067292f81aa253a1c32
/blstation-master/blstation-entity/src/main/java/com/bl/station/entity/Cooperate.java
af41b2893df215a1f46d4d2aefa6d2d93d729623
[ "Apache-2.0" ]
permissive
itastro/mycode
bdd42061e94c89113731a9cfc767500a7c34dabd
f386a58056704dabf1ca38c89fc7fa52963ee330
refs/heads/master
2021-05-15T23:24:39.355431
2018-12-04T04:26:35
2018-12-04T04:26:35
106,793,829
1
0
null
null
null
null
UTF-8
Java
false
false
1,173
java
package com.bl.station.entity; import java.util.Date; public class Cooperate { private Integer id; private String name; private Date updatetime; private Date createtime; private String remark; private String url; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name == null ? null : name.trim(); } public Date getUpdatetime() { return updatetime; } public void setUpdatetime(Date updatetime) { this.updatetime = updatetime; } public Date getCreatetime() { return createtime; } public void setCreatetime(Date createtime) { this.createtime = createtime; } public String getRemark() { return remark; } public void setRemark(String remark) { this.remark = remark == null ? null : remark.trim(); } public String getUrl() { return url; } public void setUrl(String url) { this.url = url == null ? null : url.trim(); } }
[ "itastro@163.com" ]
itastro@163.com
301e4f4bb7fa04713f755fbc68741738d5ca021c
dab945db8541c30011771caf8ddb63ec8c683618
/src/com/osp/ide/utils/AnalysisUtil.java
2d010a16d40614128e0f5513ab44f152d3ece59b
[]
no_license
romanm11/bada-SDK-1.0.0-com.osp.ide
feb25cd9727e5f746cf618c752f933ca4a4ab61c
cd051d031310457a90eb558212b6c93b62b4dbf0
refs/heads/master
2020-04-06T04:20:24.837952
2010-10-27T18:46:27
2010-10-27T18:46:27
1,132,307
0
0
null
null
null
null
UTF-8
Java
false
false
3,586
java
package com.osp.ide.utils; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.osgi.util.NLS; import com.fasoo.bada.FHashBinary; import com.fasoo.bada.FSigning; import com.osp.ide.IConstants; import com.osp.ide.IdePlugin; import com.osp.ide.core.ManifestXmlStore; public class AnalysisUtil { public static final int INX_EXT_HTB = 0; public static final int INX_SIGNATURE_XML = 1; public static final int NUMBER_OF_IDX = 2; private String errorString=null; Throwable exception = null; public IFile[] createAnalysisFile(IProject badaProject, IPath exePath, IProgressMonitor monitor) { return createAnalysisFile(badaProject, badaProject, exePath, monitor); } public IFile[] createAnalysisFile(IProject badaProject, IProject rootProject, IPath exePath, IProgressMonitor monitor) { IFile[] analFile = new IFile[NUMBER_OF_IDX]; try { ManifestXmlStore maniStore = IdePlugin.getDefault().getManifestXmlStore(badaProject); String fileExeName = exePath.toFile().getName(); int index = fileExeName.lastIndexOf("."); if( index > 0 ) fileExeName = fileExeName.substring(0, index) + IConstants.EXT_HTB; else fileExeName = fileExeName + IConstants.EXT_HTB; FHashBinary.FHashApplication(maniStore.getId().getBytes(), maniStore.getAppVersion(), maniStore.getSecret().getBytes(), // app secrete 32 byte exePath.toOSString(), rootProject.getLocation().toOSString() + IConstants.FILE_SEP_BSLASH + fileExeName); IFile htbFile = rootProject.getFile(fileExeName); htbFile.refreshLocal(IResource.DEPTH_ONE, null); if( htbFile == null || htbFile.exists() == false) { addErrorMsg("Analysis error: " + fileExeName + " not generated.", null); return null; } else { analFile[INX_EXT_HTB] = htbFile; } String sdkHome = IdePlugin.getDefault().getSDKPath(badaProject); String manifestFilePath = badaProject.getLocation().append(IConstants.MANIFEST_FILE).toOSString(); FSigning.FSigningPackage(sdkHome + IConstants.DIR_IDE, exePath.toOSString(), manifestFilePath, htbFile.getLocation().toOSString(), rootProject.getLocation().toOSString() + IConstants.FILE_SEP_BSLASH + IConstants.FILE_SIGNATURE_XML ); IFile sigFile = rootProject.getFile(IConstants.FILE_SIGNATURE_XML); sigFile.refreshLocal(IResource.DEPTH_ONE, null); if( sigFile == null || sigFile.exists() == false) { addErrorMsg("Analysis error: " + IConstants.FILE_SIGNATURE_XML + " not generated.", null); return null; } else { analFile[INX_SIGNATURE_XML] = sigFile; } } catch (IllegalArgumentException e) { // TODO Auto-generated catch block // e.printStackTrace(); addErrorMsg(NLS.bind("Analysis error occured.", e.getMessage()), e); } catch (Exception e) { // TODO Auto-generated catch block // e.printStackTrace(); addErrorMsg(NLS.bind("Analysis error occured.", e.getMessage()), e); } return analFile; } protected void addErrorMsg(String msg, Throwable e) { errorString = msg; exception = e; } public String getErrorMsg() { return errorString; } public boolean isErrorOccured() { return !(errorString == null); } public Throwable getException() { return exception; } }
[ "rom@garay.(none)" ]
rom@garay.(none)
d418a4f0067a68f195863dece1450d954c914506
d25147a40e63e9e64a20a1a3dc8032605fd7d24e
/src/chapterThree/DateeTest.java
b228c4a53fb38cb7cc17e0cc210c7ef1238ecd57
[]
no_license
Wealthysdot/Deitel_java
fbf540ed6c6b3c2694f3e1b0609627180c9e8cef
84b5db7219a5013bb6a30ec8be5d8554b39ab4fe
refs/heads/main
2023-03-27T05:02:29.975360
2021-03-28T13:07:08
2021-03-28T13:07:08
340,776,835
0
0
null
null
null
null
UTF-8
Java
false
false
501
java
package chapterThree; import java.util.Scanner; public class DateeTest { public static void main(String[] args) { Scanner input = new Scanner(System.in); Datee dateTest = new Datee(31, 5,1993); System.out.println("input month"); int month = input.nextInt(); System.out.println("input day"); int day = input.nextInt(); System.out.println("input year"); int year = input.nextInt(); dateTest.getDisplayDate(); } }
[ "sobamboadedotun@gmail.com" ]
sobamboadedotun@gmail.com
ebd28d0278bca017f1590ba40f719c20fbfb3d55
57fc96d08111c107c9208ce6320d095ef5145e58
/src/javaGameCenterProject/Adapters/MernisServiceAdapter.java
94546e17b54b52a391f08464e0e25431d3a2c605
[]
no_license
barisertugrul/JavaCamp-GameCenterProject
c411a99fd7087e8b4f3662e99875a08b2c4a295b
05cff2d152f34bae916f0598bf5dcec0a9a9f410
refs/heads/master
2023-04-19T01:59:34.343215
2021-05-05T21:36:27
2021-05-05T21:36:27
364,526,429
0
0
null
null
null
null
UTF-8
Java
false
false
757
java
package javaGameCenterProject.Adapters; import java.rmi.RemoteException; import javaGameCenterProject.Abstract.MernisValitadable; import javaGameCenterProject.Abstract.UserValidationService; import tr.gov.nvi.tckimlik.WS.KPSPublicSoap; import tr.gov.nvi.tckimlik.WS.KPSPublicSoapProxy; public class MernisServiceAdapter implements UserValidationService { @Override public boolean Validate(MernisValitadable user) {KPSPublicSoap client= new KPSPublicSoapProxy(); try { return client.TCKimlikNoDogrula(Long.parseLong(user.getNationalityId()), user.getFirstName().toUpperCase(), user.getLastName().toUpperCase(), user.getDateOfBirth().getYear()); } catch (NumberFormatException | RemoteException e) { e.printStackTrace(); return false; } } }
[ "barisertugrul@ertyazilim.com" ]
barisertugrul@ertyazilim.com
5bc674d4c822fb1ef44e0e5e84b5c2e9df47c484
523a1fe87ce77531b512fd7fc1f53a6608228c9c
/src/com/dfbz/day05/Test4.java
f2c61be429cd3450d32bb4e3e48a46a177635647
[]
no_license
Yy147785/hello
7f433a21f798486ddc346cd4c8fbdb416390f210
b77dd031f7561cf52479c39de1d0e4759c6cca9f
refs/heads/master
2020-07-07T11:37:41.431521
2019-08-20T08:54:46
2019-08-20T08:54:46
203,337,834
0
0
null
null
null
null
UTF-8
Java
false
false
374
java
package com.dfbz.day05; public class Test4 { public static void main(String[] args) { int[] arr={1,8,10,12,18,28,12}; printBall(arr); } public static void printBall(int[] array){ System.out.println("您的双色球号码为:"); for(int i=0;i< array.length;i++){ System.out.print(array[i]+"\t"); } } }
[ "yy13125318728" ]
yy13125318728
5c278521a4e9b4f29511a3a4b3322c4fe903b281
d9477e8e6e0d823cf2dec9823d7424732a7563c4
/plugins/CamelComplete/tags/release-1_2/src/com/illengineer/jcc/CamelCaseTokenizer.java
fdb4d0240f88bf53e03286e6838fb9f2cb740f26
[]
no_license
RobertHSchmidt/jedit
48fd8e1e9527e6f680de334d1903a0113f9e8380
2fbb392d6b569aefead29975b9be12e257fbe4eb
refs/heads/master
2023-08-30T02:52:55.676638
2018-07-11T13:28:01
2018-07-11T13:28:01
140,587,948
1
0
null
null
null
null
UTF-8
Java
false
false
1,606
java
package com.illengineer.jcc; /* This tokenizer will work for identifiers written in the so-called "CamelCase" style. Some examples, along with their abbreviations, are: SwingUtilities -> SU GtkMessageBox -> GMB IOException -> IOE G_ModelScan -> GMS G_modelScan -> GmS G3openFile -> GoF _kml_openFile -> koF So the rule can basically be summarized as *All capital letters will be counted as part of the abbreviation *Any letter after a non-letter character will be counted as well. */ public class CamelCaseTokenizer implements Tokenizer { private StringBuilder buffer; private enum ParserState { FIRST, NORMAL, NONLETTER }; public CamelCaseTokenizer() { buffer = new StringBuilder(); } public char[] splitIdentifer(String identifier) { buffer.delete(0, buffer.length()); ParserState state = ParserState.FIRST; for (int i = 0; i < identifier.length(); i++) { char c = identifier.charAt(i); switch (state) { case FIRST: if (Character.isLetter(c)) { buffer.append(c); state = ParserState.NORMAL; } break; case NORMAL: if (Character.isUpperCase(c)) buffer.append(c); else if (!Character.isLetter(c)) state = ParserState.NONLETTER; break; case NONLETTER: if (Character.isLetter(c)) { buffer.append(c); state = ParserState.NORMAL; } break; } } char[] retval = new char[buffer.length()]; buffer.getChars(0, retval.length, retval, 0); return retval; } public String toString() { return "CamelCase"; } }
[ "jpavel@6b1eeb88-9816-0410-afa2-b43733a0f04e" ]
jpavel@6b1eeb88-9816-0410-afa2-b43733a0f04e
08cd2edfa41bd943e7475d8a408a0e700d71ada4
8a6453cd49949798c11f57462d3f64a1fa2fc441
/aws-java-sdk-alexaforbusiness/src/main/java/com/amazonaws/services/alexaforbusiness/model/SearchAddressBooksRequest.java
5c3498a5643c99528989da239eb8320b1fcbee1e
[ "Apache-2.0" ]
permissive
tedyu/aws-sdk-java
138837a2be45ecb73c14c0d1b5b021e7470520e1
c97c472fd66d7fc8982cb4cf3c4ae78de590cfe8
refs/heads/master
2020-04-14T14:17:28.985045
2019-01-02T21:46:53
2019-01-02T21:46:53
163,892,339
0
0
Apache-2.0
2019-01-02T21:38:39
2019-01-02T21:38:39
null
UTF-8
Java
false
false
14,060
java
/* * Copyright 2013-2018 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.alexaforbusiness.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.AmazonWebServiceRequest; /** * * @see <a href="http://docs.aws.amazon.com/goto/WebAPI/alexaforbusiness-2017-11-09/SearchAddressBooks" * target="_top">AWS API Documentation</a> */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class SearchAddressBooksRequest extends com.amazonaws.AmazonWebServiceRequest implements Serializable, Cloneable { /** * <p> * The filters to use to list a specified set of address books. The supported filter key is AddressBookName. * </p> */ private java.util.List<Filter> filters; /** * <p> * The sort order to use in listing the specified set of address books. The supported sort key is AddressBookName. * </p> */ private java.util.List<Sort> sortCriteria; /** * <p> * An optional token returned from a prior request. Use this token for pagination of results from this action. If * this parameter is specified, the response only includes results beyond the token, up to the value specified by * MaxResults. * </p> */ private String nextToken; /** * <p> * The maximum number of results to include in the response. If more results exist than the specified MaxResults * value, a token is included in the response so that the remaining results can be retrieved. * </p> */ private Integer maxResults; /** * <p> * The filters to use to list a specified set of address books. The supported filter key is AddressBookName. * </p> * * @return The filters to use to list a specified set of address books. The supported filter key is AddressBookName. */ public java.util.List<Filter> getFilters() { return filters; } /** * <p> * The filters to use to list a specified set of address books. The supported filter key is AddressBookName. * </p> * * @param filters * The filters to use to list a specified set of address books. The supported filter key is AddressBookName. */ public void setFilters(java.util.Collection<Filter> filters) { if (filters == null) { this.filters = null; return; } this.filters = new java.util.ArrayList<Filter>(filters); } /** * <p> * The filters to use to list a specified set of address books. The supported filter key is AddressBookName. * </p> * <p> * <b>NOTE:</b> This method appends the values to the existing list (if any). Use * {@link #setFilters(java.util.Collection)} or {@link #withFilters(java.util.Collection)} if you want to override * the existing values. * </p> * * @param filters * The filters to use to list a specified set of address books. The supported filter key is AddressBookName. * @return Returns a reference to this object so that method calls can be chained together. */ public SearchAddressBooksRequest withFilters(Filter... filters) { if (this.filters == null) { setFilters(new java.util.ArrayList<Filter>(filters.length)); } for (Filter ele : filters) { this.filters.add(ele); } return this; } /** * <p> * The filters to use to list a specified set of address books. The supported filter key is AddressBookName. * </p> * * @param filters * The filters to use to list a specified set of address books. The supported filter key is AddressBookName. * @return Returns a reference to this object so that method calls can be chained together. */ public SearchAddressBooksRequest withFilters(java.util.Collection<Filter> filters) { setFilters(filters); return this; } /** * <p> * The sort order to use in listing the specified set of address books. The supported sort key is AddressBookName. * </p> * * @return The sort order to use in listing the specified set of address books. The supported sort key is * AddressBookName. */ public java.util.List<Sort> getSortCriteria() { return sortCriteria; } /** * <p> * The sort order to use in listing the specified set of address books. The supported sort key is AddressBookName. * </p> * * @param sortCriteria * The sort order to use in listing the specified set of address books. The supported sort key is * AddressBookName. */ public void setSortCriteria(java.util.Collection<Sort> sortCriteria) { if (sortCriteria == null) { this.sortCriteria = null; return; } this.sortCriteria = new java.util.ArrayList<Sort>(sortCriteria); } /** * <p> * The sort order to use in listing the specified set of address books. The supported sort key is AddressBookName. * </p> * <p> * <b>NOTE:</b> This method appends the values to the existing list (if any). Use * {@link #setSortCriteria(java.util.Collection)} or {@link #withSortCriteria(java.util.Collection)} if you want to * override the existing values. * </p> * * @param sortCriteria * The sort order to use in listing the specified set of address books. The supported sort key is * AddressBookName. * @return Returns a reference to this object so that method calls can be chained together. */ public SearchAddressBooksRequest withSortCriteria(Sort... sortCriteria) { if (this.sortCriteria == null) { setSortCriteria(new java.util.ArrayList<Sort>(sortCriteria.length)); } for (Sort ele : sortCriteria) { this.sortCriteria.add(ele); } return this; } /** * <p> * The sort order to use in listing the specified set of address books. The supported sort key is AddressBookName. * </p> * * @param sortCriteria * The sort order to use in listing the specified set of address books. The supported sort key is * AddressBookName. * @return Returns a reference to this object so that method calls can be chained together. */ public SearchAddressBooksRequest withSortCriteria(java.util.Collection<Sort> sortCriteria) { setSortCriteria(sortCriteria); return this; } /** * <p> * An optional token returned from a prior request. Use this token for pagination of results from this action. If * this parameter is specified, the response only includes results beyond the token, up to the value specified by * MaxResults. * </p> * * @param nextToken * An optional token returned from a prior request. Use this token for pagination of results from this * action. If this parameter is specified, the response only includes results beyond the token, up to the * value specified by MaxResults. */ public void setNextToken(String nextToken) { this.nextToken = nextToken; } /** * <p> * An optional token returned from a prior request. Use this token for pagination of results from this action. If * this parameter is specified, the response only includes results beyond the token, up to the value specified by * MaxResults. * </p> * * @return An optional token returned from a prior request. Use this token for pagination of results from this * action. If this parameter is specified, the response only includes results beyond the token, up to the * value specified by MaxResults. */ public String getNextToken() { return this.nextToken; } /** * <p> * An optional token returned from a prior request. Use this token for pagination of results from this action. If * this parameter is specified, the response only includes results beyond the token, up to the value specified by * MaxResults. * </p> * * @param nextToken * An optional token returned from a prior request. Use this token for pagination of results from this * action. If this parameter is specified, the response only includes results beyond the token, up to the * value specified by MaxResults. * @return Returns a reference to this object so that method calls can be chained together. */ public SearchAddressBooksRequest withNextToken(String nextToken) { setNextToken(nextToken); return this; } /** * <p> * The maximum number of results to include in the response. If more results exist than the specified MaxResults * value, a token is included in the response so that the remaining results can be retrieved. * </p> * * @param maxResults * The maximum number of results to include in the response. If more results exist than the specified * MaxResults value, a token is included in the response so that the remaining results can be retrieved. */ public void setMaxResults(Integer maxResults) { this.maxResults = maxResults; } /** * <p> * The maximum number of results to include in the response. If more results exist than the specified MaxResults * value, a token is included in the response so that the remaining results can be retrieved. * </p> * * @return The maximum number of results to include in the response. If more results exist than the specified * MaxResults value, a token is included in the response so that the remaining results can be retrieved. */ public Integer getMaxResults() { return this.maxResults; } /** * <p> * The maximum number of results to include in the response. If more results exist than the specified MaxResults * value, a token is included in the response so that the remaining results can be retrieved. * </p> * * @param maxResults * The maximum number of results to include in the response. If more results exist than the specified * MaxResults value, a token is included in the response so that the remaining results can be retrieved. * @return Returns a reference to this object so that method calls can be chained together. */ public SearchAddressBooksRequest withMaxResults(Integer maxResults) { setMaxResults(maxResults); return this; } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getFilters() != null) sb.append("Filters: ").append(getFilters()).append(","); if (getSortCriteria() != null) sb.append("SortCriteria: ").append(getSortCriteria()).append(","); if (getNextToken() != null) sb.append("NextToken: ").append(getNextToken()).append(","); if (getMaxResults() != null) sb.append("MaxResults: ").append(getMaxResults()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof SearchAddressBooksRequest == false) return false; SearchAddressBooksRequest other = (SearchAddressBooksRequest) obj; if (other.getFilters() == null ^ this.getFilters() == null) return false; if (other.getFilters() != null && other.getFilters().equals(this.getFilters()) == false) return false; if (other.getSortCriteria() == null ^ this.getSortCriteria() == null) return false; if (other.getSortCriteria() != null && other.getSortCriteria().equals(this.getSortCriteria()) == false) return false; if (other.getNextToken() == null ^ this.getNextToken() == null) return false; if (other.getNextToken() != null && other.getNextToken().equals(this.getNextToken()) == false) return false; if (other.getMaxResults() == null ^ this.getMaxResults() == null) return false; if (other.getMaxResults() != null && other.getMaxResults().equals(this.getMaxResults()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getFilters() == null) ? 0 : getFilters().hashCode()); hashCode = prime * hashCode + ((getSortCriteria() == null) ? 0 : getSortCriteria().hashCode()); hashCode = prime * hashCode + ((getNextToken() == null) ? 0 : getNextToken().hashCode()); hashCode = prime * hashCode + ((getMaxResults() == null) ? 0 : getMaxResults().hashCode()); return hashCode; } @Override public SearchAddressBooksRequest clone() { return (SearchAddressBooksRequest) super.clone(); } }
[ "" ]
e641662f1cee1aa1e552d8814a534d6c7cc80423
6a4717fd3bfd68435fb054f93cf61d16daef41db
/qh_inspect/src/main/java/com/miu360/taxi_check/map/OverlayManager.java
234ae747d0d0abca2e518389f0850f7fd2ce7f60
[ "Apache-2.0" ]
permissive
mc190diancom/taxi_inspect
79a9d4ed1ac5666ca33090c6c81e2763c9bac79c
8e07e03006f520c1f33a6c5cad59e14e5eae34dd
refs/heads/master
2020-05-17T23:58:05.046853
2019-07-04T09:24:55
2019-07-04T09:24:55
184,045,911
0
0
Apache-2.0
2019-06-25T07:18:43
2019-04-29T09:58:41
Java
UTF-8
Java
false
false
3,417
java
package com.miu360.taxi_check.map; import com.baidu.mapapi.map.BaiduMap; import com.baidu.mapapi.map.BaiduMap.OnPolylineClickListener; import com.baidu.mapapi.map.MapStatusUpdateFactory; import com.baidu.mapapi.map.Marker; import com.baidu.mapapi.map.Overlay; import com.baidu.mapapi.map.OverlayOptions; import com.baidu.mapapi.model.LatLngBounds; import java.util.ArrayList; import java.util.List; import static com.baidu.mapapi.map.BaiduMap.OnMarkerClickListener; /** * 该类提供一个能够显示和管理多个Overlay的基类 * <p> * 复写{@link #getOverlayOptions()} 设置欲显示和管理的Overlay列表 * </p> * <p> * 通过 * {@link com.baidu.mapapi.map.BaiduMap#setOnMarkerClickListener(com.baidu.mapapi.map.BaiduMap.OnMarkerClickListener)} * 将覆盖物点击事件传递给OverlayManager后,OverlayManager才能响应点击事件。 * <p> * 复写{@link #onMarkerClick(com.baidu.mapapi.map.Marker)} 处理Marker点击事件 * </p> */ public abstract class OverlayManager implements OnMarkerClickListener, OnPolylineClickListener { BaiduMap mBaiduMap = null; private List<OverlayOptions> mOverlayOptionList = null; List<Overlay> mOverlayList = null; /** * 通过一个BaiduMap 对象构造 * * @param baiduMap */ public OverlayManager(BaiduMap baiduMap) { mBaiduMap = baiduMap; // mBaiduMap.setOnMarkerClickListener(this); if (mOverlayOptionList == null) { mOverlayOptionList = new ArrayList<OverlayOptions>(); } if (mOverlayList == null) { mOverlayList = new ArrayList<Overlay>(); } } /** * 覆写此方法设置要管理的Overlay列表 * * @return 管理的Overlay列表 */ public abstract List<OverlayOptions> getOverlayOptions(); /** * 将所有Overlay 添加到地图上 */ public final void addToMap() { if (mBaiduMap == null) { return; } removeFromMap(); List<OverlayOptions> overlayOptions = getOverlayOptions(); if (overlayOptions != null) { mOverlayOptionList.addAll(getOverlayOptions()); } for (OverlayOptions option : mOverlayOptionList) { mOverlayList.add(mBaiduMap.addOverlay(option)); } } /** * 将所有Overlay 从 地图上消除 */ public final void removeFromMap() { if (mBaiduMap == null) { return; } for (Overlay marker : mOverlayList) { marker.remove(); } mOverlayOptionList.clear(); mOverlayList.clear(); } /** * 缩放地图,使所有Overlay都在合适的视野内 * <p> * 注: 该方法只对Marker类型的overlay有效 * </p> * */ public void zoomToSpan() { if (mBaiduMap == null) { return; } if (mOverlayList.size() > 0) { LatLngBounds.Builder builder = new LatLngBounds.Builder(); for (Overlay overlay : mOverlayList) { // polyline 中的点可能太多,只按marker 缩放 if (overlay instanceof Marker) { builder.include(((Marker) overlay).getPosition()); } } mBaiduMap.setMapStatus(MapStatusUpdateFactory .newLatLngBounds(builder.build())); } } }
[ "522357941@qq.com" ]
522357941@qq.com
faeee3c2eeebe85295186fba5933bfcd0edc99d3
b00c54389a95d81a22e361fa9f8bdf5a2edc93e3
/packages/apps/DeskClock/src/com/android/deskclock/alarms/AlarmActivity.java
8bffe21acefcbdeacc9211759a992ad0842db793
[ "Apache-2.0" ]
permissive
mirek190/x86-android-5.0
9d1756fa7ff2f423887aa22694bd737eb634ef23
eb1029956682072bb7404192a80214189f0dc73b
refs/heads/master
2020-05-27T01:09:51.830208
2015-10-07T22:47:36
2015-10-07T22:47:36
41,942,802
15
20
null
2020-03-09T00:21:03
2015-09-05T00:11:19
null
UTF-8
Java
false
false
21,283
java
/* * Copyright (C) 2014 The Android Open Source Project * * 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.android.deskclock.alarms; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorSet; import android.animation.ObjectAnimator; import android.animation.PropertyValuesHolder; import android.animation.ValueAnimator; import android.app.Activity; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.pm.ActivityInfo; import android.graphics.Color; import android.os.Bundle; import android.os.Handler; import android.preference.PreferenceManager; import android.support.annotation.NonNull; import android.view.KeyEvent; import android.view.MotionEvent; import android.view.View; import android.view.ViewAnimationUtils; import android.view.ViewGroup; import android.view.ViewGroupOverlay; import android.view.WindowManager; import android.view.animation.Interpolator; import android.view.animation.PathInterpolator; import android.widget.ImageButton; import android.widget.TextClock; import android.widget.TextView; import com.android.deskclock.AnimatorUtils; import com.android.deskclock.LogUtils; import com.android.deskclock.R; import com.android.deskclock.SettingsActivity; import com.android.deskclock.Utils; import com.android.deskclock.provider.AlarmInstance; public class AlarmActivity extends Activity implements View.OnClickListener, View.OnTouchListener { /** * AlarmActivity listens for this broadcast intent, so that other applications can snooze the * alarm (after ALARM_ALERT_ACTION and before ALARM_DONE_ACTION). */ public static final String ALARM_SNOOZE_ACTION = "com.android.deskclock.ALARM_SNOOZE"; /** * AlarmActivity listens for this broadcast intent, so that other applications can dismiss * the alarm (after ALARM_ALERT_ACTION and before ALARM_DONE_ACTION). */ public static final String ALARM_DISMISS_ACTION = "com.android.deskclock.ALARM_DISMISS"; private static final String LOGTAG = AlarmActivity.class.getSimpleName(); private static final Interpolator PULSE_INTERPOLATOR = new PathInterpolator(0.4f, 0.0f, 0.2f, 1.0f); private static final Interpolator REVEAL_INTERPOLATOR = new PathInterpolator(0.0f, 0.0f, 0.2f, 1.0f); private static final int PULSE_DURATION_MILLIS = 1000; private static final int ALARM_BOUNCE_DURATION_MILLIS = 500; private static final int ALERT_SOURCE_DURATION_MILLIS = 250; private static final int ALERT_REVEAL_DURATION_MILLIS = 500; private static final int ALERT_FADE_DURATION_MILLIS = 500; private static final int ALERT_DISMISS_DELAY_MILLIS = 2000; private static final float BUTTON_SCALE_DEFAULT = 0.7f; private static final int BUTTON_DRAWABLE_ALPHA_DEFAULT = 165; private final Handler mHandler = new Handler(); private final BroadcastReceiver mReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { final String action = intent.getAction(); LogUtils.v(LOGTAG, "Received broadcast: %s", action); if (!mAlarmHandled) { switch (action) { case ALARM_SNOOZE_ACTION: snooze(); break; case ALARM_DISMISS_ACTION: dismiss(); break; case AlarmService.ALARM_DONE_ACTION: finish(); break; default: LogUtils.i(LOGTAG, "Unknown broadcast: %s", action); break; } } else { LogUtils.v(LOGTAG, "Ignored broadcast: %s", action); } } }; private AlarmInstance mAlarmInstance; private boolean mAlarmHandled; private String mVolumeBehavior; private int mCurrentHourColor; private ViewGroup mContainerView; private ViewGroup mAlertView; private TextView mAlertTitleView; private TextView mAlertInfoView; private ViewGroup mContentView; private ImageButton mAlarmButton; private ImageButton mSnoozeButton; private ImageButton mDismissButton; private TextView mHintView; private ValueAnimator mAlarmAnimator; private ValueAnimator mSnoozeAnimator; private ValueAnimator mDismissAnimator; private ValueAnimator mPulseAnimator; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); final long instanceId = AlarmInstance.getId(getIntent().getData()); mAlarmInstance = AlarmInstance.getInstance(getContentResolver(), instanceId); if (mAlarmInstance != null) { LogUtils.i(LOGTAG, "Displaying alarm for instance: %s", mAlarmInstance); } else { // The alarm got deleted before the activity got created, so just finish() LogUtils.e(LOGTAG, "Error displaying alarm for intent: %s", getIntent()); finish(); return; } // Get the volume/camera button behavior setting mVolumeBehavior = PreferenceManager.getDefaultSharedPreferences(this) .getString(SettingsActivity.KEY_VOLUME_BEHAVIOR, SettingsActivity.DEFAULT_VOLUME_BEHAVIOR); getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON | WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON); // In order to allow tablets to freely rotate and phones to stick // with "nosensor" (use default device orientation) we have to have // the manifest start with an orientation of unspecified" and only limit // to "nosensor" for phones. Otherwise we get behavior like in b/8728671 // where tablets start off in their default orientation and then are // able to freely rotate. if (!getResources().getBoolean(R.bool.config_rotateAlarmAlert)) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_NOSENSOR); } setContentView(R.layout.alarm_activity); mContainerView = (ViewGroup) findViewById(android.R.id.content); mAlertView = (ViewGroup) mContainerView.findViewById(R.id.alert); mAlertTitleView = (TextView) mAlertView.findViewById(R.id.alert_title); mAlertInfoView = (TextView) mAlertView.findViewById(R.id.alert_info); mContentView = (ViewGroup) mContainerView.findViewById(R.id.content); mAlarmButton = (ImageButton) mContentView.findViewById(R.id.alarm); mSnoozeButton = (ImageButton) mContentView.findViewById(R.id.snooze); mDismissButton = (ImageButton) mContentView.findViewById(R.id.dismiss); mHintView = (TextView) mContentView.findViewById(R.id.hint); final TextView titleView = (TextView) mContentView.findViewById(R.id.title); final TextClock digitalClock = (TextClock) mContentView.findViewById(R.id.digital_clock); final View pulseView = mContentView.findViewById(R.id.pulse); titleView.setText(mAlarmInstance.getLabelOrDefault(this)); Utils.setTimeFormat(digitalClock, getResources().getDimensionPixelSize(R.dimen.main_ampm_font_size)); mCurrentHourColor = Utils.getCurrentHourColor(); mContainerView.setBackgroundColor(mCurrentHourColor); mAlarmButton.setOnTouchListener(this); mSnoozeButton.setOnClickListener(this); mDismissButton.setOnClickListener(this); mAlarmAnimator = AnimatorUtils.getScaleAnimator(mAlarmButton, 1.0f, 0.0f); mSnoozeAnimator = getButtonAnimator(mSnoozeButton, Color.WHITE); mDismissAnimator = getButtonAnimator(mDismissButton, mCurrentHourColor); mPulseAnimator = ObjectAnimator.ofPropertyValuesHolder(pulseView, PropertyValuesHolder.ofFloat(View.SCALE_X, 0.0f, 1.0f), PropertyValuesHolder.ofFloat(View.SCALE_Y, 0.0f, 1.0f), PropertyValuesHolder.ofFloat(View.ALPHA, 1.0f, 0.0f)); mPulseAnimator.setDuration(PULSE_DURATION_MILLIS); mPulseAnimator.setInterpolator(PULSE_INTERPOLATOR); mPulseAnimator.setRepeatCount(ValueAnimator.INFINITE); mPulseAnimator.start(); // Set the animators to their initial values. setAnimatedFractions(0.0f /* snoozeFraction */, 0.0f /* dismissFraction */); // Register to get the alarm done/snooze/dismiss intent. final IntentFilter filter = new IntentFilter(AlarmService.ALARM_DONE_ACTION); filter.addAction(ALARM_SNOOZE_ACTION); filter.addAction(ALARM_DISMISS_ACTION); registerReceiver(mReceiver, filter); } @Override public void onDestroy() { super.onDestroy(); // If the alarm instance is null the receiver was never registered and calling // unregisterReceiver will throw an exception. if (mAlarmInstance != null) { unregisterReceiver(mReceiver); } } @Override public boolean dispatchKeyEvent(@NonNull KeyEvent keyEvent) { // Do this in dispatch to intercept a few of the system keys. LogUtils.v(LOGTAG, "dispatchKeyEvent: %s", keyEvent); switch (keyEvent.getKeyCode()) { // Volume keys and camera keys dismiss the alarm. case KeyEvent.KEYCODE_POWER: case KeyEvent.KEYCODE_VOLUME_UP: case KeyEvent.KEYCODE_VOLUME_DOWN: case KeyEvent.KEYCODE_VOLUME_MUTE: case KeyEvent.KEYCODE_CAMERA: case KeyEvent.KEYCODE_FOCUS: if (!mAlarmHandled && keyEvent.getAction() == KeyEvent.ACTION_UP) { switch (mVolumeBehavior) { case SettingsActivity.VOLUME_BEHAVIOR_SNOOZE: snooze(); break; case SettingsActivity.VOLUME_BEHAVIOR_DISMISS: dismiss(); break; default: break; } } return true; default: return super.dispatchKeyEvent(keyEvent); } } @Override public void onBackPressed() { // Don't allow back to dismiss. } @Override public void onClick(View view) { if (mAlarmHandled) { LogUtils.v(LOGTAG, "onClick ignored: %s", view); return; } LogUtils.v(LOGTAG, "onClick: %s", view); final int alarmLeft = mAlarmButton.getLeft() + mAlarmButton.getPaddingLeft(); final int alarmRight = mAlarmButton.getRight() - mAlarmButton.getPaddingRight(); final float translationX = Math.max(view.getLeft() - alarmRight, 0) + Math.min(view.getRight() - alarmLeft, 0); getAlarmBounceAnimator(translationX, translationX < 0.0f ? R.string.description_direction_left : R.string.description_direction_right).start(); } @Override public boolean onTouch(View view, MotionEvent motionEvent) { if (mAlarmHandled) { LogUtils.v(LOGTAG, "onTouch ignored: %s", motionEvent); return false; } final int[] contentLocation = {0, 0}; mContentView.getLocationOnScreen(contentLocation); final float x = motionEvent.getRawX() - contentLocation[0]; final float y = motionEvent.getRawY() - contentLocation[1]; final int alarmLeft = mAlarmButton.getLeft() + mAlarmButton.getPaddingLeft(); final int alarmRight = mAlarmButton.getRight() - mAlarmButton.getPaddingRight(); final float snoozeFraction, dismissFraction; if (mContentView.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) { snoozeFraction = getFraction(alarmRight, mSnoozeButton.getLeft(), x); dismissFraction = getFraction(alarmLeft, mDismissButton.getRight(), x); } else { snoozeFraction = getFraction(alarmLeft, mSnoozeButton.getRight(), x); dismissFraction = getFraction(alarmRight, mDismissButton.getLeft(), x); } setAnimatedFractions(snoozeFraction, dismissFraction); switch (motionEvent.getActionMasked()) { case MotionEvent.ACTION_DOWN: LogUtils.v(LOGTAG, "onTouch started: %s", motionEvent); // Stop the pulse, allowing the last pulse to finish. mPulseAnimator.setRepeatCount(0); break; case MotionEvent.ACTION_UP: LogUtils.v(LOGTAG, "onTouch ended: %s", motionEvent); if (snoozeFraction == 1.0f) { snooze(); } else if (dismissFraction == 1.0f) { dismiss(); } else { if (snoozeFraction > 0.0f || dismissFraction > 0.0f) { // Animate back to the initial state. AnimatorUtils.reverse(mAlarmAnimator, mSnoozeAnimator, mDismissAnimator); } else if (mAlarmButton.getTop() <= y && y <= mAlarmButton.getBottom()) { // User touched the alarm button, hint the dismiss action. mDismissButton.performClick(); } // Restart the pulse. mPulseAnimator.setRepeatCount(ValueAnimator.INFINITE); if (!mPulseAnimator.isStarted()) { mPulseAnimator.start(); } } break; default: break; } return true; } private void snooze() { mAlarmHandled = true; LogUtils.v(LOGTAG, "Snoozed: %s", mAlarmInstance); final int alertColor = getResources().getColor(R.color.hot_pink); setAnimatedFractions(1.0f /* snoozeFraction */, 0.0f /* dismissFraction */); getAlertAnimator(mSnoozeButton, R.string.alarm_alert_snoozed_text, AlarmStateManager.getSnoozedMinutes(this), alertColor, alertColor).start(); AlarmStateManager.setSnoozeState(this, mAlarmInstance, false /* showToast */); } private void dismiss() { mAlarmHandled = true; LogUtils.v(LOGTAG, "Dismissed: %s", mAlarmInstance); setAnimatedFractions(0.0f /* snoozeFraction */, 1.0f /* dismissFraction */); getAlertAnimator(mDismissButton, R.string.alarm_alert_off_text, null /* infoText */, Color.WHITE, mCurrentHourColor).start(); AlarmStateManager.setDismissState(this, mAlarmInstance); } private void setAnimatedFractions(float snoozeFraction, float dismissFraction) { final float alarmFraction = Math.max(snoozeFraction, dismissFraction); AnimatorUtils.setAnimatedFraction(mAlarmAnimator, alarmFraction); AnimatorUtils.setAnimatedFraction(mSnoozeAnimator, snoozeFraction); AnimatorUtils.setAnimatedFraction(mDismissAnimator, dismissFraction); } private float getFraction(float x0, float x1, float x) { return Math.max(Math.min((x - x0) / (x1 - x0), 1.0f), 0.0f); } private ValueAnimator getButtonAnimator(ImageButton button, int tintColor) { return ObjectAnimator.ofPropertyValuesHolder(button, PropertyValuesHolder.ofFloat(View.SCALE_X, BUTTON_SCALE_DEFAULT, 1.0f), PropertyValuesHolder.ofFloat(View.SCALE_Y, BUTTON_SCALE_DEFAULT, 1.0f), PropertyValuesHolder.ofInt(AnimatorUtils.BACKGROUND_ALPHA, 0, 255), PropertyValuesHolder.ofInt(AnimatorUtils.DRAWABLE_ALPHA, BUTTON_DRAWABLE_ALPHA_DEFAULT, 255), PropertyValuesHolder.ofObject(AnimatorUtils.DRAWABLE_TINT, AnimatorUtils.ARGB_EVALUATOR, Color.WHITE, tintColor)); } private ValueAnimator getAlarmBounceAnimator(float translationX, final int hintResId) { final ValueAnimator bounceAnimator = ObjectAnimator.ofFloat(mAlarmButton, View.TRANSLATION_X, mAlarmButton.getTranslationX(), translationX, 0.0f); bounceAnimator.setInterpolator(AnimatorUtils.DECELERATE_ACCELERATE_INTERPOLATOR); bounceAnimator.setDuration(ALARM_BOUNCE_DURATION_MILLIS); bounceAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animator) { mHintView.setText(hintResId); if (mHintView.getVisibility() != View.VISIBLE) { mHintView.setVisibility(View.VISIBLE); ObjectAnimator.ofFloat(mHintView, View.ALPHA, 0.0f, 1.0f).start(); } } }); return bounceAnimator; } private Animator getAlertAnimator(final View source, final int titleResId, final String infoText, final int revealColor, final int backgroundColor) { final ViewGroupOverlay overlay = mContainerView.getOverlay(); // Create a transient view for performing the reveal animation. final View revealView = new View(this); revealView.setRight(mContainerView.getWidth()); revealView.setBottom(mContainerView.getHeight()); revealView.setBackgroundColor(revealColor); overlay.add(revealView); // Add the source to the containerView's overlay so that the animation can occur under the // status bar, the source view will be automatically positioned in the overlay so that // it maintains the same relative position on screen. overlay.add(source); final int centerX = Math.round((source.getLeft() + source.getRight()) / 2.0f); final int centerY = Math.round((source.getTop() + source.getBottom()) / 2.0f); final float startRadius = Math.max(source.getWidth(), source.getHeight()) / 2.0f; final int xMax = Math.max(centerX, mContainerView.getWidth() - centerX); final int yMax = Math.max(centerY, mContainerView.getHeight() - centerY); final float endRadius = (float) Math.sqrt(Math.pow(xMax, 2.0) + Math.pow(yMax, 2.0)); final ValueAnimator sourceAnimator = ObjectAnimator.ofFloat(source, View.ALPHA, 0.0f); sourceAnimator.setDuration(ALERT_SOURCE_DURATION_MILLIS); sourceAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { overlay.remove(source); } }); final Animator revealAnimator = ViewAnimationUtils.createCircularReveal( revealView, centerX, centerY, startRadius, endRadius); revealAnimator.setDuration(ALERT_REVEAL_DURATION_MILLIS); revealAnimator.setInterpolator(REVEAL_INTERPOLATOR); revealAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animator) { mAlertView.setVisibility(View.VISIBLE); mAlertTitleView.setText(titleResId); if (infoText != null) { mAlertInfoView.setText(infoText); mAlertInfoView.setVisibility(View.VISIBLE); } mContentView.setVisibility(View.GONE); mContainerView.setBackgroundColor(backgroundColor); } }); final ValueAnimator fadeAnimator = ObjectAnimator.ofFloat(revealView, View.ALPHA, 0.0f); fadeAnimator.setDuration(ALERT_FADE_DURATION_MILLIS); fadeAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { overlay.remove(revealView); } }); final AnimatorSet alertAnimator = new AnimatorSet(); alertAnimator.play(revealAnimator).with(sourceAnimator).before(fadeAnimator); alertAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animator) { mHandler.postDelayed(new Runnable() { @Override public void run() { finish(); } }, ALERT_DISMISS_DELAY_MILLIS); } }); return alertAnimator; } }
[ "mirek190@gmail.com" ]
mirek190@gmail.com
8955cdabafac249ccf5cd422580d46abe799f828
204d2214e7c9a0bda5e2161f840d3330d8730974
/progr2/Esercizi/extr/extr3/Lists.java
1b89accaa1c327d59a0900f2c5d283b53292212d
[]
no_license
andreadlm/unito
dd8135e1c47f1100d2fcbec9d7215c79547f4c60
fa3e74b0de96dbd3098bfdbdc2537caea7651000
refs/heads/master
2022-02-28T17:43:47.039257
2022-02-16T09:42:28
2022-02-16T09:42:28
213,619,211
0
0
null
null
null
null
UTF-8
Java
false
false
4,359
java
package extr.extr3; public class Lists { public static <T> void truncate(Node<Node<T>> ll, int x){ while(ll != null) { if(x == 0) ll.setElem(null); else { // Prelevo il nodo corrente Node<T> n = ll.getElem(); int c = 0; while(n != null && c < x - 1) { n = n.getNext(); c++; } if(n != null) n.setNext(null); } ll = ll.getNext(); } } private static void removeLessThan(Node<Node<Integer>> ll, int x) { while(ll != null) { // Prelevo il nodo corrente Node<Integer> n = ll.getElem(); // Scorro il nodo corrente while(n != null && n.getElem() < x) { ll.setElem(n.getNext()); n = n.getNext(); } while(n != null && n.getNext() != null) { if(n.getNext().getElem() < x) n.setNext(n.getNext().getNext()); n = n.getNext(); } ll = ll.getNext(); } } private static void addOdd(Node<Node<Integer>> ll) { while(ll != null) { // Prelevo il nodo Node<Integer> n = ll.getElem(); // Scorro il nodo while(n != null) { if(n.getElem() % 2 == 0) { n.setNext(new Node<Integer>(n.getElem() + 1, n.getNext())); n = n.getNext(); // Salto l'elaborazione del nodo sicuramente dispari } n = n.getNext(); } ll = ll.getNext(); } } public static Node<Node<Integer>> removeEmptyLists(Node<Node<Integer>> ll) { if(ll == null) return null; if(ll.getElem() == null) return removeEmptyLists(ll.getNext()); else return new Node<Node<Integer>>(ll.getElem(), removeEmptyLists(ll.getNext())); } private static int totalNumberOfElementsInLists(Node<Node<Integer>> ll) { int s = 0; while(ll != null) { Node<Integer> l = ll.getElem(); while(l != null) { s++; l = l.getNext(); } ll = ll.getNext(); } return s; } private static Node<Node<Integer>> addListOfMaxs(Node<Node<Integer>> ll) { Node<Integer> p = null; Node<Node<Integer>> tmp = ll; while(tmp != null) { Node<Integer> n = tmp.getElem(); Integer max = Integer.MIN_VALUE; while(n != null) { if(n.getElem() > max) max = n.getElem(); n = n.getNext(); } if(max != Integer.MIN_VALUE) p = new Node<Integer>(max, p); tmp = tmp.getNext(); } return ll == null ? ll : new Node<Node<Integer>>(p, ll); } } class Node<T>{ private T elem; private Node<T> next; public Node(T elem, Node<T> next){ this.elem=elem; this.next=next; } public T getElem(){ return elem; } public Node<T> getNext(){ return next; } public void setElem(T elem){ this.elem=elem; } public void setNext(Node<T> next){ this.next=next; } @Override public String toString() { String res = "["; res += elem==null?"[]":elem.toString(); Node<T> p = next; while (p != null) { res += ","+((p.elem == null?"[]":p.elem.toString())); p = p.next; } return res += "]"; } } class List<T extends Comparable<T>> { private Node<T> first; public List() { first = null; } public void insertFirst(T elem) { first = new Node<>(elem, first); } @Override public String toString() { String s = ""; for (Node<T> p = first; p != null; p = p.getNext()) { if (p != first) s += ", "; s += p.getElem(); } return s; } public void delete(T x) { while(first != null && first.getElem().equals(x)) first = first.getNext(); Node<T> n = first; while(n != null && n.getNext() != null) { if(n.getNext().getElem().equals(x)) n.setNext(n.getNext().getNext()); n = n.getNext(); } } }
[ "delmastro2000@gmail.com" ]
delmastro2000@gmail.com
1c02e8cb449fa58774819d0786570aa65463929e
888a1c1b4252c8eab18f790cffeb66b0169846db
/app/src/test/java/com/example/amyas/grocery/ExampleUnitTest.java
1baca2c804db65f4762a4c6ae0f2094f537cd23b
[]
no_license
wuya34/grocery
789f30a2a60c6fb7fba173f6f7601b2c64ec75d4
e8fb36c45bad05e33526218acaa4867b34628b74
refs/heads/master
2021-09-09T02:02:19.015297
2018-03-13T08:54:37
2018-03-13T08:54:37
113,521,320
2
0
null
null
null
null
UTF-8
Java
false
false
914
java
package com.example.amyas.grocery; import android.net.Uri; import org.junit.Test; import java.util.ArrayList; import java.util.List; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { String uri = Uri.encode("https://webview.cht.znrmny.com/couponList?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VybmFtZSI6IjE4MTcwODc4ODQ5IiwiYWNjb3VudF9pZCI6IjIzIn0.NTjMa-FT_GbeiQ4QRFzwHnFs6J3dULVIPV0Rwx_QPOE"); System.out.println(uri); } @Test public void testListToArray(){ List<Integer> list = new ArrayList<>(); list.add(0); list.add(1); list.add(2); list.add(3); Integer[] array = list.toArray(new Integer[]{1}); } }
[ "geniusafteramyas@163.com" ]
geniusafteramyas@163.com
eef4cf72f20cedd87e901e8513743599df9ba088
a8fe6fe19686b08b14ab3b5523584b4518085f00
/com/advent/oc/domain/cacheStore/ResourceStore.java
64a6867186faf42c77b2a3e653f307f2f0d63320
[]
no_license
daweng/ocdomain
efa0dfbe6c7b9aa88ac8e513f7605f7bdf5e3c6c
d3209b9ce26f3d240e5e25d91da9c40fa774619e
refs/heads/master
2021-01-17T08:28:39.841281
2016-06-07T23:22:40
2016-06-07T23:22:40
60,638,975
0
0
null
null
null
null
UTF-8
Java
false
false
390
java
package com.advent.oc.domain.cacheStore; import com.advent.oc.cache.hibernateStore.blob.AbstractHibernateBlobStore; import com.advent.oc.domain.auth.Resource; import com.advent.oc.domain.entry.ResourceEntry; import org.springframework.stereotype.Component; import java.util.UUID; @Component public class ResourceStore extends AbstractHibernateBlobStore<UUID, Resource, ResourceEntry> { }
[ "help@genmymodel.com" ]
help@genmymodel.com
2a2caf7794972b8caa18378bc09155cab3babfd9
62a2f133d2dff201dc14c9dfbcc4932dafb0f397
/app/src/main/java/com/example/appweather/Model/Main.java
03dc18196321dbca7ea8895398f90e19615c8122
[]
no_license
CARLVINMUTAHI/AppWeather2
f27d3440ada7eb79fadc3fb5067f19af53f6d6d7
408a2839f266cccd182d8f021512d4438ff66ec1
refs/heads/master
2022-12-16T08:39:45.281320
2020-09-21T19:29:34
2020-09-21T19:29:34
297,440,861
0
0
null
null
null
null
UTF-8
Java
false
false
1,160
java
package com.example.appweather.Model; public class Main { private double temp; private double feels_like; private double temp_min; private double temp_max; private float pressure; private int humidity; public Main() { } public double getTemp() { return temp; } public void setTemp(double temp) { this.temp = temp; } public double getFeels_like() { return feels_like; } public void setFeels_like(double feels_like) { this.feels_like = feels_like; } public double getTemp_min() { return temp_min; } public void setTemp_min(double temp_min) { this.temp_min = temp_min; } public double getTemp_max() { return temp_max; } public void setTemp_max(double temp_max) { this.temp_max = temp_max; } public float getPressure() { return pressure; } public void setPressure(float pressure) { this.pressure = pressure; } public int getHumidity() { return humidity; } public void setHumidity(int humidity) { this.humidity = humidity; } }
[ "ngumocarlvin@gmail.com" ]
ngumocarlvin@gmail.com
6e9a1e396d26ba8235accb9568cf9b6264499af1
d3d7cc549f1089897b1eb3f47a0a1b4a13c3b381
/Auctions&SocialNetwork/src/commandsLib/CmdServer.java
6a05314c84fe70289f92f8074aa848cb161d9525
[]
no_license
marianosegura/auctions-and-social-network
cc6244f925e946beefadb4d7bb28244b1502a6ad
82e2cc7a1f0b3b9f328deb58f92ddc976520d315
refs/heads/main
2023-08-25T20:44:40.577561
2021-11-08T19:59:50
2021-11-08T19:59:50
421,170,102
0
0
null
null
null
null
UTF-8
Java
false
false
9,795
java
package commandsLib; import java.io.IOException; import java.net.InetSocketAddress; import java.net.ServerSocket; import java.util.ArrayList; /** * Command server. Handles socket connections and commands execution for a * given context. * @author Luis Mariano Ramírez Segura */ public class CmdServer { private ServerSocket serverSocket; // server socket private ArrayList<CmdSocket> cmdSockets; // connected command sockets private boolean running; // indicates if the server is active, can be used to stop all server threads private boolean logging; // print log received and sent commands flag /** * Constructor that receives the port used to listen for sockets. * @param port Server port * @throws IOException Error creating the server socket */ public CmdServer(int port) throws IOException { this.serverSocket = new ServerSocket(port); this.cmdSockets = new ArrayList<>(); this.running = true; this.logging = false; } /** * Starts an anonymous thread in which new sockets are accepted. For * each new socket connected an anonymous thread started to listen for * commands. Upon command received, the given cmdFactory is used to create * a concrete command and the given context object is passed to the command * for execution. The only exceptions for the command factory are the NameSocketCmd * (used to name a socket and target a specific socket when sending) and the DisconnectClinetCmd * (used to disconnect the socket from this server). * @param cmdFactory Commands factory, returns a concrete command for execution * @param context Context object being passed to the commands */ public void listen(ICmdFactory cmdFactory, Object context) { Thread listenThread = new Thread() { // start anonymous thread to accept connection sockets public void run() { while (running) { // accept sockets while the server is running try { CmdSocket cmdSocket = new CmdSocket(serverSocket.accept()); // accept new socket cmdSockets.add(cmdSocket); // add new socket if (logging) System.out.println("(CmdServer) New socket connected from " + ((InetSocketAddress)cmdSocket.getSocket().getRemoteSocketAddress()).getAddress().toString()); Thread socketThread = new Thread() { // start anonymous thread to listen socket commands public void run() { while(running) { // keep listening while server is running and socket is open String cmdString = cmdSocket.readCommandString(); if (cmdString != null) { if (logging) System.out.println("(CmdServer) " + cmdSocket.getName() + " sent: " + cmdString); String cmdIdentifier = Command.parseIdentifier(cmdString); CmdData cmdData = Command.parseData(cmdString); if (cmdIdentifier.equals("DISCONNECT_CLIENT")) break; if (cmdIdentifier.equals("NAME_SOCKET")) { // only command exception to factory is for socket naming new NameSocketCmd(cmdData).execute(cmdSocket); // pass client socket to be named } else { Command command = cmdFactory.getCommand(cmdIdentifier, cmdData); command.execute(context); // pass the server context to execute command } } } cmdSocket.close(); cmdSockets.remove(cmdSocket); // remove socket when closed } }; socketThread.start(); } catch (IOException ex) { System.out.println(ex); } } } }; listenThread.start(); } /** * Starts an anonymous thread in which new sockets are accepted. For * each new socket connected an anonymous thread started to listen for * commands. Upon command received, the given cmdFactory is used to create * a concrete command and the given context object is passed to the command * for execution. The only exceptions for the command factory are the NameSocketCmd * (used to name a socket and target a specific socket when sending) and the DisconnectClinetCmd * (used to disconnect the socket from this server). * Receives a hook to call when a named socket is disconnected. * @param cmdFactory Commands factory, returns a concrete command for execution * @param context Context object being passed to the commands * @param socketDisconnectedHook Hook called when a CmdSocket is disconnected */ public void listen(ICmdFactory cmdFactory, Object context, OnCmdSocketDisconnected socketDisconnectedHook) { Thread listenThread = new Thread() { // start anonymous thread to accept connection sockets public void run() { while (running) { // accept sockets while the server is running try { CmdSocket cmdSocket = new CmdSocket(serverSocket.accept()); // accept new socket cmdSockets.add(cmdSocket); // add new socket if (logging) System.out.println("(CmdServer) New socket connected from " + ((InetSocketAddress)cmdSocket.getSocket().getRemoteSocketAddress()).getAddress().toString()); Thread socketThread = new Thread() { // start anonymous thread to listen socket commands public void run() { while(running) { // keep listening while server is running and socket is open String cmdString = cmdSocket.readCommandString(); if (cmdString != null) { if (logging) System.out.println("(CmdServer) In (" + cmdSocket.getName() + "): " + cmdString); String cmdIdentifier = Command.parseIdentifier(cmdString); CmdData cmdData = Command.parseData(cmdString); if (cmdIdentifier.equals("DISCONNECT_CLIENT")) break; if (cmdIdentifier.equals("NAME_SOCKET")) { // only command exception to factory is for socket naming new NameSocketCmd(cmdData).execute(cmdSocket); // pass client socket to be named } else { Command command = cmdFactory.getCommand(cmdIdentifier, cmdData); command.execute(context); // pass the server context to execute command } } } cmdSocket.close(); cmdSockets.remove(cmdSocket); // remove socket when closed if (socketDisconnectedHook != null && cmdSocket.getName() != null) { socketDisconnectedHook.onCmdSocketDisconnected(cmdSocket.getName()); } } }; socketThread.start(); } catch (IOException ex) { System.out.println(ex); } } } }; listenThread.start(); } /** * Sends a command to all sockets. * @param command Command to send */ public void send(Command command) { for (CmdSocket socket : cmdSockets) { if (logging) System.out.println("(CmdServer) Out (" + socket.getName() + "): " + command.toString()); socket.send(command); } } /** * Sends a command to all sockets that match a given name. * @param command Command to send * @param socketName Socket name */ public void send(Command command, String socketName) { for (CmdSocket socket : cmdSockets) { if (socketName.equals(socket.getName())) { if (logging) System.out.println("(CmdServer) Out (" + socket.getName() + "): " + command.toString()); socket.send(command); } } } public ArrayList<CmdSocket> getCmdSockets() { return cmdSockets; } public void setLogging(boolean logging) { this.logging = logging; } public void setRunning(boolean running) { this.running = running; } public boolean isRunning() { return running; } }
[ "luismariano10del4@gmail.com" ]
luismariano10del4@gmail.com
56d87c6586fae302d727ee69556e949c4f4d51dd
19579e0c254b66304d4bf4454372ae2821044b9d
/relsellrssreaderwithsubscribe/RSSReader/app/src/main/java/com/rssreadertop/rssreader/RSSHandleXml2.java
148c493dfe30fc5323ae975f5b902e54ceef5d8c
[]
no_license
kuldeep074/GraphicEraBatchOne
1e19fc2a8fba4dfb6169efad133f4259ad7452b6
4fa7fcde84d9a22aead35f5121cdc21e78e4d460
refs/heads/master
2021-01-15T09:19:41.622680
2017-08-03T11:54:06
2017-08-03T11:54:06
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,346
java
/* * Copyright (c) 2017. Lorem ipsum dolor sit amet, consectetur adipiscing elit. * Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan. * Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna. * Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus. * Vestibulum commodo. Ut rhoncus gravida arcu. */ package com.rssreadertop.rssreader; /** * Created by anilkukreti on 05/02/16. */ import android.os.Handler; import android.os.Message; import android.text.Html; import com.rssreadertop.pojo.IRSSItem; import com.rssreadertop.pojo.RSSItem2; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserFactory; import java.io.InputStream; import java.net.HttpURLConnection; import java.net.URL; import java.util.ArrayList; public class RSSHandleXml2 implements IRSSHandler{ private String title = "title"; private String link = "link"; private String summary = "summary"; private String urlString = null; private RSSItem2 item; private boolean itemInitialized; String text=null; private ArrayList<IRSSItem> mItemList; private XmlPullParserFactory xmlFactoryObject; public volatile boolean parsingComplete = true; private Handler forRSS; public RSSHandleXml2(String url, ArrayList<IRSSItem> list, Handler handler){ this.urlString = url; this.mItemList = list; this.forRSS = handler; } public void parseXMLAndStoreIt(XmlPullParser myParser) { int event; try { event = myParser.getEventType(); while (event != XmlPullParser.END_DOCUMENT) { String name=myParser.getName(); switch (event){ case XmlPullParser.START_TAG: if(name.equals("entry")){ item = new RSSItem2(); itemInitialized = true; } break; case XmlPullParser.TEXT: text = myParser.getText(); break; case XmlPullParser.END_TAG: if(name.equals("entry")){ itemInitialized = false; mItemList.add(item); } else if (name.equals("title") && itemInitialized) { title = Html.fromHtml(text).toString(); item.setTitle(title); } else if (name.equals("link") && itemInitialized) { link = Html.fromHtml(text).toString(); item.setLink(link); } else if (name.equals("summary") && itemInitialized) { summary = text; item.setSummary(summary); } else if (name.equals("pubDate") && itemInitialized) { item.setPubDate(Html.fromHtml(text).toString()); } break; } event = myParser.next(); } parsingComplete = false; } catch (Exception e) { e.printStackTrace(); } } public void fetchXML(){ Thread thread = new Thread(new Runnable(){ @Override public void run() { try { URL url = new URL(urlString); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setReadTimeout(10000 /* milliseconds */); conn.setConnectTimeout(15000 /* milliseconds */); conn.setRequestMethod("GET"); conn.setRequestProperty("Content-type","application/rss+xml"); conn.setDoInput(true); // Starts the query conn.connect(); InputStream stream = conn.getInputStream(); /*InputStreamReader inputStreamReader = new InputStreamReader(stream,"UTF-8"); BufferedReader r = new BufferedReader(inputStreamReader); StringBuilder total = new StringBuilder(); String line; Log.v("Input = ", "start reading"); while ((line = r.readLine()) != null) { Log.v("Input = ","\n"); Log.v("Input = ",line); }*/ xmlFactoryObject = XmlPullParserFactory.newInstance(); //xmlFactoryObject.setValidating(false); XmlPullParser myparser = xmlFactoryObject.newPullParser(); myparser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true); myparser.setInput(stream,null); parseXMLAndStoreIt(myparser); stream.close(); Message msg = new Message(); msg.what = 1; forRSS.sendMessage(msg); } catch (Exception e) { e.printStackTrace(); } } }); thread.start(); } }
[ "relsellglobal@gmail.com" ]
relsellglobal@gmail.com
39d55d9f7e75818164a9b3c17f28a13ee884872a
dc6a6cc95530413c0c1e890a0e2d25b28c169b64
/java/javaWorkspace/Java14_Interface/src/fly/child/Bird.java
f46554e3380a1f6196e4f3759571c9822a98d1a2
[]
no_license
devyeony/2020.04-2020.08-TIL
93f110fda0d6c5bf62e6ed54f160f29034aa32c8
ff5eabd6c10493f4ad53fe2d1d80d7fc1b103ef9
refs/heads/master
2022-12-28T01:42:53.828505
2020-10-06T05:40:25
2020-10-06T05:40:25
null
0
0
null
null
null
null
UHC
Java
false
false
935
java
package fly.child; import fly.Flyer; /* * Flyer(인터페이스)를 상속받은 자식 클래스.. * 인터페이스를 부모로 둔 자식은 (Bird) 반드시 부모가 가진 모든 추상 메소드(구현부가 없는 메소드)를 다 구현해야만 한다. */ public class Bird implements Flyer{ //클래스에 메소드로만 구성될 수는 있음(ex: Service) //클래스에는 추상이 1도 없어야 함. 그래야 그걸로부터 instantiate가 됨(객체 생성이 됨) //부모로부터 물려받은 것을 구현, 자기화, 구체화 // => 오버라이딩!(물려준 선언부는 똑같음.) @Override public void fly() { System.out.println("새가 난다..."); } @Override public void land() { System.out.println("새가 착륙한다..."); } @Override public void take_off() { System.out.println("새가 이륙한다..."); } public String layEggs() { return "알을 까다"; } }
[ "10yeony@gmail.com" ]
10yeony@gmail.com
ee01ad623e76c753d8e5dcefbdead15cbf97cd83
89446f5a5a428f5feeec14d4a5cc43b7ad3b51ff
/remove-smells/src/main/java/org/brilliance/refactoring/method/EncapsulateDowncast.java
d4e387cdb0f6234657b3110c82ab4a09c74c43aa
[]
no_license
haperkelu/remove-smells
d5481ee2ed57c0b2c6d591386b1494f75c9300cf
7f7d0712c634ec168d99eefbeda0595974fe9e3d
refs/heads/master
2021-01-22T01:28:16.263709
2014-06-07T13:05:26
2014-06-07T13:05:26
null
0
0
null
null
null
null
UTF-8
Java
false
false
855
java
/** * @Title: EncapsulateDowncast.java * @Package org.brilliance.refactoring.method * @Description: TODO * @author PAI LI * @date 2014-6-7 下午6:33:36 * @version V1.0 */ package org.brilliance.refactoring.method; /** * @author PAI LI * */ public class EncapsulateDowncast { /** * @param args */ public static void main(String[] args) { Reading lastReading = (Reading) lastReading(); //refactoring Reading lastReading1 = lastReading_refactoring(); assert lastReading == lastReading1; } private static Reading readings = new Reading(); static Object lastReading() { return readings.lastElement(); } static Reading lastReading_refactoring() { return (Reading)readings.lastElement(); } static class Reading { public Reading lastElement() { // TODO Auto-generated method stub return null; }} }
[ "haperkelu@gmail.com" ]
haperkelu@gmail.com
c3819bb06e89157f94b88c80faffd7f554724cdf
7856c24c7a7e17d99332ca96a5469ccbfcbf67ab
/app/src/main/java/com/datacomp/magicfinmart/utility/imagecropper/CropHelper.java
a39e38e3ede0b11af821781b726fc085ac14b7c0
[]
no_license
umeshrchaurasia/finmart
8978e61cec3f132029f196e5f120dc9efdb73906
68138a15cb529ed55b868a26f85486f3afb6412b
refs/heads/master
2020-04-08T19:13:45.366875
2018-11-29T13:03:57
2018-11-29T13:03:57
159,645,549
0
0
null
null
null
null
UTF-8
Java
false
false
11,264
java
package com.datacomp.magicfinmart.utility.imagecropper; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.graphics.Bitmap; import android.net.Uri; import android.os.Environment; import android.provider.MediaStore; import android.util.Log; import java.io.File; /** * Created by IN-RB on 02-03-2017. */ public class CropHelper { private static Context mcontext; public static final String TAG = "CropHelper"; /** * request code of Activities or Fragments * You will have to change the values of the request codes below if they conflict with your own. */ public static final int REQUEST_CROP = 127; public static final int REQUEST_CAMERA = 128; public static final int REQUEST_PICK = 129; public static final String CROP_CACHE_FOLDER = "Profile"; public static final String ProfilePic = "ProfilePic.png"; private static ImageCompression imageComp; public CropHelper(Context context) { this.mcontext = context; imageComp = new ImageCompression(context); } public static Uri generateUri() { File cacheFolder = new File(Environment.getExternalStorageDirectory(), "/FINMART"); if (!cacheFolder.exists()) { try { boolean result = cacheFolder.mkdir(); Log.d(TAG, "generateUri " + cacheFolder + " result: " + (result ? "succeeded" : "failed")); } catch (Exception e) { Log.e(TAG, "generateUri failed: " + cacheFolder, e); } } // ("ProfilePic.jpg" String name = String.format(ProfilePic); return Uri .fromFile(cacheFolder) .buildUpon() .appendPath(name) .build(); } public static boolean isPhotoReallyCropped(Uri uri) { File file = new File(uri.getPath()); long length = file.length(); return length > 0; } public static void handleResult(CropHandler handler, int requestCode, int resultCode, Intent data) { String finalpath; if (handler == null) return; if (resultCode == Activity.RESULT_CANCELED) { handler.onCancel(); } else if (resultCode == Activity.RESULT_OK) { CropParams cropParams = handler.getCropParams(); if (cropParams == null) { handler.onFailed("CropHandler's params MUST NOT be null!"); return; } switch (requestCode) { // case REQUEST_GALLERY: case REQUEST_CROP: if (isPhotoReallyCropped(cropParams.uri)) { Log.d(TAG, "Photo cropped!"); onPhotoCropped(handler, cropParams); break; } else { Context context = handler.getCropParams().context; if (context != null) { if (data != null) { if (data.getData() != null) { String path = CropFileUtils.getSmartFilePath(context, data.getData()); if (path == null || (path.isEmpty())) { handler.onFailed("Use image from Internal storage only.."); break; } else { boolean result = CropFileUtils.copyFile(path, cropParams.uri.getPath()); if (!result) { handler.onFailed("Copy file to cached folder failed"); break; } } } else if (data.getExtras().get("data") != null) { Bitmap bitmap = (Bitmap) data.getExtras().get("data"); String path = CropFileUtils.getSmartFilePath(context, getImageUri(context, bitmap)); if (path == null || (path.isEmpty())) { handler.onFailed("Use image from Internal storage only.."); break; } else { boolean result = CropFileUtils.copyFile(path, cropParams.uri.getPath()); if (!result) { handler.onFailed("Copy file to cached folder failed"); break; } } } } else { handler.onFailed("Returned data is null " + data); break; } } else { handler.onFailed("CropHandler's context MUST NOT be null!"); } } case REQUEST_CAMERA: if (cropParams.enable) { Context context = handler.getCropParams().context; if (context != null) { if (data != null) { if (data.getData() != null) { String path = CropFileUtils.getSmartFilePath(context, data.getData()); if (path == null || (path.isEmpty())) { handler.onFailed("Use image from Internal storage only.."); break; } else{ boolean result = CropFileUtils.copyFile(path, cropParams.uri.getPath()); if (!result) { handler.onFailed("Copy file to cached folder failed"); break; } } } else if (data.getExtras().get("data") != null) { Bitmap bitmap = (Bitmap) data.getExtras().get("data"); String path = CropFileUtils.getSmartFilePath(context, getImageUri(context, bitmap)); if (path == null || (path.isEmpty())) { handler.onFailed("Use image from Internal storage only.."); break; } else { boolean result = CropFileUtils.copyFile(path, cropParams.uri.getPath()); if (!result) { handler.onFailed("Copy file to cached folder failed"); break; } } } } else { handler.onFailed("Returned data is null " + data); break; } } else { handler.onFailed("CropHandler's context MUST NOT be null!"); } Intent intent = buildCropFromUriIntent(cropParams); handler.handleIntent(intent, REQUEST_CROP); } else { Log.d(TAG, "Photo cropped!"); onPhotoCropped(handler, cropParams); } break; } } } public static Uri getImageUri(Context inContext, Bitmap inImage) { // ByteArrayOutputStream bytes = new ByteArrayOutputStream(); // inImage.compress(Bitmap.CompressFormat.JPEG, 100, bytes); String path = MediaStore.Images.Media.insertImage(inContext.getContentResolver(), inImage, "Title", null); return Uri.parse(path); } private static void onPhotoCropped(CropHandler handler, CropParams cropParams) { if (cropParams.compress) { Uri originUri = cropParams.uri; Uri compressUri = generateUri(); CompressImageUtils.compressImageFile(cropParams, originUri, compressUri); handler.onCompressed(compressUri); } else { handler.onPhotoCropped(cropParams.uri); } } // None-Crop Intents public static Intent buildGalleryIntent(CropParams params) { // return buildCropIntent(Intent.ACTION_GET_CONTENT, params); Intent intent; if (params.enable) { intent = buildCropIntent(Intent.ACTION_GET_CONTENT, params); } else { intent = new Intent(Intent.ACTION_GET_CONTENT) .setType("image/*") .putExtra(MediaStore.EXTRA_OUTPUT, params.uri); } return intent; } public static Intent buildCameraIntent(CropParams params) { return new Intent(MediaStore.ACTION_IMAGE_CAPTURE) // .putExtra(MediaStore.EXTRA_OUTPUT, params.uri) .putExtra("android.intent.extras.CAMERA_FACING", 1); } // Crop Intents private static Intent buildCropFromUriIntent(CropParams params) { return buildCropIntent("com.android.camera.action.CROP", params); } private static Intent buildCropIntent(String action, CropParams params) { return new Intent(action) .setDataAndType(params.uri, params.type) .putExtra("crop", "true") // .putExtra("scale", params.scale) .putExtra("aspectX", params.aspectX) .putExtra("aspectY", params.aspectY) .putExtra("outputX", params.outputX) .putExtra("outputY", params.outputY) .putExtra("return-data", params.returnData) .putExtra("outputFormat", params.outputFormat) .putExtra("noFaceDetection", params.noFaceDetection) .putExtra("scaleUpIfNeeded", params.scaleUpIfNeeded) .putExtra(MediaStore.EXTRA_OUTPUT, params.uri); } // Clear Cache public static boolean clearCacheDir() { File cacheFolder = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + CROP_CACHE_FOLDER); if (cacheFolder.exists() && cacheFolder.listFiles() != null) { for (File file : cacheFolder.listFiles()) { boolean result = file.delete(); Log.d(TAG, "Delete " + file.getAbsolutePath() + (result ? " succeeded" : " failed")); } return true; } return false; } }
[ "rajeev15069@gmail.com" ]
rajeev15069@gmail.com
288a0f386f4c27300eb56bdfe566500b53c044e5
da96a9617924a6caa9f2af96923b6ba95428bf47
/src/Sav3D/GL2/Shaders/JOGLSimpleShader.java
92ee6abdd9a1e848bad70d035bee75b0effd852d
[ "MIT" ]
permissive
PeteHub/java-model-viewer
bec30506d8a3900841e2625e677c6fe0a7f53566
dbd3e6cee6b72c5ac6cbb29e5546c47077e418b9
refs/heads/master
2021-03-12T23:36:48.564626
2012-10-10T15:23:30
2012-10-10T15:23:30
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,145
java
package Sav3D.GL2.Shaders; import com.jogamp.common.nio.Buffers; import javax.media.opengl.GL2; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.nio.ByteBuffer; import java.nio.IntBuffer; import java.util.Scanner; /** * Created by IntelliJ IDEA. * User: Peter * Date: 2/12/12 * Time: 12:21 AM * To change this template use File | Settings | File Templates. */ public class JOGLSimpleShader { private int shader_id; private int shader_type; private String sFileName; private GL2 gl; public JOGLSimpleShader( GL2 gl, String sFileName, int GL2_SHADER_TYPE ) throws IOException { this.gl = gl; this.sFileName = sFileName; this.shader_type = GL2_SHADER_TYPE; LoadShader(); } private void LoadShader() throws IOException { this.shader_id = gl.glCreateShader( this.shader_type ); InputStream ins = new FileInputStream(this.sFileName); StringBuffer buffer = new StringBuffer(); Scanner scanner = new Scanner(ins); try { while (scanner.hasNextLine()) { buffer.append(scanner.nextLine() + "\n"); } } finally { scanner.close(); } gl.glShaderSource( this.shader_id, 1, new String[] { buffer.toString() }, (int[]) null, 0 ); // Compile the shader gl.glCompileShader( this.shader_id ); IntBuffer shaderLog = Buffers.newDirectIntBuffer( 1 ); IntBuffer shaderLogLength = Buffers.newDirectIntBuffer(1); ByteBuffer shaderLogText; gl.glGetShaderiv( this.shader_id, gl.GL_INFO_LOG_LENGTH, shaderLog ); if ( shaderLog.get(0) > 1) { shaderLogText = Buffers.newDirectByteBuffer( shaderLog.get(0) ); gl.glGetShaderInfoLog(this.shader_id, shaderLog.get(0), shaderLogLength, shaderLogText ); while ( shaderLogText.hasRemaining() ) System.out.print( Character.toChars( shaderLogText.get() )); } } public int GetShaderId() { return this.shader_id; } }
[ "petehub@werik.com" ]
petehub@werik.com
8aaf07d3e63824280e43596fe1e068f3f2b388a2
e3d3a23b2a70a31f40f9347818d97a7370b6c276
/android/support/v4/app/BackStackRecord.java
058d6680283b3ac0c909af8a17accd367d5f92ba
[]
no_license
HakerTag/lllllll
79d1f1c1be35f2e1ec47247f5b1b04c098595380
356b639247fa60123e40584179bdb75278868c7c
refs/heads/main
2023-08-16T11:00:17.819659
2021-08-10T14:58:16
2021-08-10T14:58:16
394,693,473
0
0
null
null
null
null
UTF-8
Java
false
false
31,429
java
package android.support.v4.app; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentManagerImpl; import android.support.v4.util.LogWriter; import android.support.v4.view.ViewCompat; import android.util.Log; import android.view.View; import java.io.FileDescriptor; import java.io.PrintWriter; import java.lang.reflect.Modifier; import java.util.ArrayList; /* access modifiers changed from: package-private */ public final class BackStackRecord extends FragmentTransaction implements FragmentManager.BackStackEntry, FragmentManagerImpl.OpGenerator { static final int OP_ADD = 1; static final int OP_ATTACH = 7; static final int OP_DETACH = 6; static final int OP_HIDE = 4; static final int OP_NULL = 0; static final int OP_REMOVE = 3; static final int OP_REPLACE = 2; static final int OP_SET_PRIMARY_NAV = 8; static final int OP_SHOW = 5; static final int OP_UNSET_PRIMARY_NAV = 9; static final String TAG = "FragmentManager"; boolean mAddToBackStack; boolean mAllowAddToBackStack = true; int mBreadCrumbShortTitleRes; CharSequence mBreadCrumbShortTitleText; int mBreadCrumbTitleRes; CharSequence mBreadCrumbTitleText; ArrayList<Runnable> mCommitRunnables; boolean mCommitted; int mEnterAnim; int mExitAnim; int mIndex = -1; final FragmentManagerImpl mManager; String mName; ArrayList<Op> mOps = new ArrayList<>(); int mPopEnterAnim; int mPopExitAnim; boolean mReorderingAllowed = false; ArrayList<String> mSharedElementSourceNames; ArrayList<String> mSharedElementTargetNames; int mTransition; int mTransitionStyle; /* access modifiers changed from: package-private */ public static final class Op { int cmd; int enterAnim; int exitAnim; Fragment fragment; int popEnterAnim; int popExitAnim; Op() { } Op(int i, Fragment fragment2) { this.cmd = i; this.fragment = fragment2; } } public String toString() { StringBuilder sb = new StringBuilder(128); sb.append("BackStackEntry{"); sb.append(Integer.toHexString(System.identityHashCode(this))); if (this.mIndex >= 0) { sb.append(" #"); sb.append(this.mIndex); } if (this.mName != null) { sb.append(" "); sb.append(this.mName); } sb.append("}"); return sb.toString(); } public void dump(String str, FileDescriptor fileDescriptor, PrintWriter printWriter, String[] strArr) { dump(str, printWriter, true); } public void dump(String str, PrintWriter printWriter, boolean z) { String str2; if (z) { printWriter.print(str); printWriter.print("mName="); printWriter.print(this.mName); printWriter.print(" mIndex="); printWriter.print(this.mIndex); printWriter.print(" mCommitted="); printWriter.println(this.mCommitted); if (this.mTransition != 0) { printWriter.print(str); printWriter.print("mTransition=#"); printWriter.print(Integer.toHexString(this.mTransition)); printWriter.print(" mTransitionStyle=#"); printWriter.println(Integer.toHexString(this.mTransitionStyle)); } if (!(this.mEnterAnim == 0 && this.mExitAnim == 0)) { printWriter.print(str); printWriter.print("mEnterAnim=#"); printWriter.print(Integer.toHexString(this.mEnterAnim)); printWriter.print(" mExitAnim=#"); printWriter.println(Integer.toHexString(this.mExitAnim)); } if (!(this.mPopEnterAnim == 0 && this.mPopExitAnim == 0)) { printWriter.print(str); printWriter.print("mPopEnterAnim=#"); printWriter.print(Integer.toHexString(this.mPopEnterAnim)); printWriter.print(" mPopExitAnim=#"); printWriter.println(Integer.toHexString(this.mPopExitAnim)); } if (!(this.mBreadCrumbTitleRes == 0 && this.mBreadCrumbTitleText == null)) { printWriter.print(str); printWriter.print("mBreadCrumbTitleRes=#"); printWriter.print(Integer.toHexString(this.mBreadCrumbTitleRes)); printWriter.print(" mBreadCrumbTitleText="); printWriter.println(this.mBreadCrumbTitleText); } if (!(this.mBreadCrumbShortTitleRes == 0 && this.mBreadCrumbShortTitleText == null)) { printWriter.print(str); printWriter.print("mBreadCrumbShortTitleRes=#"); printWriter.print(Integer.toHexString(this.mBreadCrumbShortTitleRes)); printWriter.print(" mBreadCrumbShortTitleText="); printWriter.println(this.mBreadCrumbShortTitleText); } } if (!this.mOps.isEmpty()) { printWriter.print(str); printWriter.println("Operations:"); int size = this.mOps.size(); for (int i = 0; i < size; i++) { Op op = this.mOps.get(i); switch (op.cmd) { case 0: str2 = "NULL"; break; case 1: str2 = "ADD"; break; case 2: str2 = "REPLACE"; break; case 3: str2 = "REMOVE"; break; case 4: str2 = "HIDE"; break; case 5: str2 = "SHOW"; break; case 6: str2 = "DETACH"; break; case 7: str2 = "ATTACH"; break; case 8: str2 = "SET_PRIMARY_NAV"; break; case 9: str2 = "UNSET_PRIMARY_NAV"; break; default: str2 = "cmd=" + op.cmd; break; } printWriter.print(str); printWriter.print(" Op #"); printWriter.print(i); printWriter.print(": "); printWriter.print(str2); printWriter.print(" "); printWriter.println(op.fragment); if (z) { if (!(op.enterAnim == 0 && op.exitAnim == 0)) { printWriter.print(str); printWriter.print("enterAnim=#"); printWriter.print(Integer.toHexString(op.enterAnim)); printWriter.print(" exitAnim=#"); printWriter.println(Integer.toHexString(op.exitAnim)); } if (op.popEnterAnim != 0 || op.popExitAnim != 0) { printWriter.print(str); printWriter.print("popEnterAnim=#"); printWriter.print(Integer.toHexString(op.popEnterAnim)); printWriter.print(" popExitAnim=#"); printWriter.println(Integer.toHexString(op.popExitAnim)); } } } } } public BackStackRecord(FragmentManagerImpl fragmentManagerImpl) { this.mManager = fragmentManagerImpl; } @Override // android.support.v4.app.FragmentManager.BackStackEntry public int getId() { return this.mIndex; } @Override // android.support.v4.app.FragmentManager.BackStackEntry public int getBreadCrumbTitleRes() { return this.mBreadCrumbTitleRes; } @Override // android.support.v4.app.FragmentManager.BackStackEntry public int getBreadCrumbShortTitleRes() { return this.mBreadCrumbShortTitleRes; } @Override // android.support.v4.app.FragmentManager.BackStackEntry public CharSequence getBreadCrumbTitle() { if (this.mBreadCrumbTitleRes != 0) { return this.mManager.mHost.getContext().getText(this.mBreadCrumbTitleRes); } return this.mBreadCrumbTitleText; } @Override // android.support.v4.app.FragmentManager.BackStackEntry public CharSequence getBreadCrumbShortTitle() { if (this.mBreadCrumbShortTitleRes != 0) { return this.mManager.mHost.getContext().getText(this.mBreadCrumbShortTitleRes); } return this.mBreadCrumbShortTitleText; } /* access modifiers changed from: package-private */ public void addOp(Op op) { this.mOps.add(op); op.enterAnim = this.mEnterAnim; op.exitAnim = this.mExitAnim; op.popEnterAnim = this.mPopEnterAnim; op.popExitAnim = this.mPopExitAnim; } @Override // android.support.v4.app.FragmentTransaction public FragmentTransaction add(Fragment fragment, String str) { doAddOp(0, fragment, str, 1); return this; } @Override // android.support.v4.app.FragmentTransaction public FragmentTransaction add(int i, Fragment fragment) { doAddOp(i, fragment, null, 1); return this; } @Override // android.support.v4.app.FragmentTransaction public FragmentTransaction add(int i, Fragment fragment, String str) { doAddOp(i, fragment, str, 1); return this; } private void doAddOp(int i, Fragment fragment, String str, int i2) { Class<?> cls = fragment.getClass(); int modifiers = cls.getModifiers(); if (cls.isAnonymousClass() || !Modifier.isPublic(modifiers) || (cls.isMemberClass() && !Modifier.isStatic(modifiers))) { throw new IllegalStateException("Fragment " + cls.getCanonicalName() + " must be a public static class to be properly recreated from" + " instance state."); } fragment.mFragmentManager = this.mManager; if (str != null) { if (fragment.mTag == null || str.equals(fragment.mTag)) { fragment.mTag = str; } else { throw new IllegalStateException("Can't change tag of fragment " + fragment + ": was " + fragment.mTag + " now " + str); } } if (i != 0) { if (i == -1) { throw new IllegalArgumentException("Can't add fragment " + fragment + " with tag " + str + " to container view with no id"); } else if (fragment.mFragmentId == 0 || fragment.mFragmentId == i) { fragment.mFragmentId = i; fragment.mContainerId = i; } else { throw new IllegalStateException("Can't change container ID of fragment " + fragment + ": was " + fragment.mFragmentId + " now " + i); } } addOp(new Op(i2, fragment)); } @Override // android.support.v4.app.FragmentTransaction public FragmentTransaction replace(int i, Fragment fragment) { return replace(i, fragment, null); } @Override // android.support.v4.app.FragmentTransaction public FragmentTransaction replace(int i, Fragment fragment, String str) { if (i != 0) { doAddOp(i, fragment, str, 2); return this; } throw new IllegalArgumentException("Must use non-zero containerViewId"); } @Override // android.support.v4.app.FragmentTransaction public FragmentTransaction remove(Fragment fragment) { addOp(new Op(3, fragment)); return this; } @Override // android.support.v4.app.FragmentTransaction public FragmentTransaction hide(Fragment fragment) { addOp(new Op(4, fragment)); return this; } @Override // android.support.v4.app.FragmentTransaction public FragmentTransaction show(Fragment fragment) { addOp(new Op(5, fragment)); return this; } @Override // android.support.v4.app.FragmentTransaction public FragmentTransaction detach(Fragment fragment) { addOp(new Op(6, fragment)); return this; } @Override // android.support.v4.app.FragmentTransaction public FragmentTransaction attach(Fragment fragment) { addOp(new Op(7, fragment)); return this; } @Override // android.support.v4.app.FragmentTransaction public FragmentTransaction setPrimaryNavigationFragment(Fragment fragment) { addOp(new Op(8, fragment)); return this; } @Override // android.support.v4.app.FragmentTransaction public FragmentTransaction setCustomAnimations(int i, int i2) { return setCustomAnimations(i, i2, 0, 0); } @Override // android.support.v4.app.FragmentTransaction public FragmentTransaction setCustomAnimations(int i, int i2, int i3, int i4) { this.mEnterAnim = i; this.mExitAnim = i2; this.mPopEnterAnim = i3; this.mPopExitAnim = i4; return this; } @Override // android.support.v4.app.FragmentTransaction public FragmentTransaction setTransition(int i) { this.mTransition = i; return this; } @Override // android.support.v4.app.FragmentTransaction public FragmentTransaction addSharedElement(View view, String str) { if (FragmentTransition.supportsTransition()) { String transitionName = ViewCompat.getTransitionName(view); if (transitionName != null) { if (this.mSharedElementSourceNames == null) { this.mSharedElementSourceNames = new ArrayList<>(); this.mSharedElementTargetNames = new ArrayList<>(); } else if (this.mSharedElementTargetNames.contains(str)) { throw new IllegalArgumentException("A shared element with the target name '" + str + "' has already been added to the transaction."); } else if (this.mSharedElementSourceNames.contains(transitionName)) { throw new IllegalArgumentException("A shared element with the source name '" + transitionName + " has already been added to the transaction."); } this.mSharedElementSourceNames.add(transitionName); this.mSharedElementTargetNames.add(str); } else { throw new IllegalArgumentException("Unique transitionNames are required for all sharedElements"); } } return this; } @Override // android.support.v4.app.FragmentTransaction public FragmentTransaction setTransitionStyle(int i) { this.mTransitionStyle = i; return this; } @Override // android.support.v4.app.FragmentTransaction public FragmentTransaction addToBackStack(String str) { if (this.mAllowAddToBackStack) { this.mAddToBackStack = true; this.mName = str; return this; } throw new IllegalStateException("This FragmentTransaction is not allowed to be added to the back stack."); } @Override // android.support.v4.app.FragmentTransaction public boolean isAddToBackStackAllowed() { return this.mAllowAddToBackStack; } @Override // android.support.v4.app.FragmentTransaction public FragmentTransaction disallowAddToBackStack() { if (!this.mAddToBackStack) { this.mAllowAddToBackStack = false; return this; } throw new IllegalStateException("This transaction is already being added to the back stack"); } @Override // android.support.v4.app.FragmentTransaction public FragmentTransaction setBreadCrumbTitle(int i) { this.mBreadCrumbTitleRes = i; this.mBreadCrumbTitleText = null; return this; } @Override // android.support.v4.app.FragmentTransaction public FragmentTransaction setBreadCrumbTitle(CharSequence charSequence) { this.mBreadCrumbTitleRes = 0; this.mBreadCrumbTitleText = charSequence; return this; } @Override // android.support.v4.app.FragmentTransaction public FragmentTransaction setBreadCrumbShortTitle(int i) { this.mBreadCrumbShortTitleRes = i; this.mBreadCrumbShortTitleText = null; return this; } @Override // android.support.v4.app.FragmentTransaction public FragmentTransaction setBreadCrumbShortTitle(CharSequence charSequence) { this.mBreadCrumbShortTitleRes = 0; this.mBreadCrumbShortTitleText = charSequence; return this; } /* access modifiers changed from: package-private */ public void bumpBackStackNesting(int i) { if (this.mAddToBackStack) { if (FragmentManagerImpl.DEBUG) { Log.v(TAG, "Bump nesting in " + this + " by " + i); } int size = this.mOps.size(); for (int i2 = 0; i2 < size; i2++) { Op op = this.mOps.get(i2); if (op.fragment != null) { op.fragment.mBackStackNesting += i; if (FragmentManagerImpl.DEBUG) { Log.v(TAG, "Bump nesting of " + op.fragment + " to " + op.fragment.mBackStackNesting); } } } } } @Override // android.support.v4.app.FragmentTransaction public FragmentTransaction runOnCommit(Runnable runnable) { if (runnable != null) { disallowAddToBackStack(); if (this.mCommitRunnables == null) { this.mCommitRunnables = new ArrayList<>(); } this.mCommitRunnables.add(runnable); return this; } throw new IllegalArgumentException("runnable cannot be null"); } public void runOnCommitRunnables() { ArrayList<Runnable> arrayList = this.mCommitRunnables; if (arrayList != null) { int size = arrayList.size(); for (int i = 0; i < size; i++) { this.mCommitRunnables.get(i).run(); } this.mCommitRunnables = null; } } @Override // android.support.v4.app.FragmentTransaction public int commit() { return commitInternal(false); } @Override // android.support.v4.app.FragmentTransaction public int commitAllowingStateLoss() { return commitInternal(true); } @Override // android.support.v4.app.FragmentTransaction public void commitNow() { disallowAddToBackStack(); this.mManager.execSingleAction(this, false); } @Override // android.support.v4.app.FragmentTransaction public void commitNowAllowingStateLoss() { disallowAddToBackStack(); this.mManager.execSingleAction(this, true); } @Override // android.support.v4.app.FragmentTransaction public FragmentTransaction setReorderingAllowed(boolean z) { this.mReorderingAllowed = z; return this; } @Override // android.support.v4.app.FragmentTransaction public FragmentTransaction setAllowOptimization(boolean z) { return setReorderingAllowed(z); } /* access modifiers changed from: package-private */ public int commitInternal(boolean z) { if (!this.mCommitted) { if (FragmentManagerImpl.DEBUG) { Log.v(TAG, "Commit: " + this); PrintWriter printWriter = new PrintWriter(new LogWriter(TAG)); dump(" ", null, printWriter, null); printWriter.close(); } this.mCommitted = true; if (this.mAddToBackStack) { this.mIndex = this.mManager.allocBackStackIndex(this); } else { this.mIndex = -1; } this.mManager.enqueueAction(this, z); return this.mIndex; } throw new IllegalStateException("commit already called"); } @Override // android.support.v4.app.FragmentManagerImpl.OpGenerator public boolean generateOps(ArrayList<BackStackRecord> arrayList, ArrayList<Boolean> arrayList2) { if (FragmentManagerImpl.DEBUG) { Log.v(TAG, "Run: " + this); } arrayList.add(this); arrayList2.add(false); if (!this.mAddToBackStack) { return true; } this.mManager.addBackStackState(this); return true; } /* access modifiers changed from: package-private */ public boolean interactsWith(int i) { int size = this.mOps.size(); for (int i2 = 0; i2 < size; i2++) { Op op = this.mOps.get(i2); int i3 = op.fragment != null ? op.fragment.mContainerId : 0; if (i3 != 0 && i3 == i) { return true; } } return false; } /* access modifiers changed from: package-private */ public boolean interactsWith(ArrayList<BackStackRecord> arrayList, int i, int i2) { if (i2 == i) { return false; } int size = this.mOps.size(); int i3 = -1; for (int i4 = 0; i4 < size; i4++) { Op op = this.mOps.get(i4); int i5 = op.fragment != null ? op.fragment.mContainerId : 0; if (!(i5 == 0 || i5 == i3)) { for (int i6 = i; i6 < i2; i6++) { BackStackRecord backStackRecord = arrayList.get(i6); int size2 = backStackRecord.mOps.size(); for (int i7 = 0; i7 < size2; i7++) { Op op2 = backStackRecord.mOps.get(i7); if ((op2.fragment != null ? op2.fragment.mContainerId : 0) == i5) { return true; } } } i3 = i5; } } return false; } /* access modifiers changed from: package-private */ public void executeOps() { int size = this.mOps.size(); for (int i = 0; i < size; i++) { Op op = this.mOps.get(i); Fragment fragment = op.fragment; if (fragment != null) { fragment.setNextTransition(this.mTransition, this.mTransitionStyle); } switch (op.cmd) { case 1: fragment.setNextAnim(op.enterAnim); this.mManager.addFragment(fragment, false); break; case 2: default: throw new IllegalArgumentException("Unknown cmd: " + op.cmd); case 3: fragment.setNextAnim(op.exitAnim); this.mManager.removeFragment(fragment); break; case 4: fragment.setNextAnim(op.exitAnim); this.mManager.hideFragment(fragment); break; case 5: fragment.setNextAnim(op.enterAnim); this.mManager.showFragment(fragment); break; case 6: fragment.setNextAnim(op.exitAnim); this.mManager.detachFragment(fragment); break; case 7: fragment.setNextAnim(op.enterAnim); this.mManager.attachFragment(fragment); break; case 8: this.mManager.setPrimaryNavigationFragment(fragment); break; case 9: this.mManager.setPrimaryNavigationFragment(null); break; } if (!(this.mReorderingAllowed || op.cmd == 1 || fragment == null)) { this.mManager.moveFragmentToExpectedState(fragment); } } if (!this.mReorderingAllowed) { FragmentManagerImpl fragmentManagerImpl = this.mManager; fragmentManagerImpl.moveToState(fragmentManagerImpl.mCurState, true); } } /* access modifiers changed from: package-private */ public void executePopOps(boolean z) { for (int size = this.mOps.size() - 1; size >= 0; size--) { Op op = this.mOps.get(size); Fragment fragment = op.fragment; if (fragment != null) { fragment.setNextTransition(FragmentManagerImpl.reverseTransit(this.mTransition), this.mTransitionStyle); } switch (op.cmd) { case 1: fragment.setNextAnim(op.popExitAnim); this.mManager.removeFragment(fragment); break; case 2: default: throw new IllegalArgumentException("Unknown cmd: " + op.cmd); case 3: fragment.setNextAnim(op.popEnterAnim); this.mManager.addFragment(fragment, false); break; case 4: fragment.setNextAnim(op.popEnterAnim); this.mManager.showFragment(fragment); break; case 5: fragment.setNextAnim(op.popExitAnim); this.mManager.hideFragment(fragment); break; case 6: fragment.setNextAnim(op.popEnterAnim); this.mManager.attachFragment(fragment); break; case 7: fragment.setNextAnim(op.popExitAnim); this.mManager.detachFragment(fragment); break; case 8: this.mManager.setPrimaryNavigationFragment(null); break; case 9: this.mManager.setPrimaryNavigationFragment(fragment); break; } if (!(this.mReorderingAllowed || op.cmd == 3 || fragment == null)) { this.mManager.moveFragmentToExpectedState(fragment); } } if (!this.mReorderingAllowed && z) { FragmentManagerImpl fragmentManagerImpl = this.mManager; fragmentManagerImpl.moveToState(fragmentManagerImpl.mCurState, true); } } /* access modifiers changed from: package-private */ public Fragment expandOps(ArrayList<Fragment> arrayList, Fragment fragment) { Fragment fragment2 = fragment; int i = 0; while (i < this.mOps.size()) { Op op = this.mOps.get(i); int i2 = op.cmd; if (i2 != 1) { if (i2 == 2) { Fragment fragment3 = op.fragment; int i3 = fragment3.mContainerId; boolean z = false; for (int size = arrayList.size() - 1; size >= 0; size--) { Fragment fragment4 = arrayList.get(size); if (fragment4.mContainerId == i3) { if (fragment4 == fragment3) { z = true; } else { if (fragment4 == fragment2) { this.mOps.add(i, new Op(9, fragment4)); i++; fragment2 = null; } Op op2 = new Op(3, fragment4); op2.enterAnim = op.enterAnim; op2.popEnterAnim = op.popEnterAnim; op2.exitAnim = op.exitAnim; op2.popExitAnim = op.popExitAnim; this.mOps.add(i, op2); arrayList.remove(fragment4); i++; } } } if (z) { this.mOps.remove(i); i--; } else { op.cmd = 1; arrayList.add(fragment3); } } else if (i2 == 3 || i2 == 6) { arrayList.remove(op.fragment); if (op.fragment == fragment2) { this.mOps.add(i, new Op(9, op.fragment)); i++; fragment2 = null; } } else if (i2 != 7) { if (i2 == 8) { this.mOps.add(i, new Op(9, fragment2)); i++; fragment2 = op.fragment; } } i++; } arrayList.add(op.fragment); i++; } return fragment2; } /* access modifiers changed from: package-private */ public Fragment trackAddedFragmentsInPop(ArrayList<Fragment> arrayList, Fragment fragment) { for (int i = 0; i < this.mOps.size(); i++) { Op op = this.mOps.get(i); int i2 = op.cmd; if (i2 != 1) { if (i2 != 3) { switch (i2) { case 8: fragment = null; break; case 9: fragment = op.fragment; break; } } arrayList.add(op.fragment); } arrayList.remove(op.fragment); } return fragment; } /* access modifiers changed from: package-private */ public boolean isPostponed() { for (int i = 0; i < this.mOps.size(); i++) { if (isFragmentPostponed(this.mOps.get(i))) { return true; } } return false; } /* access modifiers changed from: package-private */ public void setOnStartPostponedListener(Fragment.OnStartEnterTransitionListener onStartEnterTransitionListener) { for (int i = 0; i < this.mOps.size(); i++) { Op op = this.mOps.get(i); if (isFragmentPostponed(op)) { op.fragment.setOnStartEnterTransitionListener(onStartEnterTransitionListener); } } } private static boolean isFragmentPostponed(Op op) { Fragment fragment = op.fragment; return fragment != null && fragment.mAdded && fragment.mView != null && !fragment.mDetached && !fragment.mHidden && fragment.isPostponed(); } @Override // android.support.v4.app.FragmentManager.BackStackEntry public String getName() { return this.mName; } public int getTransition() { return this.mTransition; } public int getTransitionStyle() { return this.mTransitionStyle; } @Override // android.support.v4.app.FragmentTransaction public boolean isEmpty() { return this.mOps.isEmpty(); } }
[ "48122411+HakerTag@users.noreply.github.com" ]
48122411+HakerTag@users.noreply.github.com
baf942c572886009cd2e3ac0f8745cdecf15e7c3
a255fcdcbdbe2fd6119fcce0b53e0a99f949a0f8
/app/src/main/java/com/cjyun/tb/patient/ui/improve/UserInfoFragment.java
f5998250031306495d54f3acafa013669295818d
[ "Apache-2.0" ]
permissive
jianghw/IrrigationTB
2b9c28653f63de6da3b4a5e5c27954de2b2bc07d
2ae714eeed37bab2f8300f39e02447f2df29aadc
refs/heads/master
2020-04-06T06:25:02.489755
2017-02-23T06:19:32
2017-02-23T06:19:40
82,891,622
0
0
null
null
null
null
UTF-8
Java
false
false
9,690
java
package com.cjyun.tb.patient.ui.improve; import android.app.Activity; import android.app.AlertDialog; import android.content.DialogInterface; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.Bundle; import android.os.Handler; import android.support.annotation.Nullable; import android.support.v4.widget.SwipeRefreshLayout; import android.text.TextUtils; import android.util.Base64; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import com.cjyun.tb.R; import com.cjyun.tb.patient.base.BaseFragment; import com.cjyun.tb.patient.constant.TbGlobal; import com.cjyun.tb.patient.custom.UserInfoText; import com.cjyun.tb.patient.data.Injection; import com.cjyun.tb.patient.ui.PhotoActivity; import com.cjyun.tb.patient.ui.main.PtMainActivity; import com.cjyun.tb.patient.util.ToastUtils; import com.tryking.trykingcitychoose.AddressActivity; import butterknife.Bind; import butterknife.ButterKnife; import butterknife.OnClick; /** * <b>@Description:</b>TODO<br/> * <b>@Author:</b>Administrator<br/> * <b>@Since:</b>2016/4/22 0022<br/> */ public class UserInfoFragment extends BaseFragment implements IUserInfoContract.IUserInfoView { @Bind(R.id.ll_actionBar_back) LinearLayout mLlActionBarBack; @Bind(R.id.tv_title_left) TextView mTvTitleLeft; @Bind(R.id.imgView_user_head) ImageView mImgViewUserHead; @Bind(R.id.userTv_fill_box) UserInfoText mUserTvFillBox; @Bind(R.id.userTv_fill_user) UserInfoText mUserTvFillUser; @Bind(R.id.userTv_fill_age) UserInfoText mUserTvFillAge; @Bind(R.id.userTv_fill_gender) UserInfoText mUserTvFillGender; @Bind(R.id.userTv_phone) UserInfoText mUserTvPhone; @Bind(R.id.userTv_fill_email) UserInfoText mUserTvFillEmail; @Bind(R.id.userTv_fill_guardian1) UserInfoText mUserTvFillGuardian1; @Bind(R.id.userTv_fill_guardian2) UserInfoText mUserTvFillGuardian2; @Bind(R.id.userTv_fill_address) UserInfoText mUserTvFillAddress; @Bind(R.id.btn_fill_enter) Button mBtnFillEnter; @Bind(R.id.swipe_refresh) SwipeRefreshLayout mSwipeRefresh; private Activity mActivity; private static Handler mHandler; private IUserInfoContract.IUserInfoPresenter mPresent; private String image = "";//等待提交的头像 @Override public void onAttach(Activity activity) { super.onAttach(activity); this.mActivity = activity; } public static UserInfoFragment newInstance(Handler handler) { mHandler = handler; return new UserInfoFragment(); } @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (mPresent == null) { mPresent = new UserInfoPresenter(Injection.provideTwoRepository(), this); } } @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View root = inflater.inflate(R.layout.fragment_pt_user_info, container, false); ButterKnife.bind(this, root); mSwipeRefresh.setColorSchemeColors( getResources().getColor(R.color.colorPrimary), getResources().getColor(R.color.colorAccent), getResources().getColor(R.color.colorPrimaryDark) ); mSwipeRefresh.setDistanceToTriggerSync(200); mSwipeRefresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { mPresent.loadingRemoteData(true); } }); return root; } @Override public void onResume() { super.onResume(); mPresent.onSubscribe(); } @Override public void onPause() { super.onPause(); mPresent.unSubscribe(); } @Override public void onDestroyView() { super.onDestroyView(); ButterKnife.unbind(this); dismissDialog(); } //拍照 @OnClick(R.id.imgView_user_head) public void setUserHead() { startActivityForResult(new Intent(mActivity, PhotoActivity.class), 101); } @OnClick(R.id.ll_actionBar_back) public void onClickBace() { mHandler.sendEmptyMessage(TbGlobal.IntHandler.HANDLER_BACK_ACTIVITY); } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode == Activity.RESULT_OK && null != data && requestCode == 101) { Bundle bundle = data.getExtras(); image = bundle.getString("image"); setUserByHead(image); } else if (resultCode == Activity.RESULT_OK && null != data && requestCode == 500) { Bundle bundle = data.getExtras(); String address = bundle.getString("result"); mUserTvFillAddress.setContentTextView(address); } } private void setUserByHead(String image) { byte[] bytes = Base64.decode(image, Base64.DEFAULT); Bitmap bitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.length); mImgViewUserHead.setImageBitmap(bitmap); } //提交资料 @OnClick(R.id.btn_fill_enter) public void onSubmitInformation() { mPresent.submitPatientInfo(); } //添加新的信息 @OnClick({R.id.userTv_phone, R.id.userTv_fill_email, R.id.userTv_fill_guardian1, R.id.userTv_fill_guardian2}) public void addNewUserInfo(UserInfoText userInfoText) { userInfoText.showPopuForEdit(mActivity); } @OnClick(R.id.userTv_fill_address) public void addAddress() { startActivityForResult(new Intent(mActivity, AddressActivity.class), 500); } @Override public void setLoadingIndicator(final boolean b) { if (getView() == null) { return; } final SwipeRefreshLayout swipeRefreshLayout = (SwipeRefreshLayout) getView().findViewById(R.id.swipe_refresh); swipeRefreshLayout.post(new Runnable() { @Override public void run() { swipeRefreshLayout.setRefreshing(b); } }); } @Override public void setBoxId(String id) { mUserTvFillBox.setContentTextView(id); } @Override public void setUserBasicInfo(String name, String identityCard, String gender) { mUserTvFillUser.setContentTextView(name); // mUserTvFillAge.setContentTextView(identityCard); mUserTvFillGender.setContentTextView(gender); } @Override public void setUserPhone(String phone) { mUserTvPhone.setContentTextView(phone); } @Override public void setUserEmail(String email) { mUserTvFillEmail.setContentTextView(email); } @Override public void setUserQQ(String QQ) { mUserTvFillGuardian1.setContentTextView(QQ); } @Override public void setUserWeiXi(String wx) { mUserTvFillGuardian2.setContentTextView(wx); } @Override public void setUserAddress(String address) { mUserTvFillAddress.setContentTextView(address); } @Override public void setUserIdentityCard(String identityCard) { mUserTvFillAge.setContentTextView(identityCard); } @Override public void setUserHead(String s) { image = s; if (!TextUtils.isEmpty(s)) setUserByHead(s); } @Override public String getUserPhone() { return mUserTvPhone.getContentTextView(); } @Override public String getUserEmail() { return mUserTvFillEmail.getContentTextView(); } @Override public String getUserQQ() { return mUserTvFillGuardian1.getContentTextView(); } @Override public String getUserWeiXi() { return mUserTvFillGuardian2.getContentTextView(); } @Override public String getUserAddress() { return mUserTvFillAddress.getContentTextView(); } @Override public String getUserPhoto() { return image; } @Override public void submitSucceed() { onJumpToNewActivity(mActivity, PtMainActivity.class); mHandler.sendEmptyMessage(TbGlobal.IntHandler.HANDLER_BACK_ACTIVITY); } @Override public void submitError(String message) { ToastUtils.showMessage(message); AlertDialog.Builder builder = new AlertDialog.Builder(mActivity); builder.setMessage("提交更新失败,是否直接进入主页") .setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); submitSucceed(); } }) .setNegativeButton(getString(R.string.no), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }) .show(); } @Override public void showToastMessage(int id) { } @Override public void loadingDialog() { createLoadingDialog(); } @Override public void dismissDialog() { dismissLoadingDialog(); } }
[ "jiaswei89@gmail.com" ]
jiaswei89@gmail.com
3d4890bbdd8d30fbf94a0b9e5615a81856a70314
2c08c3242b1dcd71aebf11f9f22710e22e2a32ad
/app/src/main/java/panjiangang/bwie/com/myapp2/bean/liebiaoBean.java
efde9a502affc79acc7e75746ca40f163614603d
[]
no_license
panjiangang/MyApp2
f0708f352e97e4c1a1b472d9944fab07c324c2d3
c573a0e90cdfc8e72b64a0326603806038179d37
refs/heads/master
2021-08-28T21:33:57.734768
2017-12-13T06:28:37
2017-12-13T06:28:37
114,082,932
0
0
null
null
null
null
UTF-8
Java
false
false
3,366
java
package panjiangang.bwie.com.myapp2.bean; import java.util.List; /** * @author ddy */ public class liebiaoBean { /** * msg : 请求成功 * code : 0 * data : [{"createtime":"2017-10-19T20:44:40","orderid":31,"price":11800,"status":0,"title":"订单标题测试14","uid":71},{"createtime":"2017-10-19T20:44:51","orderid":32,"price":11800,"status":0,"title":"订单标题测试15","uid":71},{"createtime":"2017-10-20T08:02:07","orderid":43,"price":11800,"status":0,"title":"订单标题测试","uid":71},{"createtime":"2017-10-20T08:02:16","orderid":44,"price":11800,"status":0,"title":"订单标题测试","uid":71},{"createtime":"2017-10-22T15:14:39","orderid":890,"price":11800,"status":0,"title":"","uid":71},{"createtime":"2017-11-09T09:20:58","orderid":1447,"price":567,"status":0,"title":"订单标题测试","uid":71},{"createtime":"2017-11-09T09:20:58","orderid":1448,"price":256.99,"status":0,"title":"订单标题测试","uid":71},{"createtime":"2017-11-09T09:20:58","orderid":1449,"price":399,"status":0,"title":"订单标题测试","uid":71},{"createtime":"2017-11-09T09:20:58","orderid":1450,"price":401,"status":0,"title":"订单标题测试","uid":71},{"createtime":"2017-11-09T09:20:58","orderid":1454,"price":908,"status":0,"title":"订单标题测试","uid":71}] * page : 1 */ private String msg; private String code; private String page; private List<DataBean> data; public String getMsg() { return msg; } public void setMsg(String msg) { this.msg = msg; } public String getCode() { return code; } public void setCode(String code) { this.code = code; } public String getPage() { return page; } public void setPage(String page) { this.page = page; } public List<DataBean> getData() { return data; } public void setData(List<DataBean> data) { this.data = data; } public static class DataBean { /** * createtime : 2017-10-19T20:44:40 * orderid : 31 * price : 11800.0 * status : 0 * title : 订单标题测试14 * uid : 71 */ private String createtime; private int orderid; private double price; private int status; private String title; private int uid; public String getCreatetime() { return createtime; } public void setCreatetime(String createtime) { this.createtime = createtime; } public int getOrderid() { return orderid; } public void setOrderid(int orderid) { this.orderid = orderid; } public double getPrice() { return price; } public void setPrice(double price) { this.price = price; } public int getStatus() { return status; } public void setStatus(int status) { this.status = status; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public int getUid() { return uid; } public void setUid(int uid) { this.uid = uid; } } }
[ "402792989@qq.com" ]
402792989@qq.com
050a186878d3555fb5700c21518da61e460a8c99
d17e80dd41a89df1416f23ab123c93a03f456f3f
/src/code/package-info.java
7466b8667c147960d4f43c29ac6b0f0c21e90b18
[]
no_license
liucouhua/systemIdentification
f8ef14e9b6c8469cd349bd5ffed7287fd3e80461
cb0cfa2ae931cd63c190df289bbb88776df86e96
refs/heads/master
2022-11-06T12:16:37.022094
2020-06-14T07:58:56
2020-06-14T07:58:56
191,063,844
0
0
null
null
null
null
UTF-8
Java
false
false
61
java
/** * */ /** * @author Administrator * */ package code;
[ "liucouhua@163.com" ]
liucouhua@163.com
82363ae108b2c286eb01c933196d9ccbf62d0b0e
8c39ba2862f04d155259e3977c9ee33733034a1d
/src/caseStudy/animation/Series.java
85996324934c9c9c6fe879c7cdd0f0926d9e6129
[]
no_license
FredericDesgreniers/Asign_CaseStudy
86a0cbee7530c18d6261efa80b0b60059b0ad648
3fc5e2e004c1fbf501f6ecedc749705b51760ede
refs/heads/master
2020-04-13T11:45:46.649485
2015-05-11T22:53:30
2015-05-11T22:53:30
30,413,311
0
0
null
null
null
null
UTF-8
Java
false
false
9,689
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 caseStudy.animation; import caseStudy.AnimationBase; import caseStudy.IConstants; import java.text.DecimalFormat; import javafx.animation.KeyFrame; import javafx.animation.KeyValue; import javafx.animation.Timeline; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.scene.control.Label; import javafx.scene.control.TextField; import javafx.scene.paint.Paint; import javafx.scene.shape.Circle; import javafx.scene.text.Font; import javafx.util.Duration; /** * COMMENTARY ADDED SINCE ALL IS MESSY AND HARD TO UNDERSTAND * @author Fred */ public class Series extends AnimationBase implements IConstants{ private TextField valueAText; private TextField valueRText; private Circle circleSum; private double radius; private double infinity; public Series(String name) { super(name); //Creates all the layout stuff, nothing special setupGui(); } public void setupGui() { valueAText=new TextField(String.valueOf(SERIES_A_DEF)); valueRText=new TextField(String.valueOf(SERIES_R_DEF)); circleSum=new Circle(); radius=SERIES_SUM_RADIUS_IN; circleSum.setRadius(radius); circleSum.setLayoutX(SERIES_SUM_X); circleSum.setLayoutY(SERIES_SUM_Y); infinity=SERIES_INFINITY_IN; valueRText.setLayoutY(SERIES_VALUERT_Y); valueRText.setLayoutX(SERIES_VALUERT_X); valueAText.setLayoutX(SERIES_VALUEAT_X); setStaticGUI(); } //When you forget to add sutff to the plan so you cant add 20 variables so you just decide to add a function and make it messy public void setStaticGUI() { Label formula=new Label(SERIES_LABEL_FORMULA_T); formula.setLayoutX(30); formula.setLayoutY(55); formula.setFont(FONT_ARIAL_20); Label aLabel=new Label(SERIES_LABEL_A_T); aLabel.setTextFill(PAINT_BLACK); Label rLabel=new Label(SERIES_LABEL_R_T); rLabel.setLayoutY(30); rLabel.setTextFill(PAINT_BLACK); getChildren().addAll(valueAText,valueRText,rLabel,aLabel,circleSum,formula); } //calls done to clear children and then readds everything with default values/reinitialises everything public void reset() { done(); setupGui(); } // stops animation so it's ready to start again public void done() { timeline.stop(); getChildren().clear(); setStaticGUI(); } // returns help text for dialog box public String getHelp() { return "This will use the provided value to perform a sum of the equation. The end value will be the infitnite geometrical series sum for the provided euqation of AR^n."; } public void start() //this could and should be in lots of seperate methods, but my plan didn't account for this. So it's really messy { done(); timeline=new Timeline(); double a=getValueA(); //gets A value double r=getValueR(); //gets r value radius=ZERO; infinity=SERIES_INFINITY_IN; //sets infiity var to -1, once it's higher then 0, the sum is considered tending to infinity Double tendValue=Math.PI; double scale=SERIES_SCALE_DEF; //scale of the circle, could make it dynamic, but keeping is like this for now Label radiusL=new Label(String.valueOf(radius)); //created a radius label for the big sum circle that doesnt move radiusL.getStyleClass().add(SERIES_LABEL_STYLE); radiusL.setLayoutX(SERIES_VALUE_LABEL_X); radiusL.setLayoutY(SERIES_VALUE_LABEL_Y); getChildren().add(radiusL); //adds radius label int iMax=ZERO; for(int i=ZERO;i<SERIES_MAXITERATIONS;i++) { double value=getValue(a,r,i); //finds the value at a certain n // System.out.println(value);//debug Circle c=new Circle(); //creates a small cicle tha trepresents the value c.setFill(PAINT_RED); c.setOpacity(IConstants.SERIES_OPACITY_IN); c.setRadius(0); c.setLayoutY(IConstants.SERIES_VALUE_Y);//starts at 0 DecimalFormat f = new DecimalFormat("##");//used to format things Label t=new Label(f.format(value)); //creates label for value circle t.setLayoutY(IConstants.SERIES_VALUET_Y); t.setTranslateX(IConstants.SERIES_VALUET_TY); t.setTextFill(Paint.valueOf(IConstants.SERIES_VALUET_COLOR)); t.setVisible(false); //will be set visible when small circle appears this.getChildren().addAll(c,t); //add both to screen, t being non-visible and c being of radius 0, so invisible KeyValue valuescXI=new KeyValue(c.centerXProperty(),SERIES_VALUECIRCLE_XI); //keyvalue for small circle X initial KeyValue valuescXF=new KeyValue(c.centerXProperty(),SERIES_VALUECIRCLE_XF); //keyvalue for small circle X final KeyValue valuescOI=new KeyValue(c.opacityProperty(),SERIES_OPACITY_IN); //keyvalue for small circle opacity initial KeyValue valuescOF=new KeyValue(c.opacityProperty(),SERIES_OPACITY_FN); //keyvalue for small circle opacity final KeyValue valuescRF=new KeyValue(c.radiusProperty(),(value/scale)>SERIES_VALUECIRCLE_RMIN?value/scale:SERIES_VALUECIRCLE_RMIN); //key value for small circle radius -> becomes bigger KeyValue valuetXI=new KeyValue(t.layoutXProperty(),SERIES_VALUECIRCLE_XI); //key value for value label X initial KeyValue valuetXF=new KeyValue(t.layoutXProperty(),SERIES_VALUECIRCLE_XF); //key value for value label X final KeyValue circleI=new KeyValue(circleSum.radiusProperty(),radius/scale); //creates a keyvalue for the circle radius initial if(radius>SERIES_MAX_SUM_R) // once radius is bigger then 500, it tends to a too big number { if(r>=SERIES_INFINITE_RANGE[1] || r<=SERIES_INFINITE_RANGE[0]) //iso we check if it tends to infinity { infinity=radius/scale; }else //if it tends to a real value { tendValue=(a/(1-r)); //find the sum end result to display latter } }else { radius+=value; //if its not too big continue adding } KeyValue circleF=new KeyValue(circleSum.radiusProperty(),radius/scale); //keyvalue for the circle radius final KeyFrame kf0=new KeyFrame(Duration.millis(i*TIME_MILLIS_CONVERSION),new EventHandler<ActionEvent>(){ //first keyframe for the initial values @Override public void handle(ActionEvent event) { t.setVisible(true); //set value label to true when it's animation starts } },valuescOI,valuescXI,valuetXI); KeyFrame kf1=new KeyFrame(Duration.millis((i+1)*TIME_MILLIS_CONVERSION),new EventHandler<ActionEvent>(){ //second keyframe for the final value circle values and initial sum circle values @Override public void handle(ActionEvent event) { getChildren().removeAll(c,t); //remove useless value circle and it's label since they already played the animation } },valuescXF,valuescOF,valuetXF,circleI ,valuescRF); final Double tend=tendValue; //need final for stupid innerclasses. KeyFrame kf2=new KeyFrame(Duration.millis((i+1)*TIME_MILLIS_CONVERSION+SERIES_TIME_SUM_EX),new EventHandler<ActionEvent>(){ //third keyframe for sum circle final. @Override public void handle(ActionEvent event) { DecimalFormat f = new DecimalFormat(DECIMALFORMAT_2DEC); radiusL.setText(tend!=Math.PI?f.format(tend):infinity==circleSum.getRadius()?SERIES_TEXT_INFINITE:f.format(circleSum.getRadius()*scale)); //set new sum value. Shitty code, but no time to clean up } },circleF); timeline.getKeyFrames().addAll(kf0,kf1,kf2); //add all keyframes to timeline. if(infinity>ZERO || tendValue!=Math.PI) //if too big, set maximum i for later { iMax=i; break; } if(Double.parseDouble(f.format(value))<=ZERO)//see if it's adding 0 and is then finished { iMax=i; break; } } KeyFrame kf=new KeyFrame(Duration.millis((iMax+1)*TIME_MILLIS_CONVERSION+TIME_MILLIS_CONVERSION),new KeyValue(circleSum.radiusProperty(),80)); //set sum circle to static final size so it stays on screen and isn't too big or too small for screen timeline.getKeyFrames().add(kf); timeline.play(); //play the whole damn thing } public double getValue(double a,double r,int n) { return (a*Math.pow(r, n)); } public double getValueA() { return Double.parseDouble(valueAText.getText()); } public double getValueR() { return Double.parseDouble(valueRText.getText()); } public void setValueA(int a) { valueAText.setText(String.valueOf(a)); } public void setValueR(int r) { valueAText.setText(String.valueOf(r)); } }
[ "fredericdesgreniers@gmail.com" ]
fredericdesgreniers@gmail.com
17d66b0be47079eab3b0cda5e06d41f9e698a943
a230ae34f7ec9668dfa6f95315fc540dfb965c03
/eventset/EndGame.java
f59dd0345e7c6c11c6626c97b1f160fbd918c2d3
[]
no_license
OmniConsumerPrograms/BradBin
bf6effc845840ef269e15f22236ca720253a6cb7
a22965b9f955171603f0aeb94288de7900aa74e8
refs/heads/master
2020-12-24T21:10:44.444915
2016-06-08T02:12:45
2016-06-08T02:12:45
58,172,140
0
0
null
null
null
null
UTF-8
Java
false
false
345
java
// Brad Howard // OCP Event package eventset; import interfaces.IEvent; import systemset.Gamemaster; public class EndGame implements IEvent { private Gamemaster GM; private int eventID = 990; public EndGame(Gamemaster GM) { this.GM = GM; } public void run() { GM.exit(); } public int getEventID() { return eventID; } }
[ "bjhoward@eagles.ewu.edu" ]
bjhoward@eagles.ewu.edu
48318acd9e281b80d6a817957da218171bc76add
6a37ebbce93392eb1d5739023413d3dccecd297c
/Project/product-phase-development@97ff8629ba9/micro-services/customer-service/src/main/java/com/sapient/asde/batch5/customerservice/controller/pod_d/pjmb1317/FavoriteVehicleController.java
648e623ca30b9c6e15290c7e4ae0ae423cc02a03
[]
no_license
AbhishekRajgaria-ps/sapient-asde-june-2021-training
9035810f5c36ce01c4020601a5bf803a8c31d98e
075736b7a3677d10b7ce3c180e4b73deaa6f7f9b
refs/heads/master
2023-08-24T14:45:22.770557
2021-10-08T16:33:58
2021-10-08T16:33:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,073
java
package com.sapient.asde.batch5.customerservice.controller.pod_d.pjmb1317; import java.util.HashMap; import java.util.List; import java.util.Map; import com.fasterxml.jackson.databind.ObjectMapper; import com.sapient.asde.batch5.customerservice.entity.Vehicle; import com.sapient.asde.batch5.customerservice.service.ServiceException; import com.sapient.asde.batch5.customerservice.service.pod_d.pjmb1317.FavoriteVehicleService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import lombok.extern.slf4j.Slf4j; @Slf4j @RestController @RequestMapping("/api/customers") public class FavoriteVehicleController { @Autowired FavoriteVehicleService service; @Autowired ObjectMapper om; private static final String SUCCESS = "success"; private static final String DATA = "data"; private static final String NAME = "firstName"; private static final String USER_ID = "userId"; private static final String ERROR = "error"; /** * @author vikash kumar gupta */ @GetMapping("/favorites") public ResponseEntity<Object> getCustomerWishlist( @RequestAttribute(required = false, name = "claims") Map<String, Object> claims) throws IllegalArgumentException, ServiceException { if (claims == null) { return ResponseEntity.status(HttpStatus.UNAUTHORIZED).body("Authorization header may be missing or invalid."); } if (claims.containsKey(ERROR)) { return ResponseEntity.status(HttpStatus.GATEWAY_TIMEOUT).body(claims.get(ERROR)); } Map<String, Object> map = new HashMap<>(); List<Vehicle> list = service.customerWishlist(claims.get(USER_ID).toString()); map.put(SUCCESS, true); map.put(DATA, list); return ResponseEntity.ok(map); } }
[ "kayartaya.vinod@gmail.com" ]
kayartaya.vinod@gmail.com
1645783d77b0d6713dbe786457704460756c04f1
b7900cdf340f34f1d65109b247e1591a21703523
/src/main/java/org4/weixin/domain/event/EventInMessage.java
be500032a2cb3a491d3c2f5a3e503fb51881003b
[ "Apache-2.0" ]
permissive
2412320844/weixin_kemao_lyy
8f58955fb84d16174f36d1de5760a47baa03b39b
680905168ffbcaa86b0fc80c635733a00dc8ff4a
refs/heads/master
2020-05-01T16:25:20.071278
2019-05-15T07:31:58
2019-05-15T07:31:58
177,543,226
0
0
null
null
null
null
UTF-8
Java
false
false
695
java
package org4.weixin.domain.event; import javax.xml.bind.annotation.XmlElement; import com.fasterxml.jackson.annotation.JsonProperty; import org4.weixin.domain.InMessage; public class EventInMessage extends InMessage { /** * */ private static final long serialVersionUID = 1L; @XmlElement(name = "Event") @JsonProperty("Event") private String event; @XmlElement(name = "EventKey") @JsonProperty("EventKey") private String eventKey; public String getEvent() { return event; } public void setEvent(String event) { this.event = event; } public String getEventKey() { return eventKey; } public void setEventKey(String eventKey) { this.eventKey = eventKey; } }
[ "LYY@liyuanyang" ]
LYY@liyuanyang
7316897afe64b5eed202d562addb14e665173eb3
3be8c68ad188ada90fe8c8c25be78b97f146c31a
/src/main/java/com/crazywah/request/NIMRefreshToken.java
739e18bf1d7042421a02312976c1e3cbf5f3f55b
[]
no_license
OuFungWah/PiedPiperServer
0fd492159bc365a28ba1f9dcf3e46aeaf330214a
a5f67a0bb6d2b6609512d2783190ef814fc35b1f
refs/heads/master
2020-04-17T16:56:27.539782
2019-05-30T01:41:11
2019-05-30T01:41:11
166,762,801
2
0
null
null
null
null
UTF-8
Java
false
false
357
java
package com.crazywah.request; import com.crazywah.common.RequestUrl; public class NIMRefreshToken extends RequestBase { public String request(String accountId){ params.add("accid",accountId); return requestToNIM(); } @Override protected String getUrl() { return RequestUrl.URL_USER_REFRESH_TOKEN_ACTION; } }
[ "diegobruce@163.com" ]
diegobruce@163.com
c6e9bd774dd965013e4fc342ce4340f2c8cfa283
9f37af5bcccb1c44ec149b0365108e167bc50bc3
/gmall-pms/src/main/java/com/atguigu/gmall/pms/vo/AttrVO.java
3b75135c7111740d46599db705cc90a83c37dd9e
[ "Apache-2.0" ]
permissive
xlf784679405/gmall-0615
67ab7387990123209a3891c76b9e23f9b630b087
8b084815edcbcee19544e5237c1fc251a0fd5d5e
refs/heads/master
2022-12-23T17:13:58.735000
2019-11-16T08:42:51
2019-11-16T08:42:51
217,997,035
0
0
Apache-2.0
2022-12-16T14:50:53
2019-10-28T08:16:05
JavaScript
UTF-8
Java
false
false
239
java
package com.atguigu.gmall.pms.vo; import com.atguigu.gmall.pms.entity.AttrEntity; import lombok.Data; /** * @author feilong * @create 2019-10-31 17:48 */ @Data public class AttrVO extends AttrEntity { private Long attrGroudId; }
[ "784679405@qq.com" ]
784679405@qq.com
28970a459fbb8d5d58844d02133c2c8df7b7d9bb
471d4181aa114996d6f54134847cd4e00e41918c
/src/main/java/com/lister/esb/controller/BrowseController.java
0fd528335e98b4b7bb362411680bbd71c3e0d693
[]
no_license
vamsiannem/EmergeServices
8670a40bfcd87135539826f2b61b0883fdec8f62
8afbd67710f1339e7d5229285464534fbfffa11e
refs/heads/master
2022-09-25T20:40:46.692548
2022-08-30T08:52:41
2022-08-30T08:52:41
19,113,205
0
0
null
null
null
null
UTF-8
Java
false
false
6,405
java
package com.lister.esb.controller; import com.lister.esb.dto.BrowseDTO; import com.lister.esb.enums.ActionType; import com.lister.esb.enums.SourceSystem; import com.lister.esb.exceptions.JsonException; import com.lister.esb.exceptions.XmlException; import com.lister.esb.model.DataFormat; import com.lister.esb.model.ServiceRequest; import com.lister.esb.processors.IRequestDelegate; import com.lister.esb.utils.ConversionUtils; import com.lister.esb.utils.ESBConstants; import com.lister.esb.utils.ServiceRequestFactoryBean; import org.json.JSONException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.http.HttpStatus; import org.springframework.jms.core.JmsTemplate; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; import java.io.IOException; /** * Created by IntelliJ IDEA. * User: rajeev_m * Date: 11/22/12 * Time: 3:46 PM * To change this template use File | Settings | File Templates. */ @Controller public class BrowseController { private static Logger logger = LoggerFactory.getLogger(BrowseController.class); @Autowired private ConversionUtils conversionUtils; @Autowired private JmsTemplate jmsTemplate; @Autowired @Qualifier("serviceRequestFactoryBean") private ServiceRequestFactoryBean serviceRequestFactoryBean; @Autowired @Qualifier("simpleRequestDelegator") private IRequestDelegate requestDelegator; /** * Handles the Json Format request for Creating Browse * @param isResponseRequired * @param createBrowseJson * @return */ @RequestMapping(method=RequestMethod.POST, value = "/browse" ,headers = "Accept=application/json" ) public @ResponseBody String createBrowseJson(@RequestParam(value="isResponseRequired",required=true) Boolean isResponseRequired,@RequestParam(value="storedProcedureName",required=false) String storedProcedureName,@RequestBody String createBrowseJson) { //(wraps up information to be passed to the Next Layer) ServiceRequest serviceRequest = serviceRequestFactoryBean.createServiceRequest(createBrowseJson, ActionType.CREATE, isResponseRequired, DataFormat.JSON, BrowseDTO.class, SourceSystem.MARKET,storedProcedureName); logger.info("Browse request: Service Request Created "); String responseJsonString=null; if(isResponseRequired) { // Process synchronous requests try { responseJsonString = conversionUtils.convertObjectToJson(requestDelegator.transfer(serviceRequest)); } catch (IOException e) { throw new JsonException(ESBConstants.EX_RESPONSE_JSON_FMT); } catch (JSONException e) { throw new JsonException(ESBConstants.EX_RESPONSE_JSON_FMT); } } else { //Sending the input request to the MQ logger.info("Browse Request : Sending the input request to the MQ"); jmsTemplate.convertAndSend(serviceRequest); responseJsonString=ESBConstants.RESPONSE_SUCCESS; } return responseJsonString; } /** * Handles the XML Format request for Creating Browse * @param isResponseRequired * @param createBrowseXml * @return */ @RequestMapping(method=RequestMethod.POST, value="/browse" ,headers = "Accept=application/xml" ) public @ResponseBody String createBrowseXml(@RequestParam(value="isResponseRequired",required=true) Boolean isResponseRequired ,@RequestParam(value="storedProcedureName",required=false) String storedProcedureName ,@RequestBody String createBrowseXml) { //(wraps up information to be passed to the Next Layer) ServiceRequest serviceRequest = serviceRequestFactoryBean.createServiceRequest(createBrowseXml, ActionType.CREATE, isResponseRequired, DataFormat.XML, BrowseDTO.class, SourceSystem.MARKET,storedProcedureName); logger.info("Browse request: Service Request Created "); String responseXmlString=null; if(isResponseRequired) { //Process synchronous requests try { responseXmlString=conversionUtils.convertToXML(requestDelegator.transfer(serviceRequest)); } catch (IOException e) { throw new XmlException(ESBConstants.EX_RESPONSE_XML_FMT); } } else { //Sending the input request to the MQ logger.info("Browse Request : Sending the input request to the MQ"); jmsTemplate.convertAndSend(serviceRequest); responseXmlString=ESBConstants.RESPONSE_SUCCESS; } return responseXmlString; } /** * Handles all the Exceptions related to Json format Request * @param jsonException * @return */ @ExceptionHandler(value = JsonException.class) @ResponseStatus (HttpStatus.INTERNAL_SERVER_ERROR) public @ResponseBody String handleAddressNotFoundException(JsonException jsonException) { String errorMessage; try { errorMessage = conversionUtils.convertObjectToJson(jsonException.getJsonExceptionMessage()); } catch (IOException e) { errorMessage= ESBConstants.EX_JSON_FMT; } catch (JSONException e) { errorMessage=ESBConstants.EX_JSON_FMT; } return errorMessage; } /** * Logging exceptions related to Attributes[XML] request * @param xmlException * @return */ @ExceptionHandler(value = XmlException.class) @ResponseStatus (HttpStatus.INTERNAL_SERVER_ERROR) public @ResponseBody String handleAddressNotFoundException(XmlException xmlException) { String errorMessage = null; try { errorMessage = conversionUtils.convertToXML(xmlException); } catch (IOException e) { errorMessage = "<Error>Error in forming the exception xml</Error>"; } return errorMessage; } }
[ "vamsiannem@gmail.com" ]
vamsiannem@gmail.com
cbe58b0bf0c5712f85426f02ee638a44a4d9108f
682eeef2f2fe321ccdd5ac58f0f2ceecb329c6e5
/app/src/main/java/com/xwtiger/devrescollect/study/designpattern/proxy/IShop.java
01b972ba95e74bb378f29bf7002a16e164e465eb
[]
no_license
dreamofxw/DevResCollect
4a741ba63d0760c6fe8fffa172fc8f3dcc72b366
89a0f0ae78517bb4cc6c5b1334a140eb0fe9d72d
refs/heads/master
2021-06-04T17:26:06.338471
2021-04-14T14:09:41
2021-04-14T14:09:41
109,081,823
2
1
null
2019-12-17T05:43:26
2017-11-01T03:22:19
Java
UTF-8
Java
false
false
150
java
package com.xwtiger.devrescollect.study.designpattern.proxy; /** * Created by xwadmin on 2018/4/9. */ public interface IShop { void buy(); }
[ "wenwen.xu@busonline.com" ]
wenwen.xu@busonline.com
74a81411e12afd88b009912b17f7a525814a11b1
f002af9a66643c3da8eb52496bf8a6b93a2d3ad4
/src/main/java/com/autentia/randomvos/randomizer/LongRandomizer.java
e80be3df85b5bbfa8c5b676cd3db9b5d70b615ed
[ "Apache-2.0" ]
permissive
autentia/randomvos
0869359fb50304d63f5fb420307c42fbb252b2ba
426ec35db768bb00f5e565a8927ebcff2c65f37f
refs/heads/master
2022-12-27T07:30:31.936519
2019-09-13T15:31:42
2019-09-13T15:31:42
113,060,309
0
0
Apache-2.0
2020-10-13T08:29:38
2017-12-04T15:31:44
Java
UTF-8
Java
false
false
205
java
package com.autentia.randomvos.randomizer; public class LongRandomizer extends AbstractRandomizer<Long> { @Override public Long nextRandomValue() { return getRandom().nextLong(); } }
[ "dgarciagil@autentia.com" ]
dgarciagil@autentia.com
631f648fdea151869f5bd8f0e4a93873c4c46d12
f29f8f1fc8a23ef96e4c359afb82eeb5622756bf
/src/main/java/io/github/nucleuspowered/nucleus/modules/info/listeners/InfoListener.java
a5108d1db0ced002d4c21efe540b24e1ad1313e4
[ "MIT", "Apache-2.0" ]
permissive
IdrisDose/Nucleus
ccf4684d48b70176a978dcb87ab332c073107e63
bf1e5260b0832f7fe7cb9d8e7966d254250ccaea
refs/heads/sponge-api/5
2021-01-13T03:37:47.058799
2016-12-22T17:00:01
2016-12-22T17:32:32
77,278,336
0
0
MIT
2018-10-18T06:12:56
2016-12-24T10:35:34
Java
UTF-8
Java
false
false
3,946
java
/* * This file is part of Nucleus, licensed under the MIT License (MIT). See the LICENSE.txt file * at the root of this project for more details. */ package io.github.nucleuspowered.nucleus.modules.info.listeners; import com.google.common.collect.Maps; import com.google.inject.Inject; import io.github.nucleuspowered.nucleus.ChatUtil; import io.github.nucleuspowered.nucleus.Nucleus; import io.github.nucleuspowered.nucleus.internal.ListenerBase; import io.github.nucleuspowered.nucleus.internal.PermissionRegistry; import io.github.nucleuspowered.nucleus.internal.annotations.ConditionalListener; import io.github.nucleuspowered.nucleus.internal.permissions.PermissionInformation; import io.github.nucleuspowered.nucleus.internal.permissions.SuggestedLevel; import io.github.nucleuspowered.nucleus.modules.info.InfoModule; import io.github.nucleuspowered.nucleus.modules.info.commands.MotdCommand; import io.github.nucleuspowered.nucleus.modules.info.config.InfoConfigAdapter; import io.github.nucleuspowered.nucleus.modules.info.handlers.InfoHelper; import org.spongepowered.api.Sponge; import org.spongepowered.api.entity.living.player.Player; import org.spongepowered.api.event.Listener; import org.spongepowered.api.event.network.ClientConnectionEvent; import uk.co.drnaylor.quickstart.exceptions.IncorrectAdapterTypeException; import uk.co.drnaylor.quickstart.exceptions.NoModuleException; import java.util.Map; import java.util.concurrent.TimeUnit; import java.util.function.Predicate; @ConditionalListener(InfoListener.Test.class) public class InfoListener extends ListenerBase.Reloadable { @Inject private ChatUtil chatUtil; @Inject private PermissionRegistry pr; @Inject private InfoConfigAdapter ica; private String motdPermission = null; private int delay = 500; @Listener public void playerJoin(ClientConnectionEvent.Join event) { final Player player = event.getTargetEntity(); // Send message one second later on the Async thread. Sponge.getScheduler().createAsyncExecutor(plugin).schedule(() -> { if (player.hasPermission(getMotdPermission())) { plugin.getTextFileController(InfoModule.MOTD_KEY).ifPresent(x -> { if (ica.getNodeOrDefault().isMotdUsePagination()) { InfoHelper.sendInfo(x, player, chatUtil, ica.getNodeOrDefault().getMotdTitle()); } else { InfoHelper.getTextFromStrings(x.getFileContents(), player, chatUtil).forEach(player::sendMessage); } }); } }, delay, TimeUnit.MILLISECONDS); } @Override public Map<String, PermissionInformation> getPermissions() { Map<String, PermissionInformation> msp = Maps.newHashMap(); msp.put(getMotdPermission(), new PermissionInformation(plugin.getMessageProvider().getMessageWithFormat("permission.motd.join"), SuggestedLevel.USER)); return msp; } private String getMotdPermission() { if (motdPermission == null) { motdPermission = pr.getService(MotdCommand.class).getPermissionWithSuffix("login"); } return motdPermission; } @Override public void onReload() throws Exception { this.delay = (int)(ica.getNodeOrDefault().getMotdDelay() * 1000); } public static class Test implements Predicate<Nucleus> { @Override public boolean test(Nucleus nucleus) { try { return nucleus.getModuleContainer().getConfigAdapterForModule(InfoModule.ID, InfoConfigAdapter.class) .getNodeOrDefault().isShowMotdOnJoin(); } catch (NoModuleException | IncorrectAdapterTypeException e) { if (nucleus.isDebugMode()) { e.printStackTrace(); } return false; } } } }
[ "git@drnaylor.co.uk" ]
git@drnaylor.co.uk
5c2cdfd607d318a767df6b3a4125d6c6bc48954c
6b9699a76ce88157a94747edd7ccd6e931095f61
/src/main/java/org/srcm/pmp/domain/Seeker.java
6c0d1b15eb605cab4f6832e1e44acb6ee053cf18
[]
no_license
hpoliset/pmp-datauploader
3cdf65ee437f55063ea0c86eb38c262e1c4c3f77
92f713fe6d4ad6e656b99b332a873651d66647b9
refs/heads/master
2021-01-10T10:07:52.897112
2015-12-16T08:20:09
2015-12-16T08:20:09
43,313,032
0
1
null
null
null
null
UTF-8
Java
false
false
6,035
java
package org.srcm.pmp.domain; import java.io.Serializable; import java.util.Date; import java.util.List; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.OneToMany; import javax.persistence.OneToOne; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import org.hibernate.annotations.GenericGenerator; /** * The persistent class for the seeker database table. * */ @Entity @Table(name="seeker") public class Seeker implements Serializable { private static final long serialVersionUID = 1L; private long seeker_ID; private String abhyasi_ID; private byte age; @Temporal(TemporalType.TIMESTAMP) @Column(name="create_time") private Date createTime; private String created_by; @Temporal(TemporalType.DATE) private Date date_of_Registration; private String email; private String first_Name; private int gender; private String ID_Card_Num; private String language; private String occupation; private String phone_Mobile; private byte status; private byte subscribe; private SeekerAimsCols seekerAimsCols; private Date updateTime; @Column(name="updated_by") private String updatedBy; private byte welcome_msg_sent; //bi-directional many-to-one association to Membership private List<Membership> memberships; //bi-directional many-to-one association to Maturity private Maturity maturity; public Seeker() { } @Id @GenericGenerator(name="icn" , strategy="increment") @GeneratedValue(generator="icn") @Column(name="seeker_ID") public long getSeeker_ID() { return this.seeker_ID; } public void setSeeker_ID(long seeker_ID) { this.seeker_ID = seeker_ID; } @Column(name="Abhyasi_ID") public String getAbhyasi_ID() { return this.abhyasi_ID; } public void setAbhyasi_ID(String abhyasi_ID) { this.abhyasi_ID = abhyasi_ID; } @Column(name="age") public byte getAge() { return this.age; } public void setAge(byte age) { this.age = age; } @Column(name="create_Time") public Date getCreateTime() { return this.createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } @Column(name="created_by") public String getCreated_by() { return this.created_by; } public void setCreated_by(String created_by) { this.created_by = created_by; } @Column(name="date_of_Registration") public Date getDate_of_Registration() { return this.date_of_Registration; } public void setDate_of_Registration(Date date_of_Registration) { this.date_of_Registration = date_of_Registration; } @Column(name="email") public String getEmail() { return this.email; } public void setEmail(String email) { this.email = email; } @Column(name="First_Name") public String getFirst_Name() { return this.first_Name; } public void setFirst_Name(String first_Name) { this.first_Name = first_Name; } @Column(name="Gender") public int getGender() { return this.gender; } public void setGender(int gender) { this.gender = gender; } @Column(name="ID_Card_Num") public String getID_Card_Num() { return this.ID_Card_Num; } public void setID_Card_Num(String ID_Card_Num) { this.ID_Card_Num = ID_Card_Num; } @Column(name="Language") public String getLanguage() { return this.language; } public void setLanguage(String language) { this.language = language; } @Column(name="occupation") public String getOccupation() { return this.occupation; } public void setOccupation(String occupation) { this.occupation = occupation; } @Column(name="phone_Mobile") public String getPhone_Mobile() { return this.phone_Mobile; } public void setPhone_Mobile(String phone_Mobile) { this.phone_Mobile = phone_Mobile; } @Column(name="status") public byte getStatus() { return this.status; } public void setStatus(byte status) { this.status = status; } @Column(name="subscribe") public byte getSubscribe() { return this.subscribe; } public void setSubscribe(byte subscribe) { this.subscribe = subscribe; } @Temporal(TemporalType.TIMESTAMP) @Column(name="update_time") public Date getUpdateTime() { return this.updateTime; } public void setUpdateTime(Date updateTime) { this.updateTime = updateTime; } @Column(name="updated_By") public String getUpdatedBy() { return this.updatedBy; } public void setUpdatedBy(String updatedBy) { this.updatedBy = updatedBy; } @Column(name="welcome_msg_sent") public byte getWelcome_msg_sent() { return this.welcome_msg_sent; } public void setWelcome_msg_sent(byte welcome_msg_sent) { this.welcome_msg_sent = welcome_msg_sent; } @OneToMany(mappedBy="seeker") public List<Membership> getMemberships() { return this.memberships; } public void setMemberships(List<Membership> memberships) { this.memberships = memberships; } public Membership addMembership(Membership membership) { getMemberships().add(membership); membership.setSeeker(this); return membership; } public Membership removeMembership(Membership membership) { getMemberships().remove(membership); membership.setSeeker(null); return membership; } @ManyToOne @JoinColumn(name="Maturity_Status_ID") public Maturity getMaturity() { return this.maturity; } public void setMaturity(Maturity maturity) { this.maturity = maturity; } @OneToOne(fetch = FetchType.LAZY,mappedBy="seeker") public SeekerAimsCols getSeekerAimsCols() { return seekerAimsCols; } public void setSeekerAimsCols(SeekerAimsCols seekerAimsCols) { this.seekerAimsCols = seekerAimsCols; } }
[ "hpoliset@amazon.com" ]
hpoliset@amazon.com
75eb9c7d5c3c294f92502a52efae93b128541e32
b1caa341e775fc03ab13b3955f770493fbe683a6
/Red5Pro/src/main/java/infrared5/com/red5proandroid/subscribe/Subscribe.java
6f00d6f28365ffe73ddf8b72682973e47a584e34
[ "Apache-2.0" ]
permissive
deyin/red5pro-android-app
8f5f05b5403e86618715c89705d78f4b089f0e30
1b43b92260122265ee04b9e706ea271abc4a4eaf
refs/heads/master
2021-01-17T06:02:38.893112
2015-08-26T20:30:51
2015-08-26T20:30:51
41,779,923
1
1
null
2015-09-02T04:30:40
2015-09-02T04:30:40
null
UTF-8
Java
false
false
6,690
java
package infrared5.com.red5proandroid.subscribe; import android.app.Activity; import android.app.DialogFragment; import android.content.Context; import android.content.SharedPreferences; import android.os.Bundle; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import android.widget.Toast; import com.red5pro.streaming.R5Connection; import com.red5pro.streaming.R5Stream; import com.red5pro.streaming.R5StreamProtocol; import com.red5pro.streaming.config.R5Configuration; import com.red5pro.streaming.event.R5ConnectionEvent; import com.red5pro.streaming.event.R5ConnectionListener; import com.red5pro.streaming.view.R5VideoView; import infrared5.com.red5proandroid.AppState; import infrared5.com.red5proandroid.ControlBarFragment; import infrared5.com.red5proandroid.R; import infrared5.com.red5proandroid.publish.PublishStreamConfig; import infrared5.com.red5proandroid.settings.SettingsDialogFragment; public class Subscribe extends Activity implements ControlBarFragment.OnFragmentInteractionListener, SettingsDialogFragment.OnFragmentInteractionListener { PublishStreamConfig streamParams = new PublishStreamConfig(); R5Stream stream; public boolean isStreaming = false; public final static String TAG = "Subscribe"; public void onStateSelection(AppState state) { this.finish(); } public void onSettingsClick() { openSettings(); } public void onSettingsDialogClose() { configure(); } public String getStringResource(int id) { return getResources().getString(id); } //setup configuration private void configure() { SharedPreferences preferences = getPreferences(MODE_MULTI_PROCESS); streamParams.host = preferences.getString(getStringResource(R.string.preference_host), getStringResource(R.string.preference_default_host)); streamParams.port = preferences.getInt(getStringResource(R.string.preference_port), Integer.parseInt(getStringResource(R.string.preference_default_port))); streamParams.app = preferences.getString(getStringResource(R.string.preference_app), getStringResource(R.string.preference_default_app)); streamParams.name = preferences.getString(getStringResource(R.string.preference_name), getStringResource(R.string.preference_default_name)); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_subscribe); configure(); ControlBarFragment controlBar = (ControlBarFragment)getFragmentManager().findFragmentById(R.id.control_bar); controlBar.setSelection(AppState.SUBSCRIBE); controlBar.displayPublishControls(false); View playPauseButton = findViewById(R.id.btnSubscribePlayPause); playPauseButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { toggleStream(); } }); } private void toggleStream() { if(isStreaming) { stopStream(); } else { startStream(); } } private void setStreaming(boolean ok) { ViewGroup playPauseButton = (ViewGroup) findViewById(R.id.btnSubscribePlayPause); TextView textView = (TextView) playPauseButton.getChildAt(0); isStreaming = ok; textView.setText(isStreaming ? "Stop Stream" : "Start Stream"); } private void startStream() { //grab the main view where our video object resides View v = this.findViewById(android.R.id.content); v.setKeepScreenOn(true); //setup the stream with the user config settings stream = new R5Stream(new R5Connection(new R5Configuration(R5StreamProtocol.RTSP, streamParams.host, streamParams.port, streamParams.app, 2.0f))); //set log level to be informative stream.setLogLevel(R5Stream.LOG_LEVEL_INFO); //set up our listener stream.setListener(new R5ConnectionListener() { @Override public void onConnectionEvent(R5ConnectionEvent r5event) { //this is getting called from the network thread, so handle appropriately final R5ConnectionEvent event = r5event; runOnUiThread(new Runnable() { @Override public void run() { Context context = getApplicationContext(); CharSequence text = event.message; int duration = Toast.LENGTH_SHORT; Toast toast = Toast.makeText(context, text, duration); toast.show(); } }); } }); //associate the video object with the red5 SDK video view R5VideoView videoView = (R5VideoView)v.findViewById(R.id.video); //attach the stream videoView.attachStream(stream); //start the stream stream.play(streamParams.name); //update the state for the toggle button setStreaming(true); } private void stopStream() { if(stream != null) { View v = this.findViewById(android.R.id.content); R5VideoView videoView = (R5VideoView)v.findViewById(R.id.video); videoView.attachStream(null); stream.stop(); stream = null; } setStreaming(false); } private void openSettings() { try { DialogFragment newFragment = SettingsDialogFragment.newInstance(AppState.SUBSCRIBE); newFragment.show(getFragmentManager().beginTransaction(), "settings_dialog"); } catch(Exception e) { Log.i(TAG, "Can't open settings: " + e.getMessage()); } } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.subscribe, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.action_settings) { openSettings(); return true; } return super.onOptionsItemSelected(item); } @Override protected void onResume() { super.onResume(); openSettings(); } @Override protected void onPause() { stopStream(); super.onPause(); } @Override protected void onDestroy() { stopStream(); super.onDestroy(); } }
[ "azupko@gmail.com" ]
azupko@gmail.com
562cdc5566b4436f016e6a79dda1b9ff930ce6de
0e0b61c5a4d1edc7952db63e0d2c398ec635c534
/cryptos-java/src/main/java/io/pax/cryptos/dao/JdbcConnector.java
2e306c05d2905d7ab7a0e7c4c72db8d3a46fa0d0
[]
no_license
Feyribran/wallets
0a850d944ce9ec6d2d90de4081df62b453a8cc9e
ecacd692c3395cecb34e850de9d9142b3c21e6b1
refs/heads/master
2021-05-02T12:30:44.503172
2018-02-13T15:32:39
2018-02-13T15:32:39
120,742,571
0
0
null
null
null
null
UTF-8
Java
false
false
1,351
java
package io.pax.cryptos.dao; import com.mysql.jdbc.jdbc2.optional.MysqlDataSource; import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; import javax.sql.DataSource; import java.sql.Connection; import java.sql.SQLException; /** * Created by AELION on 09/02/2018. */ public class JdbcConnector { DataSource dataSource = this.createDataSource(); /** * Ici, on peut faire plus rapide, en "supprimant" le constructeur * il y aura un constructeur vide par défaut */ /* public JdbcConnector() { this.dataSource = this.createDataSource(); }*/ DataSource createDataSource() { try { Context context = new InitialContext(); dataSource = (DataSource) context.lookup("java:/cryptos"); } catch (NamingException e) { MysqlDataSource mysqlDataSource = new MysqlDataSource(); mysqlDataSource.setUser("root"); mysqlDataSource.setPassword(""); mysqlDataSource.setServerName("localhost"); mysqlDataSource.setDatabaseName("cryptos"); mysqlDataSource.setPort(3306); dataSource = mysqlDataSource; } return dataSource; } public Connection getConnection() throws SQLException { return dataSource.getConnection(); } }
[ "arnaud.vacherat@gmail.com" ]
arnaud.vacherat@gmail.com
b79ab79f3e4a7af8501d97b1b61af8e4a7c0e343
0e07686192b08ac827f310008720bb9a889b84d1
/src/clasesUtilidadGeneral/ApiDolar.java
a497f61a63e68cf9dd024f5a1350ade8131d34b4
[]
no_license
Franco-Hasper/SistemaPanaderiaV2
7a4ea06ade1904e138aa7006635359e8e2dc1c06
93aaebfb0d63722a34f5c45ae16fccc84666ff9b
refs/heads/master
2023-03-21T15:17:19.670022
2021-03-15T01:24:40
2021-03-15T01:24:40
263,228,441
0
1
null
null
null
null
UTF-8
Java
false
false
2,946
java
package clasesUtilidadGeneral; import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; import org.json.JSONObject; import principal.PrincipalAdministrador; public class ApiDolar { /** * Establece una conexion con un enlace que proporciona el precio atual de * venta del dolar libre e inserta dicho valor en un Label presente en la * ventana principal de la aplicacion. * * @throws Exception */ public void precioDolarOficial(PrincipalAdministrador principalAdministrador) throws Exception { String url = "https://api-dolar-argentina.herokuapp.com/api/dolaroficial"; URL obj = new URL(url); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("GET"); con.setRequestProperty("User-Agent", "Mozilla/5.0"); BufferedReader in = new BufferedReader( new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } String precioCompra = response.substring(41, 46); String precioVenta = response.substring(57, 62); principalAdministrador.getLblCompraDolar().setText("$"+precioCompra); principalAdministrador.getLblVentaDolar().setText("$"+precioVenta); in.close(); } } /** * String url = "https://api-dolar-argentina.herokuapp.com/api/dolaroficial"; //https://www.dolarsi.com/api/api.php?type=valoresprincipales URL obj = new URL(url); try { HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("GET"); con.setRequestProperty("User-Agent", "Mozilla/5.0"); int responseCode = con.getResponseCode(); BufferedReader in = new BufferedReader( new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); JSONObject myResponse = new JSONObject(response.substring(0, 61)); principalAdministrador.getLblLibre().setText(myResponse.getString("compra")); // DesktopNotify.showDesktopMessage(" INFORMACION ", " DOLAR OFICIAL:\n COMPRA: "+myResponse.getString("compra")+"\n VENTA: "+ myResponse.getString("venta")+"", DesktopNotify.INFORMATION, 10000); } catch (Exception e) { // DesktopNotify.showDesktopMessage(" error de conexion ", " NO SE PUDO OBTENER\n EL PRECIO DEL DOLAR", DesktopNotify.ERROR, 7000); principalAdministrador.getLblLibre().setText("Sin resultados"); } */
[ "francoalfredo2014@gmail.com" ]
francoalfredo2014@gmail.com
98bf9d2625c5ddee713a6e60a1b944f6513dd50a
eac7bc60b25757cfe21b35fcb507b4430868d3da
/core-query/src/main/java/com/oppo/tagbase/query/node/ComplexQuery.java
940ab0b510bad829ebaa97486e3830c9bcf1ff82
[]
no_license
dybwall1234/tagbase
88e478f54c24eba1a41c81ff6a52a05a5ff17050
ad4bf702c1ee10e046750c2ceedc88ad5d74a937
refs/heads/master
2023-05-13T11:36:25.825148
2020-03-23T07:47:53
2020-03-23T07:47:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,589
java
package com.oppo.tagbase.query.node; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.common.base.Preconditions; import java.util.List; /** * Created by huangfeng on 2020/2/15. */ public final class ComplexQuery extends BaseQuery{ private OutputType outputType; @JsonProperty("operation") private OperatorType operation; @JsonProperty("subqueryList") private List<Query> subQueries; @JsonCreator public ComplexQuery( @JsonProperty("operation") OperatorType operator, @JsonProperty("subqueryList") List<Query> subQueries, @JsonProperty("output") OutputType outputType ) { Preconditions.checkNotNull(operator, "operator can not be null"); Preconditions.checkNotNull(outputType, "output can not be null"); if(subQueries == null || subQueries.size() == 1){ throw new IllegalArgumentException("size of subQueryList must be greater than 1"); } this.operation = operator; this.outputType = outputType; this.subQueries = subQueries; } public List<Query> getSubQueries() { return subQueries; } public OutputType getOutputType() { return outputType; } public OperatorType getOperation() { return operation; } @Override public OutputType getOutput() { return outputType; } @Override public <R> R accept(QueryVisitor<R> visitor) { return visitor.visitComplexQuery(this); } }
[ "fengfeng_max@163.com" ]
fengfeng_max@163.com
c78b96d0ea6b44d610718be844b2c615e8635631
210a45ff220c1becfb2eb9e8b1d12524d74501f2
/src/main/java/fi/softala/votingEngine/beanValidation/InnovatioNameExist.java
2f545a90eb18e11e8541bb921520c7dd1aa76b7e
[]
no_license
timojar/votingengine
1f4d7b1410e8a8ee60179d0cf67ef9e6e242fae3
6bf30a5256fbe7b281bf61995ad117977dfea98d
refs/heads/master
2021-05-03T11:28:06.083616
2017-04-28T08:24:34
2017-04-28T08:24:34
69,955,439
0
0
null
null
null
null
UTF-8
Java
false
false
775
java
package fi.softala.votingEngine.beanValidation; import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.PARAMETER; import java.lang.annotation.Documented; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import javax.validation.Constraint; import javax.validation.Payload; @Documented @Constraint(validatedBy = InnovatioNameExistValidator.class) @Target( { FIELD, PARAMETER }) @Retention(RetentionPolicy.RUNTIME) public @interface InnovatioNameExist { String message() default "{fi.softala.jee.demo.d15.InnovatioNameExist.message}"; Class<?>[] groups() default {}; Class<? extends Payload>[] payload() default {}; }
[ "Timo Jarmala" ]
Timo Jarmala
5a029121177c32ce69ec8c0b7c9de90aba1b5c5f
d680d4cf8fe577edcca547dfbadb6f9fdf23e31e
/app/src/main/java/com/chyss/myapplication/widget/messagePack/bean/Info.java
95cf4eed049ffb706683ac624aa8627c7563c160
[]
no_license
chyss/MyApplication
c1fd471e39caf58b7719ac693022fe1782b003ec
86d71da0bd73a963c3b7141db28f142cdcae5ee4
refs/heads/master
2021-01-10T13:43:13.736065
2018-03-19T07:39:47
2018-03-19T07:39:47
46,260,935
0
0
null
null
null
null
UTF-8
Java
false
false
580
java
package com.chyss.myapplication.widget.messagePack.bean; import org.msgpack.annotation.Message; /** * @author chyss 2017-05-05 */ @Message public class Info { private String name; private String id; 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; } @Override public String toString() { return "name : "+ name +", id : "+ id; } }
[ "2804083976@qq.com" ]
2804083976@qq.com
cd14ba28a90916ce5b6c0c742b0f5ab6b70a1502
45222bf1a1c2b9e4ad886d25a28b43370e8f2bb9
/src/main/java/fozzyhosting/winvps/api/MachinesApi.java
8068028fcbc40df947856497b38c3034c96615f5
[ "MIT" ]
permissive
FozzyHosting/winvps-api-java
97db1e329764d8b4199556c666707f678e1c2769
b603ccadca7718456b42c79e914687d37f3779a9
refs/heads/master
2022-07-26T05:41:22.052365
2022-07-06T13:10:21
2022-07-06T13:10:21
220,948,634
0
0
NOASSERTION
2022-05-20T21:15:10
2019-11-11T09:46:01
Java
UTF-8
Java
false
false
80,765
java
/* * Fozzy Windows VPS resellers API * Application Programming Interface (API) allows clients to manage the Windows VPS machines lifecycle. ## Endpoint `https://winvps.fozzy.com/api/v2/` ## Authentication To access the API, an existing client of Fozzy Inc. should be registered as Windows VPS Reseller by the company tech support through the ticket or using Sales Email. After that, the client will have an access to the winvps.fozzy.com and will be able to get an API Token (Signature) in `Settings -> API` section of main menu. If you have already used the previous API version, then the token is known to you. Note that the Token grants full access to your account and should be protected the same way you would protect your password. Also you can reset the Token on the receipt page. To use the Token you should pass it to `Api-Key` header of each request like this: ` curl -H 'API-KEY: TOKEN' https://winvps.fozzy.com/api/v2/products ` ## Content-Type API v2 supports `application/json`, `application/x-www-form-urlencoded` and `multipart/form-data` content types. In the first case HTTP request must be JSON-encoded with the body as a valid JSON string. The othres are default POST types with content in key=value format. The response always has `application/json` type and contains JSON-encoded payload. ## Response A successful response will be returned as a JSON object with at least one of the following top-level members: - `data` - the document’s “primary data” - `error` - error message - `pagination` - pagination details The members data and error cannot coexist in the same document. ### Codes - `200 OK` - Everything worked as expected. - `201 Created` - The request was successful and a resource was created. This is typically a response from a POST request to create a resource which runs immediately. - `202 Accepted` - The request has been accepted for processing. This is typically a response from a POST request that is handled async in our system, such as a request for some machine command. - `204 No Content` - The request was successful but the response body is empty. This is typically a response from a DELETE request to delete a resource or cancel the command. - `400 Bad Request` - A required parameter or the request is invalid. - `403 Unauthorized` - The authentication credentials are invalid. - `404 Not Found` - The requested resource doesn’t exist. - `500 Server error` - something went wrong. Please contact our support team. ### Examples #### Error: ```json { \"error\": \"Error message\" } ``` #### Success - retrieve single record: ```json { \"data\": { \"id\": 1, \"name\": \"String\" } } ``` #### Success - retrieve multiple records: ```json { \"data\": [ { \"id\": 1, \"name\": \"String\" }, { \"id\": 2, \"name\": \"String\" } ], \"pagination\": { \"total\": 10, } } ``` #### Success - response for some delayed action: ```json { \"data\": { \"name\": \"String\", \"jobs\": [ { \"id\": 0, \"parent_id\": 0, \"machine_id\": 0, \"type\": \"string\", \"status\": \"string\", \"start_time\": \"string\" } ] } } ``` ## Pagination Any API endpoint that returns a list of items requires pagination. By default we will return `50` records from any listing endpoint. If an API endpoint returns a list of items, then it will include an additional object with pagination information. The pagination information contains the following details: - `total` - The total number of entries available in the entire collection - `limit` - The number of entries returned per page (default: 50) - `page` - The page currently returned (default: 1) - `pages` - The total number of pages To go through the pages you need to pass additional GET parameter `page` with the number of page wanted. ## Entities meaning ### Product A product is a resources set with which a VPS will be created by default. This is a resources such ads CPU cores count, CPU power in percents of the maximum available limit, RAM minimum and maximum values, Disk Size etc. ### Template Template is an operating system version for VPS. ### Brand Brand is a set of custom software which installs on the machine automatically. Currently this set can be created only through the request to our administrators. ### Location Location is a list of regions in which the new VPS creation is available. ### Job Job is a command to perform specific actions on the machine such as creation, starting, changing, terminating, etc. Since most actions cannot be performed instantly, they are all queued and executed one after another. You will receive an additional property `jobs` in your response if any request generates new queue positions. ### Machine Machine is a virtual private server (VPS) which used to your own needs. Each Mahine has Operating System defined by **Template** installed on the server in a data center in a country specified by **Location** option. The machine has some specified by **Product** resources which can be used by your software installed automatically by the **Brand** option or manually from the RDP interface. ## Changelog ### Version 2.3.0 Methods `/machines` and `/machines/{name}` is now additionaly returns `notes` param. ### Version 2.2.0 The machine creation command now supports an additional option `add_ipv6` to provide the IPv6 for the new machine. ### Version 2.1.0 Added new command `run_updates_install` for starting Windows updates installation. Command can be used in the *_/machines/{name}/{command}* request. The status of updates is displayed in the general information about the machine by the *_/machines/{name}* request. * * OpenAPI spec version: 2.1.0 * * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ package fozzyhosting.winvps.api; import fozzyhosting.winvps.ApiCallback; import fozzyhosting.winvps.ApiClient; import fozzyhosting.winvps.ApiException; import fozzyhosting.winvps.ApiResponse; import fozzyhosting.winvps.Configuration; import fozzyhosting.winvps.Pair; import fozzyhosting.winvps.ProgressRequestBody; import fozzyhosting.winvps.ProgressResponseBody; import com.google.gson.reflect.TypeToken; import java.io.IOException; import fozzyhosting.winvps.model.ErrorResponse; import fozzyhosting.winvps.model.JobsListResponse; import fozzyhosting.winvps.model.MachineAddIpResponse; import fozzyhosting.winvps.model.MachineCommandResultResponse; import fozzyhosting.winvps.model.MachineCreateRequestBody; import fozzyhosting.winvps.model.MachineCreateResponse; import fozzyhosting.winvps.model.MachineDetailsResponse; import fozzyhosting.winvps.model.MachineReinstallRequestBody; import fozzyhosting.winvps.model.MachineUpdateRequestBody; import fozzyhosting.winvps.model.MachineUsersListResponse; import fozzyhosting.winvps.model.MachinesListResponse; import java.lang.reflect.Type; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; public class MachinesApi { private ApiClient apiClient; public MachinesApi() { this(Configuration.getDefaultApiClient()); } public MachinesApi(ApiClient apiClient) { this.apiClient = apiClient; } public ApiClient getApiClient() { return apiClient; } public void setApiClient(ApiClient apiClient) { this.apiClient = apiClient; } private Integer currentPage = 1; public void nextPage() { currentPage++; } public void previousPage() { currentPage--; } /** * Build call for machinesGet * @param progressListener Progress listener * @param progressRequestListener Progress request listener * @return Call to execute * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call machinesGetCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // create path and map variables String localVarPath = "/machines"; List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); Pair page = new Pair("page", String.valueOf(currentPage)); localVarQueryParams.add(page); System.out.println(localVarQueryParams); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) .build(); } }); } String[] localVarAuthNames = new String[] { "ApiKeyAuth" }; return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") private com.squareup.okhttp.Call machinesGetValidateBeforeCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { com.squareup.okhttp.Call call = machinesGetCall(progressListener, progressRequestListener); return call; } /** * Returns machines list in short form. * * @return MachinesListResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public MachinesListResponse machinesGet() throws ApiException { ApiResponse<MachinesListResponse> resp = machinesGetWithHttpInfo(); return resp.getData(); } /** * Returns machines list in short form. * * @return ApiResponse&lt;MachinesListResponse&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse<MachinesListResponse> machinesGetWithHttpInfo() throws ApiException { com.squareup.okhttp.Call call = machinesGetValidateBeforeCall(null, null); Type localVarReturnType = new TypeToken<MachinesListResponse>(){}.getType(); return apiClient.execute(call, localVarReturnType); } /** * Returns machines list in short form. (asynchronously) * * @param callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ public com.squareup.okhttp.Call machinesGetAsync(final ApiCallback<MachinesListResponse> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = machinesGetValidateBeforeCall(progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<MachinesListResponse>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /** * Build call for machinesNameAddIpPost * @param name (required) * @param progressListener Progress listener * @param progressRequestListener Progress request listener * @return Call to execute * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call machinesNameAddIpPostCall(String name, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // create path and map variables String localVarPath = "/machines/{name}/add_ip" .replaceAll("\\{" + "name" + "\\}", apiClient.escapeString(name.toString())); List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); Pair page = new Pair("page", String.valueOf(currentPage)); localVarQueryParams.add(page); System.out.println(localVarQueryParams); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) .build(); } }); } String[] localVarAuthNames = new String[] { "ApiKeyAuth" }; return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") private com.squareup.okhttp.Call machinesNameAddIpPostValidateBeforeCall(String name, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'name' is set if (name == null) { throw new ApiException("Missing the required parameter 'name' when calling machinesNameAddIpPost(Async)"); } com.squareup.okhttp.Call call = machinesNameAddIpPostCall(name, progressListener, progressRequestListener); return call; } /** * Send unary machine command * * @param name (required) * @return MachineAddIpResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public MachineAddIpResponse machinesNameAddIpPost(String name) throws ApiException { ApiResponse<MachineAddIpResponse> resp = machinesNameAddIpPostWithHttpInfo(name); return resp.getData(); } /** * Send unary machine command * * @param name (required) * @return ApiResponse&lt;MachineAddIpResponse&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse<MachineAddIpResponse> machinesNameAddIpPostWithHttpInfo(String name) throws ApiException { com.squareup.okhttp.Call call = machinesNameAddIpPostValidateBeforeCall(name, null, null); Type localVarReturnType = new TypeToken<MachineAddIpResponse>(){}.getType(); return apiClient.execute(call, localVarReturnType); } /** * Send unary machine command (asynchronously) * * @param name (required) * @param callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ public com.squareup.okhttp.Call machinesNameAddIpPostAsync(String name, final ApiCallback<MachineAddIpResponse> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = machinesNameAddIpPostValidateBeforeCall(name, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<MachineAddIpResponse>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /** * Build call for machinesNameCommandPost * @param name Machine name. (required) * @param command Command key. (required) * @param progressListener Progress listener * @param progressRequestListener Progress request listener * @return Call to execute * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call machinesNameCommandPostCall(String name, String command, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // create path and map variables String localVarPath = "/machines/{name}/{command}" .replaceAll("\\{" + "name" + "\\}", apiClient.escapeString(name.toString())) .replaceAll("\\{" + "command" + "\\}", apiClient.escapeString(command.toString())); List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); Pair page = new Pair("page", String.valueOf(currentPage)); localVarQueryParams.add(page); System.out.println(localVarQueryParams); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) .build(); } }); } String[] localVarAuthNames = new String[] { "ApiKeyAuth" }; return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") private com.squareup.okhttp.Call machinesNameCommandPostValidateBeforeCall(String name, String command, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'name' is set if (name == null) { throw new ApiException("Missing the required parameter 'name' when calling machinesNameCommandPost(Async)"); } // verify the required parameter 'command' is set if (command == null) { throw new ApiException("Missing the required parameter 'command' when calling machinesNameCommandPost(Async)"); } com.squareup.okhttp.Call call = machinesNameCommandPostCall(name, command, progressListener, progressRequestListener); return call; } /** * Send single command which does not need additional options. * * @param name Machine name. (required) * @param command Command key. (required) * @return MachineCommandResultResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public MachineCommandResultResponse machinesNameCommandPost(String name, String command) throws ApiException { ApiResponse<MachineCommandResultResponse> resp = machinesNameCommandPostWithHttpInfo(name, command); return resp.getData(); } /** * Send single command which does not need additional options. * * @param name Machine name. (required) * @param command Command key. (required) * @return ApiResponse&lt;MachineCommandResultResponse&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse<MachineCommandResultResponse> machinesNameCommandPostWithHttpInfo(String name, String command) throws ApiException { com.squareup.okhttp.Call call = machinesNameCommandPostValidateBeforeCall(name, command, null, null); Type localVarReturnType = new TypeToken<MachineCommandResultResponse>(){}.getType(); return apiClient.execute(call, localVarReturnType); } /** * Send single command which does not need additional options. (asynchronously) * * @param name Machine name. (required) * @param command Command key. (required) * @param callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ public com.squareup.okhttp.Call machinesNameCommandPostAsync(String name, String command, final ApiCallback<MachineCommandResultResponse> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = machinesNameCommandPostValidateBeforeCall(name, command, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<MachineCommandResultResponse>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /** * Build call for machinesNameDelete * @param name (required) * @param progressListener Progress listener * @param progressRequestListener Progress request listener * @return Call to execute * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call machinesNameDeleteCall(String name, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // create path and map variables String localVarPath = "/machines/{name}" .replaceAll("\\{" + "name" + "\\}", apiClient.escapeString(name.toString())); List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); Pair page = new Pair("page", String.valueOf(currentPage)); localVarQueryParams.add(page); System.out.println(localVarQueryParams); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) .build(); } }); } String[] localVarAuthNames = new String[] { "ApiKeyAuth" }; return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") private com.squareup.okhttp.Call machinesNameDeleteValidateBeforeCall(String name, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'name' is set if (name == null) { throw new ApiException("Missing the required parameter 'name' when calling machinesNameDelete(Async)"); } com.squareup.okhttp.Call call = machinesNameDeleteCall(name, progressListener, progressRequestListener); return call; } /** * Terminate machine * Creates machine deletion jobs. This action can be cancelled in two days. * @param name (required) * @return MachineCommandResultResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public MachineCommandResultResponse machinesNameDelete(String name) throws ApiException { ApiResponse<MachineCommandResultResponse> resp = machinesNameDeleteWithHttpInfo(name); return resp.getData(); } /** * Terminate machine * Creates machine deletion jobs. This action can be cancelled in two days. * @param name (required) * @return ApiResponse&lt;MachineCommandResultResponse&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse<MachineCommandResultResponse> machinesNameDeleteWithHttpInfo(String name) throws ApiException { com.squareup.okhttp.Call call = machinesNameDeleteValidateBeforeCall(name, null, null); Type localVarReturnType = new TypeToken<MachineCommandResultResponse>(){}.getType(); return apiClient.execute(call, localVarReturnType); } /** * Terminate machine (asynchronously) * Creates machine deletion jobs. This action can be cancelled in two days. * @param name (required) * @param callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ public com.squareup.okhttp.Call machinesNameDeleteAsync(String name, final ApiCallback<MachineCommandResultResponse> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = machinesNameDeleteValidateBeforeCall(name, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<MachineCommandResultResponse>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /** * Build call for machinesNameGet * @param name (required) * @param progressListener Progress listener * @param progressRequestListener Progress request listener * @return Call to execute * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call machinesNameGetCall(String name, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // create path and map variables String localVarPath = "/machines/{name}" .replaceAll("\\{" + "name" + "\\}", apiClient.escapeString(name.toString())); List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); Pair page = new Pair("page", String.valueOf(currentPage)); localVarQueryParams.add(page); System.out.println(localVarQueryParams); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) .build(); } }); } String[] localVarAuthNames = new String[] { "ApiKeyAuth" }; return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") private com.squareup.okhttp.Call machinesNameGetValidateBeforeCall(String name, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'name' is set if (name == null) { throw new ApiException("Missing the required parameter 'name' when calling machinesNameGet(Async)"); } com.squareup.okhttp.Call call = machinesNameGetCall(name, progressListener, progressRequestListener); return call; } /** * Returns machine details * * @param name (required) * @return MachineDetailsResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public MachineDetailsResponse machinesNameGet(String name) throws ApiException { ApiResponse<MachineDetailsResponse> resp = machinesNameGetWithHttpInfo(name); return resp.getData(); } /** * Returns machine details * * @param name (required) * @return ApiResponse&lt;MachineDetailsResponse&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse<MachineDetailsResponse> machinesNameGetWithHttpInfo(String name) throws ApiException { com.squareup.okhttp.Call call = machinesNameGetValidateBeforeCall(name, null, null); Type localVarReturnType = new TypeToken<MachineDetailsResponse>(){}.getType(); return apiClient.execute(call, localVarReturnType); } /** * Returns machine details (asynchronously) * * @param name (required) * @param callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ public com.squareup.okhttp.Call machinesNameGetAsync(String name, final ApiCallback<MachineDetailsResponse> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = machinesNameGetValidateBeforeCall(name, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<MachineDetailsResponse>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /** * Build call for machinesNameJobsGet * @param name (required) * @param progressListener Progress listener * @param progressRequestListener Progress request listener * @return Call to execute * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call machinesNameJobsGetCall(String name, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // create path and map variables String localVarPath = "/machines/{name}/jobs" .replaceAll("\\{" + "name" + "\\}", apiClient.escapeString(name.toString())); List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); Pair page = new Pair("page", String.valueOf(currentPage)); localVarQueryParams.add(page); System.out.println(localVarQueryParams); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) .build(); } }); } String[] localVarAuthNames = new String[] { "ApiKeyAuth" }; return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") private com.squareup.okhttp.Call machinesNameJobsGetValidateBeforeCall(String name, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'name' is set if (name == null) { throw new ApiException("Missing the required parameter 'name' when calling machinesNameJobsGet(Async)"); } com.squareup.okhttp.Call call = machinesNameJobsGetCall(name, progressListener, progressRequestListener); return call; } /** * Returns list of jobs assigned to machine. * * @param name (required) * @return JobsListResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public JobsListResponse machinesNameJobsGet(String name) throws ApiException { ApiResponse<JobsListResponse> resp = machinesNameJobsGetWithHttpInfo(name); return resp.getData(); } /** * Returns list of jobs assigned to machine. * * @param name (required) * @return ApiResponse&lt;JobsListResponse&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse<JobsListResponse> machinesNameJobsGetWithHttpInfo(String name) throws ApiException { com.squareup.okhttp.Call call = machinesNameJobsGetValidateBeforeCall(name, null, null); Type localVarReturnType = new TypeToken<JobsListResponse>(){}.getType(); return apiClient.execute(call, localVarReturnType); } /** * Returns list of jobs assigned to machine. (asynchronously) * * @param name (required) * @param callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ public com.squareup.okhttp.Call machinesNameJobsGetAsync(String name, final ApiCallback<JobsListResponse> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = machinesNameJobsGetValidateBeforeCall(name, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<JobsListResponse>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /** * Build call for machinesNamePost * @param body (required) * @param name (required) * @param progressListener Progress listener * @param progressRequestListener Progress request listener * @return Call to execute * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call machinesNamePostCall(MachineReinstallRequestBody body, String name, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; // create path and map variables String localVarPath = "/machines/{name}" .replaceAll("\\{" + "name" + "\\}", apiClient.escapeString(name.toString())); List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); Pair page = new Pair("page", String.valueOf(currentPage)); localVarQueryParams.add(page); System.out.println(localVarQueryParams); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { "application/json", "application/x-www-form-urlencoded" }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) .build(); } }); } String[] localVarAuthNames = new String[] { "ApiKeyAuth" }; return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") private com.squareup.okhttp.Call machinesNamePostValidateBeforeCall(MachineReinstallRequestBody body, String name, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'body' is set if (body == null) { throw new ApiException("Missing the required parameter 'body' when calling machinesNamePost(Async)"); } // verify the required parameter 'name' is set if (name == null) { throw new ApiException("Missing the required parameter 'name' when calling machinesNamePost(Async)"); } com.squareup.okhttp.Call call = machinesNamePostCall(body, name, progressListener, progressRequestListener); return call; } /** * Reinstall machine * * @param body (required) * @param name (required) * @return MachineCommandResultResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public MachineCommandResultResponse machinesNamePost(MachineReinstallRequestBody body, String name) throws ApiException { ApiResponse<MachineCommandResultResponse> resp = machinesNamePostWithHttpInfo(body, name); return resp.getData(); } /** * Reinstall machine * * @param body (required) * @param name (required) * @return ApiResponse&lt;MachineCommandResultResponse&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse<MachineCommandResultResponse> machinesNamePostWithHttpInfo(MachineReinstallRequestBody body, String name) throws ApiException { com.squareup.okhttp.Call call = machinesNamePostValidateBeforeCall(body, name, null, null); Type localVarReturnType = new TypeToken<MachineCommandResultResponse>(){}.getType(); return apiClient.execute(call, localVarReturnType); } /** * Reinstall machine (asynchronously) * * @param body (required) * @param name (required) * @param callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ public com.squareup.okhttp.Call machinesNamePostAsync(MachineReinstallRequestBody body, String name, final ApiCallback<MachineCommandResultResponse> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = machinesNamePostValidateBeforeCall(body, name, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<MachineCommandResultResponse>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /** * Build call for machinesNamePut * @param body (required) * @param name (required) * @param progressListener Progress listener * @param progressRequestListener Progress request listener * @return Call to execute * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call machinesNamePutCall(MachineUpdateRequestBody body, String name, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; // create path and map variables String localVarPath = "/machines/{name}" .replaceAll("\\{" + "name" + "\\}", apiClient.escapeString(name.toString())); List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); Pair page = new Pair("page", String.valueOf(currentPage)); localVarQueryParams.add(page); System.out.println(localVarQueryParams); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { "application/json", "application/x-www-form-urlencoded" }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) .build(); } }); } String[] localVarAuthNames = new String[] { "ApiKeyAuth" }; return apiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") private com.squareup.okhttp.Call machinesNamePutValidateBeforeCall(MachineUpdateRequestBody body, String name, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'body' is set if (body == null) { throw new ApiException("Missing the required parameter 'body' when calling machinesNamePut(Async)"); } // verify the required parameter 'name' is set if (name == null) { throw new ApiException("Missing the required parameter 'name' when calling machinesNamePut(Async)"); } com.squareup.okhttp.Call call = machinesNamePutCall(body, name, progressListener, progressRequestListener); return call; } /** * Update machine details * * @param body (required) * @param name (required) * @return MachineCommandResultResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public MachineCommandResultResponse machinesNamePut(MachineUpdateRequestBody body, String name) throws ApiException { ApiResponse<MachineCommandResultResponse> resp = machinesNamePutWithHttpInfo(body, name); return resp.getData(); } /** * Update machine details * * @param body (required) * @param name (required) * @return ApiResponse&lt;MachineCommandResultResponse&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse<MachineCommandResultResponse> machinesNamePutWithHttpInfo(MachineUpdateRequestBody body, String name) throws ApiException { com.squareup.okhttp.Call call = machinesNamePutValidateBeforeCall(body, name, null, null); Type localVarReturnType = new TypeToken<MachineCommandResultResponse>(){}.getType(); return apiClient.execute(call, localVarReturnType); } /** * Update machine details (asynchronously) * * @param body (required) * @param name (required) * @param callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ public com.squareup.okhttp.Call machinesNamePutAsync(MachineUpdateRequestBody body, String name, final ApiCallback<MachineCommandResultResponse> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = machinesNamePutValidateBeforeCall(body, name, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<MachineCommandResultResponse>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /** * Build call for machinesNameUsersGet * @param name (required) * @param progressListener Progress listener * @param progressRequestListener Progress request listener * @return Call to execute * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call machinesNameUsersGetCall(String name, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // create path and map variables String localVarPath = "/machines/{name}/users" .replaceAll("\\{" + "name" + "\\}", apiClient.escapeString(name.toString())); List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); Pair page = new Pair("page", String.valueOf(currentPage)); localVarQueryParams.add(page); System.out.println(localVarQueryParams); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) .build(); } }); } String[] localVarAuthNames = new String[] { "ApiKeyAuth" }; return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") private com.squareup.okhttp.Call machinesNameUsersGetValidateBeforeCall(String name, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'name' is set if (name == null) { throw new ApiException("Missing the required parameter 'name' when calling machinesNameUsersGet(Async)"); } com.squareup.okhttp.Call call = machinesNameUsersGetCall(name, progressListener, progressRequestListener); return call; } /** * Returns list of additional system users. * * @param name (required) * @return MachineUsersListResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public MachineUsersListResponse machinesNameUsersGet(String name) throws ApiException { ApiResponse<MachineUsersListResponse> resp = machinesNameUsersGetWithHttpInfo(name); return resp.getData(); } /** * Returns list of additional system users. * * @param name (required) * @return ApiResponse&lt;MachineUsersListResponse&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse<MachineUsersListResponse> machinesNameUsersGetWithHttpInfo(String name) throws ApiException { com.squareup.okhttp.Call call = machinesNameUsersGetValidateBeforeCall(name, null, null); Type localVarReturnType = new TypeToken<MachineUsersListResponse>(){}.getType(); return apiClient.execute(call, localVarReturnType); } /** * Returns list of additional system users. (asynchronously) * * @param name (required) * @param callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ public com.squareup.okhttp.Call machinesNameUsersGetAsync(String name, final ApiCallback<MachineUsersListResponse> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = machinesNameUsersGetValidateBeforeCall(name, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<MachineUsersListResponse>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /** * Build call for machinesPost * @param body Optional description in *Markdown* (required) * @param progressListener Progress listener * @param progressRequestListener Progress request listener * @return Call to execute * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call machinesPostCall(MachineCreateRequestBody body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; // create path and map variables String localVarPath = "/machines"; List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); Pair page = new Pair("page", String.valueOf(currentPage)); localVarQueryParams.add(page); System.out.println(localVarQueryParams); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { "application/json", "application/x-www-form-urlencoded" }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) .build(); } }); } String[] localVarAuthNames = new String[] { "ApiKeyAuth" }; return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") private com.squareup.okhttp.Call machinesPostValidateBeforeCall(MachineCreateRequestBody body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'body' is set if (body == null) { throw new ApiException("Missing the required parameter 'body' when calling machinesPost(Async)"); } com.squareup.okhttp.Call call = machinesPostCall(body, progressListener, progressRequestListener); return call; } /** * Create new machine. * * @param body Optional description in *Markdown* (required) * @return MachineCreateResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public MachineCreateResponse machinesPost(MachineCreateRequestBody body) throws ApiException { ApiResponse<MachineCreateResponse> resp = machinesPostWithHttpInfo(body); return resp.getData(); } /** * Create new machine. * * @param body Optional description in *Markdown* (required) * @return ApiResponse&lt;MachineCreateResponse&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse<MachineCreateResponse> machinesPostWithHttpInfo(MachineCreateRequestBody body) throws ApiException { com.squareup.okhttp.Call call = machinesPostValidateBeforeCall(body, null, null); Type localVarReturnType = new TypeToken<MachineCreateResponse>(){}.getType(); return apiClient.execute(call, localVarReturnType); } /** * Create new machine. (asynchronously) * * @param body Optional description in *Markdown* (required) * @param callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ public com.squareup.okhttp.Call machinesPostAsync(MachineCreateRequestBody body, final ApiCallback<MachineCreateResponse> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = machinesPostValidateBeforeCall(body, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<MachineCreateResponse>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /** * Build call for machinesRunningGet * @param progressListener Progress listener * @param progressRequestListener Progress request listener * @return Call to execute * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call machinesRunningGetCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // create path and map variables String localVarPath = "/machines/running"; List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); Pair page = new Pair("page", String.valueOf(currentPage)); localVarQueryParams.add(page); System.out.println(localVarQueryParams); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) .build(); } }); } String[] localVarAuthNames = new String[] { "ApiKeyAuth" }; return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") private com.squareup.okhttp.Call machinesRunningGetValidateBeforeCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { com.squareup.okhttp.Call call = machinesRunningGetCall(progressListener, progressRequestListener); return call; } /** * Returns list of currently running machines. * * @return MachinesListResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public MachinesListResponse machinesRunningGet() throws ApiException { ApiResponse<MachinesListResponse> resp = machinesRunningGetWithHttpInfo(); return resp.getData(); } /** * Returns list of currently running machines. * * @return ApiResponse&lt;MachinesListResponse&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse<MachinesListResponse> machinesRunningGetWithHttpInfo() throws ApiException { com.squareup.okhttp.Call call = machinesRunningGetValidateBeforeCall(null, null); Type localVarReturnType = new TypeToken<MachinesListResponse>(){}.getType(); return apiClient.execute(call, localVarReturnType); } /** * Returns list of currently running machines. (asynchronously) * * @param callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ public com.squareup.okhttp.Call machinesRunningGetAsync(final ApiCallback<MachinesListResponse> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = machinesRunningGetValidateBeforeCall(progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<MachinesListResponse>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /** * Build call for machinesStoppedGet * @param progressListener Progress listener * @param progressRequestListener Progress request listener * @return Call to execute * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call machinesStoppedGetCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // create path and map variables String localVarPath = "/machines/stopped"; List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); Pair page = new Pair("page", String.valueOf(currentPage)); localVarQueryParams.add(page); System.out.println(localVarQueryParams); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) .build(); } }); } String[] localVarAuthNames = new String[] { "ApiKeyAuth" }; return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") private com.squareup.okhttp.Call machinesStoppedGetValidateBeforeCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { com.squareup.okhttp.Call call = machinesStoppedGetCall(progressListener, progressRequestListener); return call; } /** * Returns list of currently stopped or suspended machines. * * @return MachinesListResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public MachinesListResponse machinesStoppedGet() throws ApiException { ApiResponse<MachinesListResponse> resp = machinesStoppedGetWithHttpInfo(); return resp.getData(); } /** * Returns list of currently stopped or suspended machines. * * @return ApiResponse&lt;MachinesListResponse&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse<MachinesListResponse> machinesStoppedGetWithHttpInfo() throws ApiException { com.squareup.okhttp.Call call = machinesStoppedGetValidateBeforeCall(null, null); Type localVarReturnType = new TypeToken<MachinesListResponse>(){}.getType(); return apiClient.execute(call, localVarReturnType); } /** * Returns list of currently stopped or suspended machines. (asynchronously) * * @param callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ public com.squareup.okhttp.Call machinesStoppedGetAsync(final ApiCallback<MachinesListResponse> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = machinesStoppedGetValidateBeforeCall(progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<MachinesListResponse>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } }
[ "serjikz123@gmail.com" ]
serjikz123@gmail.com