blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
sequencelengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
sequencelengths
1
1
author_id
stringlengths
0
313
a66af1a2db1de29b054ebb550cc23921fd5a0c22
1d928c3f90d4a0a9a3919a804597aa0a4aab19a3
/java/ExoPlayer/2019/8/ExoMediaDrm.java
ca776267aa83f0561f9982dcb8d6103c44eb59d5
[]
no_license
rosoareslv/SED99
d8b2ff5811e7f0ffc59be066a5a0349a92cbb845
a062c118f12b93172e31e8ca115ce3f871b64461
refs/heads/main
2023-02-22T21:59:02.703005
2021-01-28T19:40:51
2021-01-28T19:40:51
306,497,459
1
1
null
2020-11-24T20:56:18
2020-10-23T01:18:07
null
UTF-8
Java
false
false
8,380
java
/* * Copyright (C) 2016 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.google.android.exoplayer2.drm; import android.media.DeniedByServerException; import android.media.MediaCryptoException; import android.media.MediaDrm; import android.media.MediaDrmException; import android.media.NotProvisionedException; import android.os.Handler; import androidx.annotation.Nullable; import com.google.android.exoplayer2.drm.DrmInitData.SchemeData; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.UUID; /** * Used to obtain keys for decrypting protected media streams. See {@link android.media.MediaDrm}. */ public interface ExoMediaDrm<T extends ExoMediaCrypto> { /** * @see MediaDrm#EVENT_KEY_REQUIRED */ @SuppressWarnings("InlinedApi") int EVENT_KEY_REQUIRED = MediaDrm.EVENT_KEY_REQUIRED; /** * @see MediaDrm#EVENT_KEY_EXPIRED */ @SuppressWarnings("InlinedApi") int EVENT_KEY_EXPIRED = MediaDrm.EVENT_KEY_EXPIRED; /** * @see MediaDrm#EVENT_PROVISION_REQUIRED */ @SuppressWarnings("InlinedApi") int EVENT_PROVISION_REQUIRED = MediaDrm.EVENT_PROVISION_REQUIRED; /** * @see MediaDrm#KEY_TYPE_STREAMING */ @SuppressWarnings("InlinedApi") int KEY_TYPE_STREAMING = MediaDrm.KEY_TYPE_STREAMING; /** * @see MediaDrm#KEY_TYPE_OFFLINE */ @SuppressWarnings("InlinedApi") int KEY_TYPE_OFFLINE = MediaDrm.KEY_TYPE_OFFLINE; /** * @see MediaDrm#KEY_TYPE_RELEASE */ @SuppressWarnings("InlinedApi") int KEY_TYPE_RELEASE = MediaDrm.KEY_TYPE_RELEASE; /** * @see android.media.MediaDrm.OnEventListener */ interface OnEventListener<T extends ExoMediaCrypto> { /** * Called when an event occurs that requires the app to be notified * * @param mediaDrm The {@link ExoMediaDrm} object on which the event occurred. * @param sessionId The DRM session ID on which the event occurred. * @param event Indicates the event type. * @param extra A secondary error code. * @param data Optional byte array of data that may be associated with the event. */ void onEvent( ExoMediaDrm<? extends T> mediaDrm, @Nullable byte[] sessionId, int event, int extra, @Nullable byte[] data); } /** * @see android.media.MediaDrm.OnKeyStatusChangeListener */ interface OnKeyStatusChangeListener<T extends ExoMediaCrypto> { /** * Called when the keys in a session change status, such as when the license is renewed or * expires. * * @param mediaDrm The {@link ExoMediaDrm} object on which the event occurred. * @param sessionId The DRM session ID on which the event occurred. * @param exoKeyInformation A list of {@link KeyStatus} that contains key ID and status. * @param hasNewUsableKey Whether a new key became usable. */ void onKeyStatusChange( ExoMediaDrm<? extends T> mediaDrm, byte[] sessionId, List<KeyStatus> exoKeyInformation, boolean hasNewUsableKey); } /** @see android.media.MediaDrm.KeyStatus */ final class KeyStatus { private final int statusCode; private final byte[] keyId; public KeyStatus(int statusCode, byte[] keyId) { this.statusCode = statusCode; this.keyId = keyId; } public int getStatusCode() { return statusCode; } public byte[] getKeyId() { return keyId; } } /** @see android.media.MediaDrm.KeyRequest */ final class KeyRequest { private final byte[] data; private final String licenseServerUrl; public KeyRequest(byte[] data, String licenseServerUrl) { this.data = data; this.licenseServerUrl = licenseServerUrl; } public byte[] getData() { return data; } public String getLicenseServerUrl() { return licenseServerUrl; } } /** @see android.media.MediaDrm.ProvisionRequest */ final class ProvisionRequest { private final byte[] data; private final String defaultUrl; public ProvisionRequest(byte[] data, String defaultUrl) { this.data = data; this.defaultUrl = defaultUrl; } public byte[] getData() { return data; } public String getDefaultUrl() { return defaultUrl; } } /** * @see MediaDrm#setOnEventListener(MediaDrm.OnEventListener) */ void setOnEventListener(OnEventListener<? super T> listener); /** * @see MediaDrm#setOnKeyStatusChangeListener(MediaDrm.OnKeyStatusChangeListener, Handler) */ void setOnKeyStatusChangeListener(OnKeyStatusChangeListener<? super T> listener); /** * @see MediaDrm#openSession() */ byte[] openSession() throws MediaDrmException; /** * @see MediaDrm#closeSession(byte[]) */ void closeSession(byte[] sessionId); /** * Generates a key request. * * @param scope If {@code keyType} is {@link #KEY_TYPE_STREAMING} or {@link #KEY_TYPE_OFFLINE}, * the session id that the keys will be provided to. If {@code keyType} is {@link * #KEY_TYPE_RELEASE}, the keySetId of the keys to release. * @param schemeDatas If key type is {@link #KEY_TYPE_STREAMING} or {@link #KEY_TYPE_OFFLINE}, a * list of {@link SchemeData} instances extracted from the media. Null otherwise. * @param keyType The type of the request. Either {@link #KEY_TYPE_STREAMING} to acquire keys for * streaming, {@link #KEY_TYPE_OFFLINE} to acquire keys for offline usage, or {@link * #KEY_TYPE_RELEASE} to release acquired keys. Releasing keys invalidates them for all * sessions. * @param optionalParameters Are included in the key request message to allow a client application * to provide additional message parameters to the server. This may be {@code null} if no * additional parameters are to be sent. * @return The generated key request. * @see MediaDrm#getKeyRequest(byte[], byte[], String, int, HashMap) */ KeyRequest getKeyRequest( byte[] scope, @Nullable List<SchemeData> schemeDatas, int keyType, @Nullable HashMap<String, String> optionalParameters) throws NotProvisionedException; /** @see MediaDrm#provideKeyResponse(byte[], byte[]) */ @Nullable byte[] provideKeyResponse(byte[] scope, byte[] response) throws NotProvisionedException, DeniedByServerException; /** * @see MediaDrm#getProvisionRequest() */ ProvisionRequest getProvisionRequest(); /** * @see MediaDrm#provideProvisionResponse(byte[]) */ void provideProvisionResponse(byte[] response) throws DeniedByServerException; /** * @see MediaDrm#queryKeyStatus(byte[]) */ Map<String, String> queryKeyStatus(byte[] sessionId); /** * @see MediaDrm#release() */ void release(); /** * @see MediaDrm#restoreKeys(byte[], byte[]) */ void restoreKeys(byte[] sessionId, byte[] keySetId); /** * @see MediaDrm#getPropertyString(String) */ String getPropertyString(String propertyName); /** * @see MediaDrm#getPropertyByteArray(String) */ byte[] getPropertyByteArray(String propertyName); /** * @see MediaDrm#setPropertyString(String, String) */ void setPropertyString(String propertyName, String value); /** * @see MediaDrm#setPropertyByteArray(String, byte[]) */ void setPropertyByteArray(String propertyName, byte[] value); /** * @see android.media.MediaCrypto#MediaCrypto(UUID, byte[]) * @param sessionId The DRM session ID. * @return An object extends {@link ExoMediaCrypto}, using opaque crypto scheme specific data. * @throws MediaCryptoException If the instance can't be created. */ T createMediaCrypto(byte[] sessionId) throws MediaCryptoException; /** Returns the {@link ExoMediaCrypto} type created by {@link #createMediaCrypto(byte[])}. */ Class<T> getExoMediaCryptoType(); }
d62a42bea809d87ec63f5ed25d936c3a76ee9338
d4a865d00a85c9192d065f5e49013ffa66a13029
/app/src/main/java/com/frank/gameoflife/utils/GameConfig.java
d28e0cedfe0de37bc522dc19b32366c007651e7b
[]
no_license
FrankNT/GameOfLife
774227867c3c6abd8391319ac1780670eab271b7
f546cb6f6e05bec35e23565627b30e71093f2593
refs/heads/master
2021-01-10T17:16:22.276734
2016-04-25T16:37:55
2016-04-25T16:37:55
53,074,482
0
0
null
null
null
null
UTF-8
Java
false
false
238
java
package com.frank.gameoflife.utils; /** * Created by TrongPhuc on 2/27/16. */ public class GameConfig { public static final long SLEEP_TIME = 400L; public static final int WIDTH = 20; public static final int HEIGHT = 20; }
40c6dcc566db196b0a201ff50e3aa216aa025f7d
16558dfe1930c4cb7ec8a52ec086d1d1a7b1a565
/video_admin/src/main/java/org/n3r/idworker/RandomCodeStrategy.java
f3195e7543c98a81f4408777b54eaee676bc4c55
[]
no_license
xuhuiling00/spring_study
5a6559be624bc822a1f9e33ce0102aafa84cae16
47718ba84a84abdec9af62ed890c8a5e75d7334e
refs/heads/master
2023-03-13T19:18:10.186299
2021-03-06T14:35:36
2021-03-06T14:35:36
336,457,779
0
0
null
null
null
null
UTF-8
Java
false
false
140
java
package org.n3r.idworker; public interface RandomCodeStrategy { void init(); int prefix(); int next(); void release(); }
fb299df94b8bb8e1da6e05e0d6cef9f514aaa206
bdc69e64a6ef7a843a819fdb315eb4928dc77ce9
/library/src/main/java/com/eqdd/library/base/CommonActivity.java
f3060da23b5ba51a5e64ac2f0161d02dc75d132b
[]
no_license
lvzhihao100/Project
f1d3f0d535ceae42db9415b368b6fe9aa7ee6200
9d7fe365c92cc7500b89e2febcfd4c7a666d251a
refs/heads/master
2021-01-25T08:13:35.673848
2017-06-08T10:18:22
2017-06-08T10:18:22
93,736,138
0
0
null
null
null
null
UTF-8
Java
false
false
651
java
package com.eqdd.library.base; import android.os.Bundle; import com.eqdd.common.base.BaseActivity; import com.eqdd.library.bean.User; import com.eqdd.library.utils.GreenDaoUtil; /** * Created by lvzhihao on 17-5-30. */ public abstract class CommonActivity extends BaseActivity { public User user; private Bundle savedInstanceState; @Override protected void onCreate(Bundle savedInstanceState) { user = GreenDaoUtil.getUser(); this.savedInstanceState = savedInstanceState; super.onCreate(savedInstanceState); } public Bundle getSavedInstanceState() { return savedInstanceState; } }
6e7c5074ed3a4764890005c936297572372a33a9
4fdb8a52a5251c3757fa3b739c9b36138d7f9302
/CodingStudy/src/Chapter7/Question9/CircularArray.java
e989db02c433453f6d5f7bace7e9b37a886ad7d6
[]
no_license
dkyou7/CodingStudy
b9cca607a143430490e4496a439302a332a6e023
b4708b0877d92c1195339553b18b720d031b0853
refs/heads/master
2021-10-10T00:29:43.751342
2018-12-09T09:35:30
2018-12-09T09:35:30
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,216
java
package Chapter7.Question9; import java.util.Iterator; public class CircularArray<T> implements Iterable<T>{ private T[] items; private int head =0; public CircularArray(int size) { items = (T[])new Object[size]; } private int convert(int index) { if(index < 0) { index += items.length; } return (head + index) % items.length; } public void rotate(int shiftRight) { head = convert(shiftRight); } public T get(int i) { if(i < 0 || i >= items.length) { throw new java.lang.IndexOutOfBoundsException("Index " + i + " is out of bounds"); } return items[convert(i)]; } public void set(int i, T item) { items[convert(i)] = item; } public Iterator<T> iterator() { return new CircularArrayIterator(); } private class CircularArrayIterator implements Iterator<T>{ private int _current = -1; public CircularArrayIterator() {} @Override public boolean hasNext() { return _current < items.length -1; } @Override public T next() { _current++; return (T)items[convert(_current)]; } @Override public void remove() { throw new UnsupportedOperationException("Remove is not supported by CircularArray"); } } }
fc2bd5e417e256cd6141d58a94b0742bef4589e7
128d8aaf1cbec7d40ef163fdac2a90d4a1bb9b6b
/src/day23_Arrays/ArraysUtility.java
f7e7887f62ed0a894ac5aedd64ee1339d20e6c7f
[]
no_license
ikramazim/JavaProgramming_B23
5131cf3d7ef254d5e94d5d9ab543f948220b9a65
f3dfbf5cc3e5bdc3f4a72300b96409ea96b84fc5
refs/heads/master
2023-06-25T14:37:28.695319
2021-07-26T17:09:33
2021-07-26T17:09:33
389,715,210
0
0
null
null
null
null
UTF-8
Java
false
false
1,950
java
package day23_Arrays; import java.util.Arrays; public class ArraysUtility { public static void main(String[] args) { // toString int[] array = {1,2,3,4,5,6}; System.out.println(array); System.out.println( Arrays.toString(array) ); String[] array2 = new String[5]; System.out.println(array2); System.out.println( Arrays.toString(array2) ); double[] nums = new double[5]; System.out.println(Arrays.toString(nums)); // sort(): sorts the elemnts of the array in ascending order String[] students = {"Boburbek", "Aysu", "Abbos", "Sabir"}; System.out.println( Arrays.toString(students)); Arrays.sort(students); // the array is sorted inascending order (a to z System.out.println( Arrays.toString(students)); int[] numbers = {9,10,4,1,3,-1,0,1,2}; System.out.println( Arrays.toString(numbers) ); Arrays.sort(numbers); System.out.println( Arrays.toString(numbers) ); System.out.println("Minimum number: "+numbers[0]); System.out.println("Maximum Number: "+numbers[numbers.length-1] ); char[] chars = {'z', 'b', 'k', 'a', 'c', 'y', 'x'}; System.out.println( Arrays.toString(chars) ); Arrays.sort(chars); System.out.println( Arrays.toString(chars) ); // equals(arr1, arr2) int[] num1 = {1,2,3}; int[] num2 = {1,2,3}; int[] num3 = {3,2,1}; int[] num4 = {2,3,1}; boolean r1 = Arrays.equals(num1, num2); boolean r2 = Arrays.equals(num2, num3); Arrays.sort(num3); // num3 will be in ascending order, {1,2,3} Arrays.sort(num4); // num4 will be in ascending order, {1,2,3} boolean r3 = Arrays.equals(num3, num4); System.out.println("r1 = " + r1); System.out.println("r2 = " + r2); System.out.println("r3 = " + r3); } }
2a75a706cde2179d824123d129cf06951fbfc66b
3e2d9327ea2b56e3e4bad33c1831c979d68087dc
/src/test/java/io/refugeescode/hackboard/web/rest/errors/ExceptionTranslatorIntTest.java
60f41343ff26cc54d4a5e52ba9ec82e4784c9ca7
[]
no_license
ImgBotApp/hackboard
96504cd52faec5beb9aaf8c9623d2a8e485c517b
85fe78964f0a8606ae90ac1579760b1791b2edda
refs/heads/master
2021-06-29T18:31:27.626471
2018-06-22T11:59:37
2018-06-22T11:59:37
138,436,233
6
2
null
2020-10-01T15:09:48
2018-06-23T21:56:42
Java
UTF-8
Java
false
false
6,513
java
package io.refugeescode.hackboard.web.rest.errors; import io.refugeescode.hackboard.HackboardApp; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.http.MediaType; import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; import org.zalando.problem.spring.web.advice.MediaTypes; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; /** * Test class for the ExceptionTranslator controller advice. * * @see ExceptionTranslator */ @RunWith(SpringRunner.class) @SpringBootTest(classes = HackboardApp.class) public class ExceptionTranslatorIntTest { @Autowired private ExceptionTranslatorTestController controller; @Autowired private ExceptionTranslator exceptionTranslator; @Autowired private MappingJackson2HttpMessageConverter jacksonMessageConverter; private MockMvc mockMvc; @Before public void setup() { mockMvc = MockMvcBuilders.standaloneSetup(controller) .setControllerAdvice(exceptionTranslator) .setMessageConverters(jacksonMessageConverter) .build(); } @Test public void testConcurrencyFailure() throws Exception { mockMvc.perform(get("/test/concurrency-failure")) .andExpect(status().isConflict()) .andExpect(content().contentType(MediaTypes.PROBLEM)) .andExpect(jsonPath("$.message").value(ErrorConstants.ERR_CONCURRENCY_FAILURE)); } @Test public void testMethodArgumentNotValid() throws Exception { mockMvc.perform(post("/test/method-argument").content("{}").contentType(MediaType.APPLICATION_JSON)) .andExpect(status().isBadRequest()) .andExpect(content().contentType(MediaTypes.PROBLEM)) .andExpect(jsonPath("$.message").value(ErrorConstants.ERR_VALIDATION)) .andExpect(jsonPath("$.fieldErrors.[0].objectName").value("testDTO")) .andExpect(jsonPath("$.fieldErrors.[0].field").value("test")) .andExpect(jsonPath("$.fieldErrors.[0].message").value("NotNull")); } @Test public void testParameterizedError() throws Exception { mockMvc.perform(get("/test/parameterized-error")) .andExpect(status().isBadRequest()) .andExpect(content().contentType(MediaTypes.PROBLEM)) .andExpect(jsonPath("$.message").value("test parameterized error")) .andExpect(jsonPath("$.params.param0").value("param0_value")) .andExpect(jsonPath("$.params.param1").value("param1_value")); } @Test public void testParameterizedError2() throws Exception { mockMvc.perform(get("/test/parameterized-error2")) .andExpect(status().isBadRequest()) .andExpect(content().contentType(MediaTypes.PROBLEM)) .andExpect(jsonPath("$.message").value("test parameterized error")) .andExpect(jsonPath("$.params.foo").value("foo_value")) .andExpect(jsonPath("$.params.bar").value("bar_value")); } @Test public void testMissingServletRequestPartException() throws Exception { mockMvc.perform(get("/test/missing-servlet-request-part")) .andExpect(status().isBadRequest()) .andExpect(content().contentType(MediaTypes.PROBLEM)) .andExpect(jsonPath("$.message").value("error.http.400")); } @Test public void testMissingServletRequestParameterException() throws Exception { mockMvc.perform(get("/test/missing-servlet-request-parameter")) .andExpect(status().isBadRequest()) .andExpect(content().contentType(MediaTypes.PROBLEM)) .andExpect(jsonPath("$.message").value("error.http.400")); } @Test public void testAccessDenied() throws Exception { mockMvc.perform(get("/test/access-denied")) .andExpect(status().isForbidden()) .andExpect(content().contentType(MediaTypes.PROBLEM)) .andExpect(jsonPath("$.message").value("error.http.403")) .andExpect(jsonPath("$.detail").value("test access denied!")); } @Test public void testUnauthorized() throws Exception { mockMvc.perform(get("/test/unauthorized")) .andExpect(status().isUnauthorized()) .andExpect(content().contentType(MediaTypes.PROBLEM)) .andExpect(jsonPath("$.message").value("error.http.401")) .andExpect(jsonPath("$.path").value("/test/unauthorized")) .andExpect(jsonPath("$.detail").value("test authentication failed!")); } @Test public void testMethodNotSupported() throws Exception { mockMvc.perform(post("/test/access-denied")) .andExpect(status().isMethodNotAllowed()) .andExpect(content().contentType(MediaTypes.PROBLEM)) .andExpect(jsonPath("$.message").value("error.http.405")) .andExpect(jsonPath("$.detail").value("Request method 'POST' not supported")); } @Test public void testExceptionWithResponseStatus() throws Exception { mockMvc.perform(get("/test/response-status")) .andExpect(status().isBadRequest()) .andExpect(content().contentType(MediaTypes.PROBLEM)) .andExpect(jsonPath("$.message").value("error.http.400")) .andExpect(jsonPath("$.title").value("test response status")); } @Test public void testInternalServerError() throws Exception { mockMvc.perform(get("/test/internal-server-error")) .andExpect(status().isInternalServerError()) .andExpect(content().contentType(MediaTypes.PROBLEM)) .andExpect(jsonPath("$.message").value("error.http.500")) .andExpect(jsonPath("$.title").value("Internal Server Error")); } }
1f83cd06fb02b09f8c9e4c35fc497d75ef494ffa
fb62880dab2320a60c408e319a87edc9ee9412c2
/app/src/main/java/orders/appup_kw/newsapp/adaper/ViewPagerAdapter.java
b36b601be59c104925a37f5ab409f887226f73d5
[]
no_license
Danila-software-engineer/News-app
af0b3d45ff48141e5b910ce72017828ea7b48eb1
b152296571a6df6c16fef5faa1f16c0be1b67978
refs/heads/master
2023-02-25T23:08:56.526573
2021-01-28T12:56:10
2021-01-28T12:56:10
332,864,125
0
0
null
null
null
null
UTF-8
Java
false
false
751
java
package orders.appup_kw.newsapp.adaper; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentStatePagerAdapter; import java.util.List; import orders.appup_kw.newsapp.fragment.ScreenSlidePageFragment; public class ViewPagerAdapter extends FragmentStatePagerAdapter { List<String> imageList; public ViewPagerAdapter(FragmentManager fm, int amount, List<String> imageList) { super(fm, amount); this.imageList = imageList; } @Override public Fragment getItem(int position) { return ScreenSlidePageFragment.launchFragment(imageList.get(position)); } @Override public int getCount() { return imageList.size(); } }
84c64d825a04704ee20548803e4ca9365cf6112e
668f48c793537392b36a48e031edb27aa6ecd0aa
/src/smalljvm/classfile/instruction/store/LASTORE.java
3b640fde9b89c9584afa60c3e7d33ebbe884bd54
[]
no_license
linlinjava/smalljvm
f4bae2981be15e6e704a9276186cab0d7d2c4aad
7f3ebc0618522dac7580da7f20e8ba4e43bddbd3
refs/heads/master
2021-08-29T17:20:37.584110
2017-10-17T08:51:18
2017-10-17T08:51:20
114,249,025
7
2
null
null
null
null
UTF-8
Java
false
false
489
java
package smalljvm.classfile.instruction.store; import smalljvm.classfile.Instruction; /** * Created by junling on 2017/3/31. */ public class LASTORE implements Instruction { public byte op; @Override public byte opcode(){ return 0x50; } @Override public String strcode (){ return "lastore"; } @Override public String toString() { return strcode(); } @Override public int length() { return 1; } }
9cc385318b11474e2f3eb6b161b22f1b2f492e54
289ccab4d3f159ff8fbd3bb8ade62515c7c6f978
/fut-desktop-app-backend/fut-domain/src/main/java/com/fut/desktop/app/domain/UserDataInfo.java
edc9cc3baebf02aa33d379ef5076561929df833b
[]
no_license
Majed93/FUT-Desktop-App
36c39c395332d2a706996a1f06fec110185f9254
19e988bf8cd2817a50437bceedf3a28783cef7d6
refs/heads/master
2023-02-28T17:11:51.813057
2021-02-09T21:10:02
2021-02-09T21:10:02
284,470,498
0
1
null
2020-08-02T16:26:38
2020-08-02T13:48:27
Java
UTF-8
Java
false
false
448
java
package com.fut.desktop.app.domain; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Getter; import lombok.Setter; import java.util.List; @Getter @Setter @JsonFormat public class UserDataInfo { private String displayName; private String lastLogin; private String lastLogout; private String nucPersId; private String nucUserId; private List<UserDataInfoSettings> settings; private String sku; }
2179d16b15ec9901f2bf69d2e67c237a52a6e027
3e95ab54656a4a885f620327c805677320fc6a0c
/ConvertidorNumerosRomanos/src/convertidornumerosromanos/ConvertidorNumerosRomanos.java
f6a1bf6f02ffb54872ee14532e21e7d95e0b921f
[]
no_license
HerreraErick/ConvertidorNumerosRomanos
b04fa19fc860d0578b07efe4f6e36629c808a132
dbff6c19742ee2260d8497d2acc66a085dae4f20
refs/heads/master
2020-04-01T16:42:47.103556
2018-10-17T04:58:37
2018-10-17T04:58:37
153,394,288
0
0
null
null
null
null
UTF-8
Java
false
false
2,861
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 convertidornumerosromanos; import javax.swing.JOptionPane; /** * * @author Erick Ushiromiya */ public class ConvertidorNumerosRomanos { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here String LN; int N; do { LN = JOptionPane.showInputDialog("Introduce un número entre 1 y 1000: "); N = Integer.parseInt(LN); } while (N < 1 || N > 1000); JOptionPane.showMessageDialog(null, N + " en numeros romanos -> " + convertirNumerosRomanos(N)); } public static String convertirNumerosRomanos(int numero) { int i, mil, centenas, decenas, unidades; String romano = ""; //obtenemos cada cifra del número mil = numero / 1000; centenas = numero / 100 % 10; decenas = numero / 10 % 10; unidades = numero % 10; //mil for (i = 1; i <= mil; i++) { romano = romano + "M"; } //centenas if (centenas == 9) { romano = romano + "CM"; } else if (centenas >= 5) { romano = romano + "D"; for (i = 6; i <= centenas; i++) { romano = romano + "C"; } } else if (centenas == 4) { romano = romano + "CD"; } else { for (i = 1; i <= centenas; i++) { romano = romano + "C"; } } //decenas if (decenas == 9) { romano = romano + "XC"; } else if (decenas >= 5) { romano = romano + "L"; for (i = 6; i <= decenas; i++) { romano = romano + "X"; } } else if (decenas == 4) { romano = romano + "XL"; } else { for (i = 1; i <= decenas; i++) { romano = romano + "X"; } } //unidades if (unidades == 9) { romano = romano + "IX"; } else if (unidades >= 5) { romano = romano + "V"; for (i = 6; i <= unidades; i++) { romano = romano + "I"; } } else if (unidades == 4) { romano = romano + "IV"; } else { for (i = 1; i <= unidades; i++) { romano = romano + "I"; } } return romano; } }
8f9b9399ab7ba033a6830f3cb6238835f98b45f0
c15a55caac69b0f99e54d8c15a2b0abf32e68099
/launcher3/src/main/java/com/android/launcher3/allapps/AllAppsContainerView.java
931e58dd6475c393fdc647d46fe403221b36c963
[ "Apache-2.0" ]
permissive
xiejin740640431/ElderlyLauncher
b13a85bc6e020884fb4191adbb0c0c05b8cdb434
13fe007563f6d3a8c51913f5cf06e54073ff464b
refs/heads/master
2020-04-09T06:34:02.428418
2018-12-03T02:18:20
2018-12-03T02:18:20
160,118,355
2
2
null
null
null
null
UTF-8
Java
false
false
24,562
java
/* * Copyright (C) 2015 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.launcher3.allapps; import android.annotation.SuppressLint; import android.content.Context; import android.content.Intent; import android.content.res.Resources; import android.graphics.Point; import android.graphics.Rect; import android.graphics.drawable.InsetDrawable; import android.support.v7.widget.RecyclerView; import android.text.Selection; import android.text.SpannableStringBuilder; import android.text.method.TextKeyListener; import android.util.AttributeSet; import android.view.KeyEvent; import android.view.MotionEvent; import android.view.View; import android.view.ViewConfiguration; import android.view.ViewGroup; import android.widget.LinearLayout; import com.android.launcher3.AppInfo; import com.android.launcher3.BaseContainerView; import com.android.launcher3.CellLayout; import com.android.launcher3.DeleteDropTarget; import com.android.launcher3.DeviceProfile; import com.android.launcher3.DragSource; import com.android.launcher3.DropTarget; import com.android.launcher3.Folder; import com.android.launcher3.ItemInfo; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherTransitionable; import cn.colorfuline.elderlylauncher.R; import com.android.launcher3.Utilities; import com.android.launcher3.Workspace; import com.android.launcher3.util.ComponentKey; import com.android.launcher3.util.Thunk; import java.nio.charset.Charset; import java.nio.charset.CharsetEncoder; import java.util.ArrayList; import java.util.List; /** * A merge algorithm that merges every section indiscriminately. */ final class FullMergeAlgorithm implements AlphabeticalAppsList.MergeAlgorithm { @Override public boolean continueMerging(AlphabeticalAppsList.SectionInfo section, AlphabeticalAppsList.SectionInfo withSection, int sectionAppCount, int numAppsPerRow, int mergeCount) { // Don't merge the predicted apps if (section.firstAppItem.viewType != AllAppsGridAdapter.ICON_VIEW_TYPE) { return false; } // Otherwise, merge every other section return true; } } /** * The logic we use to merge multiple sections. We only merge sections when their final row * contains less than a certain number of icons, and stop at a specified max number of merges. * In addition, we will try and not merge sections that identify apps from different scripts. */ final class SimpleSectionMergeAlgorithm implements AlphabeticalAppsList.MergeAlgorithm { private int mMinAppsPerRow; private int mMinRowsInMergedSection; private int mMaxAllowableMerges; private CharsetEncoder mAsciiEncoder; public SimpleSectionMergeAlgorithm(int minAppsPerRow, int minRowsInMergedSection, int maxNumMerges) { mMinAppsPerRow = minAppsPerRow; mMinRowsInMergedSection = minRowsInMergedSection; mMaxAllowableMerges = maxNumMerges; mAsciiEncoder = Charset.forName("US-ASCII").newEncoder(); } @Override public boolean continueMerging(AlphabeticalAppsList.SectionInfo section, AlphabeticalAppsList.SectionInfo withSection, int sectionAppCount, int numAppsPerRow, int mergeCount) { // Don't merge the predicted apps if (section.firstAppItem.viewType != AllAppsGridAdapter.ICON_VIEW_TYPE) { return false; } // Continue merging if the number of hanging apps on the final row is less than some // fixed number (ragged), the merged rows has yet to exceed some minimum row count, // and while the number of merged sections is less than some fixed number of merges int rows = sectionAppCount / numAppsPerRow; int cols = sectionAppCount % numAppsPerRow; // Ensure that we do not merge across scripts, currently we only allow for english and // native scripts so we can test if both can just be ascii encoded boolean isCrossScript = false; if (section.firstAppItem != null && withSection.firstAppItem != null) { isCrossScript = mAsciiEncoder.canEncode(section.firstAppItem.sectionName) != mAsciiEncoder.canEncode(withSection.firstAppItem.sectionName); } return (0 < cols && cols < mMinAppsPerRow) && rows < mMinRowsInMergedSection && mergeCount < mMaxAllowableMerges && !isCrossScript; } } /** * The all apps view container. */ public class AllAppsContainerView extends BaseContainerView implements DragSource, LauncherTransitionable, View.OnTouchListener, View.OnLongClickListener, AllAppsSearchBarController.Callbacks { private static final int MIN_ROWS_IN_MERGED_SECTION_PHONE = 3; private static final int MAX_NUM_MERGES_PHONE = 2; @Thunk Launcher mLauncher; @Thunk AlphabeticalAppsList mApps; private AllAppsGridAdapter mAdapter; private RecyclerView.LayoutManager mLayoutManager; private RecyclerView.ItemDecoration mItemDecoration; @Thunk View mContent; @Thunk View mContainerView; @Thunk View mRevealView; /** * 全部 */ @Thunk AllAppsRecyclerView mAppsRecyclerView; @Thunk AllAppsSearchBarController mSearchBarController; /** * 搜索框容器 */ private ViewGroup mSearchBarContainerView; private View mSearchBarView; private SpannableStringBuilder mSearchQueryBuilder = null; private int mSectionNamesMargin; private int mNumAppsPerRow; private int mNumPredictedAppsPerRow; private int mRecyclerViewTopBottomPadding; // This coordinate is relative to this container view private final Point mBoundsCheckLastTouchDownPos = new Point(-1, -1); // This coordinate is relative to its parent private final Point mIconLastTouchPos = new Point(); private View.OnClickListener mSearchClickListener = new View.OnClickListener() { @Override public void onClick(View v) { Intent searchIntent = (Intent) v.getTag(); mLauncher.startActivitySafely(v, searchIntent, null); } }; public AllAppsContainerView(Context context) { this(context, null); } public AllAppsContainerView(Context context, AttributeSet attrs) { this(context, attrs, 0); } public AllAppsContainerView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); Resources res = context.getResources(); mLauncher = (Launcher) context; mSectionNamesMargin = res.getDimensionPixelSize(R.dimen.all_apps_grid_view_start_margin); mApps = new AlphabeticalAppsList(context); mAdapter = new AllAppsGridAdapter(mLauncher, mApps, this, mLauncher, this); mApps.setAdapter(mAdapter); mLayoutManager = mAdapter.getLayoutManager(); mItemDecoration = mAdapter.getItemDecoration(); mRecyclerViewTopBottomPadding = res.getDimensionPixelSize(R.dimen.all_apps_list_top_bottom_padding); mSearchQueryBuilder = new SpannableStringBuilder(); Selection.setSelection(mSearchQueryBuilder, 0); } /** * Sets the current set of predicted apps. */ public void setPredictedApps(List<ComponentKey> apps) { mApps.setPredictedApps(apps); } /** * Sets the current set of apps. */ public void setApps(List<AppInfo> apps) { mApps.setApps(apps); } /** * Adds new apps to the list. */ public void addApps(List<AppInfo> apps) { mApps.addApps(apps); } /** * Updates existing apps in the list */ public void updateApps(List<AppInfo> apps) { mApps.updateApps(apps); } /** * Removes some apps from the list. */ public void removeApps(List<AppInfo> apps) { mApps.removeApps(apps); } /** * Sets the search bar that shows above the a-z list. */ public void setSearchBarController(AllAppsSearchBarController searchController) { if (mSearchBarController != null) { throw new RuntimeException("Expected search bar controller to only be set once"); } mSearchBarController = searchController; mSearchBarController.initialize(mApps, this); // Add the new search view to the layout View searchBarView = searchController.getView(mSearchBarContainerView); mSearchBarContainerView.addView(searchBarView); mSearchBarContainerView.setVisibility(View.GONE); mSearchBarView = searchBarView; setHasSearchBar(); updateBackgroundAndPaddings(); } /** * Scrolls this list view to the top. */ public void scrollToTop() { mAppsRecyclerView.scrollToTop(); } /** * Returns the content view used for the launcher transitions. */ public View getContentView() { return mContainerView; } /** * Returns the all apps search view. */ public View getSearchBarView() { return mSearchBarView; } /** * Returns the reveal view used for the launcher transitions. */ public View getRevealView() { return mRevealView; } /** * Returns an new instance of the default app search controller. */ public AllAppsSearchBarController newDefaultAppSearchController() { return new DefaultAppSearchController(getContext(), this, mAppsRecyclerView); } /** * Focuses the search field and begins an app search. */ public void startAppsSearch() { if (mSearchBarController != null) { mSearchBarController.focusSearchField(); } } @Override protected void onFinishInflate() { super.onFinishInflate(); boolean isRtl = Utilities.isRtl(getResources()); mAdapter.setRtl(isRtl); mContent = findViewById(R.id.content); // This is a focus listener that proxies focus from a view into the list view. This is to // work around the search box from getting first focus and showing the cursor. View.OnFocusChangeListener focusProxyListener = new View.OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if (hasFocus) { mAppsRecyclerView.requestFocus(); } } }; mSearchBarContainerView = (ViewGroup) findViewById(R.id.search_box_container); mSearchBarContainerView.setOnFocusChangeListener(focusProxyListener); mContainerView = findViewById(R.id.all_apps_container); mContainerView.setOnFocusChangeListener(focusProxyListener); mRevealView = findViewById(R.id.all_apps_reveal); // Load the all apps recycler view mAppsRecyclerView = (AllAppsRecyclerView) findViewById(R.id.apps_list_view); mAppsRecyclerView.setApps(mApps); mAppsRecyclerView.setLayoutManager(mLayoutManager); mAppsRecyclerView.setAdapter(mAdapter); mAppsRecyclerView.setHasFixedSize(true); if (mItemDecoration != null) { mAppsRecyclerView.addItemDecoration(mItemDecoration); } updateBackgroundAndPaddings(); } @Override public void onBoundsChanged(Rect newBounds) { mLauncher.updateOverlayBounds(newBounds); } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { // Update the number of items in the grid before we measure the view int availableWidth = !mContentBounds.isEmpty() ? mContentBounds.width() : MeasureSpec.getSize(widthMeasureSpec); DeviceProfile grid = mLauncher.getDeviceProfile(); grid.updateAppsViewNumCols(getResources(), availableWidth); if (mNumAppsPerRow != grid.allAppsNumCols || mNumPredictedAppsPerRow != grid.allAppsNumPredictiveCols) { mNumAppsPerRow = grid.allAppsNumCols; mNumPredictedAppsPerRow = grid.allAppsNumPredictiveCols; // If there is a start margin to draw section names, determine how we are going to merge // app sections boolean mergeSectionsFully = mSectionNamesMargin == 0 || !grid.isPhone; AlphabeticalAppsList.MergeAlgorithm mergeAlgorithm = mergeSectionsFully ? new FullMergeAlgorithm() : new SimpleSectionMergeAlgorithm((int) Math.ceil(mNumAppsPerRow / 2f), MIN_ROWS_IN_MERGED_SECTION_PHONE, MAX_NUM_MERGES_PHONE); mAppsRecyclerView.setNumAppsPerRow(grid, mNumAppsPerRow); mAdapter.setNumAppsPerRow(mNumAppsPerRow); mApps.setNumAppsPerRow(mNumAppsPerRow, mNumPredictedAppsPerRow, mergeAlgorithm); } super.onMeasure(widthMeasureSpec, heightMeasureSpec); } /** * Update the background and padding of the Apps view and children. Instead of insetting the * container view, we inset the background and padding of the recycler view to allow for the * recycler view to handle touch events (for fast scrolling) all the way to the edge. */ @Override protected void onUpdateBackgroundAndPaddings(Rect searchBarBounds, Rect padding) { boolean isRtl = Utilities.isRtl(getResources()); // TODO: Use quantum_panel instead of quantum_panel_shape InsetDrawable background = new InsetDrawable( getResources().getDrawable(R.drawable.quantum_panel_shape), padding.left, 0, padding.right, 0); Rect bgPadding = new Rect(); background.getPadding(bgPadding); mContainerView.setBackground(background); mRevealView.setBackground(background.getConstantState().newDrawable()); mAppsRecyclerView.updateBackgroundPadding(bgPadding); mAdapter.updateBackgroundPadding(bgPadding); // Hack: We are going to let the recycler view take the full width, so reset the padding on // the container to zero after setting the background and apply the top-bottom padding to // the content view instead so that the launcher transition clips correctly. mContent.setPadding(0, padding.top, 0, padding.bottom); mContainerView.setPadding(0, 0, 0, 0); // Pad the recycler view by the background padding plus the start margin (for the section // names) // int startInset = Math.max(mSectionNamesMargin, mAppsRecyclerView.getMaxScrollbarWidth()); // int topBottomPadding = mRecyclerViewTopBottomPadding; // if (isRtl) { // mAppsRecyclerView.setPadding(padding.left + mAppsRecyclerView.getMaxScrollbarWidth(), // topBottomPadding, padding.right + startInset, topBottomPadding); // } else { // mAppsRecyclerView.setPadding(padding.left + startInset, topBottomPadding, // padding.right + mAppsRecyclerView.getMaxScrollbarWidth(), topBottomPadding); // } // Inset the search bar to fit its bounds above the container if (mSearchBarView != null) { Rect backgroundPadding = new Rect(); if (mSearchBarView.getBackground() != null) { mSearchBarView.getBackground().getPadding(backgroundPadding); } LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) mContent.getLayoutParams(); lp.leftMargin = searchBarBounds.left; lp.topMargin = searchBarBounds.top; lp.rightMargin = (getMeasuredWidth() - searchBarBounds.right); mContent.requestLayout(); } } @Override public boolean dispatchKeyEvent(KeyEvent event) { // Determine if the key event was actual text, if so, focus the search bar and then dispatch // the key normally so that it can process this key event if (!mSearchBarController.isSearchFieldFocused() && event.getAction() == KeyEvent.ACTION_DOWN) { final int unicodeChar = event.getUnicodeChar(); final boolean isKeyNotWhitespace = unicodeChar > 0 && !Character.isWhitespace(unicodeChar) && !Character.isSpaceChar(unicodeChar); if (isKeyNotWhitespace) { boolean gotKey = TextKeyListener.getInstance().onKeyDown(this, mSearchQueryBuilder, event.getKeyCode(), event); if (gotKey && mSearchQueryBuilder.length() > 0) { mSearchBarController.focusSearchField(); } } } return super.dispatchKeyEvent(event); } @Override public boolean onInterceptTouchEvent(MotionEvent ev) { return handleTouchEvent(ev); } @SuppressLint("ClickableViewAccessibility") @Override public boolean onTouchEvent(MotionEvent ev) { return handleTouchEvent(ev); } @SuppressLint("ClickableViewAccessibility") @Override public boolean onTouch(View v, MotionEvent ev) { switch (ev.getAction()) { case MotionEvent.ACTION_DOWN: case MotionEvent.ACTION_MOVE: mIconLastTouchPos.set((int) ev.getX(), (int) ev.getY()); break; } return false; } @Override public boolean onLongClick(View v) { // Return early if this is not initiated from a touch if (!v.isInTouchMode()) return false; // When we have exited all apps or are in transition, disregard long clicks if (!mLauncher.isAppsViewVisible() || mLauncher.getWorkspace().isSwitchingState()) return false; // Return if global dragging is not enabled if (!mLauncher.isDraggingEnabled()) return false; // Start the drag mLauncher.getWorkspace().beginDragShared(v, mIconLastTouchPos, this, false); // Enter spring loaded mode mLauncher.enterSpringLoadedDragMode(); return false; } @Override public boolean supportsFlingToDelete() { return true; } @Override public boolean supportsAppInfoDropTarget() { return true; } @Override public boolean supportsDeleteDropTarget() { return false; } @Override public float getIntrinsicIconScaleFactor() { DeviceProfile grid = mLauncher.getDeviceProfile(); return (float) grid.allAppsIconSizePx / grid.iconSizePx; } @Override public void onFlingToDeleteCompleted() { // We just dismiss the drag when we fling, so cleanup here mLauncher.exitSpringLoadedDragModeDelayed(true, Launcher.EXIT_SPRINGLOADED_MODE_SHORT_TIMEOUT, null); mLauncher.unlockScreenOrientation(false); } @Override public void onDropCompleted(View target, DropTarget.DragObject d, boolean isFlingToDelete, boolean success) { if (isFlingToDelete || !success || (target != mLauncher.getWorkspace() && !(target instanceof DeleteDropTarget) && !(target instanceof Folder))) { // Exit spring loaded mode if we have not successfully dropped or have not handled the // drop in Workspace mLauncher.exitSpringLoadedDragModeDelayed(true, Launcher.EXIT_SPRINGLOADED_MODE_SHORT_TIMEOUT, null); } mLauncher.unlockScreenOrientation(false); // Display an error message if the drag failed due to there not being enough space on the // target layout we were dropping on. if (!success) { boolean showOutOfSpaceMessage = false; if (target instanceof Workspace) { int currentScreen = mLauncher.getCurrentWorkspaceScreen(); Workspace workspace = (Workspace) target; CellLayout layout = (CellLayout) workspace.getChildAt(currentScreen); ItemInfo itemInfo = (ItemInfo) d.dragInfo; if (layout != null) { showOutOfSpaceMessage = !layout.findCellForSpan(null, itemInfo.spanX, itemInfo.spanY); } } if (showOutOfSpaceMessage) { mLauncher.showOutOfSpaceMessage(false); } d.deferDragViewCleanupPostAnimation = false; } } @Override public void onLauncherTransitionPrepare(Launcher l, boolean animated, boolean toWorkspace) { // Do nothing } @Override public void onLauncherTransitionStart(Launcher l, boolean animated, boolean toWorkspace) { // Do nothing } @Override public void onLauncherTransitionStep(Launcher l, float t) { // Do nothing } @Override public void onLauncherTransitionEnd(Launcher l, boolean animated, boolean toWorkspace) { if (toWorkspace) { // Reset the search bar and base recycler view after transitioning home mSearchBarController.reset(); mAppsRecyclerView.reset(); } } /** * Handles the touch events to dismiss all apps when clicking outside the bounds of the * recycler view. */ private boolean handleTouchEvent(MotionEvent ev) { DeviceProfile grid = mLauncher.getDeviceProfile(); int x = (int) ev.getX(); int y = (int) ev.getY(); switch (ev.getAction()) { case MotionEvent.ACTION_DOWN: if (!mContentBounds.isEmpty()) { // Outset the fixed bounds and check if the touch is outside all apps Rect tmpRect = new Rect(mContentBounds); tmpRect.inset(-grid.allAppsIconSizePx / 2, 0); if (ev.getX() < tmpRect.left || ev.getX() > tmpRect.right) { mBoundsCheckLastTouchDownPos.set(x, y); return true; } } else { // Check if the touch is outside all apps if (ev.getX() < getPaddingLeft() || ev.getX() > (getWidth() - getPaddingRight())) { mBoundsCheckLastTouchDownPos.set(x, y); return true; } } break; case MotionEvent.ACTION_UP: if (mBoundsCheckLastTouchDownPos.x > -1) { ViewConfiguration viewConfig = ViewConfiguration.get(getContext()); float dx = ev.getX() - mBoundsCheckLastTouchDownPos.x; float dy = ev.getY() - mBoundsCheckLastTouchDownPos.y; float distance = (float) Math.hypot(dx, dy); if (distance < viewConfig.getScaledTouchSlop()) { // The background was clicked, so just go home Launcher launcher = (Launcher) getContext(); launcher.showWorkspace(true); return true; } } // Fall through case MotionEvent.ACTION_CANCEL: mBoundsCheckLastTouchDownPos.set(-1, -1); break; } return false; } @Override public void onSearchResult(String query, ArrayList<ComponentKey> apps) { if (apps != null) { mApps.setOrderedFilter(apps); mAdapter.setLastSearchQuery(query); mAppsRecyclerView.onSearchResultsChanged(); } } @Override public void clearSearchResult() { mApps.setOrderedFilter(null); mAppsRecyclerView.onSearchResultsChanged(); // Clear the search query mSearchQueryBuilder.clear(); mSearchQueryBuilder.clearSpans(); Selection.setSelection(mSearchQueryBuilder, 0); } }
34dfbcf3f2b9d96303c643845df3f9309a9d7f26
87417c4f1e1d29a9976c4795bf5703174c9cb719
/arrinv.java
4b99bfab7efbefd221c6b52e42b5789337741dbb
[]
no_license
Harshulagarwal/CB-CRUX-JAVA
2342461ef5a72f8c8243ef96c299dc8b14c52298
edeee2bdbcebcef499dbdefb07f8c11964df96a1
refs/heads/master
2020-03-22T19:44:52.805797
2018-07-11T08:59:09
2018-07-11T08:59:09
140,548,097
0
0
null
null
null
null
UTF-8
Java
false
false
521
java
package harshul; import java.util.Scanner; public class arrinv { public static void main(String[] args) { // TODO Auto-generated method stub inverse(); } public static void inverse() {int j=0;double s=0; Scanner obj=new Scanner(System.in); int n1=obj.nextInt(); int a[]=new int[n1]; for(int i=0;i<a.length;i++) a[i]=obj.nextInt(); int cb[]=new int[n1]; for(int k=0;k<n1;k++) cb[a[k]]=k; for(int k=0;k<n1;k++) System.out.println(cb[k]); } }
06be3f747a34086c953bf88a29a16d232934d23b
efa88f2206d92262c5aeced76f2e1ff4fa9670c1
/src/studio/hdr/lms/dao/IBaseHibernateDAO.java
a324534ce8a1659e87f664580f41c9af59257c51
[]
no_license
hdr33265/LMS
961f179dbaeaf4fb356f8218f9e87cb7261778ec
fe46a6d7cc8b5138aa7b2b409c34390fedada5ad
refs/heads/master
2016-08-11T01:03:30.749757
2013-03-31T04:39:16
2013-03-31T04:39:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
218
java
package studio.hdr.lms.dao; import org.hibernate.Session; /** * Data access interface for domain model * @author MyEclipse Persistence Tools */ public interface IBaseHibernateDAO { public Session getSession(); }
fd2f46a4a2ec55f18023a3db3e74f3f072c436d3
829a84ecd7ad2782591e7a54fdbff6af07546728
/src/polymorphism/music/Wind.java
481cd6eafa9bb1210f3e5c8b3110480db4cf6895
[]
no_license
oubl23/thinkinginjava
24a3c8d9b2e96f52b289b9ad42a6f1762e1cd017
b1be7e063b3332d151db1a2afa0be5b69656f5fc
refs/heads/master
2021-01-11T11:17:55.755828
2016-11-17T14:21:48
2016-11-17T14:21:48
72,738,511
0
0
null
null
null
null
UTF-8
Java
false
false
186
java
package polymorphism.music; /** * Created by dabao on 2016/10/27. */ public class Wind extends Instrument { public void play(Note n) { System.out.println("Wind.play()" + n); } }
e012eeeb25a369f2eaa80bf786e939bfb2b45485
678eba9d03b2404bda49eeb8f979a8ca793246cf
/game/src/main/java/lujgame/anno/net/packet/NetPacketProcImpl.java
1d02915be6dbd199cb61e599bf9453bbc8c53859
[]
no_license
lowZoom/LujGame
7456b6c36ce8b97a5b755c78686830bad3fb47cd
5675751183e62449866317f17c63e21a523e6176
refs/heads/master
2020-04-05T08:53:27.638143
2018-03-25T10:12:55
2018-03-25T10:12:55
81,704,611
2
2
null
null
null
null
UTF-8
Java
false
false
8,885
java
package lujgame.anno.net.packet; import com.google.common.collect.ImmutableMap; import com.squareup.javapoet.ClassName; import com.squareup.javapoet.FieldSpec; import com.squareup.javapoet.JavaFile; import com.squareup.javapoet.MethodSpec; import com.squareup.javapoet.ParameterizedTypeName; import com.squareup.javapoet.TypeName; import com.squareup.javapoet.TypeSpec; import java.io.IOException; import java.util.List; import java.util.Map; import java.util.stream.Collectors; import javax.annotation.processing.Filer; import javax.annotation.processing.Messager; import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.Modifier; import javax.lang.model.element.TypeElement; import javax.lang.model.type.TypeMirror; import javax.lang.model.util.Elements; import javax.tools.Diagnostic; import lujgame.anno.core.generate.GenerateTool; import lujgame.anno.net.packet.input.FieldItem; import lujgame.anno.net.packet.input.PacketItem; import lujgame.anno.net.packet.output.FieldType; import lujgame.game.server.net.packet.NetPacketCodec; import lujgame.game.server.net.packet.PacketImpl; import lujgame.game.server.type.JInt; import lujgame.game.server.type.JStr; import lujgame.game.server.type.Z1; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.stereotype.Service; @Component public class NetPacketProcImpl { public void process(TypeElement elem, Elements elemUtil, Filer filer, Messager msg) throws IOException { PacketItem item = createPacketItem(elem, elemUtil); if (!checkPacketItem(item, msg)) { return; } JavaFile jsonFile = makeJsonFile(item); _generateTool.writeTo(jsonFile, filer); generatePacketImpl(item, filer, jsonFile.typeSpec); generateCodec(item, filer); } private PacketItem createPacketItem(TypeElement elem, Elements elemUtil) { List<FieldItem> fieldList = elem.getEnclosedElements().stream() .map(e -> toPacketField((ExecutableElement) e)) .collect(Collectors.toList()); return new PacketItem(elemUtil.getPackageOf(elem).getQualifiedName().toString(), elem.getSimpleName().toString(), elem.asType(), fieldList); } private boolean checkPacketItem(PacketItem item, Messager msg) { List<FieldItem> invalidList = item.getFieldList().stream() .filter(f -> FIELD_MAP.get(f.getSpec().type) == null) .collect(Collectors.toList()); invalidList.forEach(f -> { TypeName type = f.getSpec().type; msg.printMessage(Diagnostic.Kind.ERROR, "无法识别的字段类型:" + type, f.getElem()); }); return invalidList.isEmpty(); } private FieldItem toPacketField(ExecutableElement elem) { return new FieldItem(elem, FieldSpec.builder(TypeName.get(elem.getReturnType()), elem.getSimpleName().toString()).build()); } /** * 生成包json类 */ private JavaFile makeJsonFile(PacketItem item) { List<FieldSpec> fieldList = item.getFieldList().stream() .map(this::toJsonField) .collect(Collectors.toList()); return JavaFile.builder(item.getPackageName(), TypeSpec .classBuilder(getJsonName(item)) .addModifiers(Modifier.FINAL) .addFields(fieldList) .addMethods(fieldList.stream() .map(this::jsFieldToGetter) .collect(Collectors.toList())) .addMethods(fieldList.stream() .map(this::jsFieldToSetter) .collect(Collectors.toList())) .build()).build(); } private String getJsonName(PacketItem item) { return item.getClassName() + "Json"; } private FieldSpec toJsonField(FieldItem packetField) { FieldSpec spec = packetField.getSpec(); FieldType newType = FIELD_MAP.get(spec.type); if (newType == null) { return spec; } return FieldSpec.builder(newType.getValueType(), '_' + spec.name).build(); } private MethodSpec jsFieldToGetter(FieldSpec field) { return MethodSpec.methodBuilder(_generateTool.nameOfProperty("get", field.name)) .addModifiers(Modifier.PUBLIC) .returns(field.type) .addStatement("return $L", field.name) .build(); } private MethodSpec jsFieldToSetter(FieldSpec field) { String paramName = field.name.substring(1, 2); return MethodSpec.methodBuilder(_generateTool.nameOfProperty("set", field.name)) .addModifiers(Modifier.PUBLIC) .addParameter(field.type, paramName) .addStatement("$L = $L", field.name, paramName) .build(); } /** * 生成包实现类 */ private void generatePacketImpl(PacketItem item, Filer filer, TypeSpec jsonType) throws IOException { GenerateTool t = _generateTool; List<FieldSpec> fieldList = item.getFieldList().stream() .map(f -> t.makeBeanField(f.getSpec())) .collect(Collectors.toList()); String internalParam = "i"; String jsonParam = "j"; ClassName valueType = ClassName.bestGuess(jsonType.name); MethodSpec construct = fillConstruct(MethodSpec .constructorBuilder(), fieldList, internalParam, jsonParam) .addParameter(TypeName.get(Z1.class), internalParam) .addParameter(valueType, jsonParam) .build(); List<MethodSpec> propertyList = fieldList.stream() .map(t::makeBeanProperty) .collect(Collectors.toList()); t.writeTo(JavaFile.builder(item.getPackageName(), TypeSpec .classBuilder(getImplName(item)) .addModifiers(Modifier.FINAL) .superclass(ParameterizedTypeName.get(ClassName.get(PacketImpl.class), valueType)) .addSuperinterface(TypeName.get(item.getPacketType())) .addMethod(construct) .addMethods(propertyList) .addFields(fieldList) .build()).build(), filer); } private String getImplName(PacketItem item) { return item.getClassName() + "Impl"; } private MethodSpec.Builder fillConstruct(MethodSpec.Builder builder, List<FieldSpec> fieldList, String internalName, String jsonName) { GenerateTool t = _generateTool; builder.addStatement("super($1L)", jsonName); for (FieldSpec f : fieldList) { FieldType fieldType = FIELD_MAP.get(f.type); builder.addStatement("$1L = $2L.$3L($4L::$5L, $4L::$6L)", f.name, internalName, fieldType.getMaker(), jsonName, t.nameOfProperty("get", f.name), t.nameOfProperty("set", f.name)); } return builder; } /** * 生成编解码器类 */ private void generateCodec(PacketItem item, Filer filer) throws IOException { GenerateTool t = _generateTool; String internalName = "i"; TypeMirror packetType = item.getPacketType(); MethodSpec create = t.overrideBuilder("createPacket") .addModifiers(Modifier.PUBLIC) .addParameter(TypeName.get(Z1.class), internalName) .returns(PacketImpl.class) .addStatement("return new $L($L, new $L())", getImplName(item), internalName, getJsonName(item)) .build(); String dataName = "data"; MethodSpec decode = t.overrideBuilder("decodePacket") .addModifiers(Modifier.PUBLIC) .addParameter(TypeName.get(Z1.class), internalName) .addParameter(byte[].class, dataName) .returns(TypeName.get(packetType)) .addStatement("return new $L($L, readJson($L, $L.class))", getImplName(item), internalName, dataName, getJsonName(item)) .build(); String packetName = "packet"; MethodSpec encode = t.overrideBuilder("encodePacket") .addModifiers(Modifier.PUBLIC) .addParameter(TypeName.get(Object.class), packetName) .returns(byte[].class) .addStatement("return writeJson($L)", packetName) .build(); t.writeTo(JavaFile.builder(item.getPackageName(), TypeSpec .classBuilder(item.getClassName() + "Codec") .addAnnotation(Service.class) .addModifiers(Modifier.PUBLIC, Modifier.FINAL) .superclass(NetPacketCodec.class) .addMethod(buildPacketType(packetType)) .addMethod(create) .addMethod(decode) .addMethod(encode) .build()).build(), filer); } private MethodSpec buildPacketType(TypeMirror packetType) { return MethodSpec.methodBuilder("packetType") .addAnnotation(Override.class) .addModifiers(Modifier.PUBLIC) .returns(ParameterizedTypeName.get(ClassName.get(Class.class), TypeName.get(packetType))) .addStatement("return $L.class", packetType) .build(); } private static final Map<TypeName, FieldType> FIELD_MAP = ImmutableMap.<TypeName, FieldType>builder() .put(TypeName.get(JInt.class), FieldType.of(int.class, "newInt")) .put(TypeName.get(JStr.class), FieldType.of(String.class, "newStr")) .build(); @Autowired private GenerateTool _generateTool; }
9532663c1b60362815190be04322537f0d6be313
74e72d6e52673882b276e8b296a037481f490abc
/src/com/manage/service/impl/OrderService.java
2f0dcc2c6b6d4fd2c5645a36d5dd97e6713cf011
[]
no_license
javalipan/CS_ShopManage
22524b2c4220bbad8ba06b014bb51a5a7a55834f
5a7ed1094265f76c3ff44b9fe77c5caed24f01ce
refs/heads/master
2021-08-07T23:38:35.713586
2020-04-11T13:31:05
2020-04-11T13:31:05
150,222,860
0
0
null
null
null
null
UTF-8
Java
false
false
3,191
java
package com.manage.service.impl; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.manage.dao.mapper.OrderMapper; import com.manage.dao.model.Order; import com.manage.dao.model.OrderExample; import com.manage.query.mapper.OrderQueryMapper; import com.manage.query.model.OrderQuery; import com.manage.service.IOrderService; @Service public class OrderService implements IOrderService { @Autowired private OrderMapper orderMapper; @Autowired private OrderQueryMapper orderQueryMapper; public int countByExample(OrderExample example) { return orderMapper.countByExample(example); } public int deleteByExample(OrderExample example) { return orderMapper.deleteByExample(example); } public int deleteByPrimaryKey(Long id) { return orderMapper.deleteByPrimaryKey(id); } public int insertSelective(Order record) { return orderMapper.insertSelective(record); } public List<Order> selectByExample(OrderExample example) { return orderMapper.selectByExample(example); } public Order selectByPrimaryKey(Long id) { return orderMapper.selectByPrimaryKey(id); } public int updateByExampleSelective(Order record, OrderExample example) { return orderMapper.updateByExampleSelective(record, example); } public int updateByPrimaryKeySelective(Order record) { return orderMapper.updateByPrimaryKeySelective(record); } public OrderQuery selectOrderQueryById(Long id) { return orderQueryMapper.selectOrderQueryById(id); } public OrderQuery selectOrderQueryByCode(String code) { return orderQueryMapper.selectOrderQueryByCode(code); } public List<OrderQuery> selectByOrderQuery(OrderQuery orderQuery) { return orderQueryMapper.selectByOrderQuery(orderQuery); } public Integer countByOrderQuery(OrderQuery orderQuery) { return orderQueryMapper.countByOrderQuery(orderQuery); } public Map<String, Object> sumOrder(OrderQuery orderQuery) { return orderQueryMapper.sumOrder(orderQuery); } public List<Map<String, Object>> sumByOldOrNew(String year) { return orderQueryMapper.sumByOldOrNew(year); } public List<Map<String, Object>> sumBrand(String startTime, String endTime, Long brandid) { return orderQueryMapper.sumBrand(startTime, endTime, brandid); } public List<Map<String, Object>> sumColor(String startTime, String endTime, Long brandid) { return orderQueryMapper.sumColor(startTime, endTime, brandid); } public List<Map<String, Object>> sumSize(String startTime, String endTime, Long brandid) { return orderQueryMapper.sumSize(startTime, endTime, brandid); } public List<Map<String, Object>> sumStyle(String startTime, String endTime, Long brandid) { return orderQueryMapper.sumStyle(startTime, endTime, brandid); } public List<OrderQuery> selectByOrderQuery2(OrderQuery orderQuery) { return orderQueryMapper.selectByOrderQuery2(orderQuery); } public Integer countByOrderQuery2(OrderQuery orderQuery) { return orderQueryMapper.countByOrderQuery2(orderQuery); } }
0756e3c70e0c50c93b6e7978a4643814b7e2ea94
94039628301a2c19604cfba4aaeeec55c2af21a8
/src/main/java/com/camelone/excalibur/FileMessageStore.java
77a75189dec3577b4a3b1194d6c15d65831de38a
[]
no_license
hzbarcea/camelone
3399b5ad73018de0b10deb18834bd2d582daa1e4
0b5448321b107dc1f51ddf83aaf98283472bc4db
refs/heads/master
2021-01-01T20:12:28.329750
2013-06-12T19:03:45
2013-06-12T19:03:45
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,044
java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.camelone.excalibur; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.util.Collection; import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import org.apache.camel.CamelContext; import org.apache.camel.Endpoint; import org.apache.camel.Exchange; import org.apache.camel.Expression; import org.apache.camel.spi.DataFormat; import com.camelone.claimcheck.MessageStore; public class FileMessageStore implements MessageStore { private Map<String, Exchange> store = new ConcurrentHashMap<String, Exchange>(); private File location; private DataFormat df; private Expression reader; private Endpoint endpoint; public FileMessageStore(File location, DataFormat df, CamelContext context, Expression reader) { this.location = location; this.df = df; this.reader = reader; endpoint = context.getEndpoint("file:" + location.getAbsolutePath()); refresh(); } public void refresh() { store.clear(); for (File msg : location.listFiles()) { if (msg.isFile()) { Exchange exchange = fromStorage(msg); store.put(reader.evaluate(exchange, String.class), exchange); } } } @Override public void clear() { clearStorage(); store.clear(); } @Override public boolean containsKey(Object key) { return store.containsKey(key); } @Override public boolean containsValue(Object value) { return store.containsValue(value); } @Override public Set<java.util.Map.Entry<String, Exchange>> entrySet() { return store.entrySet(); } @Override public Exchange get(Object key) { return store.get(key); } @Override public boolean isEmpty() { return store.isEmpty(); } @Override public Set<String> keySet() { return store.keySet(); } @Override public Exchange put(String key, Exchange value) { toStorage(value); return store.put(key, value); } @Override public void putAll(Map<? extends String, ? extends Exchange> other) { for (Map.Entry<? extends String, ? extends Exchange> entry : other.entrySet()) { store.put(entry.getKey(), entry.getValue()); } } @Override public Exchange remove(Object key) { Exchange ex = store.get(key); File f = new File(location, ex.getExchangeId()); f.delete(); return store.remove(key); } @Override public int size() { return store.size(); } @Override public Collection<Exchange> values() { return store.values(); } private void clearStorage() { for (File msg : location.listFiles()) { if (msg.isFile()) { msg.delete(); } } } private void toStorage(Exchange exchange) { try { ByteArrayOutputStream stream = new ByteArrayOutputStream(); df.marshal(exchange, exchange.getIn().getBody(), stream); stream.writeTo(new FileOutputStream(new File(location, exchange.getExchangeId()))); } catch (Exception e) { // ignore } } private Exchange fromStorage(File message) { Exchange exchange = null; try { exchange = endpoint.createExchange(); exchange.setExchangeId(message.getName()); exchange.getIn().setBody(df.unmarshal(exchange, new FileInputStream(message))); } catch (Exception e) { // ignore } return exchange; } }
ef353da7d95b69288982150cf50d15f97ba1c936
076634b253da21a5d3ad40b30790e5f441313c93
/VotingCentral/JavaSource/com/votingcentral/model/enums/VCUserLinkStateEnum.java
2c859d7265d2f0f88fa3027bc38db5c40dfcf176
[]
no_license
hnalagandla/votingcentral
ac5cc64cbaa8910ed8921f557715720e423a829a
bb6570fea2ee0e90ebef9c0cfcda2471f9312acf
refs/heads/master
2021-01-13T02:08:18.239901
2014-01-23T21:32:59
2014-01-23T21:32:59
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,627
java
/* * Created on May 22, 2007 * * TODO To change the template for this generated file go to * Window - Preferences - Java - Code Style - Code Templates */ package com.votingcentral.model.enums; import java.util.Iterator; import java.util.ListIterator; import com.votingcentral.util.enums.BaseEnum; /** * @author harishn * * TODO To change the template for this generated type comment go to Window - * Preferences - Java - Code Style - Code Templates */ public class VCUserLinkStateEnum extends BaseEnum { public static final VCUserLinkStateEnum INITIATED = new VCUserLinkStateEnum( "INITIATED", 0); public static final VCUserLinkStateEnum ACCEPTED = new VCUserLinkStateEnum( "ACCEPTED", 1); public static final VCUserLinkStateEnum REJECTED = new VCUserLinkStateEnum( "REJECTED", 2); public static final VCUserLinkStateEnum BROKEN = new VCUserLinkStateEnum( "BROKEN", 3); public static final VCUserLinkStateEnum RE_ESTABLISHED = new VCUserLinkStateEnum( "RE_ESTABLISHED", 4); public static final VCUserLinkStateEnum RECALL = new VCUserLinkStateEnum( "RECALL", 5); public static VCUserLinkStateEnum get(String name) { Iterator iter = iterator(); while (iter.hasNext()) { VCUserLinkStateEnum roles = (VCUserLinkStateEnum) iter.next(); if (roles.getName().equalsIgnoreCase(name)) { return roles; } } return null; } // Add new instances above this line //-----------------------------------------------------------------// // Template code follows....do not modify other than to replace // // enumeration class name with the name of this class. // //-----------------------------------------------------------------// private VCUserLinkStateEnum(String name, int intValue) { super(intValue, name); } // ------- Type specific interfaces -------------------------------// /** Get the enumeration instance for a given value or null */ public static VCUserLinkStateEnum get(int key) { return (VCUserLinkStateEnum) getEnum(VCUserLinkStateEnum.class, key); } /** * Get the enumeration instance for a given value or return the elseEnum * default. */ public static VCUserLinkStateEnum getElseReturn(int key, VCUserLinkStateEnum elseEnum) { return (VCUserLinkStateEnum) getElseReturnEnum( VCUserLinkStateEnum.class, key, elseEnum); } /** * Return an bidirectional iterator that traverses the enumeration instances * in the order they were defined. */ public static ListIterator iterator() { return getIterator(VCUserLinkStateEnum.class); } }
539f5c93c6a0ee46079a2ba9bbebf8076694b19f
be73270af6be0a811bca4f1710dc6a038e4a8fd2
/crash-reproduction-moho/results/XWIKI-14227-4-12-NSGA_II-WeightedSum:TestLen:CallDiversity/com/xpn/xwiki/store/migration/AbstractDataMigrationManager_ESTest.java
e4e3327e0084785f50b9587875b895c60cdee49b
[]
no_license
STAMP-project/Botsing-multi-objectivization-using-helper-objectives-application
cf118b23ecb87a8bf59643e42f7556b521d1f754
3bb39683f9c343b8ec94890a00b8f260d158dfe3
refs/heads/master
2022-07-29T14:44:00.774547
2020-08-10T15:14:49
2020-08-10T15:14:49
285,804,495
0
0
null
null
null
null
UTF-8
Java
false
false
592
java
/* * This file was automatically generated by EvoSuite * Sat Jan 18 18:29:39 UTC 2020 */ package com.xpn.xwiki.store.migration; import org.junit.Test; import static org.junit.Assert.*; import org.evosuite.runtime.EvoRunner; import org.evosuite.runtime.EvoRunnerParameters; import org.junit.runner.RunWith; @RunWith(EvoRunner.class) @EvoRunnerParameters(useVFS = true, useJEE = true) public class AbstractDataMigrationManager_ESTest extends AbstractDataMigrationManager_ESTest_scaffolding { @Test public void notGeneratedAnyTest() { // EvoSuite did not generate any tests } }
442f9b40a7d711bbd96253c2b30c4509a1c6782a
ca8843436b3151ed6de8053fb577446a7ae2e424
/src/main/java/org/healthship/jira/client/model/ContainerForRegisteredWebhooks.java
9618ec17d4768523a2ca46b402909b02db0a49dd
[]
no_license
HealthSHIP/hs-os
f69c08e4af1dac68464eecbdefb000c4fda806b3
a00c64940076437f3d110d5d8ac8b6316d4a79c7
refs/heads/master
2022-12-28T02:35:04.714619
2020-10-16T13:02:39
2020-10-16T13:02:39
304,629,073
0
0
null
null
null
null
UTF-8
Java
false
false
4,290
java
/* * Copyright (c) 2020 Ronald MacDonald <[email protected]> * * 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. */ /* * The Jira Cloud platform REST API * Jira Cloud platform REST API documentation * * The version of the OpenAPI document: 1001.0.0-SNAPSHOT * Contact: [email protected] * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ package org.healthship.jira.client.model; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; import java.util.List; import java.util.Objects; /** * Container for a list of registered webhooks. Webhook details are returned in the same order as the request. */ @ApiModel(description = "Container for a list of registered webhooks. Webhook details are returned in the same order as the request.") @JsonPropertyOrder({ ContainerForRegisteredWebhooks.JSON_PROPERTY_WEBHOOK_REGISTRATION_RESULT }) @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2020-03-29T15:40:13.931673+01:00[Europe/London]") public class ContainerForRegisteredWebhooks { public static final String JSON_PROPERTY_WEBHOOK_REGISTRATION_RESULT = "webhookRegistrationResult"; private List<RegisteredWebhook> webhookRegistrationResult = null; public ContainerForRegisteredWebhooks webhookRegistrationResult(List<RegisteredWebhook> webhookRegistrationResult) { this.webhookRegistrationResult = webhookRegistrationResult; return this; } public ContainerForRegisteredWebhooks addWebhookRegistrationResultItem(RegisteredWebhook webhookRegistrationResultItem) { if (this.webhookRegistrationResult == null) { this.webhookRegistrationResult = new ArrayList<>(); } this.webhookRegistrationResult.add(webhookRegistrationResultItem); return this; } /** * A list of registered webhooks. * @return webhookRegistrationResult **/ @javax.annotation.Nullable @ApiModelProperty(value = "A list of registered webhooks.") @JsonProperty(JSON_PROPERTY_WEBHOOK_REGISTRATION_RESULT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List<RegisteredWebhook> getWebhookRegistrationResult() { return webhookRegistrationResult; } public void setWebhookRegistrationResult(List<RegisteredWebhook> webhookRegistrationResult) { this.webhookRegistrationResult = webhookRegistrationResult; } @Override public boolean equals(java.lang.Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } ContainerForRegisteredWebhooks containerForRegisteredWebhooks = (ContainerForRegisteredWebhooks) o; return Objects.equals(this.webhookRegistrationResult, containerForRegisteredWebhooks.webhookRegistrationResult); } @Override public int hashCode() { return Objects.hash(webhookRegistrationResult); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class ContainerForRegisteredWebhooks {\n"); sb.append(" webhookRegistrationResult: ").append(toIndentedString(webhookRegistrationResult)).append("\n"); sb.append("}"); return sb.toString(); } /** * Convert the given object to string with each line indented by 4 spaces * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { return "null"; } return o.toString().replace("\n", "\n "); } }
e5595ba83952d2febe3964a1f04b1a884b273674
7de3c619f6b10f2b36ccdf5f4e864bf0d3e3c1f5
/app/src/main/java/com/nerdcastle/nazmul/pettycash/Util.java
93a95a2f48d77afe3c2586a0838440fa575a9482
[]
no_license
mdNazmulHasan/PettyCash
e891d859103758da7b608feb819fb481eb1033f0
1ccafbe29d014506925177950d190e8e3a5374eb
refs/heads/master
2021-01-21T13:41:20.548124
2016-05-03T05:21:39
2016-05-03T05:21:39
53,309,990
0
0
null
null
null
null
UTF-8
Java
false
false
190
java
package com.nerdcastle.nazmul.pettycash; /** * Created by Nazmul on 3/8/2016. */ public class Util { public static final String baseURL="http://dotnet.nerdcastlebd.com/PettyCash/"; }
b3c4e1057df2b4a4e8ddfa380b551d5ec6747b9c
7e90a7dcf87b77e7f38659aea946551162cf6a40
/modules/flowable-app-rest/src/main/java/org/flowable/rest/servlet/ContentDispatcherServletConfiguration.java
9bc416bc038ebeeebead912eaa008293a1bdb28a
[ "Apache-2.0" ]
permissive
propersoft-cn/flowable-engine
a09e8b2493bb1c4bbdbf83bad085135a317c80ee
fc31003d2f32f6954565502dc8a4cc505500c147
refs/heads/proper-6.2.1
2021-05-09T21:56:51.854651
2018-11-15T08:37:30
2018-11-15T08:37:30
118,738,227
0
8
Apache-2.0
2019-06-06T01:49:22
2018-01-24T08:49:14
Java
UTF-8
Java
false
false
1,139
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.flowable.rest.servlet; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.scheduling.annotation.EnableAsync; @Configuration @ComponentScan({ "org.flowable.rest.content.service.api" }) @EnableAsync public class ContentDispatcherServletConfiguration extends BaseDispatcherServletConfiguration { protected static final Logger LOGGER = LoggerFactory.getLogger(ContentDispatcherServletConfiguration.class); }
e9c818e643c6a63ecd95f651d8c88a321ba4a6fe
078fa13d52ccbbb8aade6dbd5206078cfff50003
/deweyHis/src/com/dewey/his/param/dao/ChargeRuleSettingDAO.java
fa88b6252567e70792a627c56bab27dff65da643
[]
no_license
kevonz/dewey
c30e18c118bf0d27b385f0d25e042c76ea53b458
b7155b96a28d5354651a8f88b0bd68ed3e1212a9
refs/heads/master
2021-01-18T08:55:34.894327
2012-10-27T08:59:10
2012-10-27T08:59:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
633
java
package com.dewey.his.param.dao; import org.hibernate.Query; import org.springframework.stereotype.Repository; import com.dewey.his.param.model.ChargeRuleSetting; import common.base.dao.hibernate3.Hibernate3Dao; @Repository("chargeRuleSettingDAO") public class ChargeRuleSettingDAO extends Hibernate3Dao{ public ChargeRuleSetting getByMerId(long merId) { String queryString = "from ChargeRuleSetting as model where model.mer.id= ?"; Query queryObject = this.getSessionFactory().getCurrentSession().createQuery(queryString); queryObject.setParameter(0, merId); return (ChargeRuleSetting)queryObject.uniqueResult(); } }
583d176d05fbe8efa2bc7a099839833e140ea7be
689a573e6f76d06f8ee7dc992b114d266027c0cf
/mobile/src/main/java/com/example/kimbe/sunshine/MainActivity.java
89a255d4a51f77c0fafc94046fbef23ff9811b82
[]
no_license
littlesparksf/Sunshine
78ce14a4c760e55467ae23d0f557d77d03f650ea
542a1f64f45f8b7b77001dfa7c4dfccd3cab8a02
refs/heads/master
2021-01-10T08:44:58.944681
2016-04-09T04:57:46
2016-04-09T04:57:46
55,826,824
0
0
null
null
null
null
UTF-8
Java
false
false
1,945
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.example.kimbe.sunshine; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.Menu; import android.view.MenuItem; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.container, new ForecastFragment()) .commit(); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } }
0ef94a74f865cf6fd4c200af6ce559a5c2483801
465d34afbe38feba4c5b9fb37f78306a0559962e
/warcraft/src/br/unitins/wow/dao/ItemDAO.java
3231538061171278f3eb804f0984b2d533821490
[]
no_license
zhydani/projeto-topicos-jsf
d370de0984ab93d94baef75de8851d2a849d85a9
ec7020bec48c1eb203804ad703bd5efb7c8db80f
refs/heads/master
2023-08-08T14:40:39.993536
2019-11-20T02:40:15
2019-11-20T02:40:15
222,834,989
0
0
null
2023-07-22T22:06:28
2019-11-20T02:38:08
Java
UTF-8
Java
false
false
4,383
java
package br.unitins.wow.dao; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.List; import br.unitins.wow.model.Classe; import br.unitins.wow.model.Origem; import br.unitins.wow.model.Item; public class ItemDAO extends DAO<Item> { public ItemDAO(Connection conn) { super(conn); } public ItemDAO() { super(null); } @Override public void create(Item item) throws SQLException { Connection conn = getConnection(); PreparedStatement stat = conn.prepareStatement("INSERT INTO " + "public.item " + " (nome, tipo, engaste, adicional, custo) " + "VALUES " + " (?, ?, ?, ?, ?) "); stat.setString(1, item.getNome()); stat.setString(2, item.getTipo()); stat.setString(3, item.getEngaste()); stat.setDouble(4, item.getAdicional()); stat.setDouble(5, item.getCusto()); stat.execute(); } @Override public void update(Item item) throws SQLException { Connection conn = getConnection(); PreparedStatement stat = conn.prepareStatement("UPDATE public.item SET " + " nome = ?, " + " tipo = ?, " + " engaste = ?, " + " adicional = ?, " + " custo = ? " + "WHERE " + " id = ? "); stat.setString(1, item.getNome()); stat.setString(2, item.getTipo()); stat.setString(1, item.getEngaste()); stat.setDouble(1, item.getAdicional()); stat.setDouble(1, item.getCusto()); stat.setInt(6, item.getId()); stat.execute(); } @Override public List<Item> findAll() { Connection conn = getConnection(); if (conn == null) return null; try { PreparedStatement stat = conn.prepareStatement("SELECT " + " id, " + " nome, " + " tipo, " + " engaste, " + " adicional, " + " custo " + "FROM " + " public.item "); ResultSet rs = stat.executeQuery(); List<Item> listaitem = new ArrayList<Item>(); while (rs.next()) { Item item = new Item(); item.setId(rs.getInt("id")); item.setNome(rs.getString("nome")); item.setTipo(rs.getString("tipo")); item.setEngaste(rs.getString("engaste")); item.setAdicional(rs.getDouble("adicional")); item.setCusto(rs.getDouble("custo")); listaitem.add(item); } if (listaitem.isEmpty()) return null; return listaitem; } catch (SQLException e) { e.printStackTrace(); } return null; } public List<Item> findByNome(String nome) { Connection conn = getConnection(); if (conn == null) return null; try { PreparedStatement stat = conn .prepareStatement("SELECT " + " id, " + " nome, " + " tipo, " + " engaste, " + " adicional, " + " custo " + "FROM " + " public.item " + "WHERE " + " nome ilike ? "); stat.setString(1, nome == null ? "%" : "%" + nome + "%"); ResultSet rs = stat.executeQuery(); List<Item> listaitem = new ArrayList<Item>(); while (rs.next()) { Item item = new Item(); item.setId(rs.getInt("id")); item.setNome(rs.getString("nome")); item.setTipo(rs.getString("tipo")); item.setEngaste(rs.getString("engaste")); item.setAdicional(rs.getDouble("adicional")); item.setCusto(rs.getDouble("custo")); listaitem.add(item); } if (listaitem.isEmpty()) return null; return listaitem; } catch (SQLException e) { e.printStackTrace(); } return null; } public Item findById(Integer id) { Connection conn = getConnection(); if (conn == null) return null; try { PreparedStatement stat = conn.prepareStatement("SELECT " + " id, " + " nome, " + " tipo, " + " engaste, " + " adicional, " + " custo " + "FROM " + " public.item " + "WHERE id = ? "); stat.setInt(1, id); ResultSet rs = stat.executeQuery(); Item item = null; if (rs.next()) { item = new Item(); item.setId(rs.getInt("id")); item.setNome(rs.getString("nome")); item.setTipo(rs.getString("tipo")); item.setEngaste(rs.getString("engaste")); item.setAdicional(rs.getDouble("adicional")); item.setCusto(rs.getDouble("custo")); } return item; } catch (SQLException e) { e.printStackTrace(); } return null; } @Override public void delete(int id) throws SQLException { Connection conn = getConnection(); PreparedStatement stat = conn.prepareStatement("DELETE FROM public.item WHERE id = ?"); stat.setInt(1, id); stat.execute(); } }
6c2585af490b4f5fc2585ff2e0f55adb92b14896
0b93651bf4c4be26f820702985bd41089026e681
/modules/dfp_appengine/src/main/java/com/google/api/ads/dfp/jaxws/v201802/ContentMetadataTargetingErrorReason.java
5394f361a5a96278065b3b4c7d3de2ccd06cd15b
[ "Apache-2.0" ]
permissive
cmcewen-postmedia/googleads-java-lib
adf36ccaf717ab486e982b09d69922ddd09183e1
75724b4a363dff96e3cc57b7ffc443f9897a9da9
refs/heads/master
2021-10-08T16:50:38.364367
2018-12-14T22:10:58
2018-12-14T22:10:58
106,611,378
0
0
Apache-2.0
2018-12-14T22:10:59
2017-10-11T21:26:49
Java
UTF-8
Java
false
false
1,986
java
// Copyright 2018 Google Inc. 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. // 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.google.api.ads.dfp.jaxws.v201802; import javax.xml.bind.annotation.XmlEnum; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for ContentMetadataTargetingError.Reason. * * <p>The following schema fragment specifies the expected content contained within this class. * <p> * <pre> * &lt;simpleType name="ContentMetadataTargetingError.Reason"> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string"> * &lt;enumeration value="VALUES_DO_NOT_BELONG_TO_A_HIERARCHY"/> * &lt;enumeration value="UNKNOWN"/> * &lt;/restriction> * &lt;/simpleType> * </pre> * */ @XmlType(name = "ContentMetadataTargetingError.Reason") @XmlEnum public enum ContentMetadataTargetingErrorReason { /** * * One or more of the values specified in a {@code ContentMetadataHierarchyTargeting} * do not belong to the keys defined in any of the hierarchies on the network. * * */ VALUES_DO_NOT_BELONG_TO_A_HIERARCHY, /** * * The value returned if the actual value is not exposed by the requested API version. * * */ UNKNOWN; public String value() { return name(); } public static ContentMetadataTargetingErrorReason fromValue(String v) { return valueOf(v); } }
18bb3495c807309061322bd459e96c99feb609f2
50ee0e449f842c70c756bcca1af845dfe3701072
/src/Campaign.java
2aa9249071c8e0437795f877fc2df36ca0d8c24e
[]
no_license
andvlin/ExHTTPClient
6f78e1ea661012e02711719a12f31cce3390e63f
c7e176292b65d89d663175fadb8c3b2b59f091d6
refs/heads/master
2020-03-23T10:09:25.616938
2018-07-18T11:53:42
2018-07-18T11:53:42
141,428,258
0
0
null
null
null
null
UTF-8
Java
false
false
428
java
public class Campaign { public float cpm; public int id; public String start_date; public String name; public int clicks; public int views; public Campaign(float cpm, int id, String name, String start_date) { this.cpm = cpm; this.id = id; this.name = name; this.start_date = start_date; } public String getRevenueStr() { float revenue = (cpm * views) / 1000; return String.format("%.2f", revenue); } }
62c203dd3496eb5e87c432f8fc2943d82b768bf1
c5ca42f9de6a0d743bf2f9b4f3af8d391741b6fe
/SistemaConsultas3/src/main/java/br/ufscar/dc/dsw/controller/ProfissionalRestController.java
a44968f1dee7cf8b906e98fe40f0feb725068fbe
[]
no_license
amandapmn/Web1
f44f9d661a82f81df74e88fb0c56bc8507db9e93
14d6b422200540baac73568b033452508568de11
refs/heads/main
2023-06-08T06:30:48.261714
2021-06-30T10:01:08
2021-06-30T10:01:08
366,761,844
0
2
null
2021-05-25T12:13:57
2021-05-12T15:23:28
Java
UTF-8
Java
false
false
4,462
java
package br.ufscar.dc.dsw.controller; import java.io.IOException; import java.util.List; import java.util.Map; import org.json.simple.JSONObject; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; 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.ResponseBody; import org.springframework.web.bind.annotation.RestController; import com.fasterxml.jackson.databind.ObjectMapper; import br.ufscar.dc.dsw.domain.Profissional; import br.ufscar.dc.dsw.service.spec.IProfissionalService; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; @RestController public class ProfissionalRestController { @Autowired private IProfissionalService profissionalService; @Autowired BCryptPasswordEncoder encoder; private boolean isJSONValid(String jsonInString) { try { return new ObjectMapper().readTree(jsonInString) != null; } catch (IOException e) { return false; } } @SuppressWarnings("unchecked") private void parse(Profissional profissional, JSONObject json) { profissional.setEmail((String) json.get("email")); profissional.setSenha(encoder.encode((String) json.get("senha"))); profissional.setCpf((String) json.get("cpf")); profissional.setPrimeiroNome((String) json.get("primeiroNome")); profissional.setSobrenome((String) json.get("sobrenome")); profissional.setPapel("PROFISSIONAL"); profissional.setEspecialidade((String) json.get("especialidade")); profissional.setQualificacoes((String) json.get("qualificacoes")); } @GetMapping(path = "/profissionais") public ResponseEntity<List<Profissional>> lista() { List<Profissional> lista = profissionalService.buscarTodos(); if (lista.isEmpty()) { return ResponseEntity.notFound().build(); } return ResponseEntity.ok(lista); } @GetMapping(path = "/profissionais/{id}") public ResponseEntity<Profissional> lista(@PathVariable("id") long id) { Profissional profissional = profissionalService.buscarPorId(id); if (profissional == null) { return ResponseEntity.notFound().build(); } return ResponseEntity.ok(profissional); } @GetMapping(path = "/profissionais/especialidades/{nome}") public ResponseEntity<List<Profissional>> listaEspecialidades(@PathVariable String nome) { List<Profissional> lista = profissionalService.buscarPorEspecialidade(nome + "%"); if (lista == null) { return ResponseEntity.notFound().build(); } return ResponseEntity.ok(lista); } @PostMapping(path = "/profissionais") @ResponseBody public ResponseEntity<Profissional> cria(@RequestBody JSONObject json) { try { if (isJSONValid(json.toString())) { Profissional profissional = new Profissional(); parse(profissional, json); profissionalService.salvar(profissional); return ResponseEntity.ok(profissional); } else { return ResponseEntity.badRequest().body(null); } } catch (Exception e) { e.printStackTrace(); return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY).body(null); } } @PutMapping(path = "/profissionais/{id}") public ResponseEntity<Profissional> atualiza(@PathVariable("id") long id, @RequestBody JSONObject json) { try { if (isJSONValid(json.toString())) { Profissional profissional = profissionalService.buscarPorId(id); if (profissional == null) { return ResponseEntity.notFound().build(); } else { parse(profissional, json); profissionalService.salvar(profissional); return ResponseEntity.ok(profissional); } } else { return ResponseEntity.badRequest().body(null); } } catch (Exception e) { return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY).body(null); } } @DeleteMapping(path = "/profissionais/{id}") public ResponseEntity<Boolean> remove(@PathVariable("id") long id) { Profissional profissional = profissionalService.buscarPorId(id); if (profissional == null) { return ResponseEntity.notFound().build(); } else { profissionalService.excluir(id); return ResponseEntity.noContent().build(); } } }
db4eb1a2466d65a521529302cbbb80de820febdc
b494132d4e9574fba3598a39153900911e07931c
/LeagueManager_Project2/src/LeagueManager.java
cf504bd54a35ddc5e1c1237ee975c8a2ce7b4a20
[]
no_license
Taflah/LeagueManager
1f569ceeefdf95f89c1e31ede14125baef1dccb4
36d1f86e878a17ea403b04be6a259a11c6a80dec
refs/heads/master
2021-05-11T14:47:12.220902
2018-01-16T16:50:44
2018-01-16T16:50:44
117,712,160
0
0
null
null
null
null
UTF-8
Java
false
false
469
java
import com.teamtreehouse.model.Player; import com.teamtreehouse.model.Players; import com.teamtreehouse.model.Prompter; import java.io.IOException; public class LeagueManager { public static void main(String[] args) throws IOException { Player[] players = Players.load(); Prompter prompter = new Prompter(Players.load()); System.out.printf("There are currently %d registered players.%n", players.length); prompter.run(); } }
43eed3bf2da6fc703657d19521c9fca9d6a75460
02ea43c90973437de5e9776b48e0ecbd5e54d790
/src/DecoratorPattern/Decorator.java
df5be83e6e0a5ab71e28e008f78874928be625bb
[]
no_license
glumes/DesignPattern
bdc68ed2620e79dc0c63611ad65456a5e8a09644
5af79a2aa92b3fac247aa80db2a7290b8ed965c5
refs/heads/master
2021-01-12T12:16:20.277141
2017-01-18T03:04:07
2017-01-18T03:04:07
72,402,820
0
1
null
null
null
null
UTF-8
Java
false
false
334
java
package DecoratorPattern; /** * Created by zhaoying on 2016/12/16. */ public abstract class Decorator implements Component{ private Component mComponent ; public Decorator(Component mComponent) { this.mComponent = mComponent; } @Override public void operate() { mComponent.operate(); } }
33a5f669f74f1f39f25ebb267620108ebbe3a4c8
8233fd0f7800f7341987ec4072867412c64d133c
/server/common/dao/src/main/java/org/kaaproject/kaa/server/common/dao/impl/LogSchemaDao.java
101e25750dc97c96ac66a679313c9b8e1b8b1214
[ "Apache-2.0" ]
permissive
aiyi/kaa
73e2ab0216f4d2406e82d8e3870c1ea02fcb9903
0ba0ee9d5513751e1cf25baa33f273fb4e863acd
refs/heads/master
2020-12-24T13:52:57.960839
2014-08-04T14:55:22
2014-08-04T15:03:26
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,688
java
/* * Copyright 2014 CyberVision, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.kaaproject.kaa.server.common.dao.impl; import java.util.List; /** * The interface Log Schema dao. * @param <T> the type parameter */ public interface LogSchemaDao<T> extends Dao<T> { /** * Find all Log Schemas for Application with specific id * * @param applicationId the id of Application * @return List of Log Schemas */ List<T> findByApplicationId(String applicationId); /** * Find Log Schema by application id and version. * * @param applicationId the application id * @param version the version of profile schema * @return the Log Schema */ T findByApplicationIdAndVersion(String applicationId, int version); /** * Remove by application id. * * @param applicationId the application id */ void removeByApplicationId(String applicationId); /** * Find latest log schema by application id. * * @param applicationId the application id * @return the notification schema */ T findLatestLogSchemaByAppId(String applicationId); }
a1cdf57488810f7cf1b16e923369a7db7e309306
5fe8047266a1147e6ce5a2ce21be93468db0dd4f
/src/test/java/com/example/library/mode/repository/BookRepositoryTest.java
4c4aa9646ae5a44c2a578fa729cf7368e6afe818
[]
no_license
caiusmuniz/library-api
1963d81eeb501ffe05623403c4117cbc94cafef3
ca377def05a7f0ee6cd8da0d5113119f0e8cbbf1
refs/heads/master
2023-05-27T21:22:13.113709
2021-06-10T18:12:18
2021-06-10T18:12:18
375,771,785
0
0
null
null
null
null
UTF-8
Java
false
false
2,838
java
package com.example.library.mode.repository; import com.example.library.model.entity.Book; import com.example.library.model.repository.BookRepository; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; import org.springframework.boot.test.autoconfigure.orm.jpa.TestEntityManager; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit.jupiter.SpringExtension; import java.util.Optional; import static org.assertj.core.api.Assertions.assertThat; @ExtendWith(SpringExtension.class) @ActiveProfiles("test") @DataJpaTest public class BookRepositoryTest { @Autowired TestEntityManager entityManager; @Autowired BookRepository repository; @Test @DisplayName("Deve retornar verdadeiro quando existir um livro na base com o ISBN informado.") public void returnTrueWhenIsbnExists() { // cenario String isbn = "123"; Book book = createNewBook(isbn); entityManager.persist(book); // execução boolean exists = repository.existsByIsbn(isbn); // verificação assertThat(exists).isTrue(); } @Test @DisplayName("Deve retornar falso quando existir um livro na base com o ISBN informado.") public void returnFalseWhenIsbnExists() { // cenario String isbn = "123"; // execução boolean exists = repository.existsByIsbn(isbn); // verificação assertThat(exists).isFalse(); } @Test @DisplayName("Deve obter um livro por Id.") public void findByIdTest() { // cenário Book book = createNewBook("123"); entityManager.persist(book); // execução Optional<Book> foundBook = repository.findById(book.getId()); // verificação assertThat(foundBook.isPresent()).isTrue(); } @Test @DisplayName("Deve salvar um livro.") public void saveBookTest() { Book book = createNewBook("123"); Book savedBook = repository.save(book); assertThat(savedBook.getId()).isNotNull(); } @Test @DisplayName("Deve excluir um livro.") public void deleteBookTest() { Book book = createNewBook("123"); entityManager.persist(book); Book foundBook = entityManager.find(Book.class, book.getId()); repository.delete(foundBook); Book deletedBook = entityManager.find(Book.class, book.getId()); assertThat(deletedBook).isNull(); } public static Book createNewBook(String isbn) { return Book.builder().author("Author").title("Title").isbn(isbn).build(); } }
5198f3bc491c5e942a2e51ddb14e85325bed5537
31b23283e8f6be897b4dfc79e615acec1c39b234
/src/main/java/com/obd/mapper/pid/PIDInformationMaker.java
e31d18e68aa732e62e4df2ffeea324970fbaaba8
[ "Unlicense" ]
permissive
deshanchathusanka/obd-java-kit
135cbd56373a587a2e6fd4171f771d5e83f41cdd
81d4b85d62f016a2489c86d3a5bfd434d504bb36
refs/heads/master
2022-05-26T13:00:38.186311
2020-03-01T06:26:51
2020-03-01T06:26:51
242,566,718
0
0
Unlicense
2022-05-20T21:28:46
2020-02-23T18:13:49
Java
UTF-8
Java
false
false
9,460
java
package com.obd.mapper.pid; import com.obd.mapper.VehicleDetailsStoreMan; import com.obd.mapper.operation.HexUtils; import org.apache.commons.codec.binary.Hex; /** * Created by Deshan on 10/13/16. */ public class PIDInformationMaker { String[] obdRequirmentArray={ "", "OBD II (California ARB)", "OBD (Federal EPA)", "OBD and OBD II", "OBD I", "Not OBD compliant", "EOBD", "EOBD and OBD II", "EOBD and OBD", "EOBD, OBD and OBD II", "JOBD", "JOBD and OBD II", "JOBD and EOBD", "JOBD, EOBD, and OBD II", "Heavy Duty Vehicles (EURO IV) B1", "Heavy Duty Vehicles (EURO V) B2", "Heavy Duty Vehicles (EURO EEC)", "Engine Manufacturer Diagnostics (EMD)" }; private VehicleDetailsStoreMan vehicleDetailsStoreMan; public PIDInformationMaker(VehicleDetailsStoreMan vehicleDetailsStoreMan){ this.vehicleDetailsStoreMan = vehicleDetailsStoreMan; } public void setPidInformation(String pidStr, String pidDataStr){ char[] pidStrChar = pidStr.toCharArray(); pidStrChar[1] = Character.toLowerCase(pidStrChar[1]); pidStr = String.valueOf(pidStrChar); if ("04".equals(pidStr)) { vehicleDetailsStoreMan.setCalculatedLoadValue_percentage(getCalculatedLoadValue(pidDataStr)); } else if ("05".equals(pidStr)) { vehicleDetailsStoreMan.setEngineCoolentTemperature(getEngineCoolentTemperature(pidDataStr)); } else if ("0a".equals(pidStr)) { vehicleDetailsStoreMan.setFuelRailPressure(getFuelRailPressure(pidDataStr)); } else if ("0b".equals(pidStr)) { vehicleDetailsStoreMan.setIntakeManifoldAbsoluteTemperature(getIntakeManifoldAbsoluteTemperature(pidDataStr)); } else if ("0c".equals(pidStr)) { vehicleDetailsStoreMan.setEngineRPM(getEngineRPM(pidDataStr)); } else if ("0d".equals(pidStr)) { vehicleDetailsStoreMan.setSpeed(getVehicleSpeed(pidDataStr)); } else if ("0f".equals(pidStr)) { vehicleDetailsStoreMan.setIntakeAirTemparature(getIntakeAirTemparature(pidDataStr)); } else if ("10".equals(pidStr)) { vehicleDetailsStoreMan.setMafAirFlowRat(getMAFAirFlowRate(pidDataStr)); } else if ("11".equals(pidStr)) { vehicleDetailsStoreMan.setAbsoluteThrottlePosition(getAbsoluteThrottlePosition(pidDataStr)); } else if ("1c".equals(pidStr)) { vehicleDetailsStoreMan.setObdRequirement(getOBDRequirment(pidDataStr)); } else if ("1f".equals(pidStr)) { vehicleDetailsStoreMan.setTimeSinceEngineStart(getTimeSinceEngineStart(pidDataStr)); } else if ("21".equals(pidStr)) { vehicleDetailsStoreMan.setDistanceTraveledWhileMILisActivated(getDistanceTraveledWhileMILisActivated(pidDataStr)); } else if ("2f".equals(pidStr)) { vehicleDetailsStoreMan.setFuelLevel(getFuelLevelInput(pidDataStr)); } else if ("30".equals(pidStr)) { vehicleDetailsStoreMan.setNoOfWarmUpsSinceDTCsCleared(getNoOfWarmUpsSinceDTCsCleared(pidDataStr)); } else if ("31".equals(pidStr)) { vehicleDetailsStoreMan.setDistanceTraveledSinceDTCsCleared(getDistanceTraveledSinceDTCsCleared(pidDataStr)); } else if ("33".equals(pidStr)) { vehicleDetailsStoreMan.setBarometricPressure(getBarometricPressure(pidDataStr)); } else if ("42".equals(pidStr)) { vehicleDetailsStoreMan.setControlModuleVoltage(getControlModuleVoltage(pidDataStr)); } else if ("43".equals(pidStr)) { vehicleDetailsStoreMan.setAbsoluteLoadValue(getAbsoluteLoadValue(pidDataStr)); } else if ("46".equals(pidStr)) { vehicleDetailsStoreMan.setAmbientAirTemperature(getAmbientAirTemperature(pidDataStr)); } else if ("4c".equals(pidStr)) { vehicleDetailsStoreMan.setCommandedThrottleActuatorControl(getCommandedThrottleActuatorControl(pidDataStr)); } else if ("4d".equals(pidStr)) { vehicleDetailsStoreMan.setEngineRunTimeWhileMILON(getEngineRunTimeWhileMILON(pidDataStr)); } else if ("4e".equals(pidStr)) { vehicleDetailsStoreMan.setEngineRunTimeSinceDTCsCleared(getEngineRunTimeSinceDTCsCleared(pidDataStr)); } else if ("52".equals(pidStr)) { vehicleDetailsStoreMan.setAlcoholFuelPercentage(getAlcoholFuelPercentage(pidDataStr)); } } private String getEngineCoolentTemperature(String pidDataStr) { String engineCoolentTemperature = Integer.toString(Integer.parseInt(pidDataStr,16)); return engineCoolentTemperature; } private String getIntakeManifoldAbsoluteTemperature(String pidDataStr){ String intakeManifoldAbsoluteTemperature = Integer.toString(Integer.parseInt(pidDataStr,16)); return intakeManifoldAbsoluteTemperature; } private String getEngineRPM(String pidDataStr){ String engineRPM = Integer.toString(Integer.parseInt(HexUtils.getReverseOrderedHexString(pidDataStr),16)); return engineRPM; } private String getVehicleSpeed(String pidDataStr){ String speed = Integer.toString(Integer.parseInt(pidDataStr,16)); return speed; } private String getIntakeAirTemparature(String pidDataStr){ String intakeAirTemparature = Integer.toString(Integer.parseInt(pidDataStr,16)); return intakeAirTemparature; } private String getMAFAirFlowRate(String pidDataStr){ String mafAirFlowRate = Double.toString(Integer.parseInt(pidDataStr,16)*0.01); return mafAirFlowRate; } private String getCalculatedLoadValue(String pidDataStr){ String calculatedLoadValue=Integer.toString(Integer.parseInt(pidDataStr,16)); return calculatedLoadValue; } private String getFuelRailPressure(String pidDataStr){ String fuelRailPressure=Integer.toString(Integer.parseInt(HexUtils.getReverseOrderedHexString(pidDataStr),16)); return fuelRailPressure; } private String getAbsoluteThrottlePosition(String pidDataStr){ String absoluteThrottlePosition=Integer.toString(Integer.parseInt(pidDataStr,16)); return absoluteThrottlePosition; } private String getOBDRequirment(String pidDataStr){ String obdRequirment=obdRequirmentArray[Integer.parseInt(pidDataStr,16)]; return obdRequirment; } private String getTimeSinceEngineStart(String pidDataStr){ String timeSinceEngineStart=Integer.toString(Integer.parseInt(HexUtils.getReverseOrderedHexString(pidDataStr),16)); return timeSinceEngineStart; } private String getDistanceTraveledWhileMILisActivated(String pidDataStr){ String distanceTraveledWhileMILisActivated=Integer.toString(Integer.parseInt(HexUtils.getReverseOrderedHexString(pidDataStr),16)); return distanceTraveledWhileMILisActivated; } private String getFuelLevelInput(String pidDataStr){ String fuelLevelInput=Integer.toString(Integer.parseInt(pidDataStr,16)); return fuelLevelInput; } private String getNoOfWarmUpsSinceDTCsCleared(String pidDataStr){ String noOfWarmUpsSinceDTCsCleared=Integer.toString(Integer.parseInt(pidDataStr,16)); return noOfWarmUpsSinceDTCsCleared; } private String getDistanceTraveledSinceDTCsCleared(String pidDataStr){ String distanceTraveledSinceDTCsCleared=Integer.toString(Integer.parseInt(HexUtils.getReverseOrderedHexString(pidDataStr),16)); return distanceTraveledSinceDTCsCleared; } private String getBarometricPressure(String pidDataStr){ String barometricPressure=Integer.toString(Integer.parseInt(pidDataStr,16)); return barometricPressure; } private String getControlModuleVoltage(String pidDataStr){ String controlModuleVoltage=Double.toString(Integer.parseInt(HexUtils.getReverseOrderedHexString(pidDataStr),16)/1000.0); return controlModuleVoltage; } private String getAbsoluteLoadValue(String pidDataStr){ String absoluteLoadValue=Integer.toString(Integer.parseInt(pidDataStr,16)); return absoluteLoadValue; } private String getAmbientAirTemperature(String pidDataStr){ String ambientAirTemperature=Integer.toString(Integer.parseInt(pidDataStr,16)); return ambientAirTemperature; } private String getCommandedThrottleActuatorControl(String pidDataStr){ String commandedThrottleActuatorControl=Integer.toString(Integer.parseInt(pidDataStr,16)); return commandedThrottleActuatorControl; } private String getEngineRunTimeWhileMILON(String pidDataStr){ String engineRunTimeWhileMILOn=Integer.toString(Integer.parseInt(HexUtils.getReverseOrderedHexString(pidDataStr),16)); return engineRunTimeWhileMILOn; } private String getEngineRunTimeSinceDTCsCleared(String pidDataStr){ String engineRunTimeSinceDTCsCleared=Integer.toString(Integer.parseInt(HexUtils.getReverseOrderedHexString(pidDataStr),16)); return engineRunTimeSinceDTCsCleared; } private String getAlcoholFuelPercentage(String pidDataStr){ String alcoholFuelPercentage=Integer.toString(Integer.parseInt(pidDataStr,16)); return alcoholFuelPercentage; } }
d842ee8a24379c55fb7009732f444eca6a2fe989
6b544d1fb7640e1f81916ba2f8f9083f9b77ced5
/KitapOneriUzmanSistem_1_1/src/kitaponeriuzmansistem/KitapOneriUzmanSistem.java
a6658263ef452e4c06c2678c1d988a30e5f5e5ab
[]
no_license
muhendisaysee/kitap-oneri-uzman-sistem
551f3019f4c8be0ca05d65998a05d4ffe982f009
337efe08146680d57c8aceea91f135c9bb133638
refs/heads/master
2021-03-26T17:33:54.943706
2020-03-16T14:48:25
2020-03-16T14:48:25
247,726,462
2
0
null
null
null
null
UTF-8
Java
false
false
949
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 kitaponeriuzmansistem; import javafx.application.Application; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.stage.Stage; /** * * @author ayse */ public class KitapOneriUzmanSistem extends Application { //Program başladığında FXMLDocument.fxml arayüzüne yönlendiren function @Override public void start(Stage stage) throws Exception { Parent root = FXMLLoader.load(getClass().getResource("FXMLDocument.fxml")); Scene scene = new Scene(root); stage.setScene(scene); stage.show(); } /** * @param args the command line arguments */ public static void main(String[] args) { launch(args); } }
2ec50bf8350840b39d47e66b549e57272103a60b
6baa09045c69b0231c35c22b06cdf69a8ce227d6
/modules/adwords_appengine/src/main/java/com/google/api/ads/adwords/jaxws/v201603/cm/AdCustomizerFeedServiceInterfaceget.java
b1c9212cdf0f2708cf551c741fe13f6f2dbea6d2
[ "Apache-2.0" ]
permissive
remotejob/googleads-java-lib
f603b47117522104f7df2a72d2c96ae8c1ea011d
a330df0799de8d8de0dcdddf4c317d6b0cd2fe10
refs/heads/master
2020-12-11T01:36:29.506854
2016-07-28T22:13:24
2016-07-28T22:13:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,920
java
package com.google.api.ads.adwords.jaxws.v201603.cm; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; /** * * Returns a list of AdCustomizerFeeds that meet the selector criteria. * * @param selector Determines which AdCustomizerFeeds to return. If empty, all AdCustomizerFeeds * are returned. * @return The list of AdCustomizerFeeds. * @throws ApiException Indicates a problem with the request. * * * <p>Java class for get element declaration. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;element name="get"> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="selector" type="{https://adwords.google.com/api/adwords/cm/v201603}Selector" minOccurs="0"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * &lt;/element> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "selector" }) @XmlRootElement(name = "get") public class AdCustomizerFeedServiceInterfaceget { protected Selector selector; /** * Gets the value of the selector property. * * @return * possible object is * {@link Selector } * */ public Selector getSelector() { return selector; } /** * Sets the value of the selector property. * * @param value * allowed object is * {@link Selector } * */ public void setSelector(Selector value) { this.selector = value; } }
a9d47502c9819fd412b40fbd416f65d755800d61
27e5eb73bafde21167cd66b61a91ff27e39c639b
/src/main/java/org/fergonco/music/mjargon/model/SongLine.java
f7aed1d9379c29ae7c1a028952b27469ce53fe41
[]
no_license
fergonco/MusicJargon
1ef1a2010dd89004a135dcf6db7d402ade4b79a0
c5de7d5e5ba078570c58bb7108b49e32cff0f3b5
refs/heads/master
2021-01-20T11:47:51.983436
2019-04-14T20:15:47
2019-04-14T20:15:47
101,690,324
1
0
null
null
null
null
UTF-8
Java
false
false
365
java
package org.fergonco.music.mjargon.model; import org.fergonco.music.midi.Dynamic; public interface SongLine { boolean isBarline(); Bar[] getBars(); boolean isTempo(); double getTempo(); boolean isRepeat(); int getTarget(); boolean isDynamics(); Dynamic[] getDynamics(); void validate(Model model, int songlineIndex) throws SemanticException; }
8d1f07fc9519c26056369da183123830ee7b0f56
a7bd32eac5b9923256ab273a4d1be5bc1871ab97
/ATM livro java como programar deitel/src/Transaction.java
85a799d804e6e520729f9b6051ed94d53f9a7cf6
[]
no_license
rogertecnic/workspace-java
e17f0ac604fb7a48b48e2652d2781113922ccef1
d626d62f082fbf3683f9cab29dcab50e42e1ed8f
refs/heads/master
2020-07-02T14:27:38.262840
2017-05-06T01:07:14
2017-05-06T01:07:14
74,300,014
0
0
null
null
null
null
UTF-8
Java
false
false
2,246
java
// Transaction.java // Abstract superclass Transaction represents an ATM transaction public abstract class Transaction { private int accountNumber; // indicates account involved private Screen screen; // ATM's screen private BankDatabase bankDatabase; // account info database // Transaction constructor invoked by subclasses using super() public Transaction( int userAccountNumber, Screen atmScreen, BankDatabase atmBankDatabase ) { accountNumber = userAccountNumber; screen = atmScreen; bankDatabase = atmBankDatabase; } // end Transaction constructor // return account number public int getAccountNumber() { return accountNumber; } // end method getAccountNumber // return reference to screen public Screen getScreen() { return screen; } // end method getScreen // return reference to bank database public BankDatabase getBankDatabase() { return bankDatabase; } // end method getBankDatabase // perform the transaction (overridden by each subclass) abstract public void execute(); } // end class Transaction /************************************************************************** * (C) Copyright 1992-2005 by Deitel & Associates, Inc. and * * Pearson Education, Inc. All Rights Reserved. * * * * DISCLAIMER: The authors and publisher of this book have used their * * best efforts in preparing the book. These efforts include the * * development, research, and testing of the theories and programs * * to determine their effectiveness. The authors and publisher make * * no warranty of any kind, expressed or implied, with regard to these * * programs or to the documentation contained in these books. The authors * * and publisher shall not be liable in any event for incidental or * * consequential damages in connection with, or arising out of, the * * furnishing, performance, or use of these programs. * *************************************************************************/
b79c630ce8c52522a282b1e43e8e434bbe49e970
1cbefa0d6358368cd40c130eabb4ab7120822c63
/app/src/androidTest/java/com/smasite/mimascota/ExampleInstrumentedTest.java
79b9a22c37f99b243064730421a75ce2e393094f
[]
no_license
JuanAraiza/MiMascota130517
273c506750e67330adc24289a3894f69ec8945d2
f58505d579bdcf991823c7a62465703c44e7a0cd
refs/heads/master
2020-12-30T15:54:34.149009
2017-05-13T15:22:24
2017-05-13T15:22:24
91,183,447
0
0
null
null
null
null
UTF-8
Java
false
false
746
java
package com.smasite.mimascota; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumentation test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() throws Exception { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.smasite.mimascota", appContext.getPackageName()); } }
7b5410e4c114715ee964d1effead688df473ec1c
5887acadd7a0f2e042c39338e41e3eb962398b16
/Discrete Mathematics/Lab05_Automata/A_WordAcceptDka.java
5d84c75b9d8867f1102a8acd8bf10bd9f58a6200
[]
no_license
andrey-star/itmo-labs
bd23560c2873245cfde96b9b5d49766036850740
79bb67dc2a4134355dec9fa8ce5f82840fc72a99
refs/heads/master
2023-01-06T12:11:26.824877
2022-12-28T20:08:46
2022-12-28T20:08:46
218,313,068
6
1
null
null
null
null
UTF-8
Java
false
false
1,428
java
import java.io.*; import java.util.Arrays; public class A_WordAcceptDka { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream("problem1.in"))); String s = in.readLine(); String[] line = in.readLine().trim().split(" +"); int n = Integer.parseInt(line[0]); int m = Integer.parseInt(line[1]); int k = Integer.parseInt(line[2]); int[][] g = new int[n]['z' - 'a' + 1]; for (int[] ints : g) { Arrays.fill(ints, -1); } int[] term = new int[k]; line = in.readLine().trim().split(" +"); for (int i = 0; i < k; i++) { term[i] = Integer.parseInt(line[i]) - 1; } for (int i = 0; i < m; i++) { line = in.readLine().trim().split(" +"); int a = Integer.parseInt(line[0]) - 1; int b = Integer.parseInt(line[1]) - 1; char c = line[2].charAt(0); g[a][c - 'a'] = b; } int cur = 0; boolean ok = true; for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); if (g[cur][c - 'a'] == -1) { ok = false; break; } cur = g[cur][c - 'a']; } PrintWriter out = new PrintWriter(new File("problem1.out")); if (!ok) { out.println("Rejects"); } else { ok = false; for (int i = 0; i < k; i++) { if (term[i] == cur) { ok = true; break; } } if (ok) { out.println("Accepts"); } else { out.println("Rejects"); } } out.close(); } }
ef9f5dce3bb64710005b491a61755e6165d444f5
814169b683b88f1b7498f1edf530a8d1bec2971f
/mall-search/src/main/java/com/bootx/mall/config/ElasticSearchConfig.java
3352bddef2a99219af39d31d557d5bf2b42c034b
[]
no_license
springwindyike/mall-auth
fe7f216c7241d8fd9247344e40503f7bc79fe494
3995d258955ecc3efbccbb22ef4204d148ec3206
refs/heads/master
2022-10-20T15:12:19.329363
2020-07-05T13:04:29
2020-07-05T13:04:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
833
java
package com.bootx.mall.config; import org.apache.http.HttpHost; import org.elasticsearch.client.RequestOptions; import org.elasticsearch.client.RestClient; import org.elasticsearch.client.RestHighLevelClient; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @Configuration public class ElasticSearchConfig { public static final RequestOptions COMMON_OPTIONS; static { RequestOptions.Builder builder = RequestOptions.DEFAULT.toBuilder(); COMMON_OPTIONS = builder.build(); } @Bean public RestHighLevelClient restHighLevelClient(){ RestHighLevelClient client = new RestHighLevelClient( RestClient.builder( new HttpHost("localhost", 9200, "http"))); return client; } }
[ "a12345678" ]
a12345678
8297f115791bec08dee79fd792e4688359a9e649
c885ef92397be9d54b87741f01557f61d3f794f3
/results/Gson-16/com.google.gson.internal.$Gson$Types/BBC-F0-opt-70/tests/27/com/google/gson/internal/$Gson$Types_ESTest.java
73b81795572fde6821b337b02ebac12898581ef6
[ "CC-BY-4.0", "MIT" ]
permissive
pderakhshanfar/EMSE-BBC-experiment
f60ac5f7664dd9a85f755a00a57ec12c7551e8c6
fea1a92c2e7ba7080b8529e2052259c9b697bbda
refs/heads/main
2022-11-25T00:39:58.983828
2022-04-12T16:04:26
2022-04-12T16:04:26
309,335,889
0
1
null
2021-11-05T11:18:43
2020-11-02T10:30:38
null
UTF-8
Java
false
false
637
java
/* * This file was automatically generated by EvoSuite * Sat Oct 23 04:58:28 GMT 2021 */ package com.google.gson.internal; import org.junit.Test; import static org.junit.Assert.*; import org.evosuite.runtime.EvoRunner; import org.evosuite.runtime.EvoRunnerParameters; import org.junit.runner.RunWith; @RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true) public class $Gson$Types_ESTest extends $Gson$Types_ESTest_scaffolding { @Test public void notGeneratedAnyTest() { // EvoSuite did not generate any tests } }
17afc8a5b44523a307caf2feeaa45af0bd9c5072
19e6ca9b34a063985f417ecf02e60a08fa56d50d
/service-azure/src/main/java/com/example/demo-azure-spring-cloud/SourceExample.java
7eef2c10f2365ccac7d6da4616331e23e947a35a
[]
no_license
fabianorosa1/demo-azure-spring-cloud
5bafe27f1985512a3bbbfa5e1f4f5b2891476a0c
2461c18b4150f6e2c15985f45c121027c9b7f044
refs/heads/master
2020-04-06T18:19:58.423106
2018-11-15T10:36:17
2018-11-15T10:36:17
157,694,313
0
0
null
null
null
null
UTF-8
Java
false
false
879
java
package com.example.demo-azure-spring-cloud; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cloud.stream.annotation.EnableBinding; import org.springframework.cloud.stream.messaging.Source; import org.springframework.messaging.support.GenericMessage; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RequestMapping; @RestController @RequestMapping("/eventhub") @EnableBinding(Source.class) public class SourceExample { @Autowired private Source source; @PostMapping("/messages") public String postMessage(@RequestParam String message) { this.source.output().send(new GenericMessage<>(message)); return message; } }
67dbc5cf3b61f9f66e309c0394f30deb9f576748
13dd186b1a87191c91e6f16375e9fa60962e2037
/server/sundeinfo.core/src/main/java/com/sundeinfo/core/token/Token.java
5f3be98df4cf680bfb5730f35609dece96d1dd4a
[]
no_license
libiao1205/WenXin
b019233e0eca4be5643491a85a085ea5fa3a09e5
ed7dc18f10a69bb04cb4eebf0a2211c018fb5f6f
refs/heads/master
2022-11-30T12:42:06.616151
2020-08-18T10:36:28
2020-08-18T10:36:28
286,409,937
0
1
null
null
null
null
UTF-8
Java
false
false
307
java
package com.sundeinfo.core.token; import org.springframework.web.bind.annotation.Mapping; import java.lang.annotation.*; @Target({ElementType.METHOD,ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) @Documented @Mapping public @interface Token { TokenType[] types() default {TokenType.ALL}; }
0ed76af0db04d587dd937b3151829b6c73fc5743
685e3097d073a5a948e26f15936897a126cfabdd
/FindAnagramMappings/Solution.java
0d0921cc1da4d7f00213f98c456e6429146824d7
[]
no_license
flyPisces/LeetCodeSolution
2ae0b48c149bb1eb20c180647feaabd392120e4e
e4399fc8791491082934b634a60caa2a1e350fbd
refs/heads/master
2021-01-10T22:36:23.241283
2020-08-22T07:01:38
2020-08-22T07:01:38
69,706,033
1
0
null
null
null
null
UTF-8
Java
false
false
1,056
java
package FindAnagramMappings; import java.util.*; /** * Given two lists Aand B, and B is an anagram of A. B is an anagram of A means B is made by * randomizing the order of the elements in A. We want to find an index mapping P, from A to B. A mapping P[i] = j means the ith element in A appears in B at index j. These lists A and B may contain duplicates. If there are multiple answers, output any of them. For example, given A = [12, 28, 46, 32, 50] B = [50, 12, 32, 46, 28] We should return [1, 4, 3, 2, 0] as P[0] = 1 because the 0th element of A appears at B[1], and P[1] = 4 because the 1st element of A appears at B[4], and so on. */ public class Solution { public int[] anagramMappings(int[] A, int[] B) { Map<Integer, Integer> mapping = new HashMap<>(); for (int i = 0;i < B.length;++ i) { mapping.put(B[i], i); } int[] results = new int[A.length]; for (int i = 0;i < A.length;++ i) { results[i] = mapping.get(A[i]); } return results; } }
[ "!Pat381mort686" ]
!Pat381mort686
ae80460a1f5a3a5abda8976a2413a425365271e7
fc459675a329244b920bdc37375f72286c0f3d2e
/src/main/java/com/merlin/merlinsblog/po/Type.java
dba4208486bdfeb2f6bc5399313729aabd331734
[ "MIT" ]
permissive
DustMerlin/MerlinsBlog
2a6f8fa8194b9400493086b718af3df86ca17f81
48437c1dbc723b4ef1eb0b4d369feba1ed377cc0
refs/heads/master
2023-02-12T09:39:15.858972
2021-01-08T09:13:03
2021-01-08T09:13:03
295,615,783
1
0
null
2020-09-23T08:27:34
2020-09-15T04:38:30
Java
UTF-8
Java
false
false
2,107
java
package com.merlin.merlinsblog.po; import javax.persistence.*; import javax.validation.constraints.NotBlank; import java.util.ArrayList; import java.util.List; //import org.hibernate.validator.constraints.NotBlank; //此处的校验功能已废弃,需要使用以下依赖才能完成相应的功能 //import javax.validation.constraints.NotBlank; 使用这种写法 //博客地址 caorui.net/blog/111848631920754688.html //经常查找文档发现,validation-api 只是一套标准, //而具体是实现是依赖 hibernate-validator 库,所以在引用 validation-api 库的前提下, //还要引用 hibernate-validator 库才能正常使用,具体的 pom 信息如下 //<dependency> //<groupId>javax.validation</groupId> //<artifactId>validation-api</artifactId> //<version>2.0.1.Final</version> //</dependency> //<dependency> //<groupId>org.hibernate</groupId> //<artifactId>hibernate-validator</artifactId> //<version>6.0.13.Final</version> //</dependency> @Entity @Table(name="type") public class Type { @Id @GeneratedValue private Long id; @NotBlank(message = "分类名不能为空") private String name; // 此处一(类型)对多(博客),在一端使用mappedBy = "type",type被维护,blog 维护 @OneToMany(mappedBy = "type") private List<Blog> blogs = new ArrayList<>(); public Type() { } public Type(Long id, String name, List<Blog> blogs) { this.id = id; this.name = name; this.blogs = blogs; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public List<Blog> getBlogs() { return blogs; } public void setBlogs(List<Blog> blogs) { this.blogs = blogs; } @Override public String toString() { return "Type{" + "id=" + id + ", name='" + name + '\'' + ", blogs=" + blogs + '}'; } }
47ac1f768e15dda8bf12fef69d6b71b8115362fc
2ea623cad50e022623f4189ad638abae49e205ee
/clients/1.28.0/google-api-services-servicebroker/v1alpha1/com/google/api/services/servicebroker/v1alpha1/ServiceBroker.java
2c30073b23039ced1ac73eae6bc5ce80cee9046a
[ "Apache-2.0" ]
permissive
andrey-qlogic/google-api-java-client-services
88f5f9bbecd422f9ed133c59a982f5b4189589c8
dbdb7736dafa70c9af5f19ebda02d51aed4892b1
refs/heads/master
2020-04-22T17:10:45.164078
2019-02-13T15:14:15
2019-02-13T15:14:15
170,531,797
1
0
null
2019-02-13T15:32:53
2019-02-13T15:32:53
null
UTF-8
Java
false
false
151,499
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. */ /* * This code was generated by https://github.com/googleapis/google-api-java-client-services/ * Modify at your own risk. */ package com.google.api.services.servicebroker.v1alpha1; /** * Service definition for ServiceBroker (v1alpha1). * * <p> * The Google Cloud Platform Service Broker API provides Google hosted implementation of the Open Service Broker API (https://www.openservicebrokerapi.org/). * </p> * * <p> * For more information about this service, see the * <a href="https://cloud.google.com/kubernetes-engine/docs/concepts/add-on/service-broker" target="_blank">API Documentation</a> * </p> * * <p> * This service uses {@link ServiceBrokerRequestInitializer} to initialize global parameters via its * {@link Builder}. * </p> * * @since 1.3 * @author Google, Inc. */ @SuppressWarnings("javadoc") public class ServiceBroker extends com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient { // Note: Leave this static initializer at the top of the file. static { com.google.api.client.util.Preconditions.checkState( com.google.api.client.googleapis.GoogleUtils.MAJOR_VERSION == 1 && com.google.api.client.googleapis.GoogleUtils.MINOR_VERSION >= 15, "You are currently running with version %s of google-api-client. " + "You need at least version 1.15 of google-api-client to run version " + "1.28.0 of the Service Broker API library.", com.google.api.client.googleapis.GoogleUtils.VERSION); } /** * The default encoded root URL of the service. This is determined when the library is generated * and normally should not be changed. * * @since 1.7 */ public static final String DEFAULT_ROOT_URL = "https://servicebroker.googleapis.com/"; /** * The default encoded service path of the service. This is determined when the library is * generated and normally should not be changed. * * @since 1.7 */ public static final String DEFAULT_SERVICE_PATH = ""; /** * The default encoded batch path of the service. This is determined when the library is * generated and normally should not be changed. * * @since 1.23 */ public static final String DEFAULT_BATCH_PATH = "batch"; /** * The default encoded base URL of the service. This is determined when the library is generated * and normally should not be changed. */ public static final String DEFAULT_BASE_URL = DEFAULT_ROOT_URL + DEFAULT_SERVICE_PATH; /** * Constructor. * * <p> * Use {@link Builder} if you need to specify any of the optional parameters. * </p> * * @param transport HTTP transport, which should normally be: * <ul> * <li>Google App Engine: * {@code com.google.api.client.extensions.appengine.http.UrlFetchTransport}</li> * <li>Android: {@code newCompatibleTransport} from * {@code com.google.api.client.extensions.android.http.AndroidHttp}</li> * <li>Java: {@link com.google.api.client.googleapis.javanet.GoogleNetHttpTransport#newTrustedTransport()} * </li> * </ul> * @param jsonFactory JSON factory, which may be: * <ul> * <li>Jackson: {@code com.google.api.client.json.jackson2.JacksonFactory}</li> * <li>Google GSON: {@code com.google.api.client.json.gson.GsonFactory}</li> * <li>Android Honeycomb or higher: * {@code com.google.api.client.extensions.android.json.AndroidJsonFactory}</li> * </ul> * @param httpRequestInitializer HTTP request initializer or {@code null} for none * @since 1.7 */ public ServiceBroker(com.google.api.client.http.HttpTransport transport, com.google.api.client.json.JsonFactory jsonFactory, com.google.api.client.http.HttpRequestInitializer httpRequestInitializer) { this(new Builder(transport, jsonFactory, httpRequestInitializer)); } /** * @param builder builder */ ServiceBroker(Builder builder) { super(builder); } @Override protected void initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest<?> httpClientRequest) throws java.io.IOException { super.initialize(httpClientRequest); } /** * An accessor for creating requests from the Projects collection. * * <p>The typical use is:</p> * <pre> * {@code ServiceBroker servicebroker = new ServiceBroker(...);} * {@code ServiceBroker.Projects.List request = servicebroker.projects().list(parameters ...)} * </pre> * * @return the resource collection */ public Projects projects() { return new Projects(); } /** * The "projects" collection of methods. */ public class Projects { /** * An accessor for creating requests from the Brokers collection. * * <p>The typical use is:</p> * <pre> * {@code ServiceBroker servicebroker = new ServiceBroker(...);} * {@code ServiceBroker.Brokers.List request = servicebroker.brokers().list(parameters ...)} * </pre> * * @return the resource collection */ public Brokers brokers() { return new Brokers(); } /** * The "brokers" collection of methods. */ public class Brokers { /** * An accessor for creating requests from the Instances collection. * * <p>The typical use is:</p> * <pre> * {@code ServiceBroker servicebroker = new ServiceBroker(...);} * {@code ServiceBroker.Instances.List request = servicebroker.instances().list(parameters ...)} * </pre> * * @return the resource collection */ public Instances instances() { return new Instances(); } /** * The "instances" collection of methods. */ public class Instances { /** * Gets the given service instance from the system. This API is an extension and not part of the OSB * spec. Hence the path is a standard Google API URL. * * Create a request for the method "instances.get". * * This request holds the parameters needed by the servicebroker server. After setting any optional * parameters, call the {@link Get#execute()} method to invoke the remote operation. * * @param name The resource name of the instance to return. * @return the request */ public Get get(java.lang.String name) throws java.io.IOException { Get result = new Get(name); initialize(result); return result; } public class Get extends ServiceBrokerRequest<com.google.api.services.servicebroker.v1alpha1.model.GoogleCloudServicebrokerV1alpha1ServiceInstance> { private static final String REST_PATH = "v1alpha1/{+name}"; private final java.util.regex.Pattern NAME_PATTERN = java.util.regex.Pattern.compile("^projects/[^/]+/brokers/[^/]+/instances/[^/]+$"); /** * Gets the given service instance from the system. This API is an extension and not part of the * OSB spec. Hence the path is a standard Google API URL. * * Create a request for the method "instances.get". * * This request holds the parameters needed by the the servicebroker server. After setting any * optional parameters, call the {@link Get#execute()} method to invoke the remote operation. <p> * {@link Get#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} * must be called to initialize this instance immediately after invoking the constructor. </p> * * @param name The resource name of the instance to return. * @since 1.13 */ protected Get(java.lang.String name) { super(ServiceBroker.this, "GET", REST_PATH, null, com.google.api.services.servicebroker.v1alpha1.model.GoogleCloudServicebrokerV1alpha1ServiceInstance.class); this.name = com.google.api.client.util.Preconditions.checkNotNull(name, "Required parameter name must be specified."); if (!getSuppressPatternChecks()) { com.google.api.client.util.Preconditions.checkArgument(NAME_PATTERN.matcher(name).matches(), "Parameter name must conform to the pattern " + "^projects/[^/]+/brokers/[^/]+/instances/[^/]+$"); } } @Override public com.google.api.client.http.HttpResponse executeUsingHead() throws java.io.IOException { return super.executeUsingHead(); } @Override public com.google.api.client.http.HttpRequest buildHttpRequestUsingHead() throws java.io.IOException { return super.buildHttpRequestUsingHead(); } @Override public Get set$Xgafv(java.lang.String $Xgafv) { return (Get) super.set$Xgafv($Xgafv); } @Override public Get setAccessToken(java.lang.String accessToken) { return (Get) super.setAccessToken(accessToken); } @Override public Get setAlt(java.lang.String alt) { return (Get) super.setAlt(alt); } @Override public Get setCallback(java.lang.String callback) { return (Get) super.setCallback(callback); } @Override public Get setFields(java.lang.String fields) { return (Get) super.setFields(fields); } @Override public Get setKey(java.lang.String key) { return (Get) super.setKey(key); } @Override public Get setOauthToken(java.lang.String oauthToken) { return (Get) super.setOauthToken(oauthToken); } @Override public Get setPrettyPrint(java.lang.Boolean prettyPrint) { return (Get) super.setPrettyPrint(prettyPrint); } @Override public Get setQuotaUser(java.lang.String quotaUser) { return (Get) super.setQuotaUser(quotaUser); } @Override public Get setUploadType(java.lang.String uploadType) { return (Get) super.setUploadType(uploadType); } @Override public Get setUploadProtocol(java.lang.String uploadProtocol) { return (Get) super.setUploadProtocol(uploadProtocol); } /** The resource name of the instance to return. */ @com.google.api.client.util.Key private java.lang.String name; /** The resource name of the instance to return. */ public java.lang.String getName() { return name; } /** The resource name of the instance to return. */ public Get setName(java.lang.String name) { if (!getSuppressPatternChecks()) { com.google.api.client.util.Preconditions.checkArgument(NAME_PATTERN.matcher(name).matches(), "Parameter name must conform to the pattern " + "^projects/[^/]+/brokers/[^/]+/instances/[^/]+$"); } this.name = name; return this; } @Override public Get set(String parameterName, Object value) { return (Get) super.set(parameterName, value); } } /** * An accessor for creating requests from the ServiceBindings collection. * * <p>The typical use is:</p> * <pre> * {@code ServiceBroker servicebroker = new ServiceBroker(...);} * {@code ServiceBroker.ServiceBindings.List request = servicebroker.serviceBindings().list(parameters ...)} * </pre> * * @return the resource collection */ public ServiceBindings serviceBindings() { return new ServiceBindings(); } /** * The "service_bindings" collection of methods. */ public class ServiceBindings { /** * Lists all the bindings in the instance * * Create a request for the method "service_bindings.list". * * This request holds the parameters needed by the servicebroker server. After setting any optional * parameters, call the {@link List#execute()} method to invoke the remote operation. * * @param parent Parent must match `projects/[PROJECT_ID]/brokers/[BROKER_ID]/instances/[INSTANCE_ID]`. * @return the request */ public List list(java.lang.String parent) throws java.io.IOException { List result = new List(parent); initialize(result); return result; } public class List extends ServiceBrokerRequest<com.google.api.services.servicebroker.v1alpha1.model.GoogleCloudServicebrokerV1alpha1ListBindingsResponse> { private static final String REST_PATH = "v1alpha1/{+parent}/service_bindings"; private final java.util.regex.Pattern PARENT_PATTERN = java.util.regex.Pattern.compile("^projects/[^/]+/brokers/[^/]+/instances/[^/]+$"); /** * Lists all the bindings in the instance * * Create a request for the method "service_bindings.list". * * This request holds the parameters needed by the the servicebroker server. After setting any * optional parameters, call the {@link List#execute()} method to invoke the remote operation. <p> * {@link List#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} * must be called to initialize this instance immediately after invoking the constructor. </p> * * @param parent Parent must match `projects/[PROJECT_ID]/brokers/[BROKER_ID]/instances/[INSTANCE_ID]`. * @since 1.13 */ protected List(java.lang.String parent) { super(ServiceBroker.this, "GET", REST_PATH, null, com.google.api.services.servicebroker.v1alpha1.model.GoogleCloudServicebrokerV1alpha1ListBindingsResponse.class); this.parent = com.google.api.client.util.Preconditions.checkNotNull(parent, "Required parameter parent must be specified."); if (!getSuppressPatternChecks()) { com.google.api.client.util.Preconditions.checkArgument(PARENT_PATTERN.matcher(parent).matches(), "Parameter parent must conform to the pattern " + "^projects/[^/]+/brokers/[^/]+/instances/[^/]+$"); } } @Override public com.google.api.client.http.HttpResponse executeUsingHead() throws java.io.IOException { return super.executeUsingHead(); } @Override public com.google.api.client.http.HttpRequest buildHttpRequestUsingHead() throws java.io.IOException { return super.buildHttpRequestUsingHead(); } @Override public List set$Xgafv(java.lang.String $Xgafv) { return (List) super.set$Xgafv($Xgafv); } @Override public List setAccessToken(java.lang.String accessToken) { return (List) super.setAccessToken(accessToken); } @Override public List setAlt(java.lang.String alt) { return (List) super.setAlt(alt); } @Override public List setCallback(java.lang.String callback) { return (List) super.setCallback(callback); } @Override public List setFields(java.lang.String fields) { return (List) super.setFields(fields); } @Override public List setKey(java.lang.String key) { return (List) super.setKey(key); } @Override public List setOauthToken(java.lang.String oauthToken) { return (List) super.setOauthToken(oauthToken); } @Override public List setPrettyPrint(java.lang.Boolean prettyPrint) { return (List) super.setPrettyPrint(prettyPrint); } @Override public List setQuotaUser(java.lang.String quotaUser) { return (List) super.setQuotaUser(quotaUser); } @Override public List setUploadType(java.lang.String uploadType) { return (List) super.setUploadType(uploadType); } @Override public List setUploadProtocol(java.lang.String uploadProtocol) { return (List) super.setUploadProtocol(uploadProtocol); } /** * Parent must match * `projects/[PROJECT_ID]/brokers/[BROKER_ID]/instances/[INSTANCE_ID]`. */ @com.google.api.client.util.Key private java.lang.String parent; /** Parent must match `projects/[PROJECT_ID]/brokers/[BROKER_ID]/instances/[INSTANCE_ID]`. */ public java.lang.String getParent() { return parent; } /** * Parent must match * `projects/[PROJECT_ID]/brokers/[BROKER_ID]/instances/[INSTANCE_ID]`. */ public List setParent(java.lang.String parent) { if (!getSuppressPatternChecks()) { com.google.api.client.util.Preconditions.checkArgument(PARENT_PATTERN.matcher(parent).matches(), "Parameter parent must conform to the pattern " + "^projects/[^/]+/brokers/[^/]+/instances/[^/]+$"); } this.parent = parent; return this; } /** * Specifies the number of results to return per page. If there are fewer elements than * the specified number, returns all elements. Optional. If unset or 0, all the results * will be returned. */ @com.google.api.client.util.Key private java.lang.Integer pageSize; /** Specifies the number of results to return per page. If there are fewer elements than the specified number, returns all elements. Optional. If unset or 0, all the results will be returned. */ public java.lang.Integer getPageSize() { return pageSize; } /** * Specifies the number of results to return per page. If there are fewer elements than * the specified number, returns all elements. Optional. If unset or 0, all the results * will be returned. */ public List setPageSize(java.lang.Integer pageSize) { this.pageSize = pageSize; return this; } /** * Specifies a page token to use. Set `pageToken` to a `nextPageToken` returned by a * previous list request to get the next page of results. */ @com.google.api.client.util.Key private java.lang.String pageToken; /** Specifies a page token to use. Set `pageToken` to a `nextPageToken` returned by a previous list request to get the next page of results. */ public java.lang.String getPageToken() { return pageToken; } /** * Specifies a page token to use. Set `pageToken` to a `nextPageToken` returned by a * previous list request to get the next page of results. */ public List setPageToken(java.lang.String pageToken) { this.pageToken = pageToken; return this; } @Override public List set(String parameterName, Object value) { return (List) super.set(parameterName, value); } } } } /** * An accessor for creating requests from the ServiceInstances collection. * * <p>The typical use is:</p> * <pre> * {@code ServiceBroker servicebroker = new ServiceBroker(...);} * {@code ServiceBroker.ServiceInstances.List request = servicebroker.serviceInstances().list(parameters ...)} * </pre> * * @return the resource collection */ public ServiceInstances serviceInstances() { return new ServiceInstances(); } /** * The "service_instances" collection of methods. */ public class ServiceInstances { /** * Lists all the instances in the brokers This API is an extension and not part of the OSB spec. * Hence the path is a standard Google API URL. * * Create a request for the method "service_instances.list". * * This request holds the parameters needed by the servicebroker server. After setting any optional * parameters, call the {@link List#execute()} method to invoke the remote operation. * * @param parent Parent must match `projects/[PROJECT_ID]/brokers/[BROKER_ID]`. * @return the request */ public List list(java.lang.String parent) throws java.io.IOException { List result = new List(parent); initialize(result); return result; } public class List extends ServiceBrokerRequest<com.google.api.services.servicebroker.v1alpha1.model.GoogleCloudServicebrokerV1alpha1ListServiceInstancesResponse> { private static final String REST_PATH = "v1alpha1/{+parent}/service_instances"; private final java.util.regex.Pattern PARENT_PATTERN = java.util.regex.Pattern.compile("^projects/[^/]+/brokers/[^/]+$"); /** * Lists all the instances in the brokers This API is an extension and not part of the OSB spec. * Hence the path is a standard Google API URL. * * Create a request for the method "service_instances.list". * * This request holds the parameters needed by the the servicebroker server. After setting any * optional parameters, call the {@link List#execute()} method to invoke the remote operation. <p> * {@link List#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} * must be called to initialize this instance immediately after invoking the constructor. </p> * * @param parent Parent must match `projects/[PROJECT_ID]/brokers/[BROKER_ID]`. * @since 1.13 */ protected List(java.lang.String parent) { super(ServiceBroker.this, "GET", REST_PATH, null, com.google.api.services.servicebroker.v1alpha1.model.GoogleCloudServicebrokerV1alpha1ListServiceInstancesResponse.class); this.parent = com.google.api.client.util.Preconditions.checkNotNull(parent, "Required parameter parent must be specified."); if (!getSuppressPatternChecks()) { com.google.api.client.util.Preconditions.checkArgument(PARENT_PATTERN.matcher(parent).matches(), "Parameter parent must conform to the pattern " + "^projects/[^/]+/brokers/[^/]+$"); } } @Override public com.google.api.client.http.HttpResponse executeUsingHead() throws java.io.IOException { return super.executeUsingHead(); } @Override public com.google.api.client.http.HttpRequest buildHttpRequestUsingHead() throws java.io.IOException { return super.buildHttpRequestUsingHead(); } @Override public List set$Xgafv(java.lang.String $Xgafv) { return (List) super.set$Xgafv($Xgafv); } @Override public List setAccessToken(java.lang.String accessToken) { return (List) super.setAccessToken(accessToken); } @Override public List setAlt(java.lang.String alt) { return (List) super.setAlt(alt); } @Override public List setCallback(java.lang.String callback) { return (List) super.setCallback(callback); } @Override public List setFields(java.lang.String fields) { return (List) super.setFields(fields); } @Override public List setKey(java.lang.String key) { return (List) super.setKey(key); } @Override public List setOauthToken(java.lang.String oauthToken) { return (List) super.setOauthToken(oauthToken); } @Override public List setPrettyPrint(java.lang.Boolean prettyPrint) { return (List) super.setPrettyPrint(prettyPrint); } @Override public List setQuotaUser(java.lang.String quotaUser) { return (List) super.setQuotaUser(quotaUser); } @Override public List setUploadType(java.lang.String uploadType) { return (List) super.setUploadType(uploadType); } @Override public List setUploadProtocol(java.lang.String uploadProtocol) { return (List) super.setUploadProtocol(uploadProtocol); } /** Parent must match `projects/[PROJECT_ID]/brokers/[BROKER_ID]`. */ @com.google.api.client.util.Key private java.lang.String parent; /** Parent must match `projects/[PROJECT_ID]/brokers/[BROKER_ID]`. */ public java.lang.String getParent() { return parent; } /** Parent must match `projects/[PROJECT_ID]/brokers/[BROKER_ID]`. */ public List setParent(java.lang.String parent) { if (!getSuppressPatternChecks()) { com.google.api.client.util.Preconditions.checkArgument(PARENT_PATTERN.matcher(parent).matches(), "Parameter parent must conform to the pattern " + "^projects/[^/]+/brokers/[^/]+$"); } this.parent = parent; return this; } /** * Specifies the number of results to return per page. If there are fewer elements than * the specified number, returns all elements. Optional. If unset or 0, all the results * will be returned. */ @com.google.api.client.util.Key private java.lang.Integer pageSize; /** Specifies the number of results to return per page. If there are fewer elements than the specified number, returns all elements. Optional. If unset or 0, all the results will be returned. */ public java.lang.Integer getPageSize() { return pageSize; } /** * Specifies the number of results to return per page. If there are fewer elements than * the specified number, returns all elements. Optional. If unset or 0, all the results * will be returned. */ public List setPageSize(java.lang.Integer pageSize) { this.pageSize = pageSize; return this; } /** * Specifies a page token to use. Set `pageToken` to a `nextPageToken` returned by a * previous list request to get the next page of results. */ @com.google.api.client.util.Key private java.lang.String pageToken; /** Specifies a page token to use. Set `pageToken` to a `nextPageToken` returned by a previous list request to get the next page of results. */ public java.lang.String getPageToken() { return pageToken; } /** * Specifies a page token to use. Set `pageToken` to a `nextPageToken` returned by a * previous list request to get the next page of results. */ public List setPageToken(java.lang.String pageToken) { this.pageToken = pageToken; return this; } @Override public List set(String parameterName, Object value) { return (List) super.set(parameterName, value); } } } /** * An accessor for creating requests from the V2 collection. * * <p>The typical use is:</p> * <pre> * {@code ServiceBroker servicebroker = new ServiceBroker(...);} * {@code ServiceBroker.V2.List request = servicebroker.v2().list(parameters ...)} * </pre> * * @return the resource collection */ public V2 v2() { return new V2(); } /** * The "v2" collection of methods. */ public class V2 { /** * An accessor for creating requests from the Catalog collection. * * <p>The typical use is:</p> * <pre> * {@code ServiceBroker servicebroker = new ServiceBroker(...);} * {@code ServiceBroker.Catalog.List request = servicebroker.catalog().list(parameters ...)} * </pre> * * @return the resource collection */ public Catalog catalog() { return new Catalog(); } /** * The "catalog" collection of methods. */ public class Catalog { /** * Lists all the Services registered with this broker for consumption for given service registry * broker, which contains an set of services. Note, that Service producer API is separate from * Broker API. * * Create a request for the method "catalog.list". * * This request holds the parameters needed by the servicebroker server. After setting any optional * parameters, call the {@link List#execute()} method to invoke the remote operation. * * @param parent Parent must match `projects/[PROJECT_ID]/brokers/[BROKER_ID]`. * @return the request */ public List list(java.lang.String parent) throws java.io.IOException { List result = new List(parent); initialize(result); return result; } public class List extends ServiceBrokerRequest<com.google.api.services.servicebroker.v1alpha1.model.GoogleCloudServicebrokerV1alpha1ListCatalogResponse> { private static final String REST_PATH = "v1alpha1/{+parent}/v2/catalog"; private final java.util.regex.Pattern PARENT_PATTERN = java.util.regex.Pattern.compile("^projects/[^/]+/brokers/[^/]+$"); /** * Lists all the Services registered with this broker for consumption for given service registry * broker, which contains an set of services. Note, that Service producer API is separate from * Broker API. * * Create a request for the method "catalog.list". * * This request holds the parameters needed by the the servicebroker server. After setting any * optional parameters, call the {@link List#execute()} method to invoke the remote operation. <p> * {@link List#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} * must be called to initialize this instance immediately after invoking the constructor. </p> * * @param parent Parent must match `projects/[PROJECT_ID]/brokers/[BROKER_ID]`. * @since 1.13 */ protected List(java.lang.String parent) { super(ServiceBroker.this, "GET", REST_PATH, null, com.google.api.services.servicebroker.v1alpha1.model.GoogleCloudServicebrokerV1alpha1ListCatalogResponse.class); this.parent = com.google.api.client.util.Preconditions.checkNotNull(parent, "Required parameter parent must be specified."); if (!getSuppressPatternChecks()) { com.google.api.client.util.Preconditions.checkArgument(PARENT_PATTERN.matcher(parent).matches(), "Parameter parent must conform to the pattern " + "^projects/[^/]+/brokers/[^/]+$"); } } @Override public com.google.api.client.http.HttpResponse executeUsingHead() throws java.io.IOException { return super.executeUsingHead(); } @Override public com.google.api.client.http.HttpRequest buildHttpRequestUsingHead() throws java.io.IOException { return super.buildHttpRequestUsingHead(); } @Override public List set$Xgafv(java.lang.String $Xgafv) { return (List) super.set$Xgafv($Xgafv); } @Override public List setAccessToken(java.lang.String accessToken) { return (List) super.setAccessToken(accessToken); } @Override public List setAlt(java.lang.String alt) { return (List) super.setAlt(alt); } @Override public List setCallback(java.lang.String callback) { return (List) super.setCallback(callback); } @Override public List setFields(java.lang.String fields) { return (List) super.setFields(fields); } @Override public List setKey(java.lang.String key) { return (List) super.setKey(key); } @Override public List setOauthToken(java.lang.String oauthToken) { return (List) super.setOauthToken(oauthToken); } @Override public List setPrettyPrint(java.lang.Boolean prettyPrint) { return (List) super.setPrettyPrint(prettyPrint); } @Override public List setQuotaUser(java.lang.String quotaUser) { return (List) super.setQuotaUser(quotaUser); } @Override public List setUploadType(java.lang.String uploadType) { return (List) super.setUploadType(uploadType); } @Override public List setUploadProtocol(java.lang.String uploadProtocol) { return (List) super.setUploadProtocol(uploadProtocol); } /** Parent must match `projects/[PROJECT_ID]/brokers/[BROKER_ID]`. */ @com.google.api.client.util.Key private java.lang.String parent; /** Parent must match `projects/[PROJECT_ID]/brokers/[BROKER_ID]`. */ public java.lang.String getParent() { return parent; } /** Parent must match `projects/[PROJECT_ID]/brokers/[BROKER_ID]`. */ public List setParent(java.lang.String parent) { if (!getSuppressPatternChecks()) { com.google.api.client.util.Preconditions.checkArgument(PARENT_PATTERN.matcher(parent).matches(), "Parameter parent must conform to the pattern " + "^projects/[^/]+/brokers/[^/]+$"); } this.parent = parent; return this; } /** * Specifies the number of results to return per page. If there are fewer elements than * the specified number, returns all elements. Optional. If unset or 0, all the results * will be returned. */ @com.google.api.client.util.Key private java.lang.Integer pageSize; /** Specifies the number of results to return per page. If there are fewer elements than the specified number, returns all elements. Optional. If unset or 0, all the results will be returned. */ public java.lang.Integer getPageSize() { return pageSize; } /** * Specifies the number of results to return per page. If there are fewer elements than * the specified number, returns all elements. Optional. If unset or 0, all the results * will be returned. */ public List setPageSize(java.lang.Integer pageSize) { this.pageSize = pageSize; return this; } /** * Specifies a page token to use. Set `pageToken` to a `nextPageToken` returned by a * previous list request to get the next page of results. */ @com.google.api.client.util.Key private java.lang.String pageToken; /** Specifies a page token to use. Set `pageToken` to a `nextPageToken` returned by a previous list request to get the next page of results. */ public java.lang.String getPageToken() { return pageToken; } /** * Specifies a page token to use. Set `pageToken` to a `nextPageToken` returned by a * previous list request to get the next page of results. */ public List setPageToken(java.lang.String pageToken) { this.pageToken = pageToken; return this; } @Override public List set(String parameterName, Object value) { return (List) super.set(parameterName, value); } } } /** * An accessor for creating requests from the ServiceInstances collection. * * <p>The typical use is:</p> * <pre> * {@code ServiceBroker servicebroker = new ServiceBroker(...);} * {@code ServiceBroker.ServiceInstances.List request = servicebroker.serviceInstances().list(parameters ...)} * </pre> * * @return the resource collection */ public ServiceInstances serviceInstances() { return new ServiceInstances(); } /** * The "service_instances" collection of methods. */ public class ServiceInstances { /** * Provisions a service instance. If `request.accepts_incomplete` is false and Broker cannot execute * request synchronously HTTP 422 error will be returned along with FAILED_PRECONDITION status. If * `request.accepts_incomplete` is true and the Broker decides to execute resource asynchronously * then HTTP 202 response code will be returned and a valid polling operation in the response will * be included. If Broker executes the request synchronously and it succeeds HTTP 201 response will * be furnished. If identical instance exists, then HTTP 200 response will be returned. If an * instance with identical ID but mismatching parameters exists, then HTTP 409 status code will be * returned. * * Create a request for the method "service_instances.create". * * This request holds the parameters needed by the servicebroker server. After setting any optional * parameters, call the {@link Create#execute()} method to invoke the remote operation. * * @param parent Parent must match `projects/[PROJECT_ID]/brokers/[BROKER_ID]`. * @param instanceId The id of the service instance. Must be unique within GCP project. Maximum length is 64, GUID * recommended. Required. * @param content the {@link com.google.api.services.servicebroker.v1alpha1.model.GoogleCloudServicebrokerV1alpha1ServiceInstance} * @return the request */ public Create create(java.lang.String parent, java.lang.String instanceId, com.google.api.services.servicebroker.v1alpha1.model.GoogleCloudServicebrokerV1alpha1ServiceInstance content) throws java.io.IOException { Create result = new Create(parent, instanceId, content); initialize(result); return result; } public class Create extends ServiceBrokerRequest<com.google.api.services.servicebroker.v1alpha1.model.GoogleCloudServicebrokerV1alpha1CreateServiceInstanceResponse> { private static final String REST_PATH = "v1alpha1/{+parent}/v2/service_instances/{+instance_id}"; private final java.util.regex.Pattern PARENT_PATTERN = java.util.regex.Pattern.compile("^projects/[^/]+/brokers/[^/]+$"); private final java.util.regex.Pattern INSTANCE_ID_PATTERN = java.util.regex.Pattern.compile("^[^/]+$"); /** * Provisions a service instance. If `request.accepts_incomplete` is false and Broker cannot * execute request synchronously HTTP 422 error will be returned along with FAILED_PRECONDITION * status. If `request.accepts_incomplete` is true and the Broker decides to execute resource * asynchronously then HTTP 202 response code will be returned and a valid polling operation in * the response will be included. If Broker executes the request synchronously and it succeeds * HTTP 201 response will be furnished. If identical instance exists, then HTTP 200 response will * be returned. If an instance with identical ID but mismatching parameters exists, then HTTP 409 * status code will be returned. * * Create a request for the method "service_instances.create". * * This request holds the parameters needed by the the servicebroker server. After setting any * optional parameters, call the {@link Create#execute()} method to invoke the remote operation. * <p> {@link * Create#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must * be called to initialize this instance immediately after invoking the constructor. </p> * * @param parent Parent must match `projects/[PROJECT_ID]/brokers/[BROKER_ID]`. * @param instanceId The id of the service instance. Must be unique within GCP project. Maximum length is 64, GUID * recommended. Required. * @param content the {@link com.google.api.services.servicebroker.v1alpha1.model.GoogleCloudServicebrokerV1alpha1ServiceInstance} * @since 1.13 */ protected Create(java.lang.String parent, java.lang.String instanceId, com.google.api.services.servicebroker.v1alpha1.model.GoogleCloudServicebrokerV1alpha1ServiceInstance content) { super(ServiceBroker.this, "PUT", REST_PATH, content, com.google.api.services.servicebroker.v1alpha1.model.GoogleCloudServicebrokerV1alpha1CreateServiceInstanceResponse.class); this.parent = com.google.api.client.util.Preconditions.checkNotNull(parent, "Required parameter parent must be specified."); if (!getSuppressPatternChecks()) { com.google.api.client.util.Preconditions.checkArgument(PARENT_PATTERN.matcher(parent).matches(), "Parameter parent must conform to the pattern " + "^projects/[^/]+/brokers/[^/]+$"); } this.instanceId = com.google.api.client.util.Preconditions.checkNotNull(instanceId, "Required parameter instanceId must be specified."); if (!getSuppressPatternChecks()) { com.google.api.client.util.Preconditions.checkArgument(INSTANCE_ID_PATTERN.matcher(instanceId).matches(), "Parameter instanceId must conform to the pattern " + "^[^/]+$"); } } @Override public Create set$Xgafv(java.lang.String $Xgafv) { return (Create) super.set$Xgafv($Xgafv); } @Override public Create setAccessToken(java.lang.String accessToken) { return (Create) super.setAccessToken(accessToken); } @Override public Create setAlt(java.lang.String alt) { return (Create) super.setAlt(alt); } @Override public Create setCallback(java.lang.String callback) { return (Create) super.setCallback(callback); } @Override public Create setFields(java.lang.String fields) { return (Create) super.setFields(fields); } @Override public Create setKey(java.lang.String key) { return (Create) super.setKey(key); } @Override public Create setOauthToken(java.lang.String oauthToken) { return (Create) super.setOauthToken(oauthToken); } @Override public Create setPrettyPrint(java.lang.Boolean prettyPrint) { return (Create) super.setPrettyPrint(prettyPrint); } @Override public Create setQuotaUser(java.lang.String quotaUser) { return (Create) super.setQuotaUser(quotaUser); } @Override public Create setUploadType(java.lang.String uploadType) { return (Create) super.setUploadType(uploadType); } @Override public Create setUploadProtocol(java.lang.String uploadProtocol) { return (Create) super.setUploadProtocol(uploadProtocol); } /** Parent must match `projects/[PROJECT_ID]/brokers/[BROKER_ID]`. */ @com.google.api.client.util.Key private java.lang.String parent; /** Parent must match `projects/[PROJECT_ID]/brokers/[BROKER_ID]`. */ public java.lang.String getParent() { return parent; } /** Parent must match `projects/[PROJECT_ID]/brokers/[BROKER_ID]`. */ public Create setParent(java.lang.String parent) { if (!getSuppressPatternChecks()) { com.google.api.client.util.Preconditions.checkArgument(PARENT_PATTERN.matcher(parent).matches(), "Parameter parent must conform to the pattern " + "^projects/[^/]+/brokers/[^/]+$"); } this.parent = parent; return this; } /** * The id of the service instance. Must be unique within GCP project. Maximum length is * 64, GUID recommended. Required. */ @com.google.api.client.util.Key("instance_id") private java.lang.String instanceId; /** The id of the service instance. Must be unique within GCP project. Maximum length is 64, GUID recommended. Required. */ public java.lang.String getInstanceId() { return instanceId; } /** * The id of the service instance. Must be unique within GCP project. Maximum length is * 64, GUID recommended. Required. */ public Create setInstanceId(java.lang.String instanceId) { if (!getSuppressPatternChecks()) { com.google.api.client.util.Preconditions.checkArgument(INSTANCE_ID_PATTERN.matcher(instanceId).matches(), "Parameter instanceId must conform to the pattern " + "^[^/]+$"); } this.instanceId = instanceId; return this; } /** * Value indicating that API client supports asynchronous operations. If Broker cannot * execute the request synchronously HTTP 422 code will be returned to HTTP clients * along with FAILED_PRECONDITION error. If true and broker will execute request * asynchronously 202 HTTP code will be returned. This broker always requires this to be * true as all mutator operations are asynchronous. */ @com.google.api.client.util.Key private java.lang.Boolean acceptsIncomplete; /** Value indicating that API client supports asynchronous operations. If Broker cannot execute the request synchronously HTTP 422 code will be returned to HTTP clients along with FAILED_PRECONDITION error. If true and broker will execute request asynchronously 202 HTTP code will be returned. This broker always requires this to be true as all mutator operations are asynchronous. */ public java.lang.Boolean getAcceptsIncomplete() { return acceptsIncomplete; } /** * Value indicating that API client supports asynchronous operations. If Broker cannot * execute the request synchronously HTTP 422 code will be returned to HTTP clients * along with FAILED_PRECONDITION error. If true and broker will execute request * asynchronously 202 HTTP code will be returned. This broker always requires this to be * true as all mutator operations are asynchronous. */ public Create setAcceptsIncomplete(java.lang.Boolean acceptsIncomplete) { this.acceptsIncomplete = acceptsIncomplete; return this; } @Override public Create set(String parameterName, Object value) { return (Create) super.set(parameterName, value); } } /** * Deprovisions a service instance. For synchronous/asynchronous request details see * CreateServiceInstance method. If service instance does not exist HTTP 410 status will be * returned. * * Create a request for the method "service_instances.delete". * * This request holds the parameters needed by the servicebroker server. After setting any optional * parameters, call the {@link Delete#execute()} method to invoke the remote operation. * * @param parent Parent must match `projects/[PROJECT_ID]/brokers/[BROKER_ID]`. * @param instanceId The instance id to deprovision. * @return the request */ public Delete delete(java.lang.String parent, java.lang.String instanceId) throws java.io.IOException { Delete result = new Delete(parent, instanceId); initialize(result); return result; } public class Delete extends ServiceBrokerRequest<com.google.api.services.servicebroker.v1alpha1.model.GoogleCloudServicebrokerV1alpha1DeleteServiceInstanceResponse> { private static final String REST_PATH = "v1alpha1/{+parent}/v2/service_instances/{+instanceId}"; private final java.util.regex.Pattern PARENT_PATTERN = java.util.regex.Pattern.compile("^projects/[^/]+/brokers/[^/]+$"); private final java.util.regex.Pattern INSTANCE_ID_PATTERN = java.util.regex.Pattern.compile("^[^/]+$"); /** * Deprovisions a service instance. For synchronous/asynchronous request details see * CreateServiceInstance method. If service instance does not exist HTTP 410 status will be * returned. * * Create a request for the method "service_instances.delete". * * This request holds the parameters needed by the the servicebroker server. After setting any * optional parameters, call the {@link Delete#execute()} method to invoke the remote operation. * <p> {@link * Delete#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must * be called to initialize this instance immediately after invoking the constructor. </p> * * @param parent Parent must match `projects/[PROJECT_ID]/brokers/[BROKER_ID]`. * @param instanceId The instance id to deprovision. * @since 1.13 */ protected Delete(java.lang.String parent, java.lang.String instanceId) { super(ServiceBroker.this, "DELETE", REST_PATH, null, com.google.api.services.servicebroker.v1alpha1.model.GoogleCloudServicebrokerV1alpha1DeleteServiceInstanceResponse.class); this.parent = com.google.api.client.util.Preconditions.checkNotNull(parent, "Required parameter parent must be specified."); if (!getSuppressPatternChecks()) { com.google.api.client.util.Preconditions.checkArgument(PARENT_PATTERN.matcher(parent).matches(), "Parameter parent must conform to the pattern " + "^projects/[^/]+/brokers/[^/]+$"); } this.instanceId = com.google.api.client.util.Preconditions.checkNotNull(instanceId, "Required parameter instanceId must be specified."); if (!getSuppressPatternChecks()) { com.google.api.client.util.Preconditions.checkArgument(INSTANCE_ID_PATTERN.matcher(instanceId).matches(), "Parameter instanceId must conform to the pattern " + "^[^/]+$"); } } @Override public Delete set$Xgafv(java.lang.String $Xgafv) { return (Delete) super.set$Xgafv($Xgafv); } @Override public Delete setAccessToken(java.lang.String accessToken) { return (Delete) super.setAccessToken(accessToken); } @Override public Delete setAlt(java.lang.String alt) { return (Delete) super.setAlt(alt); } @Override public Delete setCallback(java.lang.String callback) { return (Delete) super.setCallback(callback); } @Override public Delete setFields(java.lang.String fields) { return (Delete) super.setFields(fields); } @Override public Delete setKey(java.lang.String key) { return (Delete) super.setKey(key); } @Override public Delete setOauthToken(java.lang.String oauthToken) { return (Delete) super.setOauthToken(oauthToken); } @Override public Delete setPrettyPrint(java.lang.Boolean prettyPrint) { return (Delete) super.setPrettyPrint(prettyPrint); } @Override public Delete setQuotaUser(java.lang.String quotaUser) { return (Delete) super.setQuotaUser(quotaUser); } @Override public Delete setUploadType(java.lang.String uploadType) { return (Delete) super.setUploadType(uploadType); } @Override public Delete setUploadProtocol(java.lang.String uploadProtocol) { return (Delete) super.setUploadProtocol(uploadProtocol); } /** Parent must match `projects/[PROJECT_ID]/brokers/[BROKER_ID]`. */ @com.google.api.client.util.Key private java.lang.String parent; /** Parent must match `projects/[PROJECT_ID]/brokers/[BROKER_ID]`. */ public java.lang.String getParent() { return parent; } /** Parent must match `projects/[PROJECT_ID]/brokers/[BROKER_ID]`. */ public Delete setParent(java.lang.String parent) { if (!getSuppressPatternChecks()) { com.google.api.client.util.Preconditions.checkArgument(PARENT_PATTERN.matcher(parent).matches(), "Parameter parent must conform to the pattern " + "^projects/[^/]+/brokers/[^/]+$"); } this.parent = parent; return this; } /** The instance id to deprovision. */ @com.google.api.client.util.Key private java.lang.String instanceId; /** The instance id to deprovision. */ public java.lang.String getInstanceId() { return instanceId; } /** The instance id to deprovision. */ public Delete setInstanceId(java.lang.String instanceId) { if (!getSuppressPatternChecks()) { com.google.api.client.util.Preconditions.checkArgument(INSTANCE_ID_PATTERN.matcher(instanceId).matches(), "Parameter instanceId must conform to the pattern " + "^[^/]+$"); } this.instanceId = instanceId; return this; } /** See CreateServiceInstanceRequest for details. */ @com.google.api.client.util.Key private java.lang.Boolean acceptsIncomplete; /** See CreateServiceInstanceRequest for details. */ public java.lang.Boolean getAcceptsIncomplete() { return acceptsIncomplete; } /** See CreateServiceInstanceRequest for details. */ public Delete setAcceptsIncomplete(java.lang.Boolean acceptsIncomplete) { this.acceptsIncomplete = acceptsIncomplete; return this; } /** The plan id of the service instance. */ @com.google.api.client.util.Key private java.lang.String planId; /** The plan id of the service instance. */ public java.lang.String getPlanId() { return planId; } /** The plan id of the service instance. */ public Delete setPlanId(java.lang.String planId) { this.planId = planId; return this; } /** The service id of the service instance. */ @com.google.api.client.util.Key private java.lang.String serviceId; /** The service id of the service instance. */ public java.lang.String getServiceId() { return serviceId; } /** The service id of the service instance. */ public Delete setServiceId(java.lang.String serviceId) { this.serviceId = serviceId; return this; } @Override public Delete set(String parameterName, Object value) { return (Delete) super.set(parameterName, value); } } /** * Gets the given service instance from the system. This API is an extension and not part of the OSB * spec. Hence the path is a standard Google API URL. * * Create a request for the method "service_instances.get". * * This request holds the parameters needed by the servicebroker server. After setting any optional * parameters, call the {@link Get#execute()} method to invoke the remote operation. * * @param name The resource name of the instance to return. * @return the request */ public Get get(java.lang.String name) throws java.io.IOException { Get result = new Get(name); initialize(result); return result; } public class Get extends ServiceBrokerRequest<com.google.api.services.servicebroker.v1alpha1.model.GoogleCloudServicebrokerV1alpha1ServiceInstance> { private static final String REST_PATH = "v1alpha1/{+name}"; private final java.util.regex.Pattern NAME_PATTERN = java.util.regex.Pattern.compile("^projects/[^/]+/brokers/[^/]+/v2/service_instances/[^/]+$"); /** * Gets the given service instance from the system. This API is an extension and not part of the * OSB spec. Hence the path is a standard Google API URL. * * Create a request for the method "service_instances.get". * * This request holds the parameters needed by the the servicebroker server. After setting any * optional parameters, call the {@link Get#execute()} method to invoke the remote operation. <p> * {@link Get#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} * must be called to initialize this instance immediately after invoking the constructor. </p> * * @param name The resource name of the instance to return. * @since 1.13 */ protected Get(java.lang.String name) { super(ServiceBroker.this, "GET", REST_PATH, null, com.google.api.services.servicebroker.v1alpha1.model.GoogleCloudServicebrokerV1alpha1ServiceInstance.class); this.name = com.google.api.client.util.Preconditions.checkNotNull(name, "Required parameter name must be specified."); if (!getSuppressPatternChecks()) { com.google.api.client.util.Preconditions.checkArgument(NAME_PATTERN.matcher(name).matches(), "Parameter name must conform to the pattern " + "^projects/[^/]+/brokers/[^/]+/v2/service_instances/[^/]+$"); } } @Override public com.google.api.client.http.HttpResponse executeUsingHead() throws java.io.IOException { return super.executeUsingHead(); } @Override public com.google.api.client.http.HttpRequest buildHttpRequestUsingHead() throws java.io.IOException { return super.buildHttpRequestUsingHead(); } @Override public Get set$Xgafv(java.lang.String $Xgafv) { return (Get) super.set$Xgafv($Xgafv); } @Override public Get setAccessToken(java.lang.String accessToken) { return (Get) super.setAccessToken(accessToken); } @Override public Get setAlt(java.lang.String alt) { return (Get) super.setAlt(alt); } @Override public Get setCallback(java.lang.String callback) { return (Get) super.setCallback(callback); } @Override public Get setFields(java.lang.String fields) { return (Get) super.setFields(fields); } @Override public Get setKey(java.lang.String key) { return (Get) super.setKey(key); } @Override public Get setOauthToken(java.lang.String oauthToken) { return (Get) super.setOauthToken(oauthToken); } @Override public Get setPrettyPrint(java.lang.Boolean prettyPrint) { return (Get) super.setPrettyPrint(prettyPrint); } @Override public Get setQuotaUser(java.lang.String quotaUser) { return (Get) super.setQuotaUser(quotaUser); } @Override public Get setUploadType(java.lang.String uploadType) { return (Get) super.setUploadType(uploadType); } @Override public Get setUploadProtocol(java.lang.String uploadProtocol) { return (Get) super.setUploadProtocol(uploadProtocol); } /** The resource name of the instance to return. */ @com.google.api.client.util.Key private java.lang.String name; /** The resource name of the instance to return. */ public java.lang.String getName() { return name; } /** The resource name of the instance to return. */ public Get setName(java.lang.String name) { if (!getSuppressPatternChecks()) { com.google.api.client.util.Preconditions.checkArgument(NAME_PATTERN.matcher(name).matches(), "Parameter name must conform to the pattern " + "^projects/[^/]+/brokers/[^/]+/v2/service_instances/[^/]+$"); } this.name = name; return this; } @Override public Get set(String parameterName, Object value) { return (Get) super.set(parameterName, value); } } /** * Returns the state of the last operation for the service instance. Only last (or current) * operation can be polled. * * Create a request for the method "service_instances.getLast_operation". * * This request holds the parameters needed by the servicebroker server. After setting any optional * parameters, call the {@link GetLastOperation#execute()} method to invoke the remote operation. * * @param parent Parent must match `projects/[PROJECT_ID]/brokers/[BROKER_ID]`. * @param instanceId The instance id for which to return the last operation status. * @return the request */ public GetLastOperation getLastOperation(java.lang.String parent, java.lang.String instanceId) throws java.io.IOException { GetLastOperation result = new GetLastOperation(parent, instanceId); initialize(result); return result; } public class GetLastOperation extends ServiceBrokerRequest<com.google.api.services.servicebroker.v1alpha1.model.GoogleCloudServicebrokerV1alpha1Operation> { private static final String REST_PATH = "v1alpha1/{+parent}/v2/service_instances/{+instanceId}/last_operation"; private final java.util.regex.Pattern PARENT_PATTERN = java.util.regex.Pattern.compile("^projects/[^/]+/brokers/[^/]+$"); private final java.util.regex.Pattern INSTANCE_ID_PATTERN = java.util.regex.Pattern.compile("^[^/]+$"); /** * Returns the state of the last operation for the service instance. Only last (or current) * operation can be polled. * * Create a request for the method "service_instances.getLast_operation". * * This request holds the parameters needed by the the servicebroker server. After setting any * optional parameters, call the {@link GetLastOperation#execute()} method to invoke the remote * operation. <p> {@link GetLastOperation#initialize(com.google.api.client.googleapis.services.Abs * tractGoogleClientRequest)} must be called to initialize this instance immediately after * invoking the constructor. </p> * * @param parent Parent must match `projects/[PROJECT_ID]/brokers/[BROKER_ID]`. * @param instanceId The instance id for which to return the last operation status. * @since 1.13 */ protected GetLastOperation(java.lang.String parent, java.lang.String instanceId) { super(ServiceBroker.this, "GET", REST_PATH, null, com.google.api.services.servicebroker.v1alpha1.model.GoogleCloudServicebrokerV1alpha1Operation.class); this.parent = com.google.api.client.util.Preconditions.checkNotNull(parent, "Required parameter parent must be specified."); if (!getSuppressPatternChecks()) { com.google.api.client.util.Preconditions.checkArgument(PARENT_PATTERN.matcher(parent).matches(), "Parameter parent must conform to the pattern " + "^projects/[^/]+/brokers/[^/]+$"); } this.instanceId = com.google.api.client.util.Preconditions.checkNotNull(instanceId, "Required parameter instanceId must be specified."); if (!getSuppressPatternChecks()) { com.google.api.client.util.Preconditions.checkArgument(INSTANCE_ID_PATTERN.matcher(instanceId).matches(), "Parameter instanceId must conform to the pattern " + "^[^/]+$"); } } @Override public com.google.api.client.http.HttpResponse executeUsingHead() throws java.io.IOException { return super.executeUsingHead(); } @Override public com.google.api.client.http.HttpRequest buildHttpRequestUsingHead() throws java.io.IOException { return super.buildHttpRequestUsingHead(); } @Override public GetLastOperation set$Xgafv(java.lang.String $Xgafv) { return (GetLastOperation) super.set$Xgafv($Xgafv); } @Override public GetLastOperation setAccessToken(java.lang.String accessToken) { return (GetLastOperation) super.setAccessToken(accessToken); } @Override public GetLastOperation setAlt(java.lang.String alt) { return (GetLastOperation) super.setAlt(alt); } @Override public GetLastOperation setCallback(java.lang.String callback) { return (GetLastOperation) super.setCallback(callback); } @Override public GetLastOperation setFields(java.lang.String fields) { return (GetLastOperation) super.setFields(fields); } @Override public GetLastOperation setKey(java.lang.String key) { return (GetLastOperation) super.setKey(key); } @Override public GetLastOperation setOauthToken(java.lang.String oauthToken) { return (GetLastOperation) super.setOauthToken(oauthToken); } @Override public GetLastOperation setPrettyPrint(java.lang.Boolean prettyPrint) { return (GetLastOperation) super.setPrettyPrint(prettyPrint); } @Override public GetLastOperation setQuotaUser(java.lang.String quotaUser) { return (GetLastOperation) super.setQuotaUser(quotaUser); } @Override public GetLastOperation setUploadType(java.lang.String uploadType) { return (GetLastOperation) super.setUploadType(uploadType); } @Override public GetLastOperation setUploadProtocol(java.lang.String uploadProtocol) { return (GetLastOperation) super.setUploadProtocol(uploadProtocol); } /** Parent must match `projects/[PROJECT_ID]/brokers/[BROKER_ID]`. */ @com.google.api.client.util.Key private java.lang.String parent; /** Parent must match `projects/[PROJECT_ID]/brokers/[BROKER_ID]`. */ public java.lang.String getParent() { return parent; } /** Parent must match `projects/[PROJECT_ID]/brokers/[BROKER_ID]`. */ public GetLastOperation setParent(java.lang.String parent) { if (!getSuppressPatternChecks()) { com.google.api.client.util.Preconditions.checkArgument(PARENT_PATTERN.matcher(parent).matches(), "Parameter parent must conform to the pattern " + "^projects/[^/]+/brokers/[^/]+$"); } this.parent = parent; return this; } /** The instance id for which to return the last operation status. */ @com.google.api.client.util.Key private java.lang.String instanceId; /** The instance id for which to return the last operation status. */ public java.lang.String getInstanceId() { return instanceId; } /** The instance id for which to return the last operation status. */ public GetLastOperation setInstanceId(java.lang.String instanceId) { if (!getSuppressPatternChecks()) { com.google.api.client.util.Preconditions.checkArgument(INSTANCE_ID_PATTERN.matcher(instanceId).matches(), "Parameter instanceId must conform to the pattern " + "^[^/]+$"); } this.instanceId = instanceId; return this; } /** * If `operation` was returned during mutation operation, this field must be populated * with the provided value. */ @com.google.api.client.util.Key private java.lang.String operation; /** If `operation` was returned during mutation operation, this field must be populated with the provided value. */ public java.lang.String getOperation() { return operation; } /** * If `operation` was returned during mutation operation, this field must be populated * with the provided value. */ public GetLastOperation setOperation(java.lang.String operation) { this.operation = operation; return this; } /** Plan id. */ @com.google.api.client.util.Key private java.lang.String planId; /** Plan id. */ public java.lang.String getPlanId() { return planId; } /** Plan id. */ public GetLastOperation setPlanId(java.lang.String planId) { this.planId = planId; return this; } /** Service id. */ @com.google.api.client.util.Key private java.lang.String serviceId; /** Service id. */ public java.lang.String getServiceId() { return serviceId; } /** Service id. */ public GetLastOperation setServiceId(java.lang.String serviceId) { this.serviceId = serviceId; return this; } @Override public GetLastOperation set(String parameterName, Object value) { return (GetLastOperation) super.set(parameterName, value); } } /** * Updates an existing service instance. See CreateServiceInstance for possible response codes. * * Create a request for the method "service_instances.patch". * * This request holds the parameters needed by the servicebroker server. After setting any optional * parameters, call the {@link Patch#execute()} method to invoke the remote operation. * * @param parent Parent must match `projects/[PROJECT_ID]/brokers/[BROKER_ID]`. * @param instanceId The id of the service instance. Must be unique within GCP project. Maximum length is 64, GUID * recommended. Required. * @param content the {@link com.google.api.services.servicebroker.v1alpha1.model.GoogleCloudServicebrokerV1alpha1ServiceInstance} * @return the request */ public Patch patch(java.lang.String parent, java.lang.String instanceId, com.google.api.services.servicebroker.v1alpha1.model.GoogleCloudServicebrokerV1alpha1ServiceInstance content) throws java.io.IOException { Patch result = new Patch(parent, instanceId, content); initialize(result); return result; } public class Patch extends ServiceBrokerRequest<com.google.api.services.servicebroker.v1alpha1.model.GoogleCloudServicebrokerV1alpha1UpdateServiceInstanceResponse> { private static final String REST_PATH = "v1alpha1/{+parent}/v2/service_instances/{+instance_id}"; private final java.util.regex.Pattern PARENT_PATTERN = java.util.regex.Pattern.compile("^projects/[^/]+/brokers/[^/]+$"); private final java.util.regex.Pattern INSTANCE_ID_PATTERN = java.util.regex.Pattern.compile("^[^/]+$"); /** * Updates an existing service instance. See CreateServiceInstance for possible response codes. * * Create a request for the method "service_instances.patch". * * This request holds the parameters needed by the the servicebroker server. After setting any * optional parameters, call the {@link Patch#execute()} method to invoke the remote operation. * <p> {@link * Patch#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must * be called to initialize this instance immediately after invoking the constructor. </p> * * @param parent Parent must match `projects/[PROJECT_ID]/brokers/[BROKER_ID]`. * @param instanceId The id of the service instance. Must be unique within GCP project. Maximum length is 64, GUID * recommended. Required. * @param content the {@link com.google.api.services.servicebroker.v1alpha1.model.GoogleCloudServicebrokerV1alpha1ServiceInstance} * @since 1.13 */ protected Patch(java.lang.String parent, java.lang.String instanceId, com.google.api.services.servicebroker.v1alpha1.model.GoogleCloudServicebrokerV1alpha1ServiceInstance content) { super(ServiceBroker.this, "PATCH", REST_PATH, content, com.google.api.services.servicebroker.v1alpha1.model.GoogleCloudServicebrokerV1alpha1UpdateServiceInstanceResponse.class); this.parent = com.google.api.client.util.Preconditions.checkNotNull(parent, "Required parameter parent must be specified."); if (!getSuppressPatternChecks()) { com.google.api.client.util.Preconditions.checkArgument(PARENT_PATTERN.matcher(parent).matches(), "Parameter parent must conform to the pattern " + "^projects/[^/]+/brokers/[^/]+$"); } this.instanceId = com.google.api.client.util.Preconditions.checkNotNull(instanceId, "Required parameter instanceId must be specified."); if (!getSuppressPatternChecks()) { com.google.api.client.util.Preconditions.checkArgument(INSTANCE_ID_PATTERN.matcher(instanceId).matches(), "Parameter instanceId must conform to the pattern " + "^[^/]+$"); } } @Override public Patch set$Xgafv(java.lang.String $Xgafv) { return (Patch) super.set$Xgafv($Xgafv); } @Override public Patch setAccessToken(java.lang.String accessToken) { return (Patch) super.setAccessToken(accessToken); } @Override public Patch setAlt(java.lang.String alt) { return (Patch) super.setAlt(alt); } @Override public Patch setCallback(java.lang.String callback) { return (Patch) super.setCallback(callback); } @Override public Patch setFields(java.lang.String fields) { return (Patch) super.setFields(fields); } @Override public Patch setKey(java.lang.String key) { return (Patch) super.setKey(key); } @Override public Patch setOauthToken(java.lang.String oauthToken) { return (Patch) super.setOauthToken(oauthToken); } @Override public Patch setPrettyPrint(java.lang.Boolean prettyPrint) { return (Patch) super.setPrettyPrint(prettyPrint); } @Override public Patch setQuotaUser(java.lang.String quotaUser) { return (Patch) super.setQuotaUser(quotaUser); } @Override public Patch setUploadType(java.lang.String uploadType) { return (Patch) super.setUploadType(uploadType); } @Override public Patch setUploadProtocol(java.lang.String uploadProtocol) { return (Patch) super.setUploadProtocol(uploadProtocol); } /** Parent must match `projects/[PROJECT_ID]/brokers/[BROKER_ID]`. */ @com.google.api.client.util.Key private java.lang.String parent; /** Parent must match `projects/[PROJECT_ID]/brokers/[BROKER_ID]`. */ public java.lang.String getParent() { return parent; } /** Parent must match `projects/[PROJECT_ID]/brokers/[BROKER_ID]`. */ public Patch setParent(java.lang.String parent) { if (!getSuppressPatternChecks()) { com.google.api.client.util.Preconditions.checkArgument(PARENT_PATTERN.matcher(parent).matches(), "Parameter parent must conform to the pattern " + "^projects/[^/]+/brokers/[^/]+$"); } this.parent = parent; return this; } /** * The id of the service instance. Must be unique within GCP project. Maximum length is * 64, GUID recommended. Required. */ @com.google.api.client.util.Key("instance_id") private java.lang.String instanceId; /** The id of the service instance. Must be unique within GCP project. Maximum length is 64, GUID recommended. Required. */ public java.lang.String getInstanceId() { return instanceId; } /** * The id of the service instance. Must be unique within GCP project. Maximum length is * 64, GUID recommended. Required. */ public Patch setInstanceId(java.lang.String instanceId) { if (!getSuppressPatternChecks()) { com.google.api.client.util.Preconditions.checkArgument(INSTANCE_ID_PATTERN.matcher(instanceId).matches(), "Parameter instanceId must conform to the pattern " + "^[^/]+$"); } this.instanceId = instanceId; return this; } /** See CreateServiceInstanceRequest for details. */ @com.google.api.client.util.Key private java.lang.Boolean acceptsIncomplete; /** See CreateServiceInstanceRequest for details. */ public java.lang.Boolean getAcceptsIncomplete() { return acceptsIncomplete; } /** See CreateServiceInstanceRequest for details. */ public Patch setAcceptsIncomplete(java.lang.Boolean acceptsIncomplete) { this.acceptsIncomplete = acceptsIncomplete; return this; } @Override public Patch set(String parameterName, Object value) { return (Patch) super.set(parameterName, value); } } /** * An accessor for creating requests from the ServiceBindings collection. * * <p>The typical use is:</p> * <pre> * {@code ServiceBroker servicebroker = new ServiceBroker(...);} * {@code ServiceBroker.ServiceBindings.List request = servicebroker.serviceBindings().list(parameters ...)} * </pre> * * @return the resource collection */ public ServiceBindings serviceBindings() { return new ServiceBindings(); } /** * The "service_bindings" collection of methods. */ public class ServiceBindings { /** * CreateBinding generates a service binding to an existing service instance. See * ProviServiceInstance for async operation details. * * Create a request for the method "service_bindings.create". * * This request holds the parameters needed by the servicebroker server. After setting any optional * parameters, call the {@link Create#execute()} method to invoke the remote operation. * * @param parent The GCP container. Must match `projects/[PROJECT_ID]/brokers/[BROKER_ID]`. * @param instanceId The service instance to which to bind. * @param bindingId The id of the binding. Must be unique within GCP project. Maximum length is 64, GUID recommended. * Required. * @param content the {@link com.google.api.services.servicebroker.v1alpha1.model.GoogleCloudServicebrokerV1alpha1Binding} * @return the request */ public Create create(java.lang.String parent, java.lang.String instanceId, java.lang.String bindingId, com.google.api.services.servicebroker.v1alpha1.model.GoogleCloudServicebrokerV1alpha1Binding content) throws java.io.IOException { Create result = new Create(parent, instanceId, bindingId, content); initialize(result); return result; } public class Create extends ServiceBrokerRequest<com.google.api.services.servicebroker.v1alpha1.model.GoogleCloudServicebrokerV1alpha1CreateBindingResponse> { private static final String REST_PATH = "v1alpha1/{+parent}/v2/service_instances/{+instanceId}/service_bindings/{+binding_id}"; private final java.util.regex.Pattern PARENT_PATTERN = java.util.regex.Pattern.compile("^projects/[^/]+/brokers/[^/]+$"); private final java.util.regex.Pattern INSTANCE_ID_PATTERN = java.util.regex.Pattern.compile("^[^/]+$"); private final java.util.regex.Pattern BINDING_ID_PATTERN = java.util.regex.Pattern.compile("^[^/]+$"); /** * CreateBinding generates a service binding to an existing service instance. See * ProviServiceInstance for async operation details. * * Create a request for the method "service_bindings.create". * * This request holds the parameters needed by the the servicebroker server. After setting any * optional parameters, call the {@link Create#execute()} method to invoke the remote operation. * <p> {@link * Create#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must * be called to initialize this instance immediately after invoking the constructor. </p> * * @param parent The GCP container. Must match `projects/[PROJECT_ID]/brokers/[BROKER_ID]`. * @param instanceId The service instance to which to bind. * @param bindingId The id of the binding. Must be unique within GCP project. Maximum length is 64, GUID recommended. * Required. * @param content the {@link com.google.api.services.servicebroker.v1alpha1.model.GoogleCloudServicebrokerV1alpha1Binding} * @since 1.13 */ protected Create(java.lang.String parent, java.lang.String instanceId, java.lang.String bindingId, com.google.api.services.servicebroker.v1alpha1.model.GoogleCloudServicebrokerV1alpha1Binding content) { super(ServiceBroker.this, "PUT", REST_PATH, content, com.google.api.services.servicebroker.v1alpha1.model.GoogleCloudServicebrokerV1alpha1CreateBindingResponse.class); this.parent = com.google.api.client.util.Preconditions.checkNotNull(parent, "Required parameter parent must be specified."); if (!getSuppressPatternChecks()) { com.google.api.client.util.Preconditions.checkArgument(PARENT_PATTERN.matcher(parent).matches(), "Parameter parent must conform to the pattern " + "^projects/[^/]+/brokers/[^/]+$"); } this.instanceId = com.google.api.client.util.Preconditions.checkNotNull(instanceId, "Required parameter instanceId must be specified."); if (!getSuppressPatternChecks()) { com.google.api.client.util.Preconditions.checkArgument(INSTANCE_ID_PATTERN.matcher(instanceId).matches(), "Parameter instanceId must conform to the pattern " + "^[^/]+$"); } this.bindingId = com.google.api.client.util.Preconditions.checkNotNull(bindingId, "Required parameter bindingId must be specified."); if (!getSuppressPatternChecks()) { com.google.api.client.util.Preconditions.checkArgument(BINDING_ID_PATTERN.matcher(bindingId).matches(), "Parameter bindingId must conform to the pattern " + "^[^/]+$"); } } @Override public Create set$Xgafv(java.lang.String $Xgafv) { return (Create) super.set$Xgafv($Xgafv); } @Override public Create setAccessToken(java.lang.String accessToken) { return (Create) super.setAccessToken(accessToken); } @Override public Create setAlt(java.lang.String alt) { return (Create) super.setAlt(alt); } @Override public Create setCallback(java.lang.String callback) { return (Create) super.setCallback(callback); } @Override public Create setFields(java.lang.String fields) { return (Create) super.setFields(fields); } @Override public Create setKey(java.lang.String key) { return (Create) super.setKey(key); } @Override public Create setOauthToken(java.lang.String oauthToken) { return (Create) super.setOauthToken(oauthToken); } @Override public Create setPrettyPrint(java.lang.Boolean prettyPrint) { return (Create) super.setPrettyPrint(prettyPrint); } @Override public Create setQuotaUser(java.lang.String quotaUser) { return (Create) super.setQuotaUser(quotaUser); } @Override public Create setUploadType(java.lang.String uploadType) { return (Create) super.setUploadType(uploadType); } @Override public Create setUploadProtocol(java.lang.String uploadProtocol) { return (Create) super.setUploadProtocol(uploadProtocol); } /** * The GCP container. Must match `projects/[PROJECT_ID]/brokers/[BROKER_ID]`. */ @com.google.api.client.util.Key private java.lang.String parent; /** The GCP container. Must match `projects/[PROJECT_ID]/brokers/[BROKER_ID]`. */ public java.lang.String getParent() { return parent; } /** * The GCP container. Must match `projects/[PROJECT_ID]/brokers/[BROKER_ID]`. */ public Create setParent(java.lang.String parent) { if (!getSuppressPatternChecks()) { com.google.api.client.util.Preconditions.checkArgument(PARENT_PATTERN.matcher(parent).matches(), "Parameter parent must conform to the pattern " + "^projects/[^/]+/brokers/[^/]+$"); } this.parent = parent; return this; } /** The service instance to which to bind. */ @com.google.api.client.util.Key private java.lang.String instanceId; /** The service instance to which to bind. */ public java.lang.String getInstanceId() { return instanceId; } /** The service instance to which to bind. */ public Create setInstanceId(java.lang.String instanceId) { if (!getSuppressPatternChecks()) { com.google.api.client.util.Preconditions.checkArgument(INSTANCE_ID_PATTERN.matcher(instanceId).matches(), "Parameter instanceId must conform to the pattern " + "^[^/]+$"); } this.instanceId = instanceId; return this; } /** * The id of the binding. Must be unique within GCP project. Maximum length is 64, * GUID recommended. Required. */ @com.google.api.client.util.Key("binding_id") private java.lang.String bindingId; /** The id of the binding. Must be unique within GCP project. Maximum length is 64, GUID recommended. Required. */ public java.lang.String getBindingId() { return bindingId; } /** * The id of the binding. Must be unique within GCP project. Maximum length is 64, * GUID recommended. Required. */ public Create setBindingId(java.lang.String bindingId) { if (!getSuppressPatternChecks()) { com.google.api.client.util.Preconditions.checkArgument(BINDING_ID_PATTERN.matcher(bindingId).matches(), "Parameter bindingId must conform to the pattern " + "^[^/]+$"); } this.bindingId = bindingId; return this; } /** See CreateServiceInstanceRequest for details. */ @com.google.api.client.util.Key private java.lang.Boolean acceptsIncomplete; /** See CreateServiceInstanceRequest for details. */ public java.lang.Boolean getAcceptsIncomplete() { return acceptsIncomplete; } /** See CreateServiceInstanceRequest for details. */ public Create setAcceptsIncomplete(java.lang.Boolean acceptsIncomplete) { this.acceptsIncomplete = acceptsIncomplete; return this; } @Override public Create set(String parameterName, Object value) { return (Create) super.set(parameterName, value); } } /** * Unbinds from a service instance. For synchronous/asynchronous request details see * CreateServiceInstance method. If binding does not exist HTTP 410 status will be returned. * * Create a request for the method "service_bindings.delete". * * This request holds the parameters needed by the servicebroker server. After setting any optional * parameters, call the {@link Delete#execute()} method to invoke the remote operation. * * @param parent Parent must match `projects/[PROJECT_ID]/brokers/[BROKER_ID]`. * @param instanceId The service instance id that deleted binding is bound to. * @param bindingId The id of the binding to delete. * @return the request */ public Delete delete(java.lang.String parent, java.lang.String instanceId, java.lang.String bindingId) throws java.io.IOException { Delete result = new Delete(parent, instanceId, bindingId); initialize(result); return result; } public class Delete extends ServiceBrokerRequest<com.google.api.services.servicebroker.v1alpha1.model.GoogleCloudServicebrokerV1alpha1DeleteBindingResponse> { private static final String REST_PATH = "v1alpha1/{+parent}/v2/service_instances/{instanceId}/service_bindings/{bindingId}"; private final java.util.regex.Pattern PARENT_PATTERN = java.util.regex.Pattern.compile("^projects/[^/]+/brokers/[^/]+$"); /** * Unbinds from a service instance. For synchronous/asynchronous request details see * CreateServiceInstance method. If binding does not exist HTTP 410 status will be returned. * * Create a request for the method "service_bindings.delete". * * This request holds the parameters needed by the the servicebroker server. After setting any * optional parameters, call the {@link Delete#execute()} method to invoke the remote operation. * <p> {@link * Delete#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must * be called to initialize this instance immediately after invoking the constructor. </p> * * @param parent Parent must match `projects/[PROJECT_ID]/brokers/[BROKER_ID]`. * @param instanceId The service instance id that deleted binding is bound to. * @param bindingId The id of the binding to delete. * @since 1.13 */ protected Delete(java.lang.String parent, java.lang.String instanceId, java.lang.String bindingId) { super(ServiceBroker.this, "DELETE", REST_PATH, null, com.google.api.services.servicebroker.v1alpha1.model.GoogleCloudServicebrokerV1alpha1DeleteBindingResponse.class); this.parent = com.google.api.client.util.Preconditions.checkNotNull(parent, "Required parameter parent must be specified."); if (!getSuppressPatternChecks()) { com.google.api.client.util.Preconditions.checkArgument(PARENT_PATTERN.matcher(parent).matches(), "Parameter parent must conform to the pattern " + "^projects/[^/]+/brokers/[^/]+$"); } this.instanceId = com.google.api.client.util.Preconditions.checkNotNull(instanceId, "Required parameter instanceId must be specified."); this.bindingId = com.google.api.client.util.Preconditions.checkNotNull(bindingId, "Required parameter bindingId must be specified."); } @Override public Delete set$Xgafv(java.lang.String $Xgafv) { return (Delete) super.set$Xgafv($Xgafv); } @Override public Delete setAccessToken(java.lang.String accessToken) { return (Delete) super.setAccessToken(accessToken); } @Override public Delete setAlt(java.lang.String alt) { return (Delete) super.setAlt(alt); } @Override public Delete setCallback(java.lang.String callback) { return (Delete) super.setCallback(callback); } @Override public Delete setFields(java.lang.String fields) { return (Delete) super.setFields(fields); } @Override public Delete setKey(java.lang.String key) { return (Delete) super.setKey(key); } @Override public Delete setOauthToken(java.lang.String oauthToken) { return (Delete) super.setOauthToken(oauthToken); } @Override public Delete setPrettyPrint(java.lang.Boolean prettyPrint) { return (Delete) super.setPrettyPrint(prettyPrint); } @Override public Delete setQuotaUser(java.lang.String quotaUser) { return (Delete) super.setQuotaUser(quotaUser); } @Override public Delete setUploadType(java.lang.String uploadType) { return (Delete) super.setUploadType(uploadType); } @Override public Delete setUploadProtocol(java.lang.String uploadProtocol) { return (Delete) super.setUploadProtocol(uploadProtocol); } /** Parent must match `projects/[PROJECT_ID]/brokers/[BROKER_ID]`. */ @com.google.api.client.util.Key private java.lang.String parent; /** Parent must match `projects/[PROJECT_ID]/brokers/[BROKER_ID]`. */ public java.lang.String getParent() { return parent; } /** Parent must match `projects/[PROJECT_ID]/brokers/[BROKER_ID]`. */ public Delete setParent(java.lang.String parent) { if (!getSuppressPatternChecks()) { com.google.api.client.util.Preconditions.checkArgument(PARENT_PATTERN.matcher(parent).matches(), "Parameter parent must conform to the pattern " + "^projects/[^/]+/brokers/[^/]+$"); } this.parent = parent; return this; } /** The service instance id that deleted binding is bound to. */ @com.google.api.client.util.Key private java.lang.String instanceId; /** The service instance id that deleted binding is bound to. */ public java.lang.String getInstanceId() { return instanceId; } /** The service instance id that deleted binding is bound to. */ public Delete setInstanceId(java.lang.String instanceId) { this.instanceId = instanceId; return this; } /** The id of the binding to delete. */ @com.google.api.client.util.Key private java.lang.String bindingId; /** The id of the binding to delete. */ public java.lang.String getBindingId() { return bindingId; } /** The id of the binding to delete. */ public Delete setBindingId(java.lang.String bindingId) { this.bindingId = bindingId; return this; } /** See CreateServiceInstanceRequest for details. */ @com.google.api.client.util.Key private java.lang.Boolean acceptsIncomplete; /** See CreateServiceInstanceRequest for details. */ public java.lang.Boolean getAcceptsIncomplete() { return acceptsIncomplete; } /** See CreateServiceInstanceRequest for details. */ public Delete setAcceptsIncomplete(java.lang.Boolean acceptsIncomplete) { this.acceptsIncomplete = acceptsIncomplete; return this; } /** The plan id of the service instance. */ @com.google.api.client.util.Key private java.lang.String planId; /** The plan id of the service instance. */ public java.lang.String getPlanId() { return planId; } /** The plan id of the service instance. */ public Delete setPlanId(java.lang.String planId) { this.planId = planId; return this; } /** * Additional query parameter hints. The service id of the service instance. */ @com.google.api.client.util.Key private java.lang.String serviceId; /** Additional query parameter hints. The service id of the service instance. */ public java.lang.String getServiceId() { return serviceId; } /** * Additional query parameter hints. The service id of the service instance. */ public Delete setServiceId(java.lang.String serviceId) { this.serviceId = serviceId; return this; } @Override public Delete set(String parameterName, Object value) { return (Delete) super.set(parameterName, value); } } /** * GetBinding returns the binding information. * * Create a request for the method "service_bindings.get". * * This request holds the parameters needed by the servicebroker server. After setting any optional * parameters, call the {@link Get#execute()} method to invoke the remote operation. * * @param parent Parent must match `projects/[PROJECT_ID]/brokers/[BROKER_ID]`. * @param instanceId Instance id to which the binding is bound. * @param bindingId The binding id. * @return the request */ public Get get(java.lang.String parent, java.lang.String instanceId, java.lang.String bindingId) throws java.io.IOException { Get result = new Get(parent, instanceId, bindingId); initialize(result); return result; } public class Get extends ServiceBrokerRequest<com.google.api.services.servicebroker.v1alpha1.model.GoogleCloudServicebrokerV1alpha1GetBindingResponse> { private static final String REST_PATH = "v1alpha1/{+parent}/v2/service_instances/{+instanceId}/service_bindings/{+bindingId}"; private final java.util.regex.Pattern PARENT_PATTERN = java.util.regex.Pattern.compile("^projects/[^/]+/brokers/[^/]+$"); private final java.util.regex.Pattern INSTANCE_ID_PATTERN = java.util.regex.Pattern.compile("^[^/]+$"); private final java.util.regex.Pattern BINDING_ID_PATTERN = java.util.regex.Pattern.compile("^[^/]+$"); /** * GetBinding returns the binding information. * * Create a request for the method "service_bindings.get". * * This request holds the parameters needed by the the servicebroker server. After setting any * optional parameters, call the {@link Get#execute()} method to invoke the remote operation. <p> * {@link Get#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} * must be called to initialize this instance immediately after invoking the constructor. </p> * * @param parent Parent must match `projects/[PROJECT_ID]/brokers/[BROKER_ID]`. * @param instanceId Instance id to which the binding is bound. * @param bindingId The binding id. * @since 1.13 */ protected Get(java.lang.String parent, java.lang.String instanceId, java.lang.String bindingId) { super(ServiceBroker.this, "GET", REST_PATH, null, com.google.api.services.servicebroker.v1alpha1.model.GoogleCloudServicebrokerV1alpha1GetBindingResponse.class); this.parent = com.google.api.client.util.Preconditions.checkNotNull(parent, "Required parameter parent must be specified."); if (!getSuppressPatternChecks()) { com.google.api.client.util.Preconditions.checkArgument(PARENT_PATTERN.matcher(parent).matches(), "Parameter parent must conform to the pattern " + "^projects/[^/]+/brokers/[^/]+$"); } this.instanceId = com.google.api.client.util.Preconditions.checkNotNull(instanceId, "Required parameter instanceId must be specified."); if (!getSuppressPatternChecks()) { com.google.api.client.util.Preconditions.checkArgument(INSTANCE_ID_PATTERN.matcher(instanceId).matches(), "Parameter instanceId must conform to the pattern " + "^[^/]+$"); } this.bindingId = com.google.api.client.util.Preconditions.checkNotNull(bindingId, "Required parameter bindingId must be specified."); if (!getSuppressPatternChecks()) { com.google.api.client.util.Preconditions.checkArgument(BINDING_ID_PATTERN.matcher(bindingId).matches(), "Parameter bindingId must conform to the pattern " + "^[^/]+$"); } } @Override public com.google.api.client.http.HttpResponse executeUsingHead() throws java.io.IOException { return super.executeUsingHead(); } @Override public com.google.api.client.http.HttpRequest buildHttpRequestUsingHead() throws java.io.IOException { return super.buildHttpRequestUsingHead(); } @Override public Get set$Xgafv(java.lang.String $Xgafv) { return (Get) super.set$Xgafv($Xgafv); } @Override public Get setAccessToken(java.lang.String accessToken) { return (Get) super.setAccessToken(accessToken); } @Override public Get setAlt(java.lang.String alt) { return (Get) super.setAlt(alt); } @Override public Get setCallback(java.lang.String callback) { return (Get) super.setCallback(callback); } @Override public Get setFields(java.lang.String fields) { return (Get) super.setFields(fields); } @Override public Get setKey(java.lang.String key) { return (Get) super.setKey(key); } @Override public Get setOauthToken(java.lang.String oauthToken) { return (Get) super.setOauthToken(oauthToken); } @Override public Get setPrettyPrint(java.lang.Boolean prettyPrint) { return (Get) super.setPrettyPrint(prettyPrint); } @Override public Get setQuotaUser(java.lang.String quotaUser) { return (Get) super.setQuotaUser(quotaUser); } @Override public Get setUploadType(java.lang.String uploadType) { return (Get) super.setUploadType(uploadType); } @Override public Get setUploadProtocol(java.lang.String uploadProtocol) { return (Get) super.setUploadProtocol(uploadProtocol); } /** Parent must match `projects/[PROJECT_ID]/brokers/[BROKER_ID]`. */ @com.google.api.client.util.Key private java.lang.String parent; /** Parent must match `projects/[PROJECT_ID]/brokers/[BROKER_ID]`. */ public java.lang.String getParent() { return parent; } /** Parent must match `projects/[PROJECT_ID]/brokers/[BROKER_ID]`. */ public Get setParent(java.lang.String parent) { if (!getSuppressPatternChecks()) { com.google.api.client.util.Preconditions.checkArgument(PARENT_PATTERN.matcher(parent).matches(), "Parameter parent must conform to the pattern " + "^projects/[^/]+/brokers/[^/]+$"); } this.parent = parent; return this; } /** Instance id to which the binding is bound. */ @com.google.api.client.util.Key private java.lang.String instanceId; /** Instance id to which the binding is bound. */ public java.lang.String getInstanceId() { return instanceId; } /** Instance id to which the binding is bound. */ public Get setInstanceId(java.lang.String instanceId) { if (!getSuppressPatternChecks()) { com.google.api.client.util.Preconditions.checkArgument(INSTANCE_ID_PATTERN.matcher(instanceId).matches(), "Parameter instanceId must conform to the pattern " + "^[^/]+$"); } this.instanceId = instanceId; return this; } /** The binding id. */ @com.google.api.client.util.Key private java.lang.String bindingId; /** The binding id. */ public java.lang.String getBindingId() { return bindingId; } /** The binding id. */ public Get setBindingId(java.lang.String bindingId) { if (!getSuppressPatternChecks()) { com.google.api.client.util.Preconditions.checkArgument(BINDING_ID_PATTERN.matcher(bindingId).matches(), "Parameter bindingId must conform to the pattern " + "^[^/]+$"); } this.bindingId = bindingId; return this; } /** Plan id. */ @com.google.api.client.util.Key private java.lang.String planId; /** Plan id. */ public java.lang.String getPlanId() { return planId; } /** Plan id. */ public Get setPlanId(java.lang.String planId) { this.planId = planId; return this; } /** Service id. */ @com.google.api.client.util.Key private java.lang.String serviceId; /** Service id. */ public java.lang.String getServiceId() { return serviceId; } /** Service id. */ public Get setServiceId(java.lang.String serviceId) { this.serviceId = serviceId; return this; } @Override public Get set(String parameterName, Object value) { return (Get) super.set(parameterName, value); } } /** * Returns the state of the last operation for the binding. Only last (or current) operation can be * polled. * * Create a request for the method "service_bindings.getLast_operation". * * This request holds the parameters needed by the servicebroker server. After setting any optional * parameters, call the {@link GetLastOperation#execute()} method to invoke the remote operation. * * @param parent Parent must match `projects/[PROJECT_ID]/brokers/[BROKER_ID]`. * @param instanceId The instance id that the binding is bound to. * @param bindingId The binding id for which to return the last operation * @return the request */ public GetLastOperation getLastOperation(java.lang.String parent, java.lang.String instanceId, java.lang.String bindingId) throws java.io.IOException { GetLastOperation result = new GetLastOperation(parent, instanceId, bindingId); initialize(result); return result; } public class GetLastOperation extends ServiceBrokerRequest<com.google.api.services.servicebroker.v1alpha1.model.GoogleCloudServicebrokerV1alpha1Operation> { private static final String REST_PATH = "v1alpha1/{+parent}/v2/service_instances/{+instanceId}/service_bindings/{+bindingId}/last_operation"; private final java.util.regex.Pattern PARENT_PATTERN = java.util.regex.Pattern.compile("^projects/[^/]+/brokers/[^/]+$"); private final java.util.regex.Pattern INSTANCE_ID_PATTERN = java.util.regex.Pattern.compile("^[^/]+$"); private final java.util.regex.Pattern BINDING_ID_PATTERN = java.util.regex.Pattern.compile("^[^/]+$"); /** * Returns the state of the last operation for the binding. Only last (or current) operation can * be polled. * * Create a request for the method "service_bindings.getLast_operation". * * This request holds the parameters needed by the the servicebroker server. After setting any * optional parameters, call the {@link GetLastOperation#execute()} method to invoke the remote * operation. <p> {@link GetLastOperation#initialize(com.google.api.client.googleapis.services.Abs * tractGoogleClientRequest)} must be called to initialize this instance immediately after * invoking the constructor. </p> * * @param parent Parent must match `projects/[PROJECT_ID]/brokers/[BROKER_ID]`. * @param instanceId The instance id that the binding is bound to. * @param bindingId The binding id for which to return the last operation * @since 1.13 */ protected GetLastOperation(java.lang.String parent, java.lang.String instanceId, java.lang.String bindingId) { super(ServiceBroker.this, "GET", REST_PATH, null, com.google.api.services.servicebroker.v1alpha1.model.GoogleCloudServicebrokerV1alpha1Operation.class); this.parent = com.google.api.client.util.Preconditions.checkNotNull(parent, "Required parameter parent must be specified."); if (!getSuppressPatternChecks()) { com.google.api.client.util.Preconditions.checkArgument(PARENT_PATTERN.matcher(parent).matches(), "Parameter parent must conform to the pattern " + "^projects/[^/]+/brokers/[^/]+$"); } this.instanceId = com.google.api.client.util.Preconditions.checkNotNull(instanceId, "Required parameter instanceId must be specified."); if (!getSuppressPatternChecks()) { com.google.api.client.util.Preconditions.checkArgument(INSTANCE_ID_PATTERN.matcher(instanceId).matches(), "Parameter instanceId must conform to the pattern " + "^[^/]+$"); } this.bindingId = com.google.api.client.util.Preconditions.checkNotNull(bindingId, "Required parameter bindingId must be specified."); if (!getSuppressPatternChecks()) { com.google.api.client.util.Preconditions.checkArgument(BINDING_ID_PATTERN.matcher(bindingId).matches(), "Parameter bindingId must conform to the pattern " + "^[^/]+$"); } } @Override public com.google.api.client.http.HttpResponse executeUsingHead() throws java.io.IOException { return super.executeUsingHead(); } @Override public com.google.api.client.http.HttpRequest buildHttpRequestUsingHead() throws java.io.IOException { return super.buildHttpRequestUsingHead(); } @Override public GetLastOperation set$Xgafv(java.lang.String $Xgafv) { return (GetLastOperation) super.set$Xgafv($Xgafv); } @Override public GetLastOperation setAccessToken(java.lang.String accessToken) { return (GetLastOperation) super.setAccessToken(accessToken); } @Override public GetLastOperation setAlt(java.lang.String alt) { return (GetLastOperation) super.setAlt(alt); } @Override public GetLastOperation setCallback(java.lang.String callback) { return (GetLastOperation) super.setCallback(callback); } @Override public GetLastOperation setFields(java.lang.String fields) { return (GetLastOperation) super.setFields(fields); } @Override public GetLastOperation setKey(java.lang.String key) { return (GetLastOperation) super.setKey(key); } @Override public GetLastOperation setOauthToken(java.lang.String oauthToken) { return (GetLastOperation) super.setOauthToken(oauthToken); } @Override public GetLastOperation setPrettyPrint(java.lang.Boolean prettyPrint) { return (GetLastOperation) super.setPrettyPrint(prettyPrint); } @Override public GetLastOperation setQuotaUser(java.lang.String quotaUser) { return (GetLastOperation) super.setQuotaUser(quotaUser); } @Override public GetLastOperation setUploadType(java.lang.String uploadType) { return (GetLastOperation) super.setUploadType(uploadType); } @Override public GetLastOperation setUploadProtocol(java.lang.String uploadProtocol) { return (GetLastOperation) super.setUploadProtocol(uploadProtocol); } /** Parent must match `projects/[PROJECT_ID]/brokers/[BROKER_ID]`. */ @com.google.api.client.util.Key private java.lang.String parent; /** Parent must match `projects/[PROJECT_ID]/brokers/[BROKER_ID]`. */ public java.lang.String getParent() { return parent; } /** Parent must match `projects/[PROJECT_ID]/brokers/[BROKER_ID]`. */ public GetLastOperation setParent(java.lang.String parent) { if (!getSuppressPatternChecks()) { com.google.api.client.util.Preconditions.checkArgument(PARENT_PATTERN.matcher(parent).matches(), "Parameter parent must conform to the pattern " + "^projects/[^/]+/brokers/[^/]+$"); } this.parent = parent; return this; } /** The instance id that the binding is bound to. */ @com.google.api.client.util.Key private java.lang.String instanceId; /** The instance id that the binding is bound to. */ public java.lang.String getInstanceId() { return instanceId; } /** The instance id that the binding is bound to. */ public GetLastOperation setInstanceId(java.lang.String instanceId) { if (!getSuppressPatternChecks()) { com.google.api.client.util.Preconditions.checkArgument(INSTANCE_ID_PATTERN.matcher(instanceId).matches(), "Parameter instanceId must conform to the pattern " + "^[^/]+$"); } this.instanceId = instanceId; return this; } /** The binding id for which to return the last operation */ @com.google.api.client.util.Key private java.lang.String bindingId; /** The binding id for which to return the last operation */ public java.lang.String getBindingId() { return bindingId; } /** The binding id for which to return the last operation */ public GetLastOperation setBindingId(java.lang.String bindingId) { if (!getSuppressPatternChecks()) { com.google.api.client.util.Preconditions.checkArgument(BINDING_ID_PATTERN.matcher(bindingId).matches(), "Parameter bindingId must conform to the pattern " + "^[^/]+$"); } this.bindingId = bindingId; return this; } /** * If `operation` was returned during mutation operation, this field must be populated * with the provided value. */ @com.google.api.client.util.Key private java.lang.String operation; /** If `operation` was returned during mutation operation, this field must be populated with the provided value. */ public java.lang.String getOperation() { return operation; } /** * If `operation` was returned during mutation operation, this field must be populated * with the provided value. */ public GetLastOperation setOperation(java.lang.String operation) { this.operation = operation; return this; } /** Plan id. */ @com.google.api.client.util.Key private java.lang.String planId; /** Plan id. */ public java.lang.String getPlanId() { return planId; } /** Plan id. */ public GetLastOperation setPlanId(java.lang.String planId) { this.planId = planId; return this; } /** Service id. */ @com.google.api.client.util.Key private java.lang.String serviceId; /** Service id. */ public java.lang.String getServiceId() { return serviceId; } /** Service id. */ public GetLastOperation setServiceId(java.lang.String serviceId) { this.serviceId = serviceId; return this; } @Override public GetLastOperation set(String parameterName, Object value) { return (GetLastOperation) super.set(parameterName, value); } } } } } } } /** * An accessor for creating requests from the V1alpha1 collection. * * <p>The typical use is:</p> * <pre> * {@code ServiceBroker servicebroker = new ServiceBroker(...);} * {@code ServiceBroker.V1alpha1.List request = servicebroker.v1alpha1().list(parameters ...)} * </pre> * * @return the resource collection */ public V1alpha1 v1alpha1() { return new V1alpha1(); } /** * The "v1alpha1" collection of methods. */ public class V1alpha1 { /** * Gets the access control policy for a resource. Returns an empty policy if the resource exists and * does not have a policy set. * * Create a request for the method "v1alpha1.getIamPolicy". * * This request holds the parameters needed by the servicebroker server. After setting any optional * parameters, call the {@link GetIamPolicy#execute()} method to invoke the remote operation. * * @param resource REQUIRED: The resource for which the policy is being requested. See the operation documentation for * the appropriate value for this field. * @return the request */ public GetIamPolicy getIamPolicy(java.lang.String resource) throws java.io.IOException { GetIamPolicy result = new GetIamPolicy(resource); initialize(result); return result; } public class GetIamPolicy extends ServiceBrokerRequest<com.google.api.services.servicebroker.v1alpha1.model.GoogleIamV1Policy> { private static final String REST_PATH = "v1alpha1/{+resource}:getIamPolicy"; private final java.util.regex.Pattern RESOURCE_PATTERN = java.util.regex.Pattern.compile("^.+$"); /** * Gets the access control policy for a resource. Returns an empty policy if the resource exists * and does not have a policy set. * * Create a request for the method "v1alpha1.getIamPolicy". * * This request holds the parameters needed by the the servicebroker server. After setting any * optional parameters, call the {@link GetIamPolicy#execute()} method to invoke the remote * operation. <p> {@link * GetIamPolicy#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} * must be called to initialize this instance immediately after invoking the constructor. </p> * * @param resource REQUIRED: The resource for which the policy is being requested. See the operation documentation for * the appropriate value for this field. * @since 1.13 */ protected GetIamPolicy(java.lang.String resource) { super(ServiceBroker.this, "GET", REST_PATH, null, com.google.api.services.servicebroker.v1alpha1.model.GoogleIamV1Policy.class); this.resource = com.google.api.client.util.Preconditions.checkNotNull(resource, "Required parameter resource must be specified."); if (!getSuppressPatternChecks()) { com.google.api.client.util.Preconditions.checkArgument(RESOURCE_PATTERN.matcher(resource).matches(), "Parameter resource must conform to the pattern " + "^.+$"); } } @Override public com.google.api.client.http.HttpResponse executeUsingHead() throws java.io.IOException { return super.executeUsingHead(); } @Override public com.google.api.client.http.HttpRequest buildHttpRequestUsingHead() throws java.io.IOException { return super.buildHttpRequestUsingHead(); } @Override public GetIamPolicy set$Xgafv(java.lang.String $Xgafv) { return (GetIamPolicy) super.set$Xgafv($Xgafv); } @Override public GetIamPolicy setAccessToken(java.lang.String accessToken) { return (GetIamPolicy) super.setAccessToken(accessToken); } @Override public GetIamPolicy setAlt(java.lang.String alt) { return (GetIamPolicy) super.setAlt(alt); } @Override public GetIamPolicy setCallback(java.lang.String callback) { return (GetIamPolicy) super.setCallback(callback); } @Override public GetIamPolicy setFields(java.lang.String fields) { return (GetIamPolicy) super.setFields(fields); } @Override public GetIamPolicy setKey(java.lang.String key) { return (GetIamPolicy) super.setKey(key); } @Override public GetIamPolicy setOauthToken(java.lang.String oauthToken) { return (GetIamPolicy) super.setOauthToken(oauthToken); } @Override public GetIamPolicy setPrettyPrint(java.lang.Boolean prettyPrint) { return (GetIamPolicy) super.setPrettyPrint(prettyPrint); } @Override public GetIamPolicy setQuotaUser(java.lang.String quotaUser) { return (GetIamPolicy) super.setQuotaUser(quotaUser); } @Override public GetIamPolicy setUploadType(java.lang.String uploadType) { return (GetIamPolicy) super.setUploadType(uploadType); } @Override public GetIamPolicy setUploadProtocol(java.lang.String uploadProtocol) { return (GetIamPolicy) super.setUploadProtocol(uploadProtocol); } /** * REQUIRED: The resource for which the policy is being requested. See the operation * documentation for the appropriate value for this field. */ @com.google.api.client.util.Key private java.lang.String resource; /** REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field. */ public java.lang.String getResource() { return resource; } /** * REQUIRED: The resource for which the policy is being requested. See the operation * documentation for the appropriate value for this field. */ public GetIamPolicy setResource(java.lang.String resource) { if (!getSuppressPatternChecks()) { com.google.api.client.util.Preconditions.checkArgument(RESOURCE_PATTERN.matcher(resource).matches(), "Parameter resource must conform to the pattern " + "^.+$"); } this.resource = resource; return this; } @Override public GetIamPolicy set(String parameterName, Object value) { return (GetIamPolicy) super.set(parameterName, value); } } /** * Sets the access control policy on the specified resource. Replaces any existing policy. * * Create a request for the method "v1alpha1.setIamPolicy". * * This request holds the parameters needed by the servicebroker server. After setting any optional * parameters, call the {@link SetIamPolicy#execute()} method to invoke the remote operation. * * @param resource REQUIRED: The resource for which the policy is being specified. See the operation documentation for * the appropriate value for this field. * @param content the {@link com.google.api.services.servicebroker.v1alpha1.model.GoogleIamV1SetIamPolicyRequest} * @return the request */ public SetIamPolicy setIamPolicy(java.lang.String resource, com.google.api.services.servicebroker.v1alpha1.model.GoogleIamV1SetIamPolicyRequest content) throws java.io.IOException { SetIamPolicy result = new SetIamPolicy(resource, content); initialize(result); return result; } public class SetIamPolicy extends ServiceBrokerRequest<com.google.api.services.servicebroker.v1alpha1.model.GoogleIamV1Policy> { private static final String REST_PATH = "v1alpha1/{+resource}:setIamPolicy"; private final java.util.regex.Pattern RESOURCE_PATTERN = java.util.regex.Pattern.compile("^.+$"); /** * Sets the access control policy on the specified resource. Replaces any existing policy. * * Create a request for the method "v1alpha1.setIamPolicy". * * This request holds the parameters needed by the the servicebroker server. After setting any * optional parameters, call the {@link SetIamPolicy#execute()} method to invoke the remote * operation. <p> {@link * SetIamPolicy#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} * must be called to initialize this instance immediately after invoking the constructor. </p> * * @param resource REQUIRED: The resource for which the policy is being specified. See the operation documentation for * the appropriate value for this field. * @param content the {@link com.google.api.services.servicebroker.v1alpha1.model.GoogleIamV1SetIamPolicyRequest} * @since 1.13 */ protected SetIamPolicy(java.lang.String resource, com.google.api.services.servicebroker.v1alpha1.model.GoogleIamV1SetIamPolicyRequest content) { super(ServiceBroker.this, "POST", REST_PATH, content, com.google.api.services.servicebroker.v1alpha1.model.GoogleIamV1Policy.class); this.resource = com.google.api.client.util.Preconditions.checkNotNull(resource, "Required parameter resource must be specified."); if (!getSuppressPatternChecks()) { com.google.api.client.util.Preconditions.checkArgument(RESOURCE_PATTERN.matcher(resource).matches(), "Parameter resource must conform to the pattern " + "^.+$"); } } @Override public SetIamPolicy set$Xgafv(java.lang.String $Xgafv) { return (SetIamPolicy) super.set$Xgafv($Xgafv); } @Override public SetIamPolicy setAccessToken(java.lang.String accessToken) { return (SetIamPolicy) super.setAccessToken(accessToken); } @Override public SetIamPolicy setAlt(java.lang.String alt) { return (SetIamPolicy) super.setAlt(alt); } @Override public SetIamPolicy setCallback(java.lang.String callback) { return (SetIamPolicy) super.setCallback(callback); } @Override public SetIamPolicy setFields(java.lang.String fields) { return (SetIamPolicy) super.setFields(fields); } @Override public SetIamPolicy setKey(java.lang.String key) { return (SetIamPolicy) super.setKey(key); } @Override public SetIamPolicy setOauthToken(java.lang.String oauthToken) { return (SetIamPolicy) super.setOauthToken(oauthToken); } @Override public SetIamPolicy setPrettyPrint(java.lang.Boolean prettyPrint) { return (SetIamPolicy) super.setPrettyPrint(prettyPrint); } @Override public SetIamPolicy setQuotaUser(java.lang.String quotaUser) { return (SetIamPolicy) super.setQuotaUser(quotaUser); } @Override public SetIamPolicy setUploadType(java.lang.String uploadType) { return (SetIamPolicy) super.setUploadType(uploadType); } @Override public SetIamPolicy setUploadProtocol(java.lang.String uploadProtocol) { return (SetIamPolicy) super.setUploadProtocol(uploadProtocol); } /** * REQUIRED: The resource for which the policy is being specified. See the operation * documentation for the appropriate value for this field. */ @com.google.api.client.util.Key private java.lang.String resource; /** REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field. */ public java.lang.String getResource() { return resource; } /** * REQUIRED: The resource for which the policy is being specified. See the operation * documentation for the appropriate value for this field. */ public SetIamPolicy setResource(java.lang.String resource) { if (!getSuppressPatternChecks()) { com.google.api.client.util.Preconditions.checkArgument(RESOURCE_PATTERN.matcher(resource).matches(), "Parameter resource must conform to the pattern " + "^.+$"); } this.resource = resource; return this; } @Override public SetIamPolicy set(String parameterName, Object value) { return (SetIamPolicy) super.set(parameterName, value); } } /** * Returns permissions that a caller has on the specified resource. If the resource does not exist, * this will return an empty set of permissions, not a NOT_FOUND error. * * Note: This operation is designed to be used for building permission-aware UIs and command-line * tools, not for authorization checking. This operation may "fail open" without warning. * * Create a request for the method "v1alpha1.testIamPermissions". * * This request holds the parameters needed by the servicebroker server. After setting any optional * parameters, call the {@link TestIamPermissions#execute()} method to invoke the remote operation. * * @param resource REQUIRED: The resource for which the policy detail is being requested. See the operation * documentation for the appropriate value for this field. * @param content the {@link com.google.api.services.servicebroker.v1alpha1.model.GoogleIamV1TestIamPermissionsRequest} * @return the request */ public TestIamPermissions testIamPermissions(java.lang.String resource, com.google.api.services.servicebroker.v1alpha1.model.GoogleIamV1TestIamPermissionsRequest content) throws java.io.IOException { TestIamPermissions result = new TestIamPermissions(resource, content); initialize(result); return result; } public class TestIamPermissions extends ServiceBrokerRequest<com.google.api.services.servicebroker.v1alpha1.model.GoogleIamV1TestIamPermissionsResponse> { private static final String REST_PATH = "v1alpha1/{+resource}:testIamPermissions"; private final java.util.regex.Pattern RESOURCE_PATTERN = java.util.regex.Pattern.compile("^.+$"); /** * Returns permissions that a caller has on the specified resource. If the resource does not * exist, this will return an empty set of permissions, not a NOT_FOUND error. * * Note: This operation is designed to be used for building permission-aware UIs and command-line * tools, not for authorization checking. This operation may "fail open" without warning. * * Create a request for the method "v1alpha1.testIamPermissions". * * This request holds the parameters needed by the the servicebroker server. After setting any * optional parameters, call the {@link TestIamPermissions#execute()} method to invoke the remote * operation. <p> {@link TestIamPermissions#initialize(com.google.api.client.googleapis.services.A * bstractGoogleClientRequest)} must be called to initialize this instance immediately after * invoking the constructor. </p> * * @param resource REQUIRED: The resource for which the policy detail is being requested. See the operation * documentation for the appropriate value for this field. * @param content the {@link com.google.api.services.servicebroker.v1alpha1.model.GoogleIamV1TestIamPermissionsRequest} * @since 1.13 */ protected TestIamPermissions(java.lang.String resource, com.google.api.services.servicebroker.v1alpha1.model.GoogleIamV1TestIamPermissionsRequest content) { super(ServiceBroker.this, "POST", REST_PATH, content, com.google.api.services.servicebroker.v1alpha1.model.GoogleIamV1TestIamPermissionsResponse.class); this.resource = com.google.api.client.util.Preconditions.checkNotNull(resource, "Required parameter resource must be specified."); if (!getSuppressPatternChecks()) { com.google.api.client.util.Preconditions.checkArgument(RESOURCE_PATTERN.matcher(resource).matches(), "Parameter resource must conform to the pattern " + "^.+$"); } } @Override public TestIamPermissions set$Xgafv(java.lang.String $Xgafv) { return (TestIamPermissions) super.set$Xgafv($Xgafv); } @Override public TestIamPermissions setAccessToken(java.lang.String accessToken) { return (TestIamPermissions) super.setAccessToken(accessToken); } @Override public TestIamPermissions setAlt(java.lang.String alt) { return (TestIamPermissions) super.setAlt(alt); } @Override public TestIamPermissions setCallback(java.lang.String callback) { return (TestIamPermissions) super.setCallback(callback); } @Override public TestIamPermissions setFields(java.lang.String fields) { return (TestIamPermissions) super.setFields(fields); } @Override public TestIamPermissions setKey(java.lang.String key) { return (TestIamPermissions) super.setKey(key); } @Override public TestIamPermissions setOauthToken(java.lang.String oauthToken) { return (TestIamPermissions) super.setOauthToken(oauthToken); } @Override public TestIamPermissions setPrettyPrint(java.lang.Boolean prettyPrint) { return (TestIamPermissions) super.setPrettyPrint(prettyPrint); } @Override public TestIamPermissions setQuotaUser(java.lang.String quotaUser) { return (TestIamPermissions) super.setQuotaUser(quotaUser); } @Override public TestIamPermissions setUploadType(java.lang.String uploadType) { return (TestIamPermissions) super.setUploadType(uploadType); } @Override public TestIamPermissions setUploadProtocol(java.lang.String uploadProtocol) { return (TestIamPermissions) super.setUploadProtocol(uploadProtocol); } /** * REQUIRED: The resource for which the policy detail is being requested. See the operation * documentation for the appropriate value for this field. */ @com.google.api.client.util.Key private java.lang.String resource; /** REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field. */ public java.lang.String getResource() { return resource; } /** * REQUIRED: The resource for which the policy detail is being requested. See the operation * documentation for the appropriate value for this field. */ public TestIamPermissions setResource(java.lang.String resource) { if (!getSuppressPatternChecks()) { com.google.api.client.util.Preconditions.checkArgument(RESOURCE_PATTERN.matcher(resource).matches(), "Parameter resource must conform to the pattern " + "^.+$"); } this.resource = resource; return this; } @Override public TestIamPermissions set(String parameterName, Object value) { return (TestIamPermissions) super.set(parameterName, value); } } } /** * Builder for {@link ServiceBroker}. * * <p> * Implementation is not thread-safe. * </p> * * @since 1.3.0 */ public static final class Builder extends com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient.Builder { /** * Returns an instance of a new builder. * * @param transport HTTP transport, which should normally be: * <ul> * <li>Google App Engine: * {@code com.google.api.client.extensions.appengine.http.UrlFetchTransport}</li> * <li>Android: {@code newCompatibleTransport} from * {@code com.google.api.client.extensions.android.http.AndroidHttp}</li> * <li>Java: {@link com.google.api.client.googleapis.javanet.GoogleNetHttpTransport#newTrustedTransport()} * </li> * </ul> * @param jsonFactory JSON factory, which may be: * <ul> * <li>Jackson: {@code com.google.api.client.json.jackson2.JacksonFactory}</li> * <li>Google GSON: {@code com.google.api.client.json.gson.GsonFactory}</li> * <li>Android Honeycomb or higher: * {@code com.google.api.client.extensions.android.json.AndroidJsonFactory}</li> * </ul> * @param httpRequestInitializer HTTP request initializer or {@code null} for none * @since 1.7 */ public Builder(com.google.api.client.http.HttpTransport transport, com.google.api.client.json.JsonFactory jsonFactory, com.google.api.client.http.HttpRequestInitializer httpRequestInitializer) { super( transport, jsonFactory, DEFAULT_ROOT_URL, DEFAULT_SERVICE_PATH, httpRequestInitializer, false); setBatchPath(DEFAULT_BATCH_PATH); } /** Builds a new instance of {@link ServiceBroker}. */ @Override public ServiceBroker build() { return new ServiceBroker(this); } @Override public Builder setRootUrl(String rootUrl) { return (Builder) super.setRootUrl(rootUrl); } @Override public Builder setServicePath(String servicePath) { return (Builder) super.setServicePath(servicePath); } @Override public Builder setBatchPath(String batchPath) { return (Builder) super.setBatchPath(batchPath); } @Override public Builder setHttpRequestInitializer(com.google.api.client.http.HttpRequestInitializer httpRequestInitializer) { return (Builder) super.setHttpRequestInitializer(httpRequestInitializer); } @Override public Builder setApplicationName(String applicationName) { return (Builder) super.setApplicationName(applicationName); } @Override public Builder setSuppressPatternChecks(boolean suppressPatternChecks) { return (Builder) super.setSuppressPatternChecks(suppressPatternChecks); } @Override public Builder setSuppressRequiredParameterChecks(boolean suppressRequiredParameterChecks) { return (Builder) super.setSuppressRequiredParameterChecks(suppressRequiredParameterChecks); } @Override public Builder setSuppressAllChecks(boolean suppressAllChecks) { return (Builder) super.setSuppressAllChecks(suppressAllChecks); } /** * Set the {@link ServiceBrokerRequestInitializer}. * * @since 1.12 */ public Builder setServiceBrokerRequestInitializer( ServiceBrokerRequestInitializer servicebrokerRequestInitializer) { return (Builder) super.setGoogleClientRequestInitializer(servicebrokerRequestInitializer); } @Override public Builder setGoogleClientRequestInitializer( com.google.api.client.googleapis.services.GoogleClientRequestInitializer googleClientRequestInitializer) { return (Builder) super.setGoogleClientRequestInitializer(googleClientRequestInitializer); } } }
9cd4378f909362bf2d78c2443bbfeeefb113a02b
896cca57024190fc3fbb62f2bd0188fff24b24c8
/2.7.x/choicemaker-cm/choicemaker-modeling/com.choicemaker.cm.matching.en.us.train/src/main/java/com/choicemaker/cm/matching/en/us/train/name/NameGrammarTrainer.java
27f0ffbdb61b4227ff349e8e9fe7f2e56138e195
[]
no_license
fgregg/cm
0d4f50f92fde2a0bed465f2bec8eb7f2fad8362c
c0ab489285938f14cdf0a6ed64bbda9ac4d04532
refs/heads/master
2021-01-10T11:27:00.663407
2015-08-11T19:35:00
2015-08-11T19:35:00
55,807,163
0
1
null
null
null
null
UTF-8
Java
false
false
1,937
java
/* * Copyright (c) 2001, 2009 ChoiceMaker Technologies, Inc. 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: * ChoiceMaker Technologies, Inc. - initial API and implementation */ package com.choicemaker.cm.matching.en.us.train.name; import java.io.FileInputStream; import com.choicemaker.cm.core.util.CommandLineArguments; import com.choicemaker.cm.matching.cfg.ContextFreeGrammar; import com.choicemaker.cm.matching.cfg.SymbolFactory; import com.choicemaker.cm.matching.cfg.train.GrammarTrainer; import com.choicemaker.cm.matching.cfg.train.ParsedDataReader; import com.choicemaker.cm.matching.cfg.xmlconf.ContextFreeGrammarXmlConf; import com.choicemaker.cm.matching.en.us.name.NameSymbolFactory; import com.choicemaker.e2.CMPlatformRunnable; /** * . * * @author Adam Winkel * @version $Revision: 1.1.1.1 $ $Date: 2009/05/03 16:03:04 $ */ public class NameGrammarTrainer implements CMPlatformRunnable { public Object run(Object argObj) throws Exception { String[] args = CommandLineArguments.eclipseArgsMapper(argObj); if (args.length < 2) { System.err.println("Need at least two arguments: grammar file and parsed data file(s)"); System.exit(1); } String grammarFileName = args[0]; SymbolFactory factory = new NameSymbolFactory(); ContextFreeGrammar grammar = ContextFreeGrammarXmlConf.readFromFile(grammarFileName, factory); GrammarTrainer trainer = new GrammarTrainer(grammar); for (int i = 1; i < args.length; i++) { FileInputStream is = new FileInputStream(args[i]); ParsedDataReader rdr = new ParsedDataReader(is, factory, grammar); trainer.readParseTrees(rdr); is.close(); } trainer.writeAll(); return null; } }
834f245b3cd69787c5927a91a19c0e2e3aa182b2
63330b7c9232b828a91dee24044353c082e83658
/Java_023_ScoreManager/src/com/callor/score/files/FileReader_01.java
03e705122aae11b6bd92ed64a1263eaf0c70eb46
[]
no_license
ksoyoun02/Biz_2021_01_403_java
0dbc110eaff86b25b1a0d4e4ad3b9a4b22ea8a68
d37e9511d943bec308f77fab81c9ac876307fd8a
refs/heads/master
2023-06-07T17:16:34.789399
2021-06-27T07:40:49
2021-06-27T07:40:49
334,835,412
0
0
null
null
null
null
UTF-8
Java
false
false
2,338
java
package com.callor.score.files; import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import java.util.List; import com.callor.score.model.ScoreVO; import com.callor.score.values.Values; public class FileReader_01 { public static void main(String[] args) { List<ScoreVO> scoreList = new ArrayList<ScoreVO>(); List<String> strLines = new ArrayList<String>(); String scoreFile = "src/com/callor/score/files/nums_rnd.txt"; FileReader fileReader = null; BufferedReader buffer = null; try { fileReader = new FileReader(scoreFile); buffer = new BufferedReader(fileReader); while (true) { String str = buffer.readLine(); if (str == null) { break; } strLines.add(str); } buffer.close(); fileReader.close(); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } for(String str : strLines) { String[] scores = str.split(":"); ScoreVO scoreVO = new ScoreVO(); scoreVO.setKor(Integer.valueOf(scores[0])); scoreVO.setEng(Integer.valueOf(scores[1])); scoreVO.setMath(Integer.valueOf(scores[2])); scoreVO.setHistory(Integer.valueOf(scores[3])); scoreVO.setMusic(Integer.valueOf(scores[4])); scoreList.add(scoreVO); } for(ScoreVO vo : scoreList) { int sum = vo.getKor(); sum += vo.getEng(); sum += vo.getMath(); sum += vo.getMusic(); sum += vo.getHistory(); float avg = (float)sum / 5; vo.setTotal(sum); vo.setAvg(avg); } System.out.println(Values.dLine); System.out.println("순번\t국어\t영어\t수학\t음악\t국사\t총점\t평균"); System.out.println(Values.sLine); int nSize = scoreList.size(); for(int i = 0 ; i < nSize; i++) { ScoreVO vo = scoreList.get(i); int num = i + 1; System.out.print(num + "\t"); System.out.print(vo.getKor() + "\t"); System.out.print(vo.getEng() + "\t"); System.out.print(vo.getMath() + "\t"); System.out.print(vo.getMusic() + "\t"); System.out.print(vo.getHistory() + "\t"); System.out.print(vo.getTotal() + "\t"); System.out.print(vo.getAvg() + "\n"); } System.out.println(Values.dLine); } }
7e8265ee3d103946f2f5dda1e5a2b2cd01e38564
5b4553efa42bfc8992795cbf5de5eda7a876701b
/src/main/java/org/killbill/billing/plugin/dwolla/util/JsonHelper.java
fc56b80b8cefa9467e7f6472f77d3243735016ef
[ "Apache-2.0" ]
permissive
matias-aguero-hs/killbill-dwolla-plugin
dfef27e9e21128e0523a980d9de21d5c463b6d44
c8548430f32de0c743cd7edfe6988002bea5a42c
refs/heads/master
2020-05-30T13:56:01.690884
2016-10-11T18:01:45
2016-10-11T18:01:45
66,856,403
0
0
null
2016-08-29T15:35:09
2016-08-29T15:35:09
null
UTF-8
Java
false
false
1,550
java
/* * Copyright 2016 The Billing Project, LLC * * The Billing Project 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.killbill.billing.plugin.dwolla.util; import com.fasterxml.jackson.databind.ObjectMapper; import org.killbill.billing.payment.plugin.api.PaymentPluginApiException; public class JsonHelper { /** * Convert servlet request (in json string format) into a java object * * @param jsonString * @param clazz * @return */ public static <T> T getObjectFromRequest(final String jsonString, final Class<T> clazz) throws PaymentPluginApiException { try { ObjectMapper mapper = new ObjectMapper(); return mapper.readValue(jsonString, clazz); } catch (Exception e) { throw new PaymentPluginApiException("Exception during generation of the Object from JSON", e.getCause()); } } public static String getIdFromUrl(final String url) { return url.substring(url.lastIndexOf("/") + 1); } }
fda0db885f98c1a95dc1cfa8e4de666ec0271915
dc0b8d47d0f59f3d2c7bab3a03573ddb388440cf
/src/main/java/pl/ioprojekt/wypozyczalniarowerow/service/BikeService.java
63c1562aa9e6d0e6cc2a70f3456db43c8da15e58
[]
no_license
OskWal048/wypozyczalniarowerow
5a714a4eb55f6dfdb3ab1c435be8b5b2b33a879d
e6c98d2f26ded56238487a938b0ed9773027eba6
refs/heads/master
2023-03-08T02:24:05.512972
2021-02-23T11:20:35
2021-02-23T11:20:35
321,037,808
1
0
null
null
null
null
UTF-8
Java
false
false
715
java
package pl.ioprojekt.wypozyczalniarowerow.service; import org.javatuples.Pair; import pl.ioprojekt.wypozyczalniarowerow.entity.Bike; import java.time.LocalDate; import java.util.List; public interface BikeService { List<Bike> findAll(); Bike findById(int id); void save(Bike bike); List<String> findColumnValues(String columnName); List<Bike> findFiltered(String brand, String color, String type); List<Bike> findFiltered(String brand, String color, String type, LocalDate date1, LocalDate date2); List<Pair<LocalDate, LocalDate>> findReservations(int id); List<Bike> filterByUsername(List<Bike> list, String username); List<Bike> filterUnusable(List<Bike> list); }
bee81679f62d11ab0f8937af74749d01efbbf8f9
19e0171e2f512d3d6e64497ce818872da3b7c78e
/source/server/nourriture-web/src/main/java/edu/bjtu/nourriture_web/restfulservice/CustomerRestfulService.java
2be6506a5160f907dc1dfaba300db3828a521ea1
[]
no_license
FreeDao/nourriture
6639ce9190f29ecef81b833a3bdd4a7492c81046
3075e2a117272b51adb1a4f5239635035d45888c
refs/heads/master
2021-01-18T09:18:05.921836
2014-12-19T07:47:19
2014-12-19T07:47:19
null
0
0
null
null
null
null
UTF-8
Java
false
false
19,190
java
package edu.bjtu.nourriture_web.restfulservice; import java.util.List; import javax.ws.rs.DELETE; import javax.ws.rs.DefaultValue; import javax.ws.rs.FormParam; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import com.google.gson.JsonArray; import com.google.gson.JsonObject; import com.google.gson.JsonParser; import edu.bjtu.nourriture_web.bean.Customer; import edu.bjtu.nourriture_web.common.JsonUtil; import edu.bjtu.nourriture_web.common.RestfulServiceUtil; import edu.bjtu.nourriture_web.idao.ICustomerDao; import edu.bjtu.nourriture_web.idao.IFlavourDao; import edu.bjtu.nourriture_web.idao.IFoodCategoryDao; import edu.bjtu.nourriture_web.idao.IRecipeCategoryDao; @Path("customer") @Produces("application/json;charset=UTF-8") public class CustomerRestfulService { //dao private ICustomerDao customerDao; private IFlavourDao flavourDao; private IFoodCategoryDao foodCategoryDao; private IRecipeCategoryDao recipeCategoryDao; //direct children links private JsonArray customerChildrenLinks; private JsonArray searchChildrenLinks; private JsonArray loginChildrenLinks; private JsonArray idChildrenLinks; private JsonArray interestChildrenLinks; //get set method for spring IOC public ICustomerDao getCustomerDao() { return customerDao; } public void setCustomerDao(ICustomerDao customerDao) { this.customerDao = customerDao; } public IFlavourDao getFlavourDao() { return flavourDao; } public void setFlavourDao(IFlavourDao flavourDao) { this.flavourDao = flavourDao; } public IFoodCategoryDao getFoodCategoryDao() { return foodCategoryDao; } public void setFoodCategoryDao(IFoodCategoryDao foodCategoryDao) { this.foodCategoryDao = foodCategoryDao; } public IRecipeCategoryDao getRecipeCategoryDao() { return recipeCategoryDao; } public void setRecipeCategoryDao(IRecipeCategoryDao recipeCategoryDao) { this.recipeCategoryDao = recipeCategoryDao; } { //initialize direct children links customerChildrenLinks = new JsonArray(); RestfulServiceUtil.addChildrenLinks(customerChildrenLinks, "search customer", "/search", "GET"); RestfulServiceUtil.addChildrenLinks(customerChildrenLinks, "login", "/login", "GET"); RestfulServiceUtil.addChildrenLinks(customerChildrenLinks, "get customer according to id", "/{id}", "GET"); RestfulServiceUtil.addChildrenLinks(customerChildrenLinks, "update customer according to id", "/{id}", "PUT"); searchChildrenLinks = new JsonArray(); loginChildrenLinks = new JsonArray(); idChildrenLinks = new JsonArray(); RestfulServiceUtil.addChildrenLinks(idChildrenLinks, "get customer interests", "/{interest}", "GET"); RestfulServiceUtil.addChildrenLinks(idChildrenLinks, "add a customer interest", "/{interest}", "POST"); RestfulServiceUtil.addChildrenLinks(idChildrenLinks, "delete a customer interest", "/{interest}", "DELETE"); interestChildrenLinks = new JsonArray(); } /** add a customer **/ @POST public String addCustomer(@FormParam("name") String name,@FormParam("password") String password, @FormParam("sex") int sex,@FormParam("age") int age){ JsonObject ret = new JsonObject(); //define error code final int ERROR_CODE_USER_EXIST = -1; final int ERROR_CODE_BAD_PARAM = -2; //check request parameters if(name == null || name.equals("") || password == null || password.equals("") || (sex != 0 && sex != 1) || age < 0){ ret.addProperty("errorCode", ERROR_CODE_BAD_PARAM); ret.add("links", customerChildrenLinks); return ret.toString(); } //check if user name is already exist if(customerDao.isNameExist(name)){ ret.addProperty("errorCode", ERROR_CODE_USER_EXIST); ret.add("links", customerChildrenLinks); return ret.toString(); } //add one row to database Customer customer = new Customer(); customer.setName(name); customer.setPassword(password); customer.setSex(sex); customer.setAge(age); ret.addProperty("id", customerDao.add(customer)); ret.add("links", customerChildrenLinks); return ret.toString(); } /** search customer by name **/ @GET @Path("search") public String searchByName(@QueryParam("name") String name){ JsonObject ret = new JsonObject(); //define error code final int ERROR_CODE_NO_RESULT = -1; final int ERROR_CODE_BAD_PARAM = -2; //check request parameters if(name == null || name.equals("")){ ret.addProperty("errorCode", ERROR_CODE_BAD_PARAM); ret.add("links", searchChildrenLinks); return ret.toString(); } //search in the database List<Customer> list = customerDao.searchByName(name); if(list.isEmpty()){ ret.addProperty("errorCode", ERROR_CODE_NO_RESULT); ret.add("links", searchChildrenLinks); return ret.toString(); } JsonArray customers = new JsonArray(); for(Customer customer : list){ JsonObject jCustomer = transformCustomer(customer); customers.add(jCustomer); } ret.add("customers", customers); ret.add("links", searchChildrenLinks); return ret.toString(); } /** login by name and password **/ @GET @Path("login") public String login(@QueryParam("name")String name,@QueryParam("password") String password){ JsonObject ret = new JsonObject(); //define error code final int ERROR_CODE_USER_NOT_EXIST = -1; final int ERROR_CODE_PASSWORD_NOT_VALIDATED = -2; final int ERROR_CODE_BAD_PARAM = -3; //check request parameters if(name == null || name.equals("") || password == null || password.equals("")){ ret.addProperty("errorCode", ERROR_CODE_BAD_PARAM); ret.add("links", loginChildrenLinks); return ret.toString(); } //check if user name is exsit if(!customerDao.isNameExist(name)){ ret.addProperty("errorCode", ERROR_CODE_USER_NOT_EXIST); ret.add("links", loginChildrenLinks); return ret.toString(); } //check password int loginResult = customerDao.login(name, password); if(loginResult == -1){ ret.addProperty("errorCode", ERROR_CODE_PASSWORD_NOT_VALIDATED); ret.add("links", loginChildrenLinks); return ret.toString(); } ret.addProperty("id", loginResult); ret.add("links", loginChildrenLinks); return ret.toString(); } /** get detail information about a customer by id **/ @GET @Path("{id}") public String getById(@PathParam("id") int id){ JsonObject ret = new JsonObject(); //select from database Customer customer = customerDao.getById(id); if(customer != null) { JsonObject jCustomer = transformCustomer(customer); ret.add("customer", jCustomer); } ret.add("links", idChildrenLinks); return ret.toString(); } /** update customer basic information **/ @PUT @Path("{id}") public String updateCustomer(@PathParam("id") int id, @FormParam("age") @DefaultValue("-1") int age, @FormParam("sex") @DefaultValue("-1") int sex){ JsonObject ret = new JsonObject(); //define error code final int ERROR_CODE_USER_NOT_EXIST = -1; final int ERROR_CODE_BAD_PARAM = -2; //check request parameters if((sex != 0 && sex != 1) && age < 0){ ret.addProperty("errorCode", ERROR_CODE_BAD_PARAM); ret.add("links", idChildrenLinks); return ret.toString(); } //check if user exsit Customer customer = customerDao.getById(id); if(customer == null){ ret.addProperty("errorCode", ERROR_CODE_USER_NOT_EXIST); ret.add("links", idChildrenLinks); return ret.toString(); } if(age >= 0) customer.setAge(age); if(sex == 0 || sex == 1) customer.setSex(sex); customerDao.update(customer); ret.addProperty("result", 0); ret.add("links", idChildrenLinks); return ret.toString(); } /** get insterests **/ @GET @Path("{id}/{interest}") public String getInterests(@PathParam("id") int id,@PathParam("interest") String interest){ JsonObject ret = new JsonObject(); //define error code final int ERROR_CODE_USER_NOT_EXIST = -1; final int ERROR_CODE_INTEREST_NOT_SET = -2; final int ERROR_CODE_BAD_PARAM = -3; //check request parameters if(id <= 0 || interest == null || interest.equals("") || (!interest.equals("flavour") && !interest.equals("foodCategory") && !interest.equals("recipeCategory"))){ ret.addProperty("errorCode", ERROR_CODE_BAD_PARAM); ret.add("links", interestChildrenLinks); return ret.toString(); } //check if user exsit Customer customer = customerDao.getById(id); if(customer == null){ ret.addProperty("errorCode", ERROR_CODE_USER_NOT_EXIST); ret.add("links", interestChildrenLinks); return ret.toString(); } //check if interest is not setted if(interest.equals("flavour")){ String sIds = customer.getInterestFlavourIds(); if(sIds == null || sIds.equals("")){ ret.addProperty("errorCode", ERROR_CODE_INTEREST_NOT_SET); ret.add("links", interestChildrenLinks); return ret.toString(); } else { JsonArray flavours = new JsonArray(); String[] ids = sIds.split(","); for(String sid : ids){ int fId = Integer.parseInt(sid); JsonObject flavour = JsonUtil.beanToJson(flavourDao.getById(fId)); flavour.remove("topFlavour"); flavour.remove("superiorFlavourId"); flavours.add(flavour); } ret.add("flavours", flavours); ret.add("links", interestChildrenLinks); return ret.toString(); } } else if(interest.equals("foodCategory")){ String sIds = customer.getInterestFoodCategoryIds(); if(sIds == null || sIds.equals("")){ ret.addProperty("errorCode", ERROR_CODE_INTEREST_NOT_SET); ret.add("links", interestChildrenLinks); return ret.toString(); } else { JsonArray foodCategorys = new JsonArray(); String[] ids = sIds.split(","); for(String sid : ids){ int fId = Integer.parseInt(sid); JsonObject foodCategory = JsonUtil.beanToJson(foodCategoryDao.getById(fId)); foodCategory.remove("topCategory"); foodCategory.remove("superiorCategoryId"); foodCategorys.add(foodCategory); } ret.add("foodCategorys", foodCategorys); ret.add("links", interestChildrenLinks); return ret.toString(); } } else { String sIds = customer.getInterestRecipeCategoryIds(); if(sIds == null || sIds.equals("")){ ret.addProperty("errorCode", ERROR_CODE_INTEREST_NOT_SET); ret.add("links", interestChildrenLinks); return ret.toString(); } else { JsonArray recipeCategorys = new JsonArray(); String[] ids = sIds.split(","); for(String sid : ids){ int fId = Integer.parseInt(sid); JsonObject recipeCategory = JsonUtil.beanToJson(recipeCategoryDao.getById(fId)); recipeCategory.remove("topCategory"); recipeCategory.remove("superiorCategoryId"); recipeCategorys.add(recipeCategory); } ret.add("foodCategorys", recipeCategorys); ret.add("links", interestChildrenLinks); return ret.toString(); } } } /** add a interest **/ @POST @Path("{id}/{interest}") public String addInterest(@PathParam("id") int id,@PathParam("interest") String interest, @FormParam("id") int InId){ JsonObject ret = new JsonObject(); //define error code final int ERROR_CODE_USER_NOT_EXIST = -1; final int ERROR_CODE_INTEREST_NOT_EXIST = -2; final int ERROR_CODE_INTEREST_ALREADY_SET = -3; final int ERROR_CODE_BAD_PARAM = -4; //check request parameters if(id <= 0 || interest == null || interest.equals("") || (!interest.equals("flavour") && !interest.equals("foodCategory") && !interest.equals("recipeCategory")) || InId < 0){ ret.addProperty("errorCode", ERROR_CODE_BAD_PARAM); ret.add("links", interestChildrenLinks); return ret.toString(); } //check if user exsit Customer customer = customerDao.getById(id); if(customer == null){ ret.addProperty("errorCode", ERROR_CODE_USER_NOT_EXIST); ret.add("links", interestChildrenLinks); return ret.toString(); } //check if interest exsit if((interest.equals("flavour") && flavourDao.getById(InId) == null) || (interest.equals("foodCategory") && foodCategoryDao.getById(InId) == null) || (interest.equals("recipeCategory") && recipeCategoryDao.getById(InId) == null)){ ret.addProperty("errorCode", ERROR_CODE_INTEREST_NOT_EXIST); ret.add("links", interestChildrenLinks); return ret.toString(); } //check if interest is already setted if(interest.equals("flavour")){ String sIds = customer.getInterestFlavourIds(); if(sIds != null){ if(sIds.contains(String.valueOf(InId))){ ret.addProperty("errorCode", ERROR_CODE_INTEREST_ALREADY_SET); ret.add("links", interestChildrenLinks); return ret.toString(); } } } else if(interest.equals("foodCategory")){ String sIds = customer.getInterestFoodCategoryIds(); if(sIds != null){ if(sIds.contains(String.valueOf(InId))){ ret.addProperty("errorCode", ERROR_CODE_INTEREST_ALREADY_SET); ret.add("links", interestChildrenLinks); return ret.toString(); } } } else { String sIds = customer.getInterestRecipeCategoryIds(); if(sIds != null){ if(sIds.contains(String.valueOf(InId))){ ret.addProperty("errorCode", ERROR_CODE_INTEREST_ALREADY_SET); ret.add("links", interestChildrenLinks); return ret.toString(); } } } //add interest to database if(interest.equals("flavour")){ String sIds = customer.getInterestFlavourIds(); if(sIds == null || sIds.equals("")) sIds = String.valueOf(InId); else sIds += ("," + InId); customer.setInterestFlavourIds(sIds); } else if(interest.equals("foodCategory")){ String sIds = customer.getInterestFoodCategoryIds(); if(sIds == null || sIds.equals("")) sIds = String.valueOf(InId); else sIds += ("," + InId); customer.setInterestFoodCategoryIds(sIds); } else { String sIds = customer.getInterestRecipeCategoryIds(); if(sIds == null || sIds.equals("")) sIds = String.valueOf(InId); else sIds += ("," + InId); customer.setInterestRecipeCategoryIds(sIds); } customerDao.update(customer); ret.addProperty("result", 0); ret.add("links", interestChildrenLinks); return ret.toString(); } /** delete a interest **/ @DELETE @Path("{id}/{interest}") public String deleteInterest(@PathParam("id") int id,@PathParam("interest") String interest, @FormParam("id") int InId){ JsonObject ret = new JsonObject(); //define error code final int ERROR_CODE_USER_NOT_EXIST = -1; final int ERROR_CODE_INTEREST_NOT_EXIST = -2; final int ERROR_CODE_INTEREST_NOT_SET = -3; final int ERROR_CODE_BAD_PARAM = -4; //check request parameters if(id <= 0 || interest == null || interest.equals("") || (!interest.equals("flavour") && !interest.equals("foodCategory") && !interest.equals("recipeCategory")) || InId < 0){ ret.addProperty("errorCode", ERROR_CODE_BAD_PARAM); ret.add("links", interestChildrenLinks); return ret.toString(); } //check if user exsit Customer customer = customerDao.getById(id); if(customer == null){ ret.addProperty("errorCode", ERROR_CODE_USER_NOT_EXIST); ret.add("links", interestChildrenLinks); return ret.toString(); } //check if interest exsit if((interest.equals("flavour") && flavourDao.getById(InId) == null) || (interest.equals("foodCategory") && foodCategoryDao.getById(InId) == null) || (interest.equals("recipeCategory") && recipeCategoryDao.getById(InId) == null)){ ret.addProperty("errorCode", ERROR_CODE_INTEREST_NOT_EXIST); ret.add("links", interestChildrenLinks); return ret.toString(); } //check if interest is already setted if(interest.equals("flavour")){ String sIds = customer.getInterestFlavourIds(); if(sIds == null || sIds.equals("") || !sIds.contains(String.valueOf(InId))){ ret.addProperty("errorCode", ERROR_CODE_INTEREST_NOT_SET); ret.add("links", interestChildrenLinks); return ret.toString(); } } else if(interest.equals("foodCategory")){ String sIds = customer.getInterestFoodCategoryIds(); if(sIds == null || sIds.equals("") || !sIds.contains(String.valueOf(InId))){ ret.addProperty("errorCode", ERROR_CODE_INTEREST_NOT_SET); ret.add("links", interestChildrenLinks); return ret.toString(); } } else { String sIds = customer.getInterestRecipeCategoryIds(); if(sIds == null || sIds.equals("") || !sIds.contains(String.valueOf(InId))){ ret.addProperty("errorCode", ERROR_CODE_INTEREST_NOT_SET); ret.add("links", interestChildrenLinks); return ret.toString(); } } //delete interest to database if(interest.equals("flavour")){ String sIds = customer.getInterestFlavourIds(); customer.setInterestFlavourIds(RestfulServiceUtil.deleteIdFromIdList(InId, sIds)); } else if(interest.equals("foodCategory")){ String sIds = customer.getInterestFoodCategoryIds(); customer.setInterestFoodCategoryIds(RestfulServiceUtil.deleteIdFromIdList(InId, sIds)); } else { String sIds = customer.getInterestRecipeCategoryIds(); customer.setInterestRecipeCategoryIds(RestfulServiceUtil.deleteIdFromIdList(InId, sIds)); } customerDao.update(customer); ret.addProperty("result", 0); ret.add("links", interestChildrenLinks); return ret.toString(); } /** * transform customer from bean to json,customer interest ids will be transformed to detail information * @param bean form of customer * @return json form of customer */ private JsonObject transformCustomer(Customer customer){ JsonObject jCustomer = JsonUtil.beanToJson(customer); //get flavour infomations String str = customer.getInterestFlavourIds(); JsonArray flavours = new JsonArray(); if(str != null && !str.equals("")) { String[] ids = str.split(","); for(String id : ids){ int fId = Integer.parseInt(id); JsonObject flavour = JsonUtil.beanToJson(flavourDao.getById(fId)); flavour.remove("topFlavour"); flavour.remove("superiorFlavourId"); flavours.add(flavour); } } jCustomer.remove("interestFlavourIds"); jCustomer.add("interestFlavours", flavours); //get food category informations str = customer.getInterestFoodCategoryIds(); JsonArray foodCategorys = new JsonArray(); if(str != null && !str.equals("")) { String[] ids = str.split(","); for(String id : ids){ int fId = Integer.parseInt(id); JsonObject foodCategory = JsonUtil.beanToJson(foodCategoryDao.getById(fId)); foodCategory.remove("topCategory"); foodCategory.remove("superiorCategoryId"); flavours.add(foodCategory); } } jCustomer.remove("interestFoodCategoryIds"); jCustomer.add("interestFoodCategorys", foodCategorys); //get food recipe informations str = customer.getInterestRecipeCategoryIds(); JsonArray recipeCategorys = new JsonArray(); if(str != null && !str.equals("")) { String[] ids = str.split(","); for(String id : ids){ int fId = Integer.parseInt(id); JsonObject recipeCategory = JsonUtil.beanToJson(recipeCategoryDao.getById(fId)); recipeCategory.remove("topCategory"); recipeCategory.remove("superiorCategoryId"); flavours.add(recipeCategory); } } jCustomer.remove("interestRecipeCategoryIds"); jCustomer.add("interestRecipeCategorys", recipeCategorys); return jCustomer; } }
ee4dffee968bfb052cb53c6a01c779ae31a9bc8a
1b422ba91dc8315ba0f6ecdcb5b4c96d6da37524
/src/com/jude/controller/TaskController.java
0ca8491323700e41b71bdffc8460e12d240770cb
[ "Apache-2.0" ]
permissive
hairlun/customer-visit-web
b02580196e97b746588c2a888685b2fc2463b794
b9200f78abe3a33710503c43af6211d524164221
refs/heads/master
2020-04-15T13:38:36.221967
2016-12-22T02:15:00
2016-12-22T02:15:00
59,732,623
0
0
null
null
null
null
UTF-8
Java
false
false
10,782
java
package com.jude.controller; import com.jude.entity.Customer; import com.jude.entity.CustomerManager; import com.jude.entity.RecordDetail; import com.jude.entity.Task; import com.jude.json.JSONObject; import com.jude.service.CustomerManagerService; import com.jude.service.CustomerService; import com.jude.service.TaskService; import com.jude.util.ExtJS; import com.jude.util.HttpUtils; import com.jude.util.IdUtil; import com.jude.util.PagingSet; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Map; import java.util.Set; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; @Controller @RequestMapping({ "/task.do" }) public class TaskController { private static final Logger log = LoggerFactory.getLogger(TaskController.class); @Autowired private CustomerService customerService; @Autowired private CustomerManagerService managerService; @Autowired private TaskService taskService; private SimpleDateFormat sf; public TaskController() { this.sf = new SimpleDateFormat("yyyy年MM月dd日"); } @RequestMapping(params = { "action=forwardIndex" }) public String forwardIndex() { return "task/index.jsp"; } @RequestMapping(params = { "action=normal" }) @ResponseBody public JSONObject normalTask(HttpServletRequest request, HttpServletResponse response) throws ParseException { try { if ((LoginInfo.getUser(request) == null) || (!"admin".equals(LoginInfo.getUser(request).getUsername()))) { return ExtJS.ok("非admin用户不能发放任务!"); } Date start = this.sf.parse(request.getParameter("start")); Date end = this.sf.parse(request.getParameter("end")); if (start.after(end)) { return ExtJS.ok("起始时间不能大于任务完成时间!"); } List<Task> tasks = new ArrayList<Task>(); for (Customer customer : this.customerService.getCustomers(0, 1000000).getList()) { if (customer.getCustomerManager() == null) { continue; } Task task = new Task(); task.setContent(request.getParameter("content")); task.setCustomer(customer); task.setManager(customer.getCustomerManager()); task.setStart(start); task.setEnd(end); task.setId(IdUtil.getId()); tasks.add(task); } if (tasks.size() < 1) { return ExtJS.ok("无客户,请添加客户后重试!"); } List cs = new ArrayList(); Map map = HttpUtils.getRequestParam(request); Set<String> keySet = map.keySet(); for (String s : keySet) { if ((s.matches("^content.+")) && (!s.equals("content"))) { RecordDetail detail = new RecordDetail(); detail.setContent(map.get(s) + ""); cs.add(detail); } } this.taskService.addTask(tasks, cs); return ExtJS.ok("发放成功!"); } catch (Exception e) { log.error("error", e); } return ExtJS.ok("发放常规任务失败,请重试!"); } // @RequestMapping(params = { "action=indevi" }) // @ResponseBody // public JSONObject indeviTask(String mids, String content, HttpServletRequest request, // HttpServletResponse response) { // try { // if ((LoginInfo.getUser(request) == null) // || (!"admin".equals(LoginInfo.getUser(request).getUsername()))) { // return ExtJS.ok("非admin用户不能发放任务!"); // } // // mids = mids.substring(1, mids.length()); // // Date start = this.sf.parse(request.getParameter("start")); // Date end = this.sf.parse(request.getParameter("end")); // if (start.after(end)) { // return ExtJS.ok("起始时间不能大于任务完成时间!"); // } // // List<Customer> list = this.customerService.getCustomersByManagerIds(mids); // List tasks = new ArrayList(); // int idx = 0; // for (Customer customer : list) { // if (customer.getCustomerManager() == null) { // continue; // } // idx++; // Task task = new Task(); // task.setContent(request.getParameter("content")); // task.setCustomer(customer); // task.setManager(customer.getCustomerManager()); // task.setStart(start); // task.setEnd(end); // task.setId(IdUtil.getId() + idx); // tasks.add(task); // } // // if (tasks.size() < 1) { // return ExtJS.ok("无客户,请添加客户后重试!"); // } // List cs = new ArrayList(); // Map map = HttpUtils.getRequestParam(request); // Set<String> keySet = map.keySet(); // for (String s : keySet) { // if ((s.matches("^content.+")) && (!s.equals("content"))) { // RecordDetail detail = new RecordDetail(); // detail.setContent(map.get(s) + ""); // cs.add(detail); // } // } // this.taskService.addTask(tasks, cs); // return ExtJS.ok("发放成功!"); // } catch (Exception e) { // log.error("error", e); // } // return ExtJS.fail("发放个别任务失败,请重试!"); // } @RequestMapping(params = { "action=group" }) @ResponseBody public JSONObject groupTask(String gids, String content, HttpServletRequest request, HttpServletResponse response) { try { if ((LoginInfo.getUser(request) == null) || (!"admin".equals(LoginInfo.getUser(request).getUsername()))) { return ExtJS.ok("非admin用户不能发放任务!"); } gids = gids.substring(1, gids.length()); Date start = this.sf.parse(request.getParameter("start")); Date end = this.sf.parse(request.getParameter("end")); if (start.after(end)) { return ExtJS.ok("起始时间不能大于任务完成时间!"); } List<Customer> list = this.customerService.getCustomersByGroupIds(gids); List tasks = new ArrayList(); for (Customer customer : list) { if (customer.getCustomerManager() == null) { continue; } Task task = new Task(); task.setContent(request.getParameter("content")); task.setCustomer(customer); task.setManager(customer.getCustomerManager()); task.setStart(start); task.setEnd(end); task.setId(IdUtil.getId()); tasks.add(task); } if (tasks.size() < 1) { return ExtJS.ok("无客户,请添加客户后重试!"); } List cs = new ArrayList(); Map map = HttpUtils.getRequestParam(request); Set<String> keySet = map.keySet(); for (String s : keySet) { if ((s.matches("^content.+")) && (!s.equals("content"))) { RecordDetail detail = new RecordDetail(); detail.setContent(map.get(s) + ""); cs.add(detail); } } this.taskService.addTask(tasks, cs); return ExtJS.ok("发放成功!"); } catch (Exception e) { log.error("error", e); } return ExtJS.fail("发放个别任务失败,请重试!"); } @RequestMapping(params = { "action=customerTask" }) @ResponseBody public JSONObject customerTask(String cids, String content, HttpServletRequest request, HttpServletResponse response) { try { if ((LoginInfo.getUser(request) == null) || (!"admin".equals(LoginInfo.getUser(request).getUsername()))) { return ExtJS.ok("非admin用户不能发放任务!"); } cids = cids.substring(1, cids.length()); Date start = this.sf.parse(request.getParameter("start")); Date end = this.sf.parse(request.getParameter("end")); if (start.after(end)) { return ExtJS.ok("起始时间不能大于任务完成时间!"); } List<Customer> list = this.customerService.getCustomersByIds(cids); List tasks = new ArrayList(); for (Customer customer : list) { if (customer.getCustomerManager() == null) { continue; } Task task = new Task(); task.setContent(request.getParameter("content")); task.setCustomer(customer); task.setManager(customer.getCustomerManager()); task.setStart(start); task.setEnd(end); task.setId(IdUtil.getId()); tasks.add(task); } if (tasks.size() < 1) { return ExtJS.ok("无客户,请添加客户后重试!"); } List cs = new ArrayList(); Map map = HttpUtils.getRequestParam(request); Set<String> keySet = map.keySet(); for (String s : keySet) { if ((s.matches("^content.+")) && (!s.equals("content"))) { RecordDetail detail = new RecordDetail(); detail.setContent(map.get(s) + ""); cs.add(detail); } } this.taskService.addTask(tasks, cs); return ExtJS.ok("发放成功!"); } catch (Exception e) { log.error("error", e); } return ExtJS.fail("发放客户任务失败,请重试!"); } @RequestMapping(params = { "action=newCustomerTask" }) @ResponseBody public JSONObject newCustomerTask(String cids, String mid, String content, HttpServletRequest request, HttpServletResponse response) { try { if ((LoginInfo.getUser(request) == null) || (!"admin".equals(LoginInfo.getUser(request).getUsername()))) { return ExtJS.ok("非admin用户不能发放任务!"); } cids = cids.substring(1, cids.length()); Date start = this.sf.parse(request.getParameter("start")); Date end = this.sf.parse(request.getParameter("end")); if (start.after(end)) { return ExtJS.ok("起始时间不能大于任务完成时间!"); } String[] cIdArr = cids.split(","); int size = cIdArr.length; List tasks = new ArrayList(); for (int idx = 1; idx <= size; idx++) { Task task = new Task(); task.setContent(request.getParameter("content")); Customer customer = new Customer(); customer.setId(Long.parseLong(cIdArr[idx - 1])); task.setCustomer(customer); CustomerManager manager = new CustomerManager(); manager.setId(Long.parseLong(mid)); task.setManager(manager); task.setStart(start); task.setEnd(end); task.setId(IdUtil.getId()); tasks.add(task); } List cs = new ArrayList(); Map map = HttpUtils.getRequestParam(request); Set<String> keySet = map.keySet(); for (String s : keySet) { if ((s.matches("^content.+")) && (!s.equals("content"))) { RecordDetail detail = new RecordDetail(); detail.setContent(map.get(s) + ""); cs.add(detail); } } this.taskService.addTask(tasks, cs); return ExtJS.ok("发放成功!"); } catch (Exception e) { log.error("error", e); } return ExtJS.fail("发放新客户任务失败,请重试!"); } }
7df511032924ab6c1ac712203a2c386205d85728
1dee501f84622ef0d515e0b32b064320f5649792
/biz.db/src/main/java/com/leeon/biz/db/module/servicelocator/AbstractServiceLocator.java
112b1b74cd547d0a09497a9b077787d83d69a8a7
[]
no_license
lunatiKoid/spring-mvc-ibatis-web
37ccf0c6b106377174ad9895c0feadc06ad2deb4
53e2dabc457a003f17d51f06a27231fa1d9981b8
refs/heads/master
2021-01-10T07:38:35.633959
2015-06-07T02:35:39
2015-06-07T02:35:39
36,935,938
0
0
null
null
null
null
UTF-8
Java
false
false
936
java
package com.leeon.biz.db.module.servicelocator; import org.springframework.beans.BeansException; import org.springframework.beans.factory.BeanFactory; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; /** * Created by liang.yaol on 5/1/15. */ public class AbstractServiceLocator { private static String servicesLocation = "classpath:spring_services_locator.xml"; protected static BeanFactory beanFactory; private static Exception initException; static { try { ApplicationContext applicationContext = new ClassPathXmlApplicationContext(servicesLocation); beanFactory = applicationContext; } catch (Exception e) { e.printStackTrace(); initException = e; } } protected static BeanFactory getBeanFactory() { return beanFactory; } }
a9809ed622a07eeb0678a1d8fa75046171920c6b
c97dffb0478522877f1a1c188a823296c75e1b87
/self_spring_read_demo/src/main/java/com/learn/springread/springevent/UserRegisterEvent.java
41ab06fefe96651da10d6291c4abf0e229d0656e
[]
no_license
zoro000/2021_learn_project
1e728a30b381dc3af104631d90e5466abc665962
464c58e19fddaa1860880f3c0cfc3e8086fd9b4d
refs/heads/master
2023-07-14T00:55:52.997305
2021-08-21T13:18:55
2021-08-21T13:18:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
509
java
package com.learn.springread.springevent; import org.springframework.context.ApplicationEvent; /** * autor:liman * createtime:2021/6/6 * comment: */ public class UserRegisterEvent extends ApplicationEvent { /** * Create a new {@code ApplicationEvent}. * * @param source the object on which the event initially occurred or with * which the event is associated (never {@code null}) */ public UserRegisterEvent(Object source) { super(source); } }
a08b85d1d425fa4c974a4a703a0dc5dbf3d1efbb
62b2e22d3870bad991ec4602d475c0029a549fe9
/ArdGuild/src/team/creativecode/ardguild/manager/events/GuildLeaveEvent.java
f766718ee350a3ec6a387fd3d6060796e0b25046
[]
no_license
TiveCS/ArdGuild
7c7a30844b60e58128eb00307729aaaf715caa02
b26bd48e8ba8068c1fd26f94ac72def6da7fb4b5
refs/heads/master
2020-04-22T00:06:49.853744
2019-02-14T10:51:14
2019-02-14T10:51:14
169,968,184
0
0
null
null
null
null
UTF-8
Java
false
false
89
java
package team.creativecode.ardguild.manager.events; public class GuildLeaveEvent { }
35383cad7f684d9b5e3150c610899e939159d5ef
69072dc8587d053542783dcf594118a07ae97f4a
/ancun-data-subscribe-mybatis/src/main/java/com/ancun/common/persistence/mapper/dx/EntUserInfoMapper.java
cd745ed7fa7ad5fd25a5329df1589b4888c06af8
[]
no_license
hejunling/boss-dts
f5dac435796b95ada7e965b60b586eb9a45f14b9
fa4f6caef355805938412e503d15f1f10cda4efd
refs/heads/master
2022-12-20T12:35:41.683426
2019-05-23T12:21:15
2019-05-23T12:21:15
94,403,799
1
2
null
2022-12-16T03:42:19
2017-06-15T05:40:09
Java
UTF-8
Java
false
false
1,101
java
package com.ancun.common.persistence.mapper.dx; import com.ancun.common.persistence.model.dx.EntUserInfo; import com.ancun.common.persistence.model.master.BizTimerConfig; import org.apache.ibatis.annotations.Param; import tk.mybatis.mapper.common.Mapper; import java.util.List; public interface EntUserInfoMapper extends Mapper<EntUserInfo> { /** * 查询企业用户,与汇工作兼容 * * @param userNo * @param userTel * @param rpCode * @return */ List<EntUserInfo> selectEntUserInfos(@Param("userNo") String userNo, @Param("userTel") String userTel, @Param("rpCode") String rpCode); /** * 更新,退订时间清空 * * @param entUserInfo */ void updateSelective(EntUserInfo entUserInfo); /** * 查询 所有rpcode * * @param config * @return */ List<String> selectAllEntRpcodes(BizTimerConfig config); /** * 查询 所有数量 * * @param config * @return */ int selectAllEntCount(BizTimerConfig config); }
7f7ef93e553fb6b28350f815e73c1dce3354db30
0d9fe88bf842079e7702ddde96d9a4a5e31cccdd
/app/src/main/java/com/maiyu/hrssc/home/activity/applying/adapter/YWCPageAdapter.java
1b9002902397b91bbfae30c627f3e2caf45487b9
[]
no_license
xiongningwan/hrssc
859fbcbc84474f915288d4fa61c30e2556f42cce
b3b727a5f9736a73e54878c4903f6911c2da70af
refs/heads/master
2021-01-23T00:06:39.304993
2017-08-31T07:17:15
2017-08-31T07:17:15
85,697,183
0
0
null
null
null
null
UTF-8
Java
false
false
4,015
java
package com.maiyu.hrssc.home.activity.applying.adapter; import android.content.Context; import android.content.Intent; import android.support.v7.widget.RecyclerView; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.TextView; import com.maiyu.hrssc.R; import com.maiyu.hrssc.home.activity.applying.ApplyingDetialActivity; import com.maiyu.hrssc.home.activity.applying.bean.Apply; import com.maiyu.hrssc.util.AppUtil; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; /** * 申请 已完成 */ public class YWCPageAdapter extends RecyclerView.Adapter<YWCPageAdapter.TodoPageViewHolder>{ private List<Apply> mList = new ArrayList(); private final Context mContext; SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); public YWCPageAdapter(Context context) { mContext = context; } public void setData(List list) { mList.clear(); mList.addAll(list); notifyDataSetChanged(); } public void loadMoreData(List list) { int startPosition = mList.size(); mList.addAll(list); notifyItemRangeChanged(startPosition, list.size()); } @Override public TodoPageViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View view = View.inflate(mContext, R.layout.list_item_list_applying_item, null); return new TodoPageViewHolder(view); } @Override public void onBindViewHolder(TodoPageViewHolder holder, int position) { holder.onBindView(); } @Override public int getItemCount() { return mList.size(); } class TodoPageViewHolder extends RecyclerView.ViewHolder { private TextView title; private TextView status; private TextView time; private Button btn; private TextView reason; public TodoPageViewHolder(View itemView) { super(itemView); title = (TextView) itemView.findViewById(R.id.title); status = (TextView) itemView.findViewById(R.id.status); time = (TextView) itemView.findViewById(R.id.time); btn = (Button) itemView.findViewById(R.id.btn_item); reason = (TextView) itemView.findViewById(R.id.reason); } void onBindView() { final Apply apply = (Apply) mList.get(getAdapterPosition()); if(apply == null) { return; } title.setText(apply.getName()); if ("0".equals(apply.getStatus())) { status.setText("待审核"); } else if ("1".equals(apply.getStatus())) { status.setText("待办理"); } else if ("2".equals(apply.getStatus())) { status.setText("待领取"); } else if ("3".equals(apply.getStatus())) { status.setText("待评价"); } else if ("4".equals(apply.getStatus())) { status.setText("已完成"); } else if ("5".equals(apply.getStatus())) { status.setText("已驳回"); } Date dateTime = null; try { dateTime = sdf.parse(apply.getCreate_time()); } catch (ParseException e) { e.printStackTrace(); } time.setText(AppUtil.setTime(dateTime)); btn.setVisibility(View.GONE); reason.setVisibility(View.GONE); itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(mContext, ApplyingDetialActivity.class); intent.putExtra("id", apply.getId()); intent.putExtra("title", "申请详情"); mContext.startActivity(intent); } }); } } }
[ "222" ]
222
a159a28e2a00c768d9144c7bfb345b843bc662e9
b6390dea167513d6a41666ea5612009b20ba0623
/07_OnetoOneUni/src/com/cg/jpastart/entities/Main.java
1f744e9f09c0a10b1024162d0fceb7689f1df349
[]
no_license
bhargavi-123/jdbcprojects
5406180fcb6f130271d4fbb01b0695cc47528bf6
a4aa88b6744a0d354a2578928e7a51fddbee0911
refs/heads/master
2020-04-05T15:28:18.899573
2018-11-10T10:16:43
2018-11-10T10:16:43
156,969,287
0
0
null
null
null
null
UTF-8
Java
false
false
718
java
package com.cg.jpastart.entities; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import javax.persistence.Persistence; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub EntityManagerFactory emf = Persistence.createEntityManagerFactory("JPA-PU"); EntityManager em = emf.createEntityManager(); Address address= em.find(Address.class, 1); System.out.println(address.getStreet()+address.getCity()+address.getState()+address.getZipCode()); Student student= em.find(Student.class, 1); System.out.println(student.getName()+student.getAddress()); em.close(); emf.close(); } }
7404e82b59481a77df171b3ac820aa1b8ed9b34e
0103f095c4280cdc0e98cf425b7b06a053bcc502
/src/il/ac/shenkar/ToDoList/TaskAlarmManager/AlarmReceiver.java
62036dd22171fac5ff68337b5c85d998b49660cc
[]
no_license
eranaltay/FinalProject
c236fc88d778e04a9fa91951f575bbb1455a55b1
074646f962a83a000397a60c7f474e56002d6952
refs/heads/master
2016-09-06T11:33:09.449820
2013-03-17T08:43:49
2013-03-17T08:43:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,925
java
/* * AlarmReceiver.java * * Copyright 2013 Eran Altay * * 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 1.13 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. */ package il.ac.shenkar.ToDoList.TaskAlarmManager; import il.ac.shenkar.ToDoList.R; import il.ac.shenkar.ToDoList.ShowTask.ShowTaskActivity; import il.ac.shenkar.ToDoList.TaskDAO.TaskObject; import il.ac.shenkar.ToDoList.TaskList.TaskListActivity; import android.app.Notification; import android.app.Notification.Builder; import android.app.NotificationManager; import android.app.PendingIntent; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.util.Log; import android.widget.Toast; /** * ReminderReciver, activate the following, when user get the alarm on his device * @author EranAltay * */ public class AlarmReceiver extends BroadcastReceiver { private NotificationManager notificationManager; private TaskObject taskToNotify; private Builder builder; private Notification notification; private Intent taskListIntent; private PendingIntent taskListPendingIntent; private Intent showTaskIntent; private PendingIntent showTaskPendingIntent; /** * Configure the the title of the notification, icon, message string, and which activity * to launch when tapping the received notification */ @Override public void onReceive(Context context, Intent intent) { taskToNotify = intent.getParcelableExtra("taskToSetAlarm"); buildNotification(context); } public void buildNotification(Context context) { try { //get the Serializable object from the createactivity int id = (int) taskToNotify.getTaskId(); //Configure which alarm will show up, in this case notification notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); taskListIntent = new Intent(context, TaskListActivity.class); taskListPendingIntent = PendingIntent.getActivity(context, id, taskListIntent, 0); showTaskIntent = new Intent(context,ShowTaskActivity.class); showTaskIntent.putExtra("tasktoshow", taskToNotify); showTaskPendingIntent = PendingIntent.getActivity(context, id, showTaskIntent, 0); builder = new Notification.Builder(context) .setContentIntent(showTaskPendingIntent) .setTicker(context.getString(R.string.appName)) .setContentTitle(taskToNotify.getTaskTitle()) .setSmallIcon(R.drawable.notifybell) .setDefaults(Notification.DEFAULT_ALL) .addAction(R.drawable.notificationicon, "Launch " + context.getString(R.string.appName), taskListPendingIntent) .setAutoCancel(true); notification = new Notification.InboxStyle(builder) .build(); //sending the notification and id of the task notificationManager.notify(id, notification); Log.i(getClass().getSimpleName(), "notification was sent from the system for task id " + id); //cancel the alarm after receiving it if(taskToNotify.getTaskInterval() == 0) { Intent sender = new Intent(context, TaskAlarmService.class); sender.putExtra("taskToRemoveIndicator", taskToNotify); context.startService(sender); } } catch (Exception e) { Toast.makeText(context, "error", Toast.LENGTH_SHORT).show(); Log.e(getClass().getSimpleName(), "Broadcast receiver error"); e.printStackTrace(); } } }
9b7011c9f7f1f720d6469d4f0870a32d72a6cd6b
a85740bfb7def38be54ed1425b7a4a06f9bdcf6a
/mybatis-generator-systests-ibatis2-java5/target/generated-sources/mybatis-generator/mbg/test/ib2j5/generated/hierarchical/dao/PkfieldsblobsDAO.java
eca0df3fb1c094b3d9e24ee1a9217503ef9247d0
[ "Apache-2.0" ]
permissive
tianbohao1010/generator-mybatis-generator-1.3.2
148841025fa9d52bcda4d529227092892ff2ee89
f917b1ae550850b76e7ac0c967da60dc87fc6eb5
refs/heads/master
2020-03-19T07:18:35.135680
2018-06-05T01:41:21
2018-06-05T01:41:21
136,103,685
0
0
null
null
null
null
UTF-8
Java
false
false
4,081
java
package mbg.test.ib2j5.generated.hierarchical.dao; import java.util.List; import mbg.test.ib2j5.generated.hierarchical.model.Pkfieldsblobs; import mbg.test.ib2j5.generated.hierarchical.model.PkfieldsblobsExample; import mbg.test.ib2j5.generated.hierarchical.model.PkfieldsblobsKey; import mbg.test.ib2j5.generated.hierarchical.model.PkfieldsblobsWithBLOBs; public interface PkfieldsblobsDAO { /** * This method was generated by MyBatis Generator. * This method corresponds to the database table PKFIELDSBLOBS * * @mbggenerated Thu Dec 21 14:43:57 CST 2017 */ int countByExample(PkfieldsblobsExample example); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table PKFIELDSBLOBS * * @mbggenerated Thu Dec 21 14:43:57 CST 2017 */ int deleteByExample(PkfieldsblobsExample example); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table PKFIELDSBLOBS * * @mbggenerated Thu Dec 21 14:43:57 CST 2017 */ int deleteByPrimaryKey(PkfieldsblobsKey _key); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table PKFIELDSBLOBS * * @mbggenerated Thu Dec 21 14:43:57 CST 2017 */ void insert(PkfieldsblobsWithBLOBs record); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table PKFIELDSBLOBS * * @mbggenerated Thu Dec 21 14:43:57 CST 2017 */ void insertSelective(PkfieldsblobsWithBLOBs record); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table PKFIELDSBLOBS * * @mbggenerated Thu Dec 21 14:43:57 CST 2017 */ List<PkfieldsblobsWithBLOBs> selectByExampleWithBLOBs(PkfieldsblobsExample example); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table PKFIELDSBLOBS * * @mbggenerated Thu Dec 21 14:43:57 CST 2017 */ List<Pkfieldsblobs> selectByExampleWithoutBLOBs(PkfieldsblobsExample example); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table PKFIELDSBLOBS * * @mbggenerated Thu Dec 21 14:43:57 CST 2017 */ PkfieldsblobsWithBLOBs selectByPrimaryKey(PkfieldsblobsKey _key); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table PKFIELDSBLOBS * * @mbggenerated Thu Dec 21 14:43:57 CST 2017 */ int updateByExampleSelective(PkfieldsblobsWithBLOBs record, PkfieldsblobsExample example); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table PKFIELDSBLOBS * * @mbggenerated Thu Dec 21 14:43:57 CST 2017 */ int updateByExample(PkfieldsblobsWithBLOBs record, PkfieldsblobsExample example); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table PKFIELDSBLOBS * * @mbggenerated Thu Dec 21 14:43:57 CST 2017 */ int updateByExample(Pkfieldsblobs record, PkfieldsblobsExample example); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table PKFIELDSBLOBS * * @mbggenerated Thu Dec 21 14:43:57 CST 2017 */ int updateByPrimaryKeySelective(PkfieldsblobsWithBLOBs record); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table PKFIELDSBLOBS * * @mbggenerated Thu Dec 21 14:43:57 CST 2017 */ int updateByPrimaryKey(PkfieldsblobsWithBLOBs record); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table PKFIELDSBLOBS * * @mbggenerated Thu Dec 21 14:43:57 CST 2017 */ int updateByPrimaryKey(Pkfieldsblobs record); }
ce0b5ecc20203703a180bbf45dcd33e6f8bd24a9
f18ecaea4fded21e5c6be80289c87d99838b65a7
/os-pm-main/src/main/java/com/jukusoft/os/pm/main/Application.java
2bf75caf902e7d3f0462b450eaa1e55fe43c06e5
[ "Apache-2.0" ]
permissive
JuKu/os-pm-tool
30b12b64b0e24787a844c49660f7f1875e45e58f
689f7cd1c898648493b4f50876b1b93a87f43551
refs/heads/master
2020-06-20T07:31:44.981546
2019-07-15T18:09:35
2019-07-15T18:09:35
197,044,081
0
0
null
null
null
null
UTF-8
Java
false
false
477
java
package com.jukusoft.os.pm.main; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; @SpringBootApplication(scanBasePackages = "com.jukusoft.os.pm") public class Application extends SpringBootServletInitializer { public static void main (String[] args) { SpringApplication.run(Application.class, args); } }
0b603b413a0c3cc64c376f74ea6bab1c9c2cb01a
cd63684aed7c31493c5c14bc7cef0d0508048dac
/server/src/main/java/com/thoughtworks/go/server/service/JobResolverService.java
d48029f3d9ba6170189613befd0297fe5b5f22d3
[ "MIT", "Apache-2.0" ]
permissive
zzz222zzz/gocd
cb1765d16840d96c991b8a9308c01cb37eb3ea7c
280175df42d13e6cd94386a7af6fdac966b2e875
refs/heads/master
2020-05-09T20:25:48.079858
2019-04-15T02:53:33
2019-04-15T02:53:33
181,407,372
1
0
Apache-2.0
2019-04-15T03:41:28
2019-04-15T03:41:26
null
UTF-8
Java
false
false
1,445
java
/*************************GO-LICENSE-START********************************* * Copyright 2014 ThoughtWorks, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *************************GO-LICENSE-END***********************************/ package com.thoughtworks.go.server.service; import com.thoughtworks.go.domain.JobIdentifier; import com.thoughtworks.go.server.dao.JobInstanceDao; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; /** * @understands resolving actual job in case of copy-for-rerun */ @Service public class JobResolverService { private final JobInstanceDao jobDao; @Autowired public JobResolverService(JobInstanceDao jobDao) { this.jobDao = jobDao; } public JobIdentifier actualJobIdentifier(JobIdentifier oldId) { return jobDao.findOriginalJobIdentifier(oldId.getStageIdentifier(), oldId.getBuildName()); } }
f659277e84d0effb665042248f7379b1b212d35e
b8dbde714f888308b79123d19c2e87def4afed88
/src/java/org/apache/cassandra/utils/ByteBufferUtil.java
55dbceb91efca7cffc09c09fe05ba2b5357e32ce
[ "Apache-2.0", "LicenseRef-scancode-public-domain" ]
permissive
eddy20062010/apache-cassandra
38d077113a3d5d2058a1ff0ff2f290e409ec3ff8
62c27b226620a1e7dac88e2695e3fcd33f541aa5
refs/heads/master
2021-01-21T08:24:58.736708
2013-11-12T13:10:53
2013-11-12T13:10:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
14,622
java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.cassandra.utils; import java.io.DataInput; import java.io.DataOutput; import java.io.EOFException; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.nio.ByteBuffer; import java.nio.charset.CharacterCodingException; import java.nio.charset.Charset; import java.util.Arrays; import org.apache.cassandra.io.util.FileDataInput; import org.apache.cassandra.io.util.FileUtils; import org.apache.commons.lang.ArrayUtils; /** * Utility methods to make ByteBuffers less painful * The following should illustrate the different ways byte buffers can be used * * public void testArrayOffet() * { * * byte[] b = "test_slice_array".getBytes(); * ByteBuffer bb = ByteBuffer.allocate(1024); * * assert bb.position() == 0; * assert bb.limit() == 1024; * assert bb.capacity() == 1024; * * bb.put(b); * * assert bb.position() == b.length; * assert bb.remaining() == bb.limit() - bb.position(); * * ByteBuffer bb2 = bb.slice(); * * assert bb2.position() == 0; * * //slice should begin at other buffers current position * assert bb2.arrayOffset() == bb.position(); * * //to match the position in the underlying array one needs to * //track arrayOffset * assert bb2.limit()+bb2.arrayOffset() == bb.limit(); * * * assert bb2.remaining() == bb.remaining(); * * } * * } * */ public class ByteBufferUtil { public static final ByteBuffer EMPTY_BYTE_BUFFER = ByteBuffer.wrap(ArrayUtils.EMPTY_BYTE_ARRAY); private static final Charset UTF_8 = Charset.forName("UTF-8"); public static int compareUnsigned(ByteBuffer o1, ByteBuffer o2) { assert o1 != null; assert o2 != null; int minLength = Math.min(o1.remaining(), o2.remaining()); for (int x = 0, i = o1.position(), j = o2.position(); x < minLength; x++, i++, j++) { if (o1.get(i) == o2.get(j)) continue; // compare non-equal bytes as unsigned return (o1.get(i) & 0xFF) < (o2.get(j) & 0xFF) ? -1 : 1; } return (o1.remaining() == o2.remaining()) ? 0 : ((o1.remaining() < o2.remaining()) ? -1 : 1); } public static int compare(byte[] o1, ByteBuffer o2) { return compareUnsigned(ByteBuffer.wrap(o1), o2); } public static int compare(ByteBuffer o1, byte[] o2) { return compareUnsigned(o1, ByteBuffer.wrap(o2)); } /** * Decode a String representation. * This method assumes that the encoding charset is UTF_8. * * @param buffer a byte buffer holding the string representation * @return the decoded string */ public static String string(ByteBuffer buffer) throws CharacterCodingException { return string(buffer, UTF_8); } /** * Decode a String representation. * This method assumes that the encoding charset is UTF_8. * * @param buffer a byte buffer holding the string representation * @param position the starting position in {@code buffer} to start decoding from * @param length the number of bytes from {@code buffer} to use * @return the decoded string */ public static String string(ByteBuffer buffer, int position, int length) throws CharacterCodingException { return string(buffer, position, length, UTF_8); } /** * Decode a String representation. * * @param buffer a byte buffer holding the string representation * @param position the starting position in {@code buffer} to start decoding from * @param length the number of bytes from {@code buffer} to use * @param charset the String encoding charset * @return the decoded string */ public static String string(ByteBuffer buffer, int position, int length, Charset charset) throws CharacterCodingException { ByteBuffer copy = buffer.duplicate(); copy.position(position); copy.limit(copy.position() + length); return string(copy, charset); } /** * Decode a String representation. * * @param buffer a byte buffer holding the string representation * @param charset the String encoding charset * @return the decoded string */ public static String string(ByteBuffer buffer, Charset charset) throws CharacterCodingException { return charset.newDecoder().decode(buffer.duplicate()).toString(); } /** * You should almost never use this. Instead, use the write* methods to avoid copies. */ public static byte[] getArray(ByteBuffer buffer) { int length = buffer.remaining(); if (buffer.hasArray()) { int start = buffer.position(); if (buffer.arrayOffset() == 0 && start == 0 && length == buffer.array().length) return buffer.array(); else return Arrays.copyOfRange(buffer.array(), start + buffer.arrayOffset(), start + length + buffer.arrayOffset()); } // else, DirectByteBuffer.get() is the fastest route byte[] bytes = new byte[length]; buffer.duplicate().get(bytes); return bytes; } /** * ByteBuffer adaptation of org.apache.commons.lang.ArrayUtils.lastIndexOf method * * @param buffer the array to traverse for looking for the object, may be <code>null</code> * @param valueToFind the value to find * @param startIndex the start index (i.e. BB position) to travers backwards from * @return the last index (i.e. BB position) of the value within the array * [between buffer.position() and buffer.limit()]; <code>-1</code> if not found. */ public static int lastIndexOf(ByteBuffer buffer, byte valueToFind, int startIndex) { assert buffer != null; if (startIndex < buffer.position()) { return -1; } else if (startIndex >= buffer.limit()) { startIndex = buffer.limit() - 1; } for (int i = startIndex; i >= buffer.position(); i--) { if (valueToFind == buffer.get(i)) return i; } return -1; } /** * Encode a String in a ByteBuffer using UTF_8. * * @param s the string to encode * @return the encoded string */ public static ByteBuffer bytes(String s) { return ByteBuffer.wrap(s.getBytes(UTF_8)); } /** * Encode a String in a ByteBuffer using the provided charset. * * @param s the string to encode * @param charset the String encoding charset to use * @return the encoded string */ public static ByteBuffer bytes(String s, Charset charset) { return ByteBuffer.wrap(s.getBytes(charset)); } /** * @return a new copy of the data in @param buffer * USUALLY YOU SHOULD USE ByteBuffer.duplicate() INSTEAD, which creates a new Buffer * (so you can mutate its position without affecting the original) without copying the underlying array. */ public static ByteBuffer clone(ByteBuffer buffer) { assert buffer != null; if (buffer.remaining() == 0) return EMPTY_BYTE_BUFFER; ByteBuffer clone = ByteBuffer.allocate(buffer.remaining()); if (buffer.hasArray()) { System.arraycopy(buffer.array(), buffer.arrayOffset() + buffer.position(), clone.array(), 0, buffer.remaining()); } else { clone.put(buffer.duplicate()); clone.flip(); } return clone; } public static void arrayCopy(ByteBuffer buffer, int position, byte[] bytes, int offset, int length) { if (buffer.hasArray()) System.arraycopy(buffer.array(), buffer.arrayOffset() + position, bytes, offset, length); else ((ByteBuffer) buffer.duplicate().position(position)).get(bytes, offset, length); } /** * Transfer bytes from one ByteBuffer to another. * This function acts as System.arrayCopy() but for ByteBuffers. * * @param src the source ByteBuffer * @param srcPos starting position in the source ByteBuffer * @param dst the destination ByteBuffer * @param dstPos starting position in the destination ByteBuffer * @param length the number of bytes to copy */ public static void arrayCopy(ByteBuffer src, int srcPos, ByteBuffer dst, int dstPos, int length) { if (src.hasArray() && dst.hasArray()) { System.arraycopy(src.array(), src.arrayOffset() + srcPos, dst.array(), dst.arrayOffset() + dstPos, length); } else { if (src.limit() - srcPos < length || dst.limit() - dstPos < length) throw new IndexOutOfBoundsException(); for (int i = 0; i < length; i++) { dst.put(dstPos++, src.get(srcPos++)); } } } public static void writeWithLength(ByteBuffer bytes, DataOutput out) throws IOException { out.writeInt(bytes.remaining()); write(bytes, out); // writing data bytes to output source } public static void write(ByteBuffer buffer, DataOutput out) throws IOException { if (buffer.hasArray()) { out.write(buffer.array(), buffer.arrayOffset() + buffer.position(), buffer.remaining()); } else { for (int i = buffer.position(); i < buffer.limit(); i++) { out.writeByte(buffer.get(i)); } } } /* @return An unsigned short in an integer. */ private static int readShortLength(DataInput in) throws IOException { int length = (in.readByte() & 0xFF) << 8; return length | (in.readByte() & 0xFF); } /** * Convert a byte buffer to an integer. * Does not change the byte buffer position. * * @param bytes byte buffer to convert to integer * @return int representation of the byte buffer */ public static int toInt(ByteBuffer bytes) { return bytes.getInt(bytes.position()); } public static long toLong(ByteBuffer bytes) { return bytes.getLong(bytes.position()); } public static float toFloat(ByteBuffer bytes) { return bytes.getFloat(bytes.position()); } public static double toDouble(ByteBuffer bytes) { return bytes.getDouble(bytes.position()); } public static ByteBuffer bytes(int i) { return ByteBuffer.allocate(4).putInt(0, i); } public static ByteBuffer bytes(long n) { return ByteBuffer.allocate(8).putLong(0, n); } public static ByteBuffer bytes(float f) { return ByteBuffer.allocate(4).putFloat(0, f); } public static ByteBuffer bytes(double d) { return ByteBuffer.allocate(8).putDouble(0, d); } public static InputStream inputStream(ByteBuffer bytes) { final ByteBuffer copy = bytes.duplicate(); return new InputStream() { public int read() throws IOException { if (!copy.hasRemaining()) return -1; return copy.get() & 0xFF; } @Override public int read(byte[] bytes, int off, int len) throws IOException { if (!copy.hasRemaining()) return -1; len = Math.min(len, copy.remaining()); copy.get(bytes, off, len); return len; } @Override public int available() throws IOException { return copy.remaining(); } }; } public static ByteBuffer hexToBytes(String str) { return ByteBuffer.wrap(FBUtilities.hexToBytes(str)); } /** * Compare two ByteBuffer at specified offsets for length. * Compares the non equal bytes as unsigned. * @param bytes1 First byte buffer to compare. * @param offset1 Position to start the comparison at in the first array. * @param bytes2 Second byte buffer to compare. * @param offset2 Position to start the comparison at in the second array. * @param length How many bytes to compare? * @return -1 if byte1 is less than byte2, 1 if byte2 is less than byte1 or 0 if equal. */ public static int compareSubArrays(ByteBuffer bytes1, int offset1, ByteBuffer bytes2, int offset2, int length) { if ( null == bytes1 ) { if ( null == bytes2) return 0; else return -1; } if (null == bytes2 ) return 1; assert bytes1.limit() >= offset1 + length : "The first byte array isn't long enough for the specified offset and length."; assert bytes2.limit() >= offset2 + length : "The second byte array isn't long enough for the specified offset and length."; for ( int i = 0; i < length; i++ ) { byte byte1 = bytes1.get(offset1 + i); byte byte2 = bytes2.get(offset2 + i); if ( byte1 == byte2 ) continue; // compare non-equal bytes as unsigned return (byte1 & 0xFF) < (byte2 & 0xFF) ? -1 : 1; } return 0; } }
86ae2c831384508cd677041ffee71e97dde8b72d
065c1f648e8dd061a20147ff9c0dbb6b5bc8b9be
/eclipsejdt_cluster/15815/tar_0.java
0f1bf48b2a34124dbe91afe11e29396705792314
[]
no_license
martinezmatias/GenPat-data-C3
63cfe27efee2946831139747e6c20cf952f1d6f6
b360265a6aa3bb21bd1d64f1fc43c3b37d0da2a4
refs/heads/master
2022-04-25T17:59:03.905613
2020-04-15T14:41:34
2020-04-15T14:41:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,406
java
package org.eclipse.jdt.internal.core.search.indexing; /* * (c) Copyright IBM Corp. 2000, 2001. * All Rights Reserved. */ import org.eclipse.jdt.core.JavaCore; import org.eclipse.jdt.internal.compiler.*; import org.eclipse.jdt.internal.core.index.*; import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; import org.eclipse.jdt.internal.compiler.parser.InvalidInputException; import org.eclipse.jdt.internal.compiler.parser.Scanner; import org.eclipse.jdt.internal.compiler.parser.TerminalSymbols; import org.eclipse.jdt.internal.compiler.problem.*; import org.eclipse.jdt.internal.core.jdom.CompilationUnit; import java.io.*; import java.util.*; /** * A SourceIndexer indexes java files using a java parser. The following items are indexed: * Declarations of: * - Classes<br> * - Interfaces; <br> * - Methods;<br> * - Fields;<br> * References to: * - Methods (with number of arguments); <br> * - Fields;<br> * - Types;<br> * - Constructors. */ public class SourceIndexer extends AbstractIndexer { public static final String[] FILE_TYPES= new String[] {"java"}; //$NON-NLS-1$ protected DefaultProblemFactory problemFactory= new DefaultProblemFactory(Locale.getDefault()); /** * Returns the file types the <code>IIndexer</code> handles. */ public String[] getFileTypes(){ return FILE_TYPES; } protected void indexFile(IDocument document) throws IOException { // Add the name of the file to the index output.addDocument(document); // Create a new Parser SourceIndexerRequestor requestor = new SourceIndexerRequestor(this, document); SourceElementParser parser = new SourceElementParser(requestor, problemFactory, new CompilerOptions(JavaCore.getOptions()), true); // index local declarations // Launch the parser char[] source = null; char[] name = null; try { source = document.getCharContent(); name = document.getName().toCharArray(); } catch(Exception e){ } if (source == null || name == null) return; // could not retrieve document info (e.g. resource was discarded) CompilationUnit compilationUnit = new CompilationUnit(source, name); try { parser.parseCompilationUnit(compilationUnit, true); } catch (Exception e) { e.printStackTrace(); } } /** * Sets the document types the <code>IIndexer</code> handles. */ public void setFileTypes(String[] fileTypes){} }
996cca68020f1f4cab70d79091ae2b647ffe4dea
1eb67e3a7bda49814855d4958b82c1e5d878a3fa
/app/src/main/java/com/example/allu/srp_psnacet/Layout_handler/Org_list.java
7b68ce6fd0312974674a90882213130aeb5d7480
[]
no_license
Alluajay/SRP
5ca8dd6d6ff470868436d178fb20cfe8c4868029
57aacb80bf43877e777a1f81500996569b7a4f56
refs/heads/master
2020-09-13T09:34:05.736711
2016-09-15T18:02:42
2016-09-15T18:02:42
67,407,394
0
0
null
null
null
null
UTF-8
Java
false
false
5,471
java
package com.example.allu.srp_psnacet.Layout_handler; import android.content.Intent; import android.os.Bundle; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; import android.support.v7.widget.DefaultItemAnimator; import android.support.v7.widget.GridLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.View; import android.support.design.widget.NavigationView; import android.support.v4.view.GravityCompat; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.ActionBarDrawerToggle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.Menu; import android.view.MenuItem; import com.example.allu.srp_psnacet.Adapters.Org_adapter; import com.example.allu.srp_psnacet.Connector.Navigation_connector; import com.example.allu.srp_psnacet.Dataclasses.Org_class; import com.example.allu.srp_psnacet.R; import java.util.ArrayList; public class Org_list extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener { RecyclerView Org_list; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_org_list); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); Org_list=(RecyclerView)findViewById(R.id.Org_list); Org_list.setHasFixedSize(true); Org_list.setLayoutManager(new GridLayoutManager(this,1)); Org_list.setItemAnimator(new DefaultItemAnimator()); Org_adapter org_adapter=new Org_adapter(this,getArray()); Org_list.setAdapter(org_adapter); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.setDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); } @Override public void onBackPressed() { DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); if (drawer.isDrawerOpen(GravityCompat.START)) { drawer.closeDrawer(GravityCompat.START); } else { super.onBackPressed(); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } @SuppressWarnings("StatementWithEmptyBody") @Override public boolean onNavigationItemSelected(MenuItem item) { // Handle navigation view item clicks here. int id = item.getItemId(); Navigation_connector navigation_connector=new Navigation_connector(id,this); Intent i=navigation_connector.GetIntend(); startActivity(i); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); drawer.closeDrawer(GravityCompat.START); return true; } public ArrayList<Org_class> getArray(){ ArrayList<Org_class> orgArray=new ArrayList<>(); Org_class org_class=new Org_class("Alpha", "Alpha to Omega Learning Centre\r\n16, Valliammal Street,\r\n", "chennai", "This is a non profitable organisation which helps physically chalenged students to learn in their natural environment", "", 446443090, 44616257, "[email protected]"); Org_class org_class1=new Org_class( "Helen keller service society for the disabled", "Helen Keller Service Society for the Disabled\r\nVizhiyagam, Viswanathapuram,\r\n", "madurai", "This is a non?profit, charitable, voluntary organization established in the year 1979. The organization implements service projects for the welfare of the disabled in Tamil Nadu, founded by Dr. G Thiruvasagam for the service of people in the field of welfare of the disabled in rural areas.\r\n", "", 452641446, 452640735, "[email protected]"); Org_class org_class2=new Org_class( "Amar Seva Sangam", "Amar Seva Sangam\r\nSulochana Gardens, Post Box No. 001, Tenkasi Road,\r\nAyikudi", "Dindigul", "Physically challenged children from the age of five to seventeen are provided with free shelter, food, clothing, medical aid and appliances at our Home so that they can pursue their education at our School without any financial worry. If they opt for higher education outside the campus, they are also provided free transport. The children are also given special coaching.\r\n", "",448274035, 8240402, "[email protected]"); orgArray.add(org_class); orgArray.add(org_class1); orgArray.add(org_class2); return orgArray; } }
51777346195e20431019a51a4495afe94aa5e575
2fbd01a415130b738726b00817f236df46e0c52b
/MDPnPBloodPump/src/main/java/rosetta/MDC_DIM_MICRO_G_PER_M_SQ_PER_MIN.java
c7d0bb096e755560ea35335ae219941de39442e4
[]
no_license
DylanBagshaw/CPM
e60c34716e6fcbccaab831ba58368485d472492f
c00ad41f46dae40800fa97de4279876c8861fbba
refs/heads/master
2020-03-11T20:05:47.618502
2018-09-13T16:08:35
2018-09-13T16:08:35
130,227,287
0
0
null
null
null
null
UTF-8
Java
false
false
450
java
/* WARNING: THIS FILE IS AUTO-GENERATED. DO NOT MODIFY. This file was generated from .idl using "rtiddsgen". The rtiddsgen tool is part of the RTI Connext distribution. For more information, type 'rtiddsgen -help' at a command shell or consult the RTI Connext manual. */ package rosetta; public class MDC_DIM_MICRO_G_PER_M_SQ_PER_MIN { public static final String VALUE = "MDC_DIM_MICRO_G_PER_M_SQ_PER_MIN"; }
28c8162acb6e7359a82e2d854464873eced804f1
d7c5121237c705b5847e374974b39f47fae13e10
/airspan.netspan/src/main/java/Netspan/NBI_17_5/Inventory/NodeResetForcedColdFactoryResponse.java
5b3085dcccca0f19b883c2161c6d5db77582dcfa
[]
no_license
AirspanNetworks/SWITModules
8ae768e0b864fa57dcb17168d015f6585d4455aa
7089a4b6456621a3abd601cc4592d4b52a948b57
refs/heads/master
2022-11-24T11:20:29.041478
2020-08-09T07:20:03
2020-08-09T07:20:03
184,545,627
1
0
null
2022-11-16T12:35:12
2019-05-02T08:21:55
Java
UTF-8
Java
false
false
1,926
java
package Netspan.NBI_17_5.Inventory; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for anonymous complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType&gt; * &lt;complexContent&gt; * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt; * &lt;sequence&gt; * &lt;element name="NodeResetForcedColdFactoryResult" type="{http://Airspan.Netspan.WebServices}NodeActionResult" minOccurs="0"/&gt; * &lt;/sequence&gt; * &lt;/restriction&gt; * &lt;/complexContent&gt; * &lt;/complexType&gt; * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "nodeResetForcedColdFactoryResult" }) @XmlRootElement(name = "NodeResetForcedColdFactoryResponse") public class NodeResetForcedColdFactoryResponse { @XmlElement(name = "NodeResetForcedColdFactoryResult") protected NodeActionResult nodeResetForcedColdFactoryResult; /** * Gets the value of the nodeResetForcedColdFactoryResult property. * * @return * possible object is * {@link NodeActionResult } * */ public NodeActionResult getNodeResetForcedColdFactoryResult() { return nodeResetForcedColdFactoryResult; } /** * Sets the value of the nodeResetForcedColdFactoryResult property. * * @param value * allowed object is * {@link NodeActionResult } * */ public void setNodeResetForcedColdFactoryResult(NodeActionResult value) { this.nodeResetForcedColdFactoryResult = value; } }
e979dd55c61731334feea623ba6083e56a33ec03
98f43214d6056c6687673a84f6aee4c0898c9f88
/trunk/f1-distribuito/src/log/java/Driver.java
5816204e4d714c4a43a6f62ed37966acc3599294
[]
no_license
BGCX067/f1sim-scd-svn-to-git
cfb226c467c4bb93f6d27b7fce0c6bafa62366f0
07adf304b9ed2972be6b4fe0d25aaa4e51ab8123
refs/heads/master
2016-09-01T08:52:31.912713
2015-12-28T14:15:56
2015-12-28T14:15:56
48,833,928
0
0
null
null
null
null
UTF-8
Java
false
false
3,951
java
import java.util.Date; /** * * @author daniele */ public class Driver implements Comparable{ private String name; private short id; private String team; private short position; private short currentLap; private int currentSegment; private float maxSpeed; private float Speed = 0; private long lastEndLap = 0; private long bestLap = Integer.MAX_VALUE; private long lastLap = 0; /* Possible states:<br> * 0: running<br> * 1: at box<br> * 2: race finished<br> * -1: out<br> * -2: not started yet<br> */ private short state = -2; private long difference = 0; private long totalTime = 0; public Driver(String name, short id, String team, short position, short currentSegment) { this.name = name; this.id = id; this.team = team; this.position = position; this.currentSegment = currentSegment; this.currentLap = 0; this.maxSpeed = 0; } public void setCurrentSegment(int Segment) { currentSegment = Segment; } public void updateMaxSpeed(float Speed) { this.Speed = Speed; if(Speed > maxSpeed){ maxSpeed = Speed; } } void setStartTime(long startTime){ this.lastEndLap = startTime; } public void setLastEndLap(long lastEndLap) { if(this.lastEndLap != 0){ lastLap = lastEndLap - this.lastEndLap; totalTime = totalTime + lastLap; if(lastLap < bestLap){ bestLap = lastLap; } } this.lastEndLap = lastEndLap; } public void setCurrentLap(short currentLap) { this.currentLap = currentLap; } public void setPosition(short position) { this.position = position; } public short getCurrentLap() { return currentLap; } public long getBestLap() { return bestLap; } public long getCurrentSegment() { return currentSegment; } public short getId() { return id; } /** Possible states:<br> * 0: running<br> * 1: at box<br> * 2: race finished<br> * -1: out<br> * -2: not started yet<br> * * @return current state */ public short getState() { return state; } public float getTopSpeed() { return Math.round(maxSpeed*100)/100; } public String getName() { return name; } public short getPosition() { return position; } public String getTeam() { return team; } long getDifference() { return difference; } long getLastLap() { return lastLap; } long getTotalTime() { return totalTime; } public float getSpeed() { return Math.round(Speed*100)/100; } public long getLastEndLap() { return lastEndLap; } /** Possible states:<br> * 0: running<br> * 1: at box<br> * 2: race finished<br> * -1: out<br> * -2: not started yet<br> * */ public void setState(short s) { state = s; //out if(state == -1){ this.Speed = (float) 0.0; totalTime = new Date().getTime() - lastEndLap + totalTime; } //race finished if(state == 2){ updateMaxSpeed((float) 0.0); } } void updateDifference(long firstDriversTime) { this.difference = this.lastEndLap - firstDriversTime; } boolean precede(Driver other){ if(currentLap > other.currentLap || (currentLap == other.currentLap && currentSegment > other.currentSegment)){ return true; } return false; } public int compareTo(Object o) { if(this.precede((Driver) o)){ return -1; } else { return 1; } } }
0f4300156a3037e5ab3310857a0034524dfec1d1
40cd4da5514eb920e6a6889e82590e48720c3d38
/desktop/applis/apps/bean/bean_games/pokemonbean/src/main/java/aiki/beans/abilities/AbilityBeanMultEvtRateSecEffectOwnerGet.java
a089a2e8b5c9aba259618b7c8369e4fde90ae017
[]
no_license
Cardman/projects
02704237e81868f8cb614abb37468cebb4ef4b31
23a9477dd736795c3af10bccccb3cdfa10c8123c
refs/heads/master
2023-08-17T11:27:41.999350
2023-08-15T07:09:28
2023-08-15T07:09:28
34,724,613
4
0
null
2020-10-13T08:08:38
2015-04-28T10:39:03
Java
UTF-8
Java
false
false
409
java
package aiki.beans.abilities; import aiki.beans.PokemonBeanStruct; import code.bean.nat.*; import code.bean.nat.RtSt; import code.bean.nat.*; public class AbilityBeanMultEvtRateSecEffectOwnerGet implements NatCaller{ @Override public NaSt re(NaSt _instance, NaSt[] _args){ return new RtSt(( (AbilityBean) ((PokemonBeanStruct)_instance).getInstance()).getMultEvtRateSecEffectOwner()); } }
1859f557a4e78cb63230b49c5bcd298acdd012f9
f207f8c663b1abd0af23e10e243fa31e67a881af
/app/src/main/java/com/example/danilserbin/baking/ui/view/MainView.java
667fd56caa8f0d89d4487b744ea2d4fbc0c2f7b9
[]
no_license
OlegSheliakin/BakingApp
b5afb7558f11c7c7594b2787e6944996eb470148
f9e3a4ea81aecb1f7eefeedb5c7489b0155636e1
refs/heads/master
2021-08-15T20:45:39.212285
2017-11-18T08:12:41
2017-11-18T08:12:41
111,188,064
0
0
null
null
null
null
UTF-8
Java
false
false
252
java
package com.example.danilserbin.baking.ui.view; import com.example.danilserbin.baking.model.pojo.Recipe; import java.util.List; public interface MainView { void fill(List<Recipe> recipes); void showError(String s); void updateWidget(); }
90b5e7d85971c5b080eb8d064a6e81b30176b8d4
defd4ffeb636a0a238d84d554348c61b77294a39
/src/main/java/stupaq/cloudatlas/messaging/MessageListener.java
55ffa65e46ad8f4c544d5be0eccf35df5adcb67a
[]
no_license
stupaq/cloud-atlas
8927f47be20a8a8dac366015ce2da24ae335f3e5
4ffb3397ff2f2c3876c51c72fb9818b7b5159493
refs/heads/master
2021-01-17T12:30:39.539203
2014-06-22T08:26:53
2014-06-22T08:26:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
851
java
package stupaq.cloudatlas.messaging; import com.google.common.base.Preconditions; import com.google.common.util.concurrent.ListeningExecutorService; public interface MessageListener { Class<?> contract(); public ListeningExecutorService executor(); public static abstract class AbstractMessageListener implements MessageListener { private final ListeningExecutorService executor; private final Class<?> contract; protected AbstractMessageListener(ListeningExecutorService executor, Class<?> contract) { Preconditions.checkArgument(contract.isAssignableFrom(this.getClass())); this.executor = executor; this.contract = contract; } @Override public Class<?> contract() { return contract; } @Override public ListeningExecutorService executor() { return executor; } } }
dfd3ae68ba41fe6b316e0a41fec96f284920f4f4
9e084510fe512bb613d9e4d61052cdaeb5b21e9e
/src/main/java/com/example/pojo/Passage.java
9139359069ac063bca93b6947af450cbd0f3246e
[]
no_license
zixiaoshuixin/salephone-java
753f3cb3664f3e4d8bfc84703a93c6dff1cceb38
7e998eb001919991b812e6e4c967c06333775c66
refs/heads/master
2023-03-22T10:07:24.743171
2021-03-02T12:18:07
2021-03-02T12:18:07
343,754,361
0
0
null
null
null
null
UTF-8
Java
false
false
2,413
java
package com.example.pojo; import java.util.Date; public class Passage { /* * 文章标识符 */ private String postID; /** * 文章标题 */ private String postTitle; /** * 文章内容 */ private String postText; /** * 浏览人数 */ private int postPageviews; /** * 文章合成语音URL地址 */ private String postAudio; /** * 文章发表时间 */ private Date postTime; /** * 点赞数 */ private int postPageSupport; /** * 最后评论时间 */ private Date lastCmTime; /** * 作者用户名 */ private String userName; /** * 作者 */ private User user; public Passage() { super(); // TODO Auto-generated constructor stub } public String getPostID() { return postID; } public void setPostID(String postID) { this.postID = postID; } public String getPostTitle() { return postTitle; } public void setPostTitle(String postTitle) { this.postTitle = postTitle; } public String getPostText() { return postText; } public void setPostText(String postText) { this.postText = postText; } public int getPostPageviews() { return postPageviews; } public void setPostPageviews(int postPageviews) { this.postPageviews = postPageviews; } public String getPostAudio() { return postAudio; } public void setPostAudio(String postAudio) { this.postAudio = postAudio; } public Date getPostTime() { return postTime; } public void setPostTime(Date postTime) { this.postTime = postTime; } public int getPostPageSupport() { return postPageSupport; } public void setPostPageSupport(int postPageSupport) { this.postPageSupport = postPageSupport; } public Date getLastCmTime() { return lastCmTime; } public void setLastCmTime(Date lastCmTime) { this.lastCmTime = lastCmTime; } public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } public User getUser() { return user; } public void setUser(User user) { this.user = user; } @Override public String toString() { return "Passage [postID=" + postID + ", postTitle=" + postTitle + ", postText=" + postText + ", postPageviews=" + postPageviews + ", postAudio=" + postAudio + ", postTime=" + postTime + ", postPageSupport=" + postPageSupport + ", lastCmTime=" + lastCmTime + ", userName=" + userName + ", user=" + user + "]"; } }
08e911ee54a8db9db5de20283e565c708299579c
435666caea9b28a9ea78b9daf9aad6a0afb88eb0
/day_2/Solution5.java
d4a609bdde6161c0dde46391c25cf18c03be10a0
[]
no_license
kohegen/geecon2019
ad3bdc86dd252fc36249a6c3865439b99289de1f
1abdddbf46db5426e9a56e6567002b6a18aee72a
refs/heads/master
2020-06-10T21:05:34.128170
2019-06-25T22:36:10
2019-06-25T22:36:10
193,747,244
0
0
null
null
null
null
UTF-8
Java
false
false
2,457
java
package day_2; import java.util.Collections; import java.util.List; import java.util.stream.Collectors; public class Solution5 { public static void main(String[] args) { // is a composite natural number with an even number of digits, // that can be factored into two natural numbers each with half as many digits as the original number // and not both with trailing zeroes, where the two factors contain precisely all the digits of the original number, // in any order, counting multiplicity. The first vampire number is 1260 = 21 × 60. int N = Integer.parseInt(args[0]); int numbersFound = 0; int lastFoundNumber = 0; int number = 1259; while (true) { number++; String numberStr = String.valueOf(number); if (numberStr.length() % 2 != 0) { //need to be even continue; } int factorial = factorial(numberStr.length()); List<Character> numberAsList = numberStr.chars().mapToObj(c -> (char) c).collect(Collectors.toList()); for (int i=0;i<factorial*4;i++) { //this is really nasty but I don't have time to implement permutations Collections.shuffle(numberAsList); String factor1 = toString(numberAsList.subList(0, numberAsList.size() / 2)); String factor2 = toString(numberAsList.subList(numberAsList.size() / 2, numberAsList.size())); if (factor1.endsWith("0") & factor2.endsWith("0")) { //both cannot have trailing zeroes continue; } if (Integer.valueOf(factor1) * Integer.valueOf(factor2) == number) { //found vampire!! numbersFound++; lastFoundNumber = number; break; } } if (numbersFound == N) { System.out.println(lastFoundNumber); break; } } } private static int factorial(int n) { int factorial = 1; for (int i=1;i<=n;i++) { factorial*=i; } return factorial; } private static String toString(List<Character> chars) { return chars.toString() .substring(1, 3 * chars.size() - 1) .replaceAll(", ", ""); } }
e376c8fde483898bda14e4bd992050fb17c0d6f4
8af1164bac943cef64e41bae312223c3c0e38114
/results-java/JetBrains--intellij-community/d79b719bc730f529a522c83fe8bcb0e243faa76d/after/PyParameterListImpl.java
94e7d9dcaf048befc050978bc544725fbc07122d
[]
no_license
fracz/refactor-extractor
3ae45c97cc63f26d5cb8b92003b12f74cc9973a9
dd5e82bfcc376e74a99e18c2bf54c95676914272
refs/heads/master
2021-01-19T06:50:08.211003
2018-11-30T13:00:57
2018-11-30T13:00:57
87,353,478
0
0
null
null
null
null
UTF-8
Java
false
false
5,085
java
package com.jetbrains.python.psi.impl; import com.intellij.lang.ASTNode; import com.intellij.psi.PsiElement; import com.jetbrains.python.PyElementTypes; import com.jetbrains.python.psi.*; import com.jetbrains.python.psi.stubs.PyParameterListStub; import com.jetbrains.python.toolbox.ArrayIterable; import org.jetbrains.annotations.NotNull; /** * @author yole */ public class PyParameterListImpl extends PyBaseElementImpl<PyParameterListStub> implements PyParameterList { public PyParameterListImpl(ASTNode astNode) { super(astNode); } public PyParameterListImpl(final PyParameterListStub stub) { super(stub, PyElementTypes.PARAMETER_LIST); } @Override protected void acceptPyVisitor(PyElementVisitor pyVisitor) { pyVisitor.visitPyParameterList(this); } public PyParameter[] getParameters() { return getStubOrPsiChildren(PyElementTypes.PARAMETERS, new PyParameter[0]); } public void addParameter(final PyNamedParameter param) { PsiElement paren = getLastChild(); if (paren != null && ")".equals(paren.getText())) { PyUtil.ensureWritable(this); ASTNode beforeWhat = paren.getNode(); // the closing paren will be this PyParameter[] params = getParameters(); PyUtil.addListNode(this, param, beforeWhat, true, params.length == 0); } } public boolean hasPositionalContainer() { for (PyParameter parameter: getParameters()) { if (parameter instanceof PyNamedParameter && ((PyNamedParameter) parameter).isPositionalContainer()) { return true; } } return false; } public boolean hasKeywordContainer() { for (PyParameter parameter: getParameters()) { if (parameter instanceof PyNamedParameter && ((PyNamedParameter) parameter).isKeywordContainer()) { return true; } } return false; } public boolean isCompatibleTo(@NotNull PyParameterList another) { PyParameter[] parameters = getParameters(); final PyParameter[] anotherParameters = another.getParameters(); final int parametersLength = parameters.length; final int anotherParametersLength = anotherParameters.length; if (parametersLength == anotherParametersLength) { if (hasPositionalContainer() == another.hasPositionalContainer() && hasKeywordContainer() == another.hasKeywordContainer()) { return true; } } int i = 0; int j = 0; while (i < parametersLength && j < anotherParametersLength) { PyParameter parameter = parameters[i]; PyParameter anotherParameter = anotherParameters[j]; if (parameter instanceof PyNamedParameter && anotherParameter instanceof PyNamedParameter) { PyNamedParameter namedParameter = (PyNamedParameter)parameter; PyNamedParameter anotherNamedParameter = (PyNamedParameter)anotherParameter; if (namedParameter.isPositionalContainer()) { while (j < anotherParametersLength && !anotherNamedParameter.isPositionalContainer() && !anotherNamedParameter.isKeywordContainer()) { anotherParameter = anotherParameters[j++]; anotherNamedParameter = (PyNamedParameter) anotherParameter; } ++i; continue; } if (anotherNamedParameter.isPositionalContainer()) { while (i < parametersLength && !namedParameter.isPositionalContainer() && !namedParameter.isKeywordContainer()) { parameter = parameters[i++]; namedParameter = (PyNamedParameter) parameter; } ++j; continue; } if (namedParameter.isKeywordContainer() || anotherNamedParameter.isKeywordContainer()) { break; } } // both are simple parameters ++i; ++j; } if (i < parametersLength) { if (parameters[i] instanceof PyNamedParameter) { if (((PyNamedParameter) parameters[i]).isKeywordContainer()) { ++i; } } } if (j < anotherParametersLength) { if (anotherParameters[j] instanceof PyNamedParameter) { if (((PyNamedParameter) anotherParameters[j]).isKeywordContainer()) { ++j; } } } return (i >= parametersLength) && (j >= anotherParametersLength); // //if (weHaveStarred && parameters.length - 1 <= anotherParameters.length) { // if (weHaveDoubleStarred == anotherHasDoubleStarred) { // return true; // } //} //if ((anotherHasDoubleStarred && parameters.length == anotherParameters.length - 1) // || (weHaveDoubleStarred && parameters.length == anotherParameters.length + 1)) { // return true; //} //return false; } @NotNull public Iterable<PyElement> iterateNames() { return new ArrayIterable<PyElement>(getParameters()); } public PyElement getElementNamed(final String the_name) { return IterHelper.findName(iterateNames(), the_name); } public boolean mustResolveOutside() { return false; // we don't exactly have children to resolve, but if we did... } }
82a66e7d1f419b95b6398437b3f077d51f7b0b1a
9bbe56fc6d8fbbc9af8e1401e75b5a6fd4683a8b
/FinalLCRANN/app/src/androidTest/java/com/example/android/finallcrann/ExampleInstrumentedTest.java
2c0c1e0212fd54e9c5a1698234c9750256779546
[]
no_license
lcrann12/lcrannCsci372
9260f969c388432d47bfd9214147bdb378f13586
5dc5f01b9c81ae144d423eaa405221dfb32a7637
refs/heads/master
2021-05-08T11:17:12.749477
2018-05-10T23:39:43
2018-05-10T23:39:43
119,888,771
0
0
null
null
null
null
UTF-8
Java
false
false
763
java
package com.example.android.finallcrann; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() throws Exception { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.example.android.finallcrann", appContext.getPackageName()); } }
7502eebde0f2b56f9bf1be94f50c870ef997ed93
201636f109d8de3d3dab649367c161afc61dfa7a
/Distributed-Whiteboard/src/whiteboard/comms/WhiteboardInterface.java
aa864d8435e0cdc47ac635965b044ab803e251ec
[]
no_license
kabi/Distributed-Whiteboard
12b3d0cf769b99df2f25ea499b9fb5fc95c669a7
3028e317c712eec9278192377407b9d31908cb67
refs/heads/master
2021-01-16T20:48:12.894470
2011-10-12T14:52:41
2011-10-12T14:52:41
2,431,286
1
0
null
null
null
null
UTF-8
Java
false
false
1,175
java
package whiteboard.comms; import java.rmi.Remote; import java.rmi.RemoteException; import java.util.ArrayList; import whiteboard.object.AWhiteboardObject; // Remote interface for the server to be able to access the client methods public interface WhiteboardInterface extends Remote { /** * Synchronizes the client shapes when new shapes are drawn/ deleted * @param globalShapeList ShapeInfo object to be appended * @throws java.rmi.RemoteException exception */ public void setShapeList(ArrayList<AWhiteboardObject> globalShapeList) throws RemoteException; /** * Server calls this method to send a new object to the clients * @param item shape object received from the Whiteboard server * @throws java.rmi.RemoteException exception */ public void appendChartItem(AWhiteboardObject item) throws RemoteException; /** * Server calls this method to send messages to the clients * @param serverMessage message the server wishes to communicate with the clients * @throws java.rmi.RemoteException exception */ public void setServerMessage(String serverMessage) throws RemoteException; }
[ "Kabi@Kabiz" ]
Kabi@Kabiz
25eaa3ce17d3691ec17fa4d0bf33138736a3ffdd
1c126f978f9a01c751837ea7a6cb42823dceb140
/app/src/main/java/br/com/asb/activity/BackupSQLActivity.java
702a910d150d8e3c471d7957c09cda91669ac3ce
[]
no_license
Felssca/Burn_out
30b3fbbb1465ce2f45fd1914ea22df09cb9ceec2
77b88d64b8c538a96515c9292db7ca16a84a9d14
refs/heads/master
2022-11-12T19:27:35.175713
2020-06-29T04:15:19
2020-06-29T04:15:19
265,431,879
0
0
null
null
null
null
UTF-8
Java
false
false
7,197
java
package br.com.asb.activity; import android.Manifest; import android.app.Activity; import android.content.Intent; import android.content.pm.PackageManager; import android.net.Uri; import android.os.Bundle; import android.os.Environment; import android.support.v4.app.ActivityCompat; import android.support.v4.content.ContextCompat; import android.support.v4.content.FileProvider; import android.view.View; import android.widget.Button; import android.widget.TextView; import java.io.File; import java.io.FileFilter; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import br.com.asb.R; import br.com.asb.dialog.GeneralSysDialog; import br.com.asb.util.UtilDate; import static android.support.v4.content.FileProvider.getUriForFile; public class BackupSQLActivity extends Activity { TextView nomeBakup; Button btnBackup; Button btnCompartilhar; final String caminhoBancoIn = "/data/data/com.aplication.asb.asb/databases/ASB.db"; GeneralSysDialog generalSysDialog; String nomeArquivoBackup = ""; String arquivoBackupType = ""; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_lista_backup); intiView(); acaoButton(); } void intiView(){ nomeBakup = (TextView) findViewById(R.id.txt_nome_ultimo_backup); btnBackup = (Button) findViewById(R.id.btn_novo_backup); btnCompartilhar = (Button) findViewById(R.id.btn_compartilhar_backup); PermissoesActivity.verifyStoragePermissions(this); try { if(criarPastaDadosSQLiteBakcup()){ backupBaseDados(); }else{ } }catch(Exception ex){ ex.printStackTrace(); } } private void acaoButton() { btnBackup.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { try { backupBaseDados(); } catch (Exception e) { e.printStackTrace(); } } }); btnCompartilhar.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { try { compartilharBancoDados(); } catch (Exception e) { e.printStackTrace(); } } }); } private boolean criarPastaDadosSQLiteBakcup(){ PermissoesActivity.verifyStoragePermissions(this); boolean success = false; try { File folder = new File(Environment.getExternalStorageDirectory() + File.separator + "ASB"); success = true; if (!folder.exists()) { success = folder.mkdirs(); } if (success) { // Do something on success } else { generalSysDialog = new GeneralSysDialog(BackupSQLActivity.this); generalSysDialog.setDialog(R.string.dialog_corpo_backup_sql_erro_01,R.string.dialog_corpo_backup_sql_erro_01,1); } } catch (Exception e) { generalSysDialog = new GeneralSysDialog(BackupSQLActivity.this); generalSysDialog.setDialog(e.getMessage(),e.getCause().toString(),1); } finally { } return success; } /* Persiste os dados no celular "Efetua o Backup da base de dados" */ private void backupBaseDados()throws IOException{ OutputStream output = null; FileInputStream fis = null; UtilDate utilDate = new UtilDate(); PermissoesActivity.verifyStoragePermissions(this); try { File dbFile = new File(caminhoBancoIn); fis = new FileInputStream(dbFile); String numeroAliatorio = utilDate.gerarNumeroAliatorio(); nomeArquivoBackup = "ASB_copy_"+utilDate.dataAtual()+"-"+numeroAliatorio+".db"; String outFileName = Environment.getExternalStorageDirectory() +"/ASB/"+nomeArquivoBackup; // Open the empty db as the output stream output = new FileOutputStream(outFileName); nomeBakup.setText(outFileName); // Transfer bytes from the inputfile to the outputfile byte[] buffer = new byte[1024]; int length; while ((length = fis.read(buffer)) > 0) { output.write(buffer, 0, length); } generalSysDialog = new GeneralSysDialog(BackupSQLActivity.this); generalSysDialog.setDialog(R.string.dialog_titulo_backup_sql,R.string.dialog_corpo_backup_sql,2); }catch(IOException ex){ ex.printStackTrace(); generalSysDialog = new GeneralSysDialog(BackupSQLActivity.this); generalSysDialog.setDialog(ex.getMessage(),ex.getCause().toString(),1); }finally { output.flush(); output.close(); fis.close(); } } /* Preparar arquivo */ private void compartilharBancoDados()throws IOException{ PermissoesActivity.verifyStoragePermissions(this); InputStream inputStream = null; FileOutputStream fileOutputStream = null; FileInputStream fileInputStream = null; File bancoBkp; try { String arquivo = nomeBakup.getText().toString(); bancoBkp = new File(Environment.getExternalStorageDirectory()+"/ASB/",nomeArquivoBackup); compartilharBancoDadosShare(bancoBkp); /* fileInputStream = openFileInput(bancoBkp.toString()); int size = fileInputStream.available(); byte[]buffer = new byte[size]; fileInputStream.read(buffer); bancoBkp = new File(fileInputStream.toString()); */ }catch(Exception ex){ ex.printStackTrace(); generalSysDialog = new GeneralSysDialog(BackupSQLActivity.this); generalSysDialog.setDialog(ex.getMessage(),ex.getCause().toString(),1); }finally { inputStream.close(); fileOutputStream.close(); } } /* Compartilhar o arquivo */ private void compartilharBancoDadosShare(File file)throws IOException{ PermissoesActivity.verifyStoragePermissions(this); try { Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND); shareIntent.setAction(Intent.ACTION_SEND); Uri fileUri = getUriForFile(getApplicationContext(),"br.com.asb",file); shareIntent.putExtra (Intent.EXTRA_STREAM, fileUri); shareIntent.setType("application/vnd.sqlite3"); startActivity(shareIntent); }catch( Exception ex){ ex.printStackTrace(); generalSysDialog = new GeneralSysDialog(BackupSQLActivity.this); generalSysDialog.setDialog(ex.toString(),ex.getCause().toString(),1); } } }
591993f76a121ac0692f5cee7f5ff1d56a6c6cdc
19be38a4b7606c9a320b0feee5c4443672c4d57b
/src/androidTest/java/com/example/listview1/ExampleInstrumentedTest.java
1feab0bd5155e55b5f7b231ce397b8787171cf89
[]
no_license
lriveraEjercicios/AndroidListView1
94e472862c29afe788dd0bf9ce5b4dccfe0caaf8
290c41653bb74fcd25f9c34b52a290f48965e187
refs/heads/master
2020-06-05T05:38:20.792709
2019-06-19T08:43:20
2019-06-19T08:43:20
192,332,128
0
0
null
null
null
null
UTF-8
Java
false
false
752
java
package com.example.listview1; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.example.listview1", appContext.getPackageName()); } }
74c9673244155396aee3b2dda8622d2d3b9c7a5e
84c697df35ca32253229b6a9fa6c0f1e9cce4723
/dyson/src/main/java/com/artigile/homestats/sensor/dyson/model/DysonPureCoolData.java
0b97d54ca9774e567eb93dd704c11e51abbd9b3a
[]
no_license
ioanbsu/homestats
925c6269020322fda1beae987fea36eab2f956f7
4835d62cc0f8d00b0114a1fe787d934f9238fd39
refs/heads/master
2021-01-18T14:20:12.023339
2020-02-27T04:04:49
2020-02-27T04:04:49
32,686,455
4
0
null
null
null
null
UTF-8
Java
false
false
1,133
java
package com.artigile.homestats.sensor.dyson.model; import java.time.Instant; /** * Dyson pure cool data. */ public class DysonPureCoolData { public final SensorData currentSensorData; public final State currentState; public final Instant lastRefreshed; public DysonPureCoolData(final Builder builder) { this.currentSensorData = builder.currentSensorData; this.currentState = builder.currentState; this.lastRefreshed = builder.lastRefreshed; } public static class Builder { private SensorData currentSensorData; private State currentState; private Instant lastRefreshed; public Builder withCurrentSensorData(final SensorData currentSensorData) { this.currentSensorData = currentSensorData; return this; } public Builder withCurrentState(final State currentState) { this.currentState = currentState; return this; } public DysonPureCoolData build() { this.lastRefreshed = Instant.now(); return new DysonPureCoolData(this); } } }
124dc3fb3d1e307df2373b7602e2b0aeb02cc3a2
3e49e08ed83b5e3be344a07a7764cc458fe5510c
/Server/src/main/java/view/graphics/SettingController.java
1fec3957a4a2f08b0ab477244790693266c4ecda
[]
no_license
Advanced-Programming-2021/project-team-09
9f48a0f714e7127df54dd8f9dc700d29698c0fc0
796b3fcb104191d141f8e0572d400bde23282687
refs/heads/main
2023-06-28T13:38:22.147328
2021-07-21T20:08:01
2021-07-21T20:08:01
355,936,327
0
1
null
null
null
null
UTF-8
Java
false
false
3,526
java
package view.graphics; import javafx.beans.value.ChangeListener; import javafx.beans.value.ObservableValue; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.Slider; import javafx.scene.control.ToggleButton; import javafx.scene.control.ToggleGroup; import javafx.scene.layout.AnchorPane; import javafx.scene.media.Media; import javafx.scene.media.MediaPlayer; import javafx.scene.paint.Color; import javafx.stage.Stage; import model.enums.Cursor; import model.enums.VoiceEffects; import java.net.URL; import java.util.ResourceBundle; public class SettingController extends Menu implements Initializable { private final static MediaPlayer PLAYER = new MediaPlayer(getVoice("BackGroundMusic","mp3")); private static boolean isMute = false; private static double sfxVolume = 0.5; private static double volume = 0.5; @FXML private AnchorPane mainPane; @FXML private Button exitButton; @FXML private Button importExport; @FXML private Slider sfxSlider; @FXML private Slider volumeSlider; @FXML private ToggleButton muteToggle; public static double getSFX() { return sfxVolume; } @Override public void initialize(URL url, ResourceBundle resourceBundle) { initToggle(); exitButton.setOnMouseEntered(mouseEvent -> changeCursor(Cursor.CANCEL,mouseEvent)); exitButton.setOnMouseExited(mouseEvent -> changeCursor(Cursor.DEFAULT,mouseEvent)); justifyButton(importExport,Cursor.TRASH); importExport.setOnMouseClicked(mouseEvent -> { playMedia(VoiceEffects.CLICK); goToImportExport(); }); exitButton.setOnMouseClicked(mouseEvent -> { playMedia(VoiceEffects.EXPLODE); close(); }); volumeSlider.valueProperty().addListener((observableValue, number, t1) -> PLAYER.setVolume(t1.doubleValue())); sfxSlider.valueProperty().addListener((observableValue, number, t1) -> { sfxVolume = t1.doubleValue(); playMedia(VoiceEffects.KEYBOARD_HIT); }); volumeSlider.setValue(PLAYER.getVolume()); sfxSlider.setValue(sfxVolume); } private void initToggle() { muteToggle.setSelected(isMute); ToggleGroup group = new ToggleGroup(); group.getToggles().add(muteToggle); onSelectToggle(muteToggle,group); muteToggle.setOnAction(actionEvent -> { playMedia(VoiceEffects.CLICK); onSelectToggle(muteToggle,group); if (muteToggle.isSelected()) mute(); else unMute(); }); } private void close() { Scene scene = mainPane.getScene(); setCurrentScene(Menu.getSceneBuffer()); setSceneBuffer(null); ((Stage)scene.getWindow()).close(); } public static void playBG() { PLAYER.setVolume(0.5); PLAYER.setCycleCount(-1); PLAYER.play(); } private void mute() { isMute = true; PLAYER.setMute(true); PLAYER.pause(); } private void unMute() { isMute = false; PLAYER.setMute(false); PLAYER.play(); } private void goToImportExport() { Scene scene = new Scene(getNode("ImportExportMenu"),-1,-1,true); scene.setFill(Color.TRANSPARENT); Menu.setCurrentScene(scene); ((Stage)mainPane.getScene().getWindow()).setScene(scene); } }
b89dd4b592221b2ed8d7e9d83464b5ce25ca1a54
275c5bda1294283cb7c007fea0b6d1a43761e2bb
/raven-compiler/src/main/java/org/raven/antlr/ast/Return.java
ef929504d250afd56f22e60643995eb510e5f573
[ "MIT" ]
permissive
BradleyWood/Raven-Lang
5956bd480bc14d4481969dfec79312a66576855e
8ad3bf166a33b71975f2b87ba8ec67245289fad3
refs/heads/master
2021-07-10T22:03:25.246892
2019-01-06T10:24:12
2019-01-06T10:24:12
102,515,994
2
0
MIT
2018-07-03T17:56:53
2017-09-05T18:27:34
Java
UTF-8
Java
false
false
862
java
package org.raven.antlr.ast; import java.util.Objects; public class Return extends Statement { private final Expression value; public Return(final Expression value) { this.value = value; } public Expression getValue() { return value; } @Override public void accept(final TreeVisitor visitor) { visitor.visitReturn(this); } @Override public boolean equals(final Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Return aReturn = (Return) o; return Objects.equals(value, aReturn.value); } @Override public int hashCode() { return Objects.hash(value); } @Override public String toString() { return "return" + (value != null ? " " + value.toString() : "") + ";"; } }
5ea3826b40b35ab691be6bf7037e3133a93741a6
32b72e1dc8b6ee1be2e80bb70a03a021c83db550
/ast_results/zxing_zxing/core/src/main/java/com/google/zxing/ResultPoint.java
8b26fd132c620eac19341926de7a40c6b48fddca
[]
no_license
cmFodWx5YWRhdjEyMTA5/smell-and-machine-learning
d90c41a17e88fcd99d543124eeb6e93f9133cb4a
0564143d92f8024ff5fa6b659c2baebf827582b1
refs/heads/master
2020-07-13T13:53:40.297493
2019-01-11T11:51:18
2019-01-11T11:51:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,521
java
// isComment package com.google.zxing; import com.google.zxing.common.detector.MathUtils; /** * isComment */ public class isClassOrIsInterface { private final float isVariable; private final float isVariable; public isConstructor(float isParameter, float isParameter) { this.isFieldAccessExpr = isNameExpr; this.isFieldAccessExpr = isNameExpr; } public final float isMethod() { return isNameExpr; } public final float isMethod() { return isNameExpr; } @Override public final boolean isMethod(Object isParameter) { if (isNameExpr instanceof ResultPoint) { ResultPoint isVariable = (ResultPoint) isNameExpr; return isNameExpr == isNameExpr.isFieldAccessExpr && isNameExpr == isNameExpr.isFieldAccessExpr; } return true; } @Override public final int isMethod() { return isIntegerConstant * isNameExpr.isMethod(isNameExpr) + isNameExpr.isMethod(isNameExpr); } @Override public final String isMethod() { return "isStringConstant" + isNameExpr + 'isStringConstant' + isNameExpr + 'isStringConstant'; } /** * isComment */ public static void isMethod(ResultPoint[] isParameter) { // isComment float isVariable = isMethod(isNameExpr[isIntegerConstant], isNameExpr[isIntegerConstant]); float isVariable = isMethod(isNameExpr[isIntegerConstant], isNameExpr[isIntegerConstant]); float isVariable = isMethod(isNameExpr[isIntegerConstant], isNameExpr[isIntegerConstant]); ResultPoint isVariable; ResultPoint isVariable; ResultPoint isVariable; // isComment if (isNameExpr >= isNameExpr && isNameExpr >= isNameExpr) { isNameExpr = isNameExpr[isIntegerConstant]; isNameExpr = isNameExpr[isIntegerConstant]; isNameExpr = isNameExpr[isIntegerConstant]; } else if (isNameExpr >= isNameExpr && isNameExpr >= isNameExpr) { isNameExpr = isNameExpr[isIntegerConstant]; isNameExpr = isNameExpr[isIntegerConstant]; isNameExpr = isNameExpr[isIntegerConstant]; } else { isNameExpr = isNameExpr[isIntegerConstant]; isNameExpr = isNameExpr[isIntegerConstant]; isNameExpr = isNameExpr[isIntegerConstant]; } // isComment if (isMethod(isNameExpr, isNameExpr, isNameExpr) < isDoubleConstant) { ResultPoint isVariable = isNameExpr; isNameExpr = isNameExpr; isNameExpr = isNameExpr; } isNameExpr[isIntegerConstant] = isNameExpr; isNameExpr[isIntegerConstant] = isNameExpr; isNameExpr[isIntegerConstant] = isNameExpr; } /** * isComment */ public static float isMethod(ResultPoint isParameter, ResultPoint isParameter) { return isNameExpr.isMethod(isNameExpr.isFieldAccessExpr, isNameExpr.isFieldAccessExpr, isNameExpr.isFieldAccessExpr, isNameExpr.isFieldAccessExpr); } /** * isComment */ private static float isMethod(ResultPoint isParameter, ResultPoint isParameter, ResultPoint isParameter) { float isVariable = isNameExpr.isFieldAccessExpr; float isVariable = isNameExpr.isFieldAccessExpr; return ((isNameExpr.isFieldAccessExpr - isNameExpr) * (isNameExpr.isFieldAccessExpr - isNameExpr)) - ((isNameExpr.isFieldAccessExpr - isNameExpr) * (isNameExpr.isFieldAccessExpr - isNameExpr)); } }
9eeaf8eb1d5fa069354e21d3cbf29bb755365e9b
2298c4b740fd996c0538840fb3a0fa76cb0d0ded
/src/main/java/com/team/manage/common/util/secert/DESSecret.java
7a2c9c8a7f9f6887306c4bf0ab79e3dee2da4192
[]
no_license
EliteCollection/server
50756146eea75dfd91fa8658fd94b58b0797d28e
0f843b338fc523b235b8fe49939dec49840e7324
refs/heads/feature-v1.0.0
2022-07-09T12:48:30.083657
2019-06-05T08:25:54
2019-06-05T08:25:54
166,790,373
3
0
null
2022-06-17T02:03:30
2019-01-21T09:56:13
Java
UTF-8
Java
false
false
5,123
java
package com.team.manage.common.util.secert; import com.team.manage.enums.SecretType; import sun.misc.BASE64Decoder; import sun.misc.BASE64Encoder; import javax.crypto.Cipher; import javax.crypto.SecretKey; import javax.crypto.SecretKeyFactory; import javax.crypto.spec.DESKeySpec; import java.security.Key; import java.security.SecureRandom; /** * DES对称加密算法 * * @author tcyu */ public class DESSecret extends Secret { // 算法名称 public static final String KEY_ALGORITHM = "DES"; public static final String KEY_DES_NOPADDING = "DES/ECB/NoPadding"; // 算法名称/加密模式/填充方式 // DES共有四种工作模式-->>ECB:电子密码本模式、CBC:加密分组链接模式、CFB:加密反馈模式、OFB:输出反馈模式 public static final String CIPHER_ALGORITHM = "DES/ECB/PKCS5Padding"; /** * 生成密钥 * * @param keyStr * @return * @throws Exception */ private SecretKey keyGenerator(String keyStr) throws Exception { MD5Secret md5Secret = (MD5Secret) SecretFactory.getInstance().getSecret(SecretType.MD5); byte input[] = HexString2Bytes(md5Secret.encode(keyStr)); DESKeySpec desKey = new DESKeySpec(input); // 创建一个密匙工厂,然后用它把DESKeySpec转换成 SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES"); SecretKey securekey = keyFactory.generateSecret(desKey); return securekey; } private int parse(char c) { if (c >= 'a') return (c - 'a' + 10) & 0x0f; if (c >= 'A') return (c - 'A' + 10) & 0x0f; return (c - '0') & 0x0f; } // 从十六进制字符串到字节数组转换 public byte[] HexString2Bytes(String hexstr) { byte[] b = new byte[hexstr.length() / 2]; int j = 0; for (int i = 0; i < b.length; i++) { char c0 = hexstr.charAt(j++); char c1 = hexstr.charAt(j++); b[i] = (byte) ((parse(c0) << 4) | parse(c1)); } return b; } public static String bytesToHexString(byte[] src) { StringBuilder stringBuilder = new StringBuilder(""); if (src == null || src.length <= 0) { return null; } for (int i = 0; i < src.length; i++) { int v = src[i] & 0xFF; String hv = Integer.toHexString(v); if (hv.length() < 2) { stringBuilder.append(0); } stringBuilder.append(hv); } return stringBuilder.toString(); } @Override public String encode(String str, String coded) throws SecretException { throw new SecretException("DES接密需要密钥"); } @Override public String decode(String str, String coded) throws SecretException { throw new SecretException("DES加密,需要密钥"); } @Override public String decodeWithKey(String str, String coded, String key) throws Exception { Key deskey = keyGenerator(key); Cipher cipher = Cipher.getInstance(CIPHER_ALGORITHM); // 初始化Cipher对象,设置为解密模式 cipher.init(Cipher.DECRYPT_MODE, deskey); // 执行解密操作 BASE64Decoder deceode = new BASE64Decoder(); return new String(cipher.doFinal(deceode.decodeBuffer(str))); } @Override public String encodeWithKey(String str, String coded, String key) throws Exception { Key deskey = keyGenerator(key); // 实例化Cipher对象,它用于完成实际的加密操作 Cipher cipher = Cipher.getInstance(KEY_ALGORITHM); SecureRandom random = new SecureRandom(); // 初始化Cipher对象,设置为加密模式 cipher.init(Cipher.ENCRYPT_MODE, deskey, random); byte[] results = cipher.doFinal(str.getBytes()); // 该部分是为了与加解密在线测试网站(http://tripledes.online-domain-tools.com/)的十六进制结果进行核对 for (int i = 0; i < results.length; i++) { //System.out.print(results[i] + " "); } // 执行加密操作。加密后的结果通常都会用Base64编码进行传输 BASE64Encoder encode = new BASE64Encoder(); return encode.encode(results); } /** * @param args */ public static void main(String[] args) throws Exception { DESSecret desSecret = new DESSecret(); String permission = "2,3,4,5,6,7,8,9,10,11,12,13,14,15,84,96,98,104,105,117"; String permission1 = "2,3,4,5,6,7,8,9,10,11,12,13,14,15,96,98"; // String macAddress = "40-B0-34-52-FB-79"; //jjwu专属有线 // String macAddress = "C8-21-58-7E-BC-D3"; //jjwu专属无线 String macAddress = "AC-DE-48-00-11-22"; String secretKey = desSecret.encodeWithKey(permission1, "utf-8", "47174063-8" + macAddress + "jh520"); System.out.println(secretKey); System.out.println(desSecret.decodeWithKey(secretKey, "utf-8", "47174063-8" + macAddress + "jh520")); // eM0hSe6np5E= } }
476a24864fd92aa8fecf97fbe63074fba3dec4d6
d0536669bb37019e766766461032003ad045665b
/jdk1.4.2_src/javax/swing/text/BoxView.java
691289929caf1c57a8ea57fbba23de9d7b727e7e
[]
no_license
eagle518/jdk-source-code
c0d60f0762bce0221c7eeb1654aa1a53a3877313
91b771140de051fb843af246ab826dd6ff688fe3
refs/heads/master
2021-01-18T19:51:07.988541
2010-09-09T06:36:02
2010-09-09T06:36:02
38,047,470
11
23
null
null
null
null
UTF-8
Java
false
false
40,645
java
/* * @(#)BoxView.java 1.59 03/01/23 * * Copyright 2003 Sun Microsystems, Inc. All rights reserved. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */ package javax.swing.text; import java.io.PrintStream; import java.util.Vector; import java.awt.*; import javax.swing.event.DocumentEvent; import javax.swing.SizeRequirements; /** * A view that arranges its children into a box shape by tiling * its children along an axis. The box is somewhat like that * found in TeX where there is alignment of the * children, flexibility of the children is considered, etc. * This is a building block that might be useful to represent * things like a collection of lines, paragraphs, * lists, columns, pages, etc. The axis along which the children are tiled is * considered the major axis. The orthoginal axis is the minor axis. * <p> * Layout for each axis is handled separately by the methods * <code>layoutMajorAxis</code> and <code>layoutMinorAxis</code>. * Subclasses can change the layout algorithm by * reimplementing these methods. These methods will be called * as necessary depending upon whether or not there is cached * layout information and the cache is considered * valid. These methods are typically called if the given size * along the axis changes, or if <code>layoutChanged</code> is * called to force an updated layout. The <code>layoutChanged</code> * method invalidates cached layout information, if there is any. * The requirements published to the parent view are calculated by * the methods <code>calculateMajorAxisRequirements</code> * and <code>calculateMinorAxisRequirements</code>. * If the layout algorithm is changed, these methods will * likely need to be reimplemented. * * @author Timothy Prinzing * @version 1.59 01/23/03 */ public class BoxView extends CompositeView { /** * Constructs a <code>BoxView</code>. * * @param elem the element this view is responsible for * @param axis either <code>View.X_AXIS</code> or <code>View.Y_AXIS</code> */ public BoxView(Element elem, int axis) { super(elem); tempRect = new Rectangle(); this.majorAxis = axis; majorOffsets = new int[0]; majorSpans = new int[0]; majorReqValid = false; majorAllocValid = false; minorOffsets = new int[0]; minorSpans = new int[0]; minorReqValid = false; minorAllocValid = false; } /** * Fetches the tile axis property. This is the axis along which * the child views are tiled. * * @return the major axis of the box, either * <code>View.X_AXIS</code> or <code>View.Y_AXIS</code> * * @since 1.3 */ public int getAxis() { return majorAxis; } /** * Sets the tile axis property. This is the axis along which * the child views are tiled. * * @param axis either <code>View.X_AXIS</code> or <code>View.Y_AXIS</code> * * @since 1.3 */ public void setAxis(int axis) { boolean axisChanged = (axis != majorAxis); majorAxis = axis; if (axisChanged) { preferenceChanged(null, true, true); } } /** * Invalidates the layout along an axis. This happens * automatically if the preferences have changed for * any of the child views. In some cases the layout * may need to be recalculated when the preferences * have not changed. The layout can be marked as * invalid by calling this method. The layout will * be updated the next time the <code>setSize</code> method * is called on this view (typically in paint). * * @param axis either <code>View.X_AXIS</code> or <code>View.Y_AXIS</code> * * @since 1.3 */ public void layoutChanged(int axis) { if (axis == majorAxis) { majorAllocValid = false; } else { minorAllocValid = false; } } /** * Determines if the layout is valid along the given axis. * * @param axis either <code>View.X_AXIS</code> or <code>View.Y_AXIS</code> * * @since 1.4 */ protected boolean isLayoutValid(int axis) { if (axis == majorAxis) { return majorAllocValid; } else { return minorAllocValid; } } /** * Paints a child. By default * that is all it does, but a subclass can use this to paint * things relative to the child. * * @param g the graphics context * @param alloc the allocated region to paint into * @param index the child index, >= 0 && < getViewCount() */ protected void paintChild(Graphics g, Rectangle alloc, int index) { View child = getView(index); child.paint(g, alloc); } // --- View methods --------------------------------------------- /** * Invalidates the layout and resizes the cache of * requests/allocations. The child allocations can still * be accessed for the old layout, but the new children * will have an offset and span of 0. * * @param index the starting index into the child views to insert * the new views; this should be a value >= 0 and <= getViewCount * @param length the number of existing child views to remove; * This should be a value >= 0 and <= (getViewCount() - offset) * @param elems the child views to add; this value can be * <code>null</code>to indicate no children are being added * (useful to remove) */ public void replace(int index, int length, View[] elems) { super.replace(index, length, elems); // invalidate cache int nInserted = (elems != null) ? elems.length : 0; majorOffsets = updateLayoutArray(majorOffsets, index, nInserted); majorSpans = updateLayoutArray(majorSpans, index, nInserted); majorReqValid = false; majorAllocValid = false; minorOffsets = updateLayoutArray(minorOffsets, index, nInserted); minorSpans = updateLayoutArray(minorSpans, index, nInserted); minorReqValid = false; minorAllocValid = false; } /** * Resizes the given layout array to match the new number of * child views. The current number of child views are used to * produce the new array. The contents of the old array are * inserted into the new array at the appropriate places so that * the old layout information is transferred to the new array. * * @param oldArray the original layout array * @param offset location where new views will be inserted * @param nInserted the number of child views being inserted; * therefore the number of blank spaces to leave in the * new array at location <code>offset</code> * @return the new layout array */ int[] updateLayoutArray(int[] oldArray, int offset, int nInserted) { int n = getViewCount(); int[] newArray = new int[n]; System.arraycopy(oldArray, 0, newArray, 0, offset); System.arraycopy(oldArray, offset, newArray, offset + nInserted, n - nInserted - offset); return newArray; } /** * Forwards the given <code>DocumentEvent</code> to the child views * that need to be notified of the change to the model. * If a child changed its requirements and the allocation * was valid prior to forwarding the portion of the box * from the starting child to the end of the box will * be repainted. * * @param ec changes to the element this view is responsible * for (may be <code>null</code> if there were no changes) * @param e the change information from the associated document * @param a the current allocation of the view * @param f the factory to use to rebuild if the view has children * @see #insertUpdate * @see #removeUpdate * @see #changedUpdate */ protected void forwardUpdate(DocumentEvent.ElementChange ec, DocumentEvent e, Shape a, ViewFactory f) { boolean wasValid = isLayoutValid(majorAxis); super.forwardUpdate(ec, e, a, f); // determine if a repaint is needed if (wasValid && (! isLayoutValid(majorAxis))) { // Repaint is needed because one of the tiled children // have changed their span along the major axis. If there // is a hosting component and an allocated shape we repaint. Component c = getContainer(); if ((a != null) && (c != null)) { int pos = e.getOffset(); int index = getViewIndexAtPosition(pos); Rectangle alloc = getInsideAllocation(a); if (majorAxis == X_AXIS) { alloc.x += majorOffsets[index]; alloc.width -= majorOffsets[index]; } else { alloc.y += minorOffsets[index]; alloc.height -= minorOffsets[index]; } c.repaint(alloc.x, alloc.y, alloc.width, alloc.height); } } } /** * This is called by a child to indicate its * preferred span has changed. This is implemented to * throw away cached layout information so that new * calculations will be done the next time the children * need an allocation. * * @param child the child view * @param width true if the width preference should change * @param height true if the height preference should change */ public void preferenceChanged(View child, boolean width, boolean height) { boolean majorChanged = (majorAxis == X_AXIS) ? width : height; boolean minorChanged = (majorAxis == X_AXIS) ? height : width; if (majorChanged) { majorReqValid = false; majorAllocValid = false; } if (minorChanged) { minorReqValid = false; minorAllocValid = false; } super.preferenceChanged(child, width, height); } /** * Gets the resize weight. A value of 0 or less is not resizable. * * @param axis may be either <code>View.X_AXIS</code> or * <code>View.Y_AXIS</code> * @return the weight * @exception IllegalArgumentException for an invalid axis */ public int getResizeWeight(int axis) { checkRequests(axis); if (axis == majorAxis) { if ((majorRequest.preferred != majorRequest.minimum) || (majorRequest.preferred != majorRequest.maximum)) { return 1; } } else { if ((minorRequest.preferred != minorRequest.minimum) || (minorRequest.preferred != minorRequest.maximum)) { return 1; } } return 0; } /** * Sets the size of the view along an axis. This should cause * layout of the view along the given axis. * * @param axis may be either <code>View.X_AXIS</code> or * <code>View.Y_AXIS</code> * @param span the span to layout to >= 0 */ void setSpanOnAxis(int axis, float span) { if (axis == majorAxis) { if (majorSpan != (int) span) { majorAllocValid = false; } if (! majorAllocValid) { // layout the major axis majorSpan = (int) span; checkRequests(majorAxis); layoutMajorAxis(majorSpan, axis, majorOffsets, majorSpans); majorAllocValid = true; // flush changes to the children updateChildSizes(); } } else { if (((int) span) != minorSpan) { minorAllocValid = false; } if (! minorAllocValid) { // layout the minor axis minorSpan = (int) span; checkRequests(axis); layoutMinorAxis(minorSpan, axis, minorOffsets, minorSpans); minorAllocValid = true; // flush changes to the children updateChildSizes(); } } } /** * Propagates the current allocations to the child views. */ void updateChildSizes() { int n = getViewCount(); if (majorAxis == X_AXIS) { for (int i = 0; i < n; i++) { View v = getView(i); v.setSize((float) majorSpans[i], (float) minorSpans[i]); } } else { for (int i = 0; i < n; i++) { View v = getView(i); v.setSize((float) minorSpans[i], (float) majorSpans[i]); } } } /** * Returns the size of the view along an axis. This is implemented * to return zero. * * @param axis may be either <code>View.X_AXIS</code> or * <code>View.Y_AXIS</code> * @return the current span of the view along the given axis, >= 0 */ float getSpanOnAxis(int axis) { if (axis == majorAxis) { return majorSpan; } else { return minorSpan; } } /** * Sets the size of the view. This should cause * layout of the view if the view caches any layout * information. This is implemented to call the * layout method with the sizes inside of the insets. * * @param width the width >= 0 * @param height the height >= 0 */ public void setSize(float width, float height) { layout((int)(width - getLeftInset() - getRightInset()), (int)(height - getTopInset() - getBottomInset())); } /** * Renders the <code>BoxView</code> using the given * rendering surface and area * on that surface. Only the children that intersect * the clip bounds of the given <code>Graphics</code> * will be rendered. * * @param g the rendering surface to use * @param allocation the allocated region to render into * @see View#paint */ public void paint(Graphics g, Shape allocation) { Rectangle alloc = (allocation instanceof Rectangle) ? (Rectangle)allocation : allocation.getBounds(); int n = getViewCount(); int x = alloc.x + getLeftInset(); int y = alloc.y + getTopInset(); Rectangle clip = g.getClipBounds(); for (int i = 0; i < n; i++) { tempRect.x = x + getOffset(X_AXIS, i); tempRect.y = y + getOffset(Y_AXIS, i); tempRect.width = getSpan(X_AXIS, i); tempRect.height = getSpan(Y_AXIS, i); if (tempRect.intersects(clip)) { paintChild(g, tempRect, i); } } } /** * Fetches the allocation for the given child view. * This enables finding out where various views * are located. This is implemented to return * <code>null</code> if the layout is invalid, * otherwise the superclass behavior is executed. * * @param index the index of the child, >= 0 && < getViewCount() * @param a the allocation to this view * @return the allocation to the child; or <code>null</code> * if <code>a</code> is <code>null</code>; * or <code>null</code> if the layout is invalid */ public Shape getChildAllocation(int index, Shape a) { if (a != null) { Shape ca = super.getChildAllocation(index, a); if ((ca != null) && (! isAllocationValid())) { // The child allocation may not have been set yet. Rectangle r = (ca instanceof Rectangle) ? (Rectangle) ca : ca.getBounds(); if ((r.width == 0) && (r.height == 0)) { return null; } } return ca; } return null; } /** * Provides a mapping from the document model coordinate space * to the coordinate space of the view mapped to it. This makes * sure the allocation is valid before calling the superclass. * * @param pos the position to convert >= 0 * @param a the allocated region to render into * @return the bounding box of the given position * @exception BadLocationException if the given position does * not represent a valid location in the associated document * @see View#modelToView */ public Shape modelToView(int pos, Shape a, Position.Bias b) throws BadLocationException { if (! isAllocationValid()) { Rectangle alloc = a.getBounds(); setSize(alloc.width, alloc.height); } return super.modelToView(pos, a, b); } /** * Provides a mapping from the view coordinate space to the logical * coordinate space of the model. * * @param x x coordinate of the view location to convert >= 0 * @param y y coordinate of the view location to convert >= 0 * @param a the allocated region to render into * @return the location within the model that best represents the * given point in the view >= 0 * @see View#viewToModel */ public int viewToModel(float x, float y, Shape a, Position.Bias[] bias) { if (! isAllocationValid()) { Rectangle alloc = a.getBounds(); setSize(alloc.width, alloc.height); } return super.viewToModel(x, y, a, bias); } /** * Determines the desired alignment for this view along an * axis. This is implemented to give the total alignment * needed to position the children with the alignment points * lined up along the axis orthoginal to the axis that is * being tiled. The axis being tiled will request to be * centered (i.e. 0.5f). * * @param axis may be either <code>View.X_AXIS</code> * or <code>View.Y_AXIS</code> * @return the desired alignment >= 0.0f && <= 1.0f; this should * be a value between 0.0 and 1.0 where 0 indicates alignment at the * origin and 1.0 indicates alignment to the full span * away from the origin; an alignment of 0.5 would be the * center of the view * @exception IllegalArgumentException for an invalid axis */ public float getAlignment(int axis) { checkRequests(axis); if (axis == majorAxis) { return majorRequest.alignment; } else { return minorRequest.alignment; } } /** * Determines the preferred span for this view along an * axis. * * @param axis may be either <code>View.X_AXIS</code> * or <code>View.Y_AXIS</code> * @return the span the view would like to be rendered into >= 0; * typically the view is told to render into the span * that is returned, although there is no guarantee; * the parent may choose to resize or break the view * @exception IllegalArgumentException for an invalid axis type */ public float getPreferredSpan(int axis) { checkRequests(axis); float marginSpan = (axis == X_AXIS) ? getLeftInset() + getRightInset() : getTopInset() + getBottomInset(); if (axis == majorAxis) { return ((float)majorRequest.preferred) + marginSpan; } else { return ((float)minorRequest.preferred) + marginSpan; } } /** * Determines the minimum span for this view along an * axis. * * @param axis may be either <code>View.X_AXIS</code> * or <code>View.Y_AXIS</code> * @return the span the view would like to be rendered into >= 0; * typically the view is told to render into the span * that is returned, although there is no guarantee; * the parent may choose to resize or break the view * @exception IllegalArgumentException for an invalid axis type */ public float getMinimumSpan(int axis) { checkRequests(axis); float marginSpan = (axis == X_AXIS) ? getLeftInset() + getRightInset() : getTopInset() + getBottomInset(); if (axis == majorAxis) { return ((float)majorRequest.minimum) + marginSpan; } else { return ((float)minorRequest.minimum) + marginSpan; } } /** * Determines the maximum span for this view along an * axis. * * @param axis may be either <code>View.X_AXIS</code> * or <code>View.Y_AXIS</code> * @return the span the view would like to be rendered into >= 0; * typically the view is told to render into the span * that is returned, although there is no guarantee; * the parent may choose to resize or break the view * @exception IllegalArgumentException for an invalid axis type */ public float getMaximumSpan(int axis) { checkRequests(axis); float marginSpan = (axis == X_AXIS) ? getLeftInset() + getRightInset() : getTopInset() + getBottomInset(); if (axis == majorAxis) { return ((float)majorRequest.maximum) + marginSpan; } else { return ((float)minorRequest.maximum) + marginSpan; } } // --- local methods ---------------------------------------------------- /** * Are the allocations for the children still * valid? * * @return true if allocations still valid */ protected boolean isAllocationValid() { return (majorAllocValid && minorAllocValid); } /** * Determines if a point falls before an allocated region. * * @param x the X coordinate >= 0 * @param y the Y coordinate >= 0 * @param innerAlloc the allocated region; this is the area * inside of the insets * @return true if the point lies before the region else false */ protected boolean isBefore(int x, int y, Rectangle innerAlloc) { if (majorAxis == View.X_AXIS) { return (x < innerAlloc.x); } else { return (y < innerAlloc.y); } } /** * Determines if a point falls after an allocated region. * * @param x the X coordinate >= 0 * @param y the Y coordinate >= 0 * @param innerAlloc the allocated region; this is the area * inside of the insets * @return true if the point lies after the region else false */ protected boolean isAfter(int x, int y, Rectangle innerAlloc) { if (majorAxis == View.X_AXIS) { return (x > (innerAlloc.width + innerAlloc.x)); } else { return (y > (innerAlloc.height + innerAlloc.y)); } } /** * Fetches the child view at the given coordinates. * * @param x the X coordinate >= 0 * @param y the Y coordinate >= 0 * @param alloc the parents inner allocation on entry, which should * be changed to the childs allocation on exit * @return the view */ protected View getViewAtPoint(int x, int y, Rectangle alloc) { int n = getViewCount(); if (majorAxis == View.X_AXIS) { if (x < (alloc.x + majorOffsets[0])) { childAllocation(0, alloc); return getView(0); } for (int i = 0; i < n; i++) { if (x < (alloc.x + majorOffsets[i])) { childAllocation(i - 1, alloc); return getView(i - 1); } } childAllocation(n - 1, alloc); return getView(n - 1); } else { if (y < (alloc.y + majorOffsets[0])) { childAllocation(0, alloc); return getView(0); } for (int i = 0; i < n; i++) { if (y < (alloc.y + majorOffsets[i])) { childAllocation(i - 1, alloc); return getView(i - 1); } } childAllocation(n - 1, alloc); return getView(n - 1); } } /** * Allocates a region for a child view. * * @param index the index of the child view to * allocate, >= 0 && < getViewCount() * @param alloc the allocated region */ protected void childAllocation(int index, Rectangle alloc) { alloc.x += getOffset(X_AXIS, index); alloc.y += getOffset(Y_AXIS, index); alloc.width = getSpan(X_AXIS, index); alloc.height = getSpan(Y_AXIS, index); } /** * Perform layout on the box * * @param width the width (inside of the insets) >= 0 * @param height the height (inside of the insets) >= 0 */ protected void layout(int width, int height) { setSpanOnAxis(X_AXIS, width); setSpanOnAxis(Y_AXIS, height); } /** * Returns the current width of the box. This is the width that * it was last allocated. * @return the current width of the box */ public int getWidth() { int span; if (majorAxis == X_AXIS) { span = majorSpan; } else { span = minorSpan; } span += getLeftInset() - getRightInset(); return span; } /** * Returns the current height of the box. This is the height that * it was last allocated. * @return the current height of the box */ public int getHeight() { int span; if (majorAxis == Y_AXIS) { span = majorSpan; } else { span = minorSpan; } span += getTopInset() - getBottomInset(); return span; } /** * Performs layout for the major axis of the box (i.e. the * axis that it represents). The results of the layout should * be placed in the given arrays which represent the allocations * to the children along the major axis. * * @param targetSpan the total span given to the view, which * would be used to layout the children * @param axis the axis being layed out * @param offsets the offsets from the origin of the view for * each of the child views; this is a return value and is * filled in by the implementation of this method * @param spans the span of each child view; this is a return * value and is filled in by the implementation of this method * @return the offset and span for each child view in the * offsets and spans parameters */ protected void layoutMajorAxis(int targetSpan, int axis, int[] offsets, int[] spans) { /* * first pass, calculate the preferred sizes * and the flexibility to adjust the sizes. */ long minimum = 0; long maximum = 0; long preferred = 0; int n = getViewCount(); for (int i = 0; i < n; i++) { View v = getView(i); spans[i] = (int) v.getPreferredSpan(axis); preferred += spans[i]; minimum += v.getMinimumSpan(axis); maximum += v.getMaximumSpan(axis); } /* * Second pass, expand or contract by as much as possible to reach * the target span. */ // determine the adjustment to be made long desiredAdjustment = targetSpan - preferred; float adjustmentFactor = 0.0f; if (desiredAdjustment != 0) { float maximumAdjustment = (desiredAdjustment > 0) ? maximum - preferred : preferred - minimum; if (maximumAdjustment == 0.0f) { adjustmentFactor = 0.0f; } else { adjustmentFactor = desiredAdjustment / maximumAdjustment; adjustmentFactor = Math.min(adjustmentFactor, 1.0f); adjustmentFactor = Math.max(adjustmentFactor, -1.0f); } } // make the adjustments int totalOffset = 0; for (int i = 0; i < n; i++) { View v = getView(i); offsets[i] = totalOffset; int availableSpan = (adjustmentFactor > 0.0f) ? (int) v.getMaximumSpan(axis) - spans[i] : spans[i] - (int) v.getMinimumSpan(axis); float adjF = adjustmentFactor * availableSpan; if (adjF < 0) { adjF -= .5f; } else { adjF += .5f; } int adj = (int)adjF; spans[i] += adj; totalOffset = (int) Math.min((long) totalOffset + (long) spans[i], Integer.MAX_VALUE); } } /** * Performs layout for the minor axis of the box (i.e. the * axis orthoginal to the axis that it represents). The results * of the layout should be placed in the given arrays which represent * the allocations to the children along the minor axis. * * @param targetSpan the total span given to the view, which * would be used to layout the children * @param axis the axis being layed out * @param offsets the offsets from the origin of the view for * each of the child views; this is a return value and is * filled in by the implementation of this method * @param spans the span of each child view; this is a return * value and is filled in by the implementation of this method * @return the offset and span for each child view in the * offsets and spans parameters */ protected void layoutMinorAxis(int targetSpan, int axis, int[] offsets, int[] spans) { int n = getViewCount(); for (int i = 0; i < n; i++) { View v = getView(i); int min = (int) v.getMinimumSpan(axis); int max = (int) v.getMaximumSpan(axis); if (max < targetSpan) { // can't make the child this wide, align it float align = v.getAlignment(axis); offsets[i] = (int) ((targetSpan - max) * align); spans[i] = max; } else { // make it the target width, or as small as it can get. offsets[i] = 0; spans[i] = Math.max(min, targetSpan); } } } /** * Calculates the size requirements for the major axis * </code>axis</code>. * * @param axis the axis being studied * @param r the <code>SizeRequirements</code> object; * if <code>null</code> one will be created * @return the newly initialized <code>SizeRequirements</code> object * @see javax.swing.SizeRequirements */ protected SizeRequirements calculateMajorAxisRequirements(int axis, SizeRequirements r) { // calculate tiled request float min = 0; float pref = 0; float max = 0; int n = getViewCount(); for (int i = 0; i < n; i++) { View v = getView(i); min += v.getMinimumSpan(axis); pref += v.getPreferredSpan(axis); max += v.getMaximumSpan(axis); } if (r == null) { r = new SizeRequirements(); } r.alignment = 0.5f; r.minimum = (int) min; r.preferred = (int) pref; r.maximum = (int) max; return r; } /** * Calculates the size requirements for the minor axis * <code>axis</code>. * * @param axis the axis being studied * @param r the <code>SizeRequirements</code> object; * if <code>null</code> one will be created * @return the newly initialized <code>SizeRequirements</code> object * @see javax.swing.SizeRequirements */ protected SizeRequirements calculateMinorAxisRequirements(int axis, SizeRequirements r) { int min = 0; long pref = 0; int max = Integer.MAX_VALUE; int n = getViewCount(); for (int i = 0; i < n; i++) { View v = getView(i); min = Math.max((int) v.getMinimumSpan(axis), min); pref = Math.max((int) v.getPreferredSpan(axis), pref); max = Math.max((int) v.getMaximumSpan(axis), max); } if (r == null) { r = new SizeRequirements(); r.alignment = 0.5f; } r.preferred = (int) pref; r.minimum = min; r.maximum = max; return r; } /** * Checks the request cache and update if needed. * @param axis the axis being studied * @exception IllegalArgumentException if <code>axis</code> is * neither <code>View.X_AXIS</code> nor </code>View.Y_AXIS</code> */ void checkRequests(int axis) { if ((axis != X_AXIS) && (axis != Y_AXIS)) { throw new IllegalArgumentException("Invalid axis: " + axis); } if (axis == majorAxis) { if (!majorReqValid) { majorRequest = calculateMajorAxisRequirements(axis, majorRequest); majorReqValid = true; } } else if (! minorReqValid) { minorRequest = calculateMinorAxisRequirements(axis, minorRequest); minorReqValid = true; } } /** * Computes the location and extent of each child view * in this <code>BoxView</code> given the <code>targetSpan</code>, * which is the width (or height) of the region we have to * work with. * * @param targetSpan the total span given to the view, which * would be used to layout the children * @param axis the axis being studied, either * <code>View.X_AXIS</code> or <code>View.Y_AXIS</code> * @param offsets an empty array filled by this method with * values specifying the location of each child view * @param spans an empty array filled by this method with * values specifying the extent of each child view */ protected void baselineLayout(int targetSpan, int axis, int[] offsets, int[] spans) { int totalAscent = (int)(targetSpan * getAlignment(axis)); int totalDescent = targetSpan - totalAscent; int n = getViewCount(); for (int i = 0; i < n; i++) { View v = getView(i); float align = v.getAlignment(axis); int viewSpan; if (v.getResizeWeight(axis) > 0) { // if resizable then resize to the best fit // the smallest span possible int minSpan = (int)v.getMinimumSpan(axis); // the largest span possible int maxSpan = (int)v.getMaximumSpan(axis); if (align == 0.0f) { // if the alignment is 0 then we need to fit into the descent viewSpan = Math.max(Math.min(maxSpan, totalDescent), minSpan); } else if (align == 1.0f) { // if the alignment is 1 then we need to fit into the ascent viewSpan = Math.max(Math.min(maxSpan, totalAscent), minSpan); } else { // figure out the span that we must fit into int fitSpan = (int)Math.min(totalAscent / align, totalDescent / (1.0f - align)); // fit into the calculated span viewSpan = Math.max(Math.min(maxSpan, fitSpan), minSpan); } } else { // otherwise use the preferred spans viewSpan = (int)v.getPreferredSpan(axis); } offsets[i] = totalAscent - (int)(viewSpan * align); spans[i] = viewSpan; } } /** * Calculates the size requirements for this <code>BoxView</code> * by examining the size of each child view. * * @param axis the axis being studied * @param r the <code>SizeRequirements</code> object; * if <code>null</code> one will be created * @return the newly initialized <code>SizeRequirements</code> object */ protected SizeRequirements baselineRequirements(int axis, SizeRequirements r) { SizeRequirements totalAscent = new SizeRequirements(); SizeRequirements totalDescent = new SizeRequirements(); if (r == null) { r = new SizeRequirements(); } r.alignment = 0.5f; int n = getViewCount(); // loop through all children calculating the max of all their ascents and // descents at minimum, preferred, and maximum sizes for (int i = 0; i < n; i++) { View v = getView(i); float align = v.getAlignment(axis); int span; int ascent; int descent; // find the maximum of the preferred ascents and descents span = (int)v.getPreferredSpan(axis); ascent = (int)(align * span); descent = span - ascent; totalAscent.preferred = Math.max(ascent, totalAscent.preferred); totalDescent.preferred = Math.max(descent, totalDescent.preferred); if (v.getResizeWeight(axis) > 0) { // if the view is resizable then do the same for the minimum and // maximum ascents and descents span = (int)v.getMinimumSpan(axis); ascent = (int)(align * span); descent = span - ascent; totalAscent.minimum = Math.max(ascent, totalAscent.minimum); totalDescent.minimum = Math.max(descent, totalDescent.minimum); span = (int)v.getMaximumSpan(axis); ascent = (int)(align * span); descent = span - ascent; totalAscent.maximum = Math.max(ascent, totalAscent.maximum); totalDescent.maximum = Math.max(descent, totalDescent.maximum); } else { // otherwise use the preferred totalAscent.minimum = Math.max(ascent, totalAscent.minimum); totalDescent.minimum = Math.max(descent, totalDescent.minimum); totalAscent.maximum = Math.max(ascent, totalAscent.maximum); totalDescent.maximum = Math.max(descent, totalDescent.maximum); } } // we now have an overall preferred, minimum, and maximum ascent and descent // calculate the preferred span as the sum of the preferred ascent and preferred descent r.preferred = (int)Math.min((long)totalAscent.preferred + (long)totalDescent.preferred, Integer.MAX_VALUE); // calculate the preferred alignment as the preferred ascent divided by the preferred span if (r.preferred > 0) { r.alignment = (float)totalAscent.preferred / r.preferred; } if (r.alignment == 0.0f) { // if the preferred alignment is 0 then the minimum and maximum spans are simply // the minimum and maximum descents since there's nothing above the baseline r.minimum = totalDescent.minimum; r.maximum = totalDescent.maximum; } else if (r.alignment == 1.0f) { // if the preferred alignment is 1 then the minimum and maximum spans are simply // the minimum and maximum ascents since there's nothing below the baseline r.minimum = totalAscent.minimum; r.maximum = totalAscent.maximum; } else { // we want to honor the preferred alignment so we calculate two possible minimum // span values using 1) the minimum ascent and the alignment, and 2) the minimum // descent and the alignment. We'll choose the larger of these two numbers. r.minimum = Math.max((int)(totalAscent.minimum / r.alignment), (int)(totalDescent.minimum / (1.0f - r.alignment))); // a similar calculation is made for the maximum but we choose the smaller number. r.maximum = Math.min((int)(totalAscent.maximum / r.alignment), (int)(totalDescent.maximum / (1.0f - r.alignment))); } return r; } /** * Fetches the offset of a particular child's current layout. * @param axis the axis being studied * @param childIndex the index of the requested child * @return the offset (location) for the specified child */ protected int getOffset(int axis, int childIndex) { int[] offsets = (axis == majorAxis) ? majorOffsets : minorOffsets; return offsets[childIndex]; } /** * Fetches the span of a particular childs current layout. * @param axis the axis being studied * @param childIndex the index of the requested child * @return the span (width or height) of the specified child */ protected int getSpan(int axis, int childIndex) { int[] spans = (axis == majorAxis) ? majorSpans : minorSpans; return spans[childIndex]; } /** * Determines in which direction the next view lays. * Consider the View at index n. Typically the <code>View</code>s * are layed out from left to right, so that the <code>View</code> * to the EAST will be at index n + 1, and the <code>View</code> * to the WEST will be at index n - 1. In certain situations, * such as with bidirectional text, it is possible * that the <code>View</code> to EAST is not at index n + 1, * but rather at index n - 1, or that the <code>View</code> * to the WEST is not at index n - 1, but index n + 1. * In this case this method would return true, * indicating the <code>View</code>s are layed out in * descending order. Otherwise the method would return false * indicating the <code>View</code>s are layed out in ascending order. * <p> * If the receiver is laying its <code>View</code>s along the * <code>Y_AXIS</code>, this will will return the value from * invoking the same method on the <code>View</code> * responsible for rendering <code>position</code> and * <code>bias</code>. Otherwise this will return false. * * @param position position into the model * @param bias either <code>Position.Bias.Forward</code> or * <code>Position.Bias.Backward</code> * @return true if the <code>View</code>s surrounding the * <code>View</code> responding for rendering * <code>position</code> and <code>bias</code> * are layed out in descending order; otherwise false */ protected boolean flipEastAndWestAtEnds(int position, Position.Bias bias) { if(majorAxis == Y_AXIS) { int testPos = (bias == Position.Bias.Backward) ? Math.max(0, position - 1) : position; int index = getViewIndexAtPosition(testPos); if(index != -1) { View v = getView(index); if(v != null && v instanceof CompositeView) { return ((CompositeView)v).flipEastAndWestAtEnds(position, bias); } } } return false; } // --- variables ------------------------------------------------ int majorAxis; int majorSpan; int minorSpan; /* * Request cache */ boolean majorReqValid; boolean minorReqValid; SizeRequirements majorRequest; SizeRequirements minorRequest; /* * Allocation cache */ boolean majorAllocValid; int[] majorOffsets; int[] majorSpans; boolean minorAllocValid; int[] minorOffsets; int[] minorSpans; /** used in paint. */ Rectangle tempRect; }
[ "kzhaicn@e8197d6f-d431-fb3f-3203-916d138821fd" ]
kzhaicn@e8197d6f-d431-fb3f-3203-916d138821fd
0baab6b7238d0271f9159618efa7a1b5ac1b2ebe
3f6904ddd220e0cc9d17a95b546fbec146f18e43
/src/WeekThree/VisitAction.java
d25086db81fe7c924193384af9c514a67be3b05a
[]
no_license
dlnrodriguez/CSC180-class
1e5cc6ded72ecfada0f73f02d2c6b5373bf86cf8
1c55a533588d3eee18896f72785d22639d2ba5b2
refs/heads/master
2020-05-29T14:39:15.405690
2016-08-22T20:28:25
2016-08-22T20:28:25
62,110,443
0
0
null
null
null
null
UTF-8
Java
false
false
118
java
package WeekThree; /** * Created by DLN on 8/3/16. */ public interface VisitAction { void visit(String url); }
393a9a4fb6589a81ec91270339b926adf11bb71c
2be4eac50faddb7170b9008ccdfc3175a86d70f5
/src/ajmas74/daylighttracker/MapLayer.java
e6bd5bcc1a883e29cb37eaacb473886e866d8517
[]
no_license
ajmas/Daylight-Tracker
004895997dd795e47fc69a9977c54bf5b631320c
efff4a053b0285bac610ea16767df7cc9ca9aafd
refs/heads/master
2020-05-18T16:59:53.999561
2012-04-06T20:15:05
2012-04-06T20:15:05
null
0
0
null
null
null
null
UTF-8
Java
false
false
944
java
package ajmas74.daylighttracker; import java.util.Date; import java.awt.*; public interface MapLayer { //would implementing an applet type interface be useful //with init, stop, refresh, etc? /** Get the short name of the layer */ public String getShortName(); /** Get the long name of the layer */ public String getLongName(); /** Indicates whether this layer is time dependant */ public boolean isTimeDependant(); /** The date and time for time based data */ public void setDateTime ( Date theDateTime ); /** The map rectangle that matches the component Rectangle */ public void setCoordRect ( MapCoordRect theRect ); /* Maybe create a configurable interface and place these here? */ /** Returns whether this layer is configurable */ public boolean isConfigurable(); /** get the Panel need for configuring this element */ public Component getConfigurationPanel(); }
8757873a2597bfecd0e4d56034a64411372bbde4
aa3202384507fc99d83cfa3e3f957a9f16de1dc6
/src/forms/PnFabricante.java
a082c5fbb3b053229b71e3bbc722b055d7e61cb9
[]
no_license
vilmarschmelzer/poo2-rick
61f99c06e79fe41af5bd44ca4c68b075ca02e42b
9e8dcef655794e9b8a06cca19091355c4d5b03e2
refs/heads/master
2021-01-23T21:36:19.458854
2013-12-19T11:35:56
2013-12-19T11:35:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,736
java
package forms; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.text.ParseException; import java.util.ArrayList; import javax.swing.JFormattedTextField; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.JTextField; import javax.swing.table.DefaultTableModel; import javax.swing.text.MaskFormatter; import models.*; public class PnFabricante extends JPanel { private JFormattedTextField txtCnpj; private JTextField txtNome; private JTextField txtNome_fantasia; private DefaultTableModel tableModel; private JTable table; public JFormattedTextField getTxtCnpj(){ return txtCnpj; } public JTextField getTxtNome(){ return txtNome; } public JTextField getTxtNome_fantasia(){ return txtNome_fantasia; } public DefaultTableModel getTableModel(){ return tableModel; } public PnFabricante(){ setLayout(null); JLabel lblCnpj = new JLabel("CNPJ *"); lblCnpj.setBounds(10, 5, 120, 30); lblCnpj.setHorizontalAlignment(JLabel.RIGHT); add(lblCnpj); JLabel lblNome = new JLabel("Nome *"); lblNome.setBounds(10, 35, 120, 30); lblNome.setHorizontalAlignment(JLabel.RIGHT); add(lblNome); JLabel lblNome_fantasia = new JLabel("Nome fantasia"); lblNome_fantasia.setBounds(10, 65, 120, 30); lblNome_fantasia.setHorizontalAlignment(JLabel.RIGHT); add(lblNome_fantasia); MaskFormatter mask=new MaskFormatter(); try { mask = new MaskFormatter("##.###.###/####-##"); } catch (ParseException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } txtCnpj=new JFormattedTextField(mask); txtCnpj.setBounds(135, 5, 150, 25); add(txtCnpj); txtNome=new JTextField(); txtNome.setBounds(135, 35, 150, 25); add(txtNome); txtNome_fantasia=new JTextField(); txtNome_fantasia.setBounds(135, 65, 150, 25); add(txtNome_fantasia); String[] colunas = new String []{"CNPJ","Nome","Nome fantasia"}; tableModel = new DefaultTableModel(null,colunas); table = new JTable(tableModel){ public boolean isCellEditable(int rowIndex, int colIndex) { return false; } }; JScrollPane scrollPane = new JScrollPane(table); scrollPane.setBounds(10, 100, 300, 200); add(scrollPane); LimparCampos(); //add linha //model.addRow(new String[]{"t3","t4"}); table.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { int row = table.getSelectedRow(); txtCnpj.setText((String)tableModel.getValueAt(row, 0)); txtNome.setText((String)tableModel.getValueAt(row, 1)); txtNome_fantasia.setText((String)tableModel.getValueAt(row, 2)); txtCnpj.setEditable(false); } }); } public void LimparCampos(){ txtCnpj.setText(""); txtCnpj.setEditable(true); txtNome.setText(""); txtNome_fantasia.setText(""); } public void AtualizaTabela(ArrayList<Fabricante> list){ int rows = tableModel.getRowCount(); for(int i = rows - 1; i >=0; i--) { tableModel.removeRow(i); } for (Fabricante fabricante : list) { tableModel.addRow(new String[] {fabricante.getCnpj()+"",fabricante.getNome(),fabricante.getNome_fantasia()}); } } public Fabricante getObjetoTela(){ System.out.println(txtCnpj.getText()); String cnpj=txtCnpj.getText(); System.out.println("cnpj "+cnpj); cnpj=cnpj.replace(".", "").replace("-", "").replace("/", ""); System.out.println(cnpj); return new Fabricante(cnpj,txtNome.getText(),txtNome_fantasia.getText()); } public boolean ValidarCampos(){ if(txtCnpj.getText().equals("")||txtNome.getText().equals("")) return false; return true; } }
329d6348e76b24f0d4449d5c6b95175fca0de599
52f80c552ed5c18a7b6662244f7ea0708ba65869
/MyApplication4/app/src/main/java/com/example/myapplication/Model/User.java
62876d740978ab54c73032cc7e368d037df55ac0
[]
no_license
mrbossgame/Music-app-mobile
dbcd4cd4e80b280d65481140305496dc43345a63
2dbfa40fc1be2c3115a0fa2b1b738076ac2fdc3c
refs/heads/master
2022-10-05T10:14:29.290339
2020-06-06T15:36:27
2020-06-06T15:36:27
270,020,616
0
0
null
null
null
null
UTF-8
Java
false
false
1,279
java
package com.example.myapplication.Model; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; public class User { @SerializedName("idUser") @Expose private String idUser; @SerializedName("TenUser") @Expose private String tenUser; @SerializedName("PassWord") @Expose private String passWord; @SerializedName("idBaiHat") @Expose private String idBaiHat; @SerializedName("idComMent") @Expose private String idComMent; public String getIdUser() { return idUser; } public void setIdUser(String idUser) { this.idUser = idUser; } public String getTenUser() { return tenUser; } public void setTenUser(String tenUser) { this.tenUser = tenUser; } public String getPassWord() { return passWord; } public void setPassWord(String passWord) { this.passWord = passWord; } public String getIdBaiHat() { return idBaiHat; } public void setIdBaiHat(String idBaiHat) { this.idBaiHat = idBaiHat; } public String getIdComMent() { return idComMent; } public void setIdComMent(String idComMent) { this.idComMent = idComMent; } }
1945834c8dc5374833e469a5f484077aa3f82c2b
2935dbf542f4798e6046d460f093bd83a4579deb
/src/net/ion/radon/cload/problems/CompilationProblem.java
570137cb732b70a8298b9121a329d8d672a0c111
[]
no_license
bleujin/aradon311
2a3d8c8d89956a34d2ce0ca322d14da0dde2ac0b
0d94113b398d5e70379068ef533479f09d7c1778
refs/heads/master
2020-04-12T03:09:56.589488
2017-02-17T05:41:02
2017-02-17T05:41:02
22,242,059
1
1
null
null
null
null
UTF-8
Java
false
false
1,882
java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.ion.radon.cload.problems; /** * An abstract definition of a compilation problem * * @author tcurdt */ public interface CompilationProblem { /** * is the problem an error and compilation cannot continue * or just a warning and compilation can proceed * * @return true if the problem is an error */ boolean isError(); /** * name of the file where the problem occurred * * @return name of the file where the problem occurred */ String getFileName(); /** * position of where the problem starts in the source code * * @return position of where the problem starts in the source code */ int getStartLine(); int getStartColumn(); /** * position of where the problem stops in the source code * * @return position of where the problem stops in the source code */ int getEndLine(); int getEndColumn(); /** * the description of the problem * * @return the description of the problem */ String getMessage(); }
eaa7e87b17f87f52b0d6586d01eacbaa36d7f4ea
2b675fd33d8481c88409b2dcaff55500d86efaaa
/infinispan/core/src/test/java/org/infinispan/distribution/DistSyncCacheStoreNotSharedNotConcurrentTest.java
c352a41471a892a7d05cac6929da8202e83fd6a9
[ "LGPL-2.0-or-later", "Apache-2.0" ]
permissive
nmldiegues/stibt
d3d761464aaf97e41dcc9cc1d43f0e3234a1269b
1ee662b7d4ed1f80e6092c22e235a3c994d1d393
refs/heads/master
2022-12-21T23:08:11.452962
2015-09-30T16:01:43
2015-09-30T16:01:43
42,459,902
0
2
Apache-2.0
2022-12-13T19:15:31
2015-09-14T16:02:52
Java
UTF-8
Java
false
false
1,472
java
/* * JBoss, Home of Professional Open Source * Copyright 2012 Red Hat Inc. and/or its affiliates and other contributors * as indicated by the @author tags. All rights reserved. * See the copyright.txt in the distribution for a * full listing of individual contributors. * * This copyrighted material is made available to anyone wishing to use, * modify, copy, or redistribute it subject to the terms and conditions * of the GNU Lesser General Public License, v. 2.1. * This program is distributed in the hope that it will be useful, but WITHOUT A * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. * You should have received a copy of the GNU Lesser General Public License, * v.2.1 along with this distribution; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. */ package org.infinispan.distribution; import org.testng.annotations.Test; @Test(groups = "functional", testName = "distribution.DistSyncCacheStoreNotSharedNotConcurrentTest") public class DistSyncCacheStoreNotSharedNotConcurrentTest extends DistSyncCacheStoreNotSharedTest { public DistSyncCacheStoreNotSharedNotConcurrentTest() { supportConcurrentWrites = false; } public void testExpectedConfig() { assert !c1.getCacheConfiguration().locking().supportsConcurrentUpdates(); } }
447ceb0cd3eb19b3b843f0b848bd0b4a93a5e684
34e55a7531813c219c191f084196ebfe0d3d0b4c
/level07/lesson04/task04/Solution.java
67eb9d27fa5b21f1cd75b52a536f4fdd584433df
[]
no_license
bezobid/javarush
c5b8f09e78bc7020c00810ea4a82267ea30dab9f
20a8b7e90a14a406b4fa02fc1b75707297d06428
refs/heads/master
2021-01-21T06:53:33.411811
2017-05-17T15:16:28
2017-05-17T15:16:28
91,590,091
0
0
null
null
null
null
UTF-8
Java
false
false
1,061
java
package com.javarush.test.level07.lesson04.task04; import java.io.BufferedReader; import java.io.InputStreamReader; /* Массив из чисел в обратном порядке 1. Создать массив на 10 чисел. 2. Ввести с клавиатуры 10 чисел и записать их в массив. 3. Расположить элементы массива в обратном порядке. 4. Вывести результат на экран, каждое значение выводить с новой строки. */ public class Solution { public static void main(String[] args) throws Exception { int[] ar = new int[10]; BufferedReader read = new BufferedReader(new InputStreamReader(System.in)); for (int a = 0; a < ar.length; a++){ ar[a] = Integer.parseInt(read.readLine()); } int[] ar1 = new int [10]; for (int a = 0; a < ar.length; a++){ ar1[a] = ar[ar.length - 1 - a]; System.out.println(ar1[a]); } } }
62df924ca94683969fc47e4ed0b88fbf8e0c4f31
e9a6574e6ec50c39a6923ade3743da1401776f6f
/Training/src/Threads/ThreadsBasics/Problem.java
781163616db92064499dd10552d54d02936c1dad
[]
no_license
bardas-oleksandr/Homeworks_All
bc1a6658c5c70aca94c5a5345ba42f00caf9de40
bf24021afcb4d0287469762761fdfff1d816a329
refs/heads/master
2020-04-28T06:47:36.046027
2019-03-11T19:34:51
2019-03-11T19:34:51
175,071,275
0
0
null
null
null
null
UTF-8
Java
false
false
901
java
package Threads.ThreadsBasics; import Interfaces.IProblem; public class Problem implements IProblem { @Override public void solve() { System.out.println("EXAMPLE #1"); Thread thread = Thread.currentThread(); System.out.println(thread); thread.setName("My thread"); thread.setPriority(Thread.NORM_PRIORITY + 5); System.out.println(thread); try { for (int n = 5; n > 0; n--) { System.out.println(n); Thread.sleep(1000); } } catch (InterruptedException е){ System.out. println( "Глaвный поток исполнения прерван"); } //Пример по синхронизации Q q = new Q(); new Producer(q); new Consumer(q); System.out.println("Press Control-C to stop."); } }
0f19642adfc8ee3d5b6ee43e4b7475b214eb2c8f
477e1a631bd4e093d511b9ea3f53a7a4807c4d1e
/Android实现悬浮式顶部和底部标题栏效果/MyTitleBar02/src/com/yangyu/mytitlebar02/MentionActivity.java
a0c9b9a999c187cee8fe85fe86155d181b84cb6a
[]
no_license
sunnyvv/Mixingdrinks
765fe22f00bc96cbeeefc130f504ed980d3e55e6
d98b994833be6422da3412d2741fa85cd21aa5ba
refs/heads/master
2021-01-18T11:23:15.551258
2015-01-04T09:25:43
2015-01-04T09:25:43
28,742,889
0
0
null
2015-01-03T12:14:15
2015-01-03T12:14:14
null
IBM852
Java
false
false
377
java
package com.yangyu.mytitlebar02; import android.app.Activity; import android.os.Bundle; /** * @author yangyu * ╣Ž─▄├Ŕ╩÷ú║╠ßđĐActivityĎ│├Š */ public class MentionActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.mention_activity); } }
c247de930a5655c0db83046b28675364b12e212a
be73270af6be0a811bca4f1710dc6a038e4a8fd2
/crash-reproduction-moho/results/XWIKI-14227-10-22-NSGA_II-WeightedSum:TestLen:CallDiversity/com/xpn/xwiki/store/migration/AbstractDataMigrationManager_ESTest.java
f56dc66621094b643df23fe99c6df7608be571a6
[]
no_license
STAMP-project/Botsing-multi-objectivization-using-helper-objectives-application
cf118b23ecb87a8bf59643e42f7556b521d1f754
3bb39683f9c343b8ec94890a00b8f260d158dfe3
refs/heads/master
2022-07-29T14:44:00.774547
2020-08-10T15:14:49
2020-08-10T15:14:49
285,804,495
0
0
null
null
null
null
UTF-8
Java
false
false
592
java
/* * This file was automatically generated by EvoSuite * Sat Jan 18 19:13:13 UTC 2020 */ package com.xpn.xwiki.store.migration; import org.junit.Test; import static org.junit.Assert.*; import org.evosuite.runtime.EvoRunner; import org.evosuite.runtime.EvoRunnerParameters; import org.junit.runner.RunWith; @RunWith(EvoRunner.class) @EvoRunnerParameters(useVFS = true, useJEE = true) public class AbstractDataMigrationManager_ESTest extends AbstractDataMigrationManager_ESTest_scaffolding { @Test public void notGeneratedAnyTest() { // EvoSuite did not generate any tests } }
2324030454bd9b84349040b4317e330dbed6ead0
6b2ac9d51867059829797e2be084e952287932a0
/WebApplication1/src/java/com/Msg.java
41dc82290eba2827474a51a4d98f4e3d734aa420
[]
no_license
salu2303/The-Classy-Events
6be0fe445eb1e5f882f3d70992a82d5a617cc47e
ebcca7ac8b8f7955643f0376bf99b9426ec286f9
refs/heads/master
2022-11-14T18:58:23.794055
2020-06-19T16:41:39
2020-06-19T16:41:39
273,541,097
0
0
null
null
null
null
UTF-8
Java
false
false
4,907
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; import java.io.IOException; import java.io.PrintWriter; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import javax.servlet.ServletException; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * * @author Dell */ public class Msg 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()) { Cookie cookie = null; Cookie[] c = null; String vid =null; c = request.getCookies(); for (Cookie c1 : c) { cookie = c1; if ((cookie.getName()).equals("1")) { vid = (cookie.getValue()); } } int flag=0; //out.println(id); try { Class.forName("com.mysql.jdbc.Driver"); Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/se?[root on Default schema]", "root", ""); Statement st = conn.createStatement(); ResultSet rs = st.executeQuery("select id from status where id ="+vid); //out.println(rs.getString("id")); // out.println(rs.next()); while(rs.next()) { out.println("<h3>"+"...............................confirmation message..................................\n" + "\n" +"</br>"+ "Dear Customer,\n" +"</br>"+ "Thank you for choosing us for managing your event.\n" +"</br>"+ "This is Saloni from EVENTO .This is confirmation message that we will look forward for managing your events and we will contact soon for further formalities."+"</h3>"); javax.servlet.RequestDispatcher rs3 = request.getRequestDispatcher("show.html"); rs3.include(request, response); flag=1; } if(flag==0) { out.println("<h3>"+"Dear Customer,\n" + "Thank you for visiting our site.\n" +"</br>"+ "Your current status should one of this:\n"+"</br>" + " 1.You have not registered any event.\n" +"</br>"+ "2.Your event registration may be in pending list.We will inform you soon with confirmation massage."+"</h3>"); javax.servlet.RequestDispatcher rs3 = request.getRequestDispatcher("show.html"); rs3.include(request, response); } } catch (ClassNotFoundException e) { out.println(e); } catch (SQLException e) { out.println(e); } } } // <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> }
2382c06840d87d5f86819ed9d3e0936fb4e83940
fadd499cb9c1e8085958670c2e698606f176048f
/src/main/java/flink2hive.java
35cd880075e0b90db513bf593a3648df9d729810
[]
no_license
SChao625/flinkStreaming
eaf8781aa039ecff3181f6576576090be554cde8
22a552447bd0c12f23b91a963f02d0fe01c8b3c8
refs/heads/master
2022-12-06T05:29:14.215783
2020-09-03T06:26:12
2020-09-03T06:26:12
292,482,177
0
0
null
null
null
null
UTF-8
Java
false
false
1,445
java
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment; import org.apache.flink.table.api.EnvironmentSettings; import org.apache.flink.table.api.Table; import org.apache.flink.table.api.TableEnvironment; import org.apache.flink.table.api.java.StreamTableEnvironment; import org.apache.flink.table.catalog.hive.HiveCatalog; import org.apache.flink.types.Row; public class flink2hive { public static void main(String[] args) { EnvironmentSettings settings = EnvironmentSettings.newInstance().inBatchMode().build(); StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(); StreamTableEnvironment tableEnv = StreamTableEnvironment.create(env,settings); String name = "myhive"; String defaultDatabase = "default"; String hiveConfDir = "E:\\idea\\IDEApro\\src\\main\\conf"; // a local path String version = "1.1.0"; HiveCatalog hive = new HiveCatalog(name, defaultDatabase, hiveConfDir, version); tableEnv.registerCatalog("myhive", hive); // set the HiveCatalog as the current catalog of the session tableEnv.useCatalog("myhive"); Table sql = tableEnv.sqlQuery("select * from dept"); tableEnv.toAppendStream(sql, Row.class).print(); try { tableEnv.execute("adas"); } catch (Exception e) { e.printStackTrace(); } } }
8ee78b38b275efd10b7421de8861fca5d07600f7
55787868f10d29caf64dede77ce5499a94c9cad8
/java/springbootvue/official/chapter09/rediscache/src/main/java/org/sang/rediscache/Book.java
86fc74e8c240abddc88f3fd71dbede6fed399ea0
[]
no_license
JavaAIer/NotesAndCodes
d4d14c9809c871142af6a6eec79b61ea760d15fb
83ebbc0ee75d06ead6cb60ec7850989ee796ba6f
refs/heads/master
2022-12-13T02:27:01.960050
2019-12-24T01:57:10
2019-12-24T01:57:10
158,776,818
3
1
null
2022-12-09T10:11:57
2018-11-23T03:32:43
Java
UTF-8
Java
false
false
791
java
package org.sang.rediscache; import java.io.Serializable; public class Book implements Serializable { private Integer id; private String name; private String author; @Override public String toString() { return "Book{" + "id=" + id + ", name='" + name + '\'' + ", author='" + author + '\'' + '}'; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getAuthor() { return author; } public void setAuthor(String author) { this.author = author; } }
1cb90feeb863ae2dbb706007168672842bf19531
f738ca66a5bd4122df3fc1d6355aa094cfbe180f
/day16_String/substring_Practice.java
0da071ff9919dc976807163004f158d2a7b17cb0
[]
no_license
ElkemEmet/GitPractice
a7fd6ca33157882dabf772db7e53bb6f8c126bba
a06ce556b78248fa498a3b81ca5da3bd7f839191
refs/heads/master
2022-12-08T02:09:49.828056
2020-08-05T03:13:44
2020-08-05T03:13:44
285,164,255
0
0
null
null
null
null
UTF-8
Java
false
false
1,158
java
package day16_String; import java.util.Scanner; /*1. Ask user to enter two words. Print first word without its first character then print the second word without its first character. Input: apple banana Output: ppleanana */ public class substring_Practice{ public static void main(String[] args) { //extra task String str = "I like to drink Pepsi"; String drink = str.substring(16); System.out.println(drink); String action=str.substring(10,15);// ending index must gives one extra index(14+1) System.out.println(action); System.out.println("======================================"); Scanner scan = new Scanner(System.in); System.out.println("Enter your first word"); String str1 = scan.next();//"Apple" System.out.println("Enter your second word"); String str2 = scan.next();//"Banana" //String result = str1.substring(1).concat(str2.substring(1));// another way to use ==> concat String result = str1.substring(1)+str2.substring(1); System.out.println(result); } }
414e4af4ba9f1ebbd12515c182297e8122f719db
54a24781a7a09311456cb685f63f0e6d2bab4bab
/src/l1j/server/server/clientpackets/C_TaxRate.java
667c4f3f3417d70e5644e68eca75fa365982ebd1
[]
no_license
crazyidol9/L1J-KR_3.80
b1c2d849a0daad99fd12166611e82b6804d2b26d
43c5da32e1986082be6f1205887ffc4538baa2c6
refs/heads/master
2021-08-16T13:50:50.570172
2017-11-20T01:20:52
2017-11-20T01:20:52
111,041,969
0
0
null
2017-11-17T01:24:24
2017-11-17T01:24:24
null
UHC
Java
false
false
2,024
java
/* * 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, 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. * * http://www.gnu.org/copyleft/gpl.html */ package l1j.server.server.clientpackets; import server.LineageClient; import l1j.server.server.model.L1Clan; import l1j.server.server.model.L1World; import l1j.server.server.model.Instance.L1PcInstance; import l1j.server.server.serverpackets.S_SystemMessage; // Referenced classes of package l1j.server.server.clientpackets: // ClientBasePacket public class C_TaxRate extends ClientBasePacket { private static final String C_TAX_RATE = "[C] C_TaxRate"; public C_TaxRate(byte abyte0[], LineageClient clientthread) throws Exception { super(abyte0); int i = readD(); int j = readC(); L1PcInstance player = clientthread.getActiveChar(); if (player == null) { return; } if (i == player.getId()) { L1Clan clan = L1World.getInstance().getClan(player.getClanname()); if (clan != null) { int castle_id = clan.getCastleId(); if (castle_id != 0) { player.sendPackets(new S_SystemMessage("세금 조정을 할수없습니다.")); //L1Castle l1castle = CastleTable.getInstance() // .getCastleTable(castle_id); //if (j >= 10 && j <= 50) { //l1castle.setTaxRate(j); //CastleTable.getInstance().updateCastle(l1castle); //} } } } } @Override public String getType() { return C_TAX_RATE; } }