blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
332
content_id
stringlengths
40
40
detected_licenses
listlengths
0
50
license_type
stringclasses
2 values
repo_name
stringlengths
7
115
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
557 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
77.7k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
17 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
82 values
src_encoding
stringclasses
28 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
7
5.41M
extension
stringclasses
11 values
content
stringlengths
7
5.41M
authors
listlengths
1
1
author
stringlengths
0
161
db7c523e4cffd79e8ad252f808dff9d8f9df0c69
0a789dce5e9185ba799cd89ed1cc57b86eccd685
/src/homeWorks/simpleJava/Input5Numbers.java
6aa2ae66700a25537149456d85133da6ed1033f2
[]
no_license
bema1121/main
ce3a3cb84bc08c568d06566f3104e8d60d979a38
8ca4c11372d1c2870d19a69f33efa54d224e1e9b
refs/heads/master
2022-12-06T05:43:37.570253
2020-08-31T19:01:45
2020-08-31T19:01:45
290,291,703
2
0
null
null
null
null
UTF-8
Java
false
false
783
java
package homeWorks.simpleJava; import java.util.Scanner; public class Input5Numbers { public static void main(String[] args) { /* Write a program in Java to input 5 numbers from keyboard and find their sum and average. Test Data Input the 5 numbers : 1 2 3 4 5 Expected Output : Input the 5 numbers : 1 2 3 4 5 The sum of 5 no is : 15 The Average is : 3.0 */ Scanner keyboard = new Scanner(System.in); System.out.println("Input the 5 numbers : "); int sum = 0; int i = keyboard.nextInt();; while(i >= 5){ i+=i; System.out.println(i); } System.out.println("The sum of 5 no is : "+sum); } }
[ "jan929397@gmail.com" ]
jan929397@gmail.com
5ae2a7468bacba7a58c4faab3cee46b1e98cff0a
d7e50159a103f17095fbaa80b5eb7a839998fe54
/src/main/java/uk/ac/ebi/ddi/extservices/net/FtpUtils.java
06936cd23e6a5b5d8ee5808faa3ccac3d017a7d5
[ "Apache-2.0" ]
permissive
OmicsDI/ddi-annotation
3e3e059d08c9015be5a1bc6aba9d1f03a5f0c477
59378cbfc81f78026699469d4ca328375fc4f24e
refs/heads/master
2023-04-03T07:33:15.918464
2021-07-02T09:11:35
2021-07-02T09:11:35
39,764,903
0
1
Apache-2.0
2023-03-24T11:50:58
2015-07-27T09:00:39
Java
UTF-8
Java
false
false
1,384
java
package uk.ac.ebi.ddi.extservices.net; import org.apache.commons.net.ftp.FTPClient; import org.apache.commons.net.ftp.FTPFile; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.List; public class FtpUtils { private static final Logger LOGGER = LoggerFactory.getLogger(FtpUtils.class); public static List<String> getListFiles(FTPClient client, String path, String... ignoreDir) throws IOException { List<String> result = new ArrayList<>(); for (String dir : ignoreDir) { if (path.equals(dir)) { return result; } } if (!client.changeWorkingDirectory(path)) { return Collections.emptyList(); } FTPFile[] ftpFiles = client.listFiles(); for (FTPFile file : ftpFiles) { if (!file.getName().equals(".") && !file.getName().equals("..")) { if (file.isDirectory()) { result.addAll(getListFiles(client, file.getName(), ignoreDir)); } else { String link = String.format("%s/%s", client.printWorkingDirectory(), file.getName()); result.add(link); } } } client.changeToParentDirectory(); return result; } }
[ "glmanhtu@gmail.com" ]
glmanhtu@gmail.com
8873f7a588152929c78dc578c28b3dfccdd075d7
09fbc1277dfb7e9fe7cb38fafb520ef81db5e644
/microservices-logging/src/main/java/com/cxrus/microservices/logging/MicroservicesLoggingApp.java
06fb9cbe88d9a5606536b5319e64f04901751808
[]
no_license
sidie88/service-discovery-in-kubernetes
555de5d13f0362e5111ad0f605b7fa303154d9da
47614594fd03a887172bb54d11e49e5a5bcfce08
refs/heads/master
2020-06-27T20:22:26.635609
2019-08-30T07:53:41
2019-08-30T07:53:41
200,040,118
0
17
null
2019-08-29T10:03:39
2019-08-01T11:44:09
Java
UTF-8
Java
false
false
335
java
package com.cxrus.microservices.logging; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class MicroservicesLoggingApp { public static void main(String[] args) { SpringApplication.run(MicroservicesLoggingApp.class , args); } }
[ "sidie88@gmail.com" ]
sidie88@gmail.com
165bffc5c8524482aaf0a7b6e419cf2eabf66e96
da51590f9a8b21385ebbccfe56e574836ff010f7
/src/main/java/com/carrental/config/WebSecurityConfig.java
b22196190179d6e38ecda8750abcc9b6334a8570
[]
no_license
woldonarkadiusz/car-rental
dec52f80172b71f74bdbbeb81e3bb42ad9fa5386
78edf3208d486bdf304595cab0ef6421aaa920a7
refs/heads/master
2020-07-12T06:46:17.685173
2019-08-27T17:06:40
2019-08-27T17:06:40
204,739,964
0
0
null
null
null
null
UTF-8
Java
false
false
2,361
java
//package com.carrental.config; // //import org.springframework.context.annotation.Bean; //import org.springframework.context.annotation.Configuration; //import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; //import org.springframework.security.config.annotation.web.builders.HttpSecurity; //import org.springframework.security.config.annotation.web.builders.WebSecurity; //import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; //import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; //import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; //import org.springframework.security.crypto.password.PasswordEncoder; // //@Configuration //@EnableWebSecurity //public class WebSecurityConfig extends WebSecurityConfigurerAdapter { // // @Override // public void configure(final AuthenticationManagerBuilder auth) throws Exception { // auth.inMemoryAuthentication() // .withUser("user").password(passwordEncoder().encode("password")).roles("USER") // .and() // .withUser("admin").password(passwordEncoder().encode("password")).roles("ADMIN"); // } // // @Override // public void configure(WebSecurity web){ // web.ignoring().antMatchers("/resources/**"); // } // // @Override // public void configure(final HttpSecurity http) throws Exception { // http // .csrf().disable() // .authorizeRequests() // .antMatchers("/h2-console/**").permitAll() // .antMatchers("/admin/**").hasRole("ADMIN") // .antMatchers("/anonymous*").anonymous() // .antMatchers("/login").permitAll() // .anyRequest().authenticated() // .and() // .formLogin() // .loginPage("/login") // .defaultSuccessUrl("/car/list") // // .and() // .logout() // .logoutUrl("/logout") // .deleteCookies("JSESSIONID") // .invalidateHttpSession(true) // .logoutSuccessUrl("/login"); // } // // @Bean // public PasswordEncoder passwordEncoder() { // return new BCryptPasswordEncoder(); // } //}
[ "woldonarkadiusz@gmail.com" ]
woldonarkadiusz@gmail.com
e8494670699395f69a7ae3f18aef759852ebd634
3c14fad73b90d6498668315eae6346f1ded37139
/Java01/src/chapter03/OperationEx6.java
fa230ecc30a6a8cec3dc8d66364f78013e7cf2cf
[]
no_license
dla629/eclipse-workspace
b6e140380889136087fb3da3971b04b02a58fcb7
b82a6f4e0be906083b40a2e8fa03aa2b3c17cb88
refs/heads/master
2023-06-14T03:14:59.378824
2021-07-12T06:52:07
2021-07-12T06:52:07
385,150,971
0
0
null
null
null
null
UTF-8
Java
false
false
403
java
package chapter03; public class OperationEx6 { public static void main(String[] args) { int num1 = 10; int num2 = 20; boolean flag; flag = !(num1 > 0); // !(not) : True ==> False, False ==> True System.out.println(flag); flag = !(num2 < 0); System.out.println(flag); flag = !(num1 > num2); System.out.println(flag); flag = !(num1 < num2); System.out.println(flag); } }
[ "bibianna4@naver.com" ]
bibianna4@naver.com
146611a172d3f9a58901affd87267a6b3f452917
14cf57437111ea2cc9812700bafc81a7851be455
/core/src/main/java/com/tribesman/kobocoinj/core/BloomFilter.java
9e984be3a755c55716d974dd0250aff91a867d8d
[ "Apache-2.0" ]
permissive
kobocoin/kobocoinj
1cdec8466e5d8c0ed2496e28a7307f1d5737d0d9
01b13b588974daa07cc9677e9cba61cbfcd5e84c
refs/heads/master
2021-01-17T22:31:29.666702
2018-08-08T01:34:37
2018-08-08T01:34:37
32,931,476
1
2
null
2015-03-26T14:15:36
2015-03-26T14:15:36
null
UTF-8
Java
false
false
11,952
java
/* * Copyright 2012 Matt Corallo * * 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.tribesman.kobocoinj.core; import com.google.common.base.Objects; import java.io.IOException; import java.io.OutputStream; import java.util.Arrays; import static com.google.common.base.Preconditions.checkArgument; import static java.lang.Math.*; /** * <p>A Bloom filter is a probabilistic data structure which can be sent to another client so that it can avoid * sending us transactions that aren't relevant to our set of keys. This allows for significantly more efficient * use of available network bandwidth and CPU time.</p> * * <p>Because a Bloom filter is probabilistic, it has a configurable false positive rate. So the filter will sometimes * match transactions that weren't inserted into it, but it will never fail to match transactions that were. This is * a useful privacy feature - if you have spare bandwidth the false positive rate can be increased so the remote peer * gets a noisy picture of what transactions are relevant to your wallet.</p> */ public class BloomFilter extends Message { /** The BLOOM_UPDATE_* constants control when the bloom filter is auto-updated by the peer using it as a filter, either never, for all outputs or only for pay-2-pubkey outputs (default) */ public enum BloomUpdate { UPDATE_NONE, // 0 UPDATE_ALL, // 1 /** Only adds outpoints to the filter if the output is a pay-to-pubkey/pay-to-multisig script */ UPDATE_P2PUBKEY_ONLY //2 } private byte[] data; private long hashFuncs; private long nTweak; private byte nFlags; // Same value as the reference client // A filter of 20,000 items and a false positive rate of 0.1% or one of 10,000 items and 0.0001% is just under 36,000 bytes private static final long MAX_FILTER_SIZE = 36000; // There is little reason to ever have more hash functions than 50 given a limit of 36,000 bytes private static final int MAX_HASH_FUNCS = 50; /** * Construct a BloomFilter by deserializing payloadBytes */ public BloomFilter(NetworkParameters params, byte[] payloadBytes) throws ProtocolException { super(params, payloadBytes, 0); } /** * Constructs a filter with the given parameters which is updated on pay2pubkey outputs only. */ public BloomFilter(int elements, double falsePositiveRate, long randomNonce) { this(elements, falsePositiveRate, randomNonce, BloomUpdate.UPDATE_P2PUBKEY_ONLY); } /** * <p>Constructs a new Bloom Filter which will provide approximately the given false positive rate when the given * number of elements have been inserted. If the filter would otherwise be larger than the maximum allowed size, * it will be automatically downsized to the maximum size.</p> * * <p>To check the theoretical false positive rate of a given filter, use * {@link BloomFilter#getFalsePositiveRate(int)}.</p> * * <p>The anonymity of which coins are yours to any peer which you send a BloomFilter to is controlled by the * false positive rate. For reference, as of block 187,000, the total number of addresses used in the chain was * roughly 4.5 million. Thus, if you use a false positive rate of 0.001 (0.1%), there will be, on average, 4,500 * distinct public keys/addresses which will be thought to be yours by nodes which have your bloom filter, but * which are not actually yours. Keep in mind that a remote node can do a pretty good job estimating the order of * magnitude of the false positive rate of a given filter you provide it when considering the anonymity of a given * filter.</p> * * <p>In order for filtered block download to function efficiently, the number of matched transactions in any given * block should be less than (with some headroom) the maximum size of the MemoryPool used by the Peer * doing the downloading (default is {@link MemoryPool#MAX_SIZE}). See the comment in processBlock(FilteredBlock) * for more information on this restriction.</p> * * <p>randomNonce is a tweak for the hash function used to prevent some theoretical DoS attacks. * It should be a random value, however secureness of the random value is of no great consequence.</p> * * <p>updateFlag is used to control filter behaviour on the server (remote node) side when it encounters a hit. * See {@link com.tribesman.kobocoinj.core.BloomFilter.BloomUpdate} for a brief description of each mode. The purpose * of this flag is to reduce network round-tripping and avoid over-dirtying the filter for the most common * wallet configurations.</p> */ public BloomFilter(int elements, double falsePositiveRate, long randomNonce, BloomUpdate updateFlag) { // The following formulas were stolen from Wikipedia's page on Bloom Filters (with the addition of min(..., MAX_...)) // Size required for a given number of elements and false-positive rate int size = (int)(-1 / (pow(log(2), 2)) * elements * log(falsePositiveRate)); size = max(1, min(size, (int) MAX_FILTER_SIZE * 8) / 8); data = new byte[size]; // Optimal number of hash functions for a given filter size and element count. hashFuncs = (int)(data.length * 8 / (double)elements * log(2)); hashFuncs = max(1, min(hashFuncs, MAX_HASH_FUNCS)); this.nTweak = randomNonce; this.nFlags = (byte)(0xff & updateFlag.ordinal()); } /** * Returns the theoretical false positive rate of this filter if were to contain the given number of elements. */ public double getFalsePositiveRate(int elements) { return pow(1 - pow(E, -1.0 * (hashFuncs * elements) / (data.length * 8)), hashFuncs); } @Override public String toString() { return "Bloom Filter of size " + data.length + " with " + hashFuncs + " hash functions."; } @Override void parse() throws ProtocolException { data = readByteArray(); if (data.length > MAX_FILTER_SIZE) throw new ProtocolException ("Bloom filter out of size range."); hashFuncs = readUint32(); if (hashFuncs > MAX_HASH_FUNCS) throw new ProtocolException("Bloom filter hash function count out of range"); nTweak = readUint32(); nFlags = readBytes(1)[0]; length = cursor - offset; } /** * Serializes this message to the provided stream. If you just want the raw bytes use kobocoinSerialize(). */ void kobocoinSerializeToStream(OutputStream stream) throws IOException { stream.write(new VarInt(data.length).encode()); stream.write(data); Utils.uint32ToByteStreamLE(hashFuncs, stream); Utils.uint32ToByteStreamLE(nTweak, stream); stream.write(nFlags); } @Override protected void parseLite() throws ProtocolException { // Do nothing, lazy parsing isn't useful for bloom filters. } private static int rotateLeft32(int x, int r) { return (x << r) | (x >>> (32 - r)); } private int hash(int hashNum, byte[] object) { // The following is MurmurHash3 (x86_32), see http://code.google.com/p/smhasher/source/browse/trunk/MurmurHash3.cpp int h1 = (int)(hashNum * 0xFBA4C795L + nTweak); final int c1 = 0xcc9e2d51; final int c2 = 0x1b873593; int numBlocks = (object.length / 4) * 4; // body for(int i = 0; i < numBlocks; i += 4) { int k1 = (object[i] & 0xFF) | ((object[i+1] & 0xFF) << 8) | ((object[i+2] & 0xFF) << 16) | ((object[i+3] & 0xFF) << 24); k1 *= c1; k1 = rotateLeft32(k1, 15); k1 *= c2; h1 ^= k1; h1 = rotateLeft32(h1, 13); h1 = h1*5+0xe6546b64; } int k1 = 0; switch(object.length & 3) { case 3: k1 ^= (object[numBlocks + 2] & 0xff) << 16; // Fall through. case 2: k1 ^= (object[numBlocks + 1] & 0xff) << 8; // Fall through. case 1: k1 ^= (object[numBlocks] & 0xff); k1 *= c1; k1 = rotateLeft32(k1, 15); k1 *= c2; h1 ^= k1; // Fall through. default: // Do nothing. break; } // finalization h1 ^= object.length; h1 ^= h1 >>> 16; h1 *= 0x85ebca6b; h1 ^= h1 >>> 13; h1 *= 0xc2b2ae35; h1 ^= h1 >>> 16; return (int)((h1&0xFFFFFFFFL) % (data.length * 8)); } /** * Returns true if the given object matches the filter either because it was inserted, or because we have a * false-positive. */ public boolean contains(byte[] object) { for (int i = 0; i < hashFuncs; i++) { if (!Utils.checkBitLE(data, hash(i, object))) return false; } return true; } /** Insert the given arbitrary data into the filter */ public void insert(byte[] object) { for (int i = 0; i < hashFuncs; i++) Utils.setBitLE(data, hash(i, object)); } /** * Sets this filter to match all objects. A Bloom filter which matches everything may seem pointless, however, * it is useful in order to reduce steady state bandwidth usage when you want full blocks. Instead of receiving * all transaction data twice, you will receive the vast majority of all transactions just once, at broadcast time. * Solved blocks will then be send just as Merkle trees of tx hashes, meaning a constant 32 bytes of data for each * transaction instead of 100-300 bytes as per usual. */ public void setMatchAll() { data = new byte[] {(byte) 0xff}; } /** * Copies filter into this. Filter must have the same size, hash function count and nTweak or an * IllegalArgumentException will be thrown. */ public void merge(BloomFilter filter) { if (!this.matchesAll() && !filter.matchesAll()) { checkArgument(filter.data.length == this.data.length && filter.hashFuncs == this.hashFuncs && filter.nTweak == this.nTweak); for (int i = 0; i < data.length; i++) this.data[i] |= filter.data[i]; } else { this.data = new byte[] {(byte) 0xff}; } } /** * Returns true if this filter will match anything. See {@link com.tribesman.kobocoinj.core.BloomFilter#setMatchAll()} * for when this can be a useful thing to do. */ public boolean matchesAll() { for (byte b : data) if (b != (byte) 0xff) return false; return true; } @Override public boolean equals(Object other) { return other instanceof BloomFilter && ((BloomFilter) other).hashFuncs == this.hashFuncs && ((BloomFilter) other).nTweak == this.nTweak && Arrays.equals(((BloomFilter) other).data, this.data); } @Override public int hashCode() { return Objects.hashCode(hashFuncs, nTweak, Arrays.hashCode(data)); } }
[ "dev@kobocoin.com" ]
dev@kobocoin.com
80034bd2ddfafcb5feec3f939653cb5b90b8b7f5
563a22c6cd4443f41952ab3adfb44e280ccd7ebc
/AlgorithmsAndDataStructure/src/main/java/com/dsa/ds/graph/Node.java
f62f37ca9ab0e44719bbadfa62d11a80ca25eaf0
[]
no_license
prakashcheckin/Algorithms-and-Datastructurs
3bee11fdb1ffb6ee7f78fab60762bb40c59609c2
a48ef8f99e99f6507e8732c26e269c72bf8ed94e
refs/heads/master
2021-07-21T21:45:24.145799
2019-12-21T12:14:24
2019-12-21T12:14:24
223,085,869
0
0
null
2020-10-13T17:37:31
2019-11-21T04:09:47
Java
UTF-8
Java
false
false
150
java
package com.dsa.ds.graph; public class Node { int n; String name; public Node(int n, String name) { this.n = n; this.name = name; } }
[ "gnanaprkashcheckout@gmail.com" ]
gnanaprkashcheckout@gmail.com
078a126d4a20acce363bbbd2a85a38565e2ed2b7
665df7112e23b502d512489635b0fb829e75b800
/app/src/main/java/sked/com/generalpreparation/LoginActivity.java
d63d5e1128964ca06e477920dd71dae2df8b9ae7
[]
no_license
madhuram0020/general-prep
4e773894889dfe62202e83522d1f7399492f6021
b39a206f28ebe8fb25e9e5ed6faa3ef93e4444fc
refs/heads/master
2021-01-22T17:38:42.387660
2016-06-21T21:20:25
2016-06-21T21:20:25
61,748,671
0
0
null
null
null
null
UTF-8
Java
false
false
4,952
java
package sked.com.generalpreparation; import android.graphics.Color; import android.os.Bundle; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; import android.support.design.widget.TabLayout; import android.support.v4.view.ViewPager; import android.support.v7.app.AppCompatActivity; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.ImageView; import butterknife.BindView; import butterknife.ButterKnife; import eu.fiskur.simpleviewpager.ImageResourceLoader; import eu.fiskur.simpleviewpager.SimpleViewPager; import sked.com.generalpreparation.adapter.PagerAdapter; import sked.com.generalpreparation.fragment.LoginFragment; import sked.com.generalpreparation.fragment.RegisterFragment; public class LoginActivity extends AppCompatActivity { /*bind viewpager indicator*/ @BindView(R.id.simple_view_pager) SimpleViewPager simpleViewPager; String[] demoUrlArray = new String[]{ "http://fiskur.eu/apps/simpleviewpagerdemo/001.jpg", "http://fiskur.eu/apps/simpleviewpagerdemo/002.jpg", "http://fiskur.eu/apps/simpleviewpagerdemo/003.jpg", "http://fiskur.eu/apps/simpleviewpagerdemo/004.jpg", "http://fiskur.eu/apps/simpleviewpagerdemo/005.jpg", }; int[] resourceIds = new int[]{ R.drawable.img_1, R.drawable.img_2, R.drawable.img_3, R.drawable.img_4, R.drawable.img_5 }; /*get resource from drawable for viewpager imageView*/ private TabLayout tabLayout; /*get resource from drawable for viewpager imageView*/ private ViewPager viewPager; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); ButterKnife.bind(this); overridePendingTransition(R.anim.hyperspace_in,R.anim.hyperspace_out); /*ShimmerFrameLayout container = (ShimmerFrameLayout) findViewById(R.id.shimmer_view_container); container.startShimmerAnimation();*/ /*floating action button implementation*/ FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); if (fab != null) { fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) .setAction("Action", null).show(); } }); } /*fab close*/ /*** * indicator ViewPager implementation */ simpleViewPager.setImageIds(resourceIds, new ImageResourceLoader() { @Override public void loadImageResource(ImageView imageView, int i) { imageView.setImageResource(i); } }); //set indicator color of selected and unselected dots. int indicatorColor = Color.parseColor("#ffffff"); int selectedIndicatorColor = Color.parseColor("#fff000"); simpleViewPager.showIndicator(indicatorColor, selectedIndicatorColor); //set the scale type of imageView on ViewPager simpleViewPager.setScaleType(ImageView.ScaleType.FIT_XY); //call method of tabStrip setViewPager(); } /*method to set TabStrip below the viewPager Indicator*/ void setViewPager() { viewPager = (ViewPager) findViewById(R.id.viewpager); PagerAdapter adapter = new PagerAdapter(getSupportFragmentManager()); adapter.addFragment(new LoginFragment(), "Existing User"); adapter.addFragment(new RegisterFragment(), "New User"); viewPager.setAdapter(adapter); tabLayout = (TabLayout) findViewById(R.id.tabs); tabLayout.setupWithViewPager(viewPager); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. /* getMenuInflater().inflate(R.menu.menu_login, 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); } @Override protected void onDestroy() { super.onDestroy(); simpleViewPager.clearListeners(); } }
[ "manish verma" ]
manish verma
32835fa9e62d9d5da4fa239eefd07c432f1f2137
0062e921d19afff4eab1d99bfaa86b4760d1e834
/src/org/json/JSONML.java
a3592100b4737ff8d087257c72cad9206284cfed
[]
no_license
kpneeraj/airforce-association
94b1ec6e8f5bb12800d761bc9a215b83b5ea1e2a
0bed8c00c34b198b9380f1983e2a27a4b1bf9ea6
refs/heads/master
2021-01-02T08:52:08.784271
2015-07-04T05:17:43
2015-07-04T05:17:43
38,382,583
0
1
null
2015-07-03T09:10:58
2015-07-01T16:37:03
JavaScript
UTF-8
Java
false
false
17,067
java
package org.json; /* Copyright (c) 2008 JSON.org Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. The Software shall be used for Good, not Evil. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ import java.util.Iterator; /** * This provides static methods to convert an XML text into a JSONArray or * JSONObject, and to covert a JSONArray or JSONObject into an XML text using * the JsonML transform. * * @author JSON.org * @version 2012-03-28 */ public class JSONML { /** * Parse XML values and store them in a JSONArray. * @param x The XMLTokener containing the source string. * @param arrayForm true if array form, false if object form. * @param ja The JSONArray that is containing the current tag or null * if we are at the outermost level. * @return A JSONArray if the value is the outermost tag, otherwise null. * @throws JSONException */ private static Object parse( XMLTokener x, boolean arrayForm, JSONArray ja ) throws JSONException { String attribute; char c; String closeTag = null; int i; JSONArray newja = null; JSONObject newjo = null; Object token; String tagName = null; // Test for and skip past these forms: // <!-- ... --> // <![ ... ]]> // <! ... > // <? ... ?> while (true) { if (!x.more()) { throw x.syntaxError("Bad XML"); } token = x.nextContent(); if (token == XML.LT) { token = x.nextToken(); if (token instanceof Character) { if (token == XML.SLASH) { // Close tag </ token = x.nextToken(); if (!(token instanceof String)) { throw new JSONException( "Expected a closing name instead of '" + token + "'."); } if (x.nextToken() != XML.GT) { throw x.syntaxError("Misshaped close tag"); } return token; } else if (token == XML.BANG) { // <! c = x.next(); if (c == '-') { if (x.next() == '-') { x.skipPast("-->"); } else { x.back(); } } else if (c == '[') { token = x.nextToken(); if (token.equals("CDATA") && x.next() == '[') { if (ja != null) { ja.put(x.nextCDATA()); } } else { throw x.syntaxError("Expected 'CDATA['"); } } else { i = 1; do { token = x.nextMeta(); if (token == null) { throw x.syntaxError("Missing '>' after '<!'."); } else if (token == XML.LT) { i += 1; } else if (token == XML.GT) { i -= 1; } } while (i > 0); } } else if (token == XML.QUEST) { // <? x.skipPast("?>"); } else { throw x.syntaxError("Misshaped tag"); } // Open tag < } else { if (!(token instanceof String)) { throw x.syntaxError("Bad tagName '" + token + "'."); } tagName = (String)token; newja = new JSONArray(); newjo = new JSONObject(); if (arrayForm) { newja.put(tagName); if (ja != null) { ja.put(newja); } } else { newjo.put("tagName", tagName); if (ja != null) { ja.put(newjo); } } token = null; for (;;) { if (token == null) { token = x.nextToken(); } if (token == null) { throw x.syntaxError("Misshaped tag"); } if (!(token instanceof String)) { break; } // attribute = value attribute = (String)token; if (!arrayForm && ("tagName".equals(attribute) || "childNode".equals(attribute))) { throw x.syntaxError("Reserved attribute."); } token = x.nextToken(); if (token == XML.EQ) { token = x.nextToken(); if (!(token instanceof String)) { throw x.syntaxError("Missing value"); } newjo.accumulate(attribute, XML.stringToValue((String)token)); token = null; } else { newjo.accumulate(attribute, ""); } } if (arrayForm && newjo.length() > 0) { newja.put(newjo); } // Empty tag <.../> if (token == XML.SLASH) { if (x.nextToken() != XML.GT) { throw x.syntaxError("Misshaped tag"); } if (ja == null) { if (arrayForm) { return newja; } else { return newjo; } } // Content, between <...> and </...> } else { if (token != XML.GT) { throw x.syntaxError("Misshaped tag"); } closeTag = (String)parse(x, arrayForm, newja); if (closeTag != null) { if (!closeTag.equals(tagName)) { throw x.syntaxError("Mismatched '" + tagName + "' and '" + closeTag + "'"); } tagName = null; if (!arrayForm && newja.length() > 0) { newjo.put("childNodes", newja); } if (ja == null) { if (arrayForm) { return newja; } else { return newjo; } } } } } } else { if (ja != null) { ja.put(token instanceof String ? XML.stringToValue((String)token) : token); } } } } /** * Convert a well-formed (but not necessarily valid) XML string into a * JSONArray using the JsonML transform. Each XML tag is represented as * a JSONArray in which the first element is the tag name. If the tag has * attributes, then the second element will be JSONObject containing the * name/value pairs. If the tag contains children, then strings and * JSONArrays will represent the child tags. * Comments, prologs, DTDs, and <code>&lt;[ [ ]]></code> are ignored. * @param string The source string. * @return A JSONArray containing the structured data from the XML string. * @throws JSONException */ public static JSONArray toJSONArray(String string) throws JSONException { return toJSONArray(new XMLTokener(string)); } /** * Convert a well-formed (but not necessarily valid) XML string into a * JSONArray using the JsonML transform. Each XML tag is represented as * a JSONArray in which the first element is the tag name. If the tag has * attributes, then the second element will be JSONObject containing the * name/value pairs. If the tag contains children, then strings and * JSONArrays will represent the child content and tags. * Comments, prologs, DTDs, and <code>&lt;[ [ ]]></code> are ignored. * @param x An XMLTokener. * @return A JSONArray containing the structured data from the XML string. * @throws JSONException */ public static JSONArray toJSONArray(XMLTokener x) throws JSONException { return (JSONArray)parse(x, true, null); } /** * Convert a well-formed (but not necessarily valid) XML string into a * JSONObject using the JsonML transform. Each XML tag is represented as * a JSONObject with a "tagName" property. If the tag has attributes, then * the attributes will be in the JSONObject as properties. If the tag * contains children, the object will have a "childNodes" property which * will be an array of strings and JsonML JSONObjects. * Comments, prologs, DTDs, and <code>&lt;[ [ ]]></code> are ignored. * @param x An XMLTokener of the XML source text. * @return A JSONObject containing the structured data from the XML string. * @throws JSONException */ public static JSONObject toJSONObject(XMLTokener x) throws JSONException { return (JSONObject)parse(x, false, null); } /** * Convert a well-formed (but not necessarily valid) XML string into a * JSONObject using the JsonML transform. Each XML tag is represented as * a JSONObject with a "tagName" property. If the tag has attributes, then * the attributes will be in the JSONObject as properties. If the tag * contains children, the object will have a "childNodes" property which * will be an array of strings and JsonML JSONObjects. * Comments, prologs, DTDs, and <code>&lt;[ [ ]]></code> are ignored. * @param string The XML source text. * @return A JSONObject containing the structured data from the XML string. * @throws JSONException */ public static JSONObject toJSONObject(String string) throws JSONException { return toJSONObject(new XMLTokener(string)); } /** * Reverse the JSONML transformation, making an XML text from a JSONArray. * @param ja A JSONArray. * @return An XML string. * @throws JSONException */ public static String toString(JSONArray ja) throws JSONException { int i; JSONObject jo; String key; Iterator keys; int length; Object object; StringBuffer sb = new StringBuffer(); String tagName; String value; // Emit <tagName tagName = ja.getString(0); XML.noSpace(tagName); tagName = XML.escape(tagName); sb.append('<'); sb.append(tagName); object = ja.opt(1); if (object instanceof JSONObject) { i = 2; jo = (JSONObject)object; // Emit the attributes keys = jo.keys(); while (keys.hasNext()) { key = keys.next().toString(); XML.noSpace(key); value = jo.optString(key); if (value != null) { sb.append(' '); sb.append(XML.escape(key)); sb.append('='); sb.append('"'); sb.append(XML.escape(value)); sb.append('"'); } } } else { i = 1; } //Emit content in body length = ja.length(); if (i >= length) { sb.append('/'); sb.append('>'); } else { sb.append('>'); do { object = ja.get(i); i += 1; if (object != null) { if (object instanceof String) { sb.append(XML.escape(object.toString())); } else if (object instanceof JSONObject) { sb.append(toString((JSONObject)object)); } else if (object instanceof JSONArray) { sb.append(toString((JSONArray)object)); } } } while (i < length); sb.append('<'); sb.append('/'); sb.append(tagName); sb.append('>'); } return sb.toString(); } /** * Reverse the JSONML transformation, making an XML text from a JSONObject. * The JSONObject must contain a "tagName" property. If it has children, * then it must have a "childNodes" property containing an array of objects. * The other properties are attributes with string values. * @param jo A JSONObject. * @return An XML string. * @throws JSONException */ public static String toString(JSONObject jo) throws JSONException { StringBuffer sb = new StringBuffer(); int i; JSONArray ja; String key; Iterator keys; int length; Object object; String tagName; String value; //Emit <tagName tagName = jo.optString("tagName"); if (tagName == null) { return XML.escape(jo.toString()); } XML.noSpace(tagName); tagName = XML.escape(tagName); sb.append('<'); sb.append(tagName); //Emit the attributes keys = jo.keys(); while (keys.hasNext()) { key = keys.next().toString(); if (!"tagName".equals(key) && !"childNodes".equals(key)) { XML.noSpace(key); value = jo.optString(key); if (value != null) { sb.append(' '); sb.append(XML.escape(key)); sb.append('='); sb.append('"'); sb.append(XML.escape(value)); sb.append('"'); } } } //Emit content in body ja = jo.optJSONArray("childNodes"); if (ja == null) { sb.append('/'); sb.append('>'); } else { sb.append('>'); length = ja.length(); for (i = 0; i < length; i += 1) { object = ja.get(i); if (object != null) { if (object instanceof String) { sb.append(XML.escape(object.toString())); } else if (object instanceof JSONObject) { sb.append(toString((JSONObject)object)); } else if (object instanceof JSONArray) { sb.append(toString((JSONArray)object)); } else { sb.append(object.toString()); } } } sb.append('<'); sb.append('/'); sb.append(tagName); sb.append('>'); } return sb.toString(); } }
[ "kpneeraj@gmail.com" ]
kpneeraj@gmail.com
9c3d74fc88b8f9d2f65ba9bccd22e5a787fd4863
14af37e44fee711797cbf66598b1fbb104b9b37f
/wetodos-service/src/main/java/com/dogiant/cms/repo/NewsRepo.java
55dd292d20fef210398ebb4f28f0f68406c3bd27
[]
no_license
dogiant/do-what-to-do
ca6c070af0c4be17fcdfe75bca3b4df6b7765db7
7734f0758750e7a50b5b5430b5735912f44e4d72
refs/heads/master
2021-09-25T14:40:40.296855
2018-10-23T02:41:10
2018-10-23T02:41:10
114,833,275
0
0
null
null
null
null
UTF-8
Java
false
false
309
java
package com.dogiant.cms.repo; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import com.dogiant.cms.domain.website.News; public interface NewsRepo extends JpaRepository<News, Long>, JpaSpecificationExecutor<News> { }
[ "dubiaoqi@jd.com" ]
dubiaoqi@jd.com
ea895ea30148dcb6265f119240f1f29390ae33a5
830354198ac04b70b6d2c5c17935095271302325
/src/main/java/Service/ServiceInterface.java
6693296b3f015667612e0ed8b26cf5c75b5ab6f8
[]
no_license
georgemihaila506/OfficeTransport
5ee41b0e4bbf4549e55dab56b7f7d8ccbac01af2
1666d1d8aa9a6e1a2e005096693a503b269ffeea
refs/heads/master
2020-03-09T10:49:14.007202
2018-04-09T09:56:32
2018-04-09T09:56:32
128,746,009
0
0
null
null
null
null
UTF-8
Java
false
false
544
java
package Service; import Domain.Cursa; import Domain.Rezervare; import Domain.Users; import java.rmi.Remote; import java.rmi.RemoteException; import java.util.List; public interface ServiceInterface extends Remote { void rezerva(Cursa cursa, Rezervare rezervare) throws ServiceException,RemoteException; List<Rezervare> cautaRezervari(Cursa cursa) throws ServiceException,RemoteException; List<Cursa> getAllTrips() throws ServiceException,RemoteException; void checkUser(Users user) throws ServiceException,RemoteException; }
[ "37144843+georgemihaila506@users.noreply.github.com" ]
37144843+georgemihaila506@users.noreply.github.com
1099abcc88aa38220624472277f3e5e801deff3f
99b98781dcc2b9abebcd4c05ebe3eb8ed35a60e8
/Space Ship Games/src/gameObjects/MovingObject.java
0f6b2c72a0deba5ea28a22cead56ba4c1e547c96
[]
no_license
christian-alexis/poo_java_netbeans
9d04ea6de58028db133d19a2c7659e1885097882
0797894584cea1c5beba868b43176b67ea2abbe1
refs/heads/master
2022-11-19T08:55:35.203017
2020-07-22T16:59:30
2020-07-22T16:59:30
276,448,900
0
0
null
null
null
null
UTF-8
Java
false
false
2,739
java
package gameObjects; import java.awt.geom.AffineTransform; import java.awt.image.BufferedImage; import java.util.ArrayList; import graphics.Assets; import graphics.Sound; import math.Vector2D; import states.GameState; public abstract class MovingObject extends GameObject { protected Vector2D velocity; protected AffineTransform at; protected double angle; protected double maxVel; protected int width; protected int height; protected GameState gameState; private Sound explosion; protected boolean Dead; public MovingObject(Vector2D position, Vector2D velocity, double maxVel, BufferedImage texture, GameState gameState) { super(position, texture); this.velocity = velocity; this.maxVel = maxVel; this.gameState = gameState; width = texture.getWidth(); height = texture.getHeight(); angle = 0; explosion = new Sound(Assets.explosion); Dead = false; } protected void collidesWith() { ArrayList<MovingObject> movingObjects = gameState.getMovingObjects(); for (int i = 0; i < movingObjects.size(); i++) { MovingObject m = movingObjects.get(i); if (m.equals(this)) { continue; } double distance = m.getCenter().subtract(getCenter()).getMagnitude(); if (distance < m.width / 2 + width / 2 && movingObjects.contains(this) && !m.Dead && !Dead) { objectCollision(this, m); } } } private void objectCollision(MovingObject a, MovingObject b) { Player p = null; if (a instanceof Player) { p = (Player) a; } else if (b instanceof Player) { p = (Player) b; } if (p != null && p.isSpawning()) { return; } if (a instanceof Meteor && b instanceof Meteor) { return; } if (!(a instanceof PowerUp || b instanceof PowerUp)) { a.Destroy(); b.Destroy(); return; } if (p != null) { if (a instanceof Player) { ((PowerUp) b).executeAction(); b.Destroy(); } else if (b instanceof Player) { ((PowerUp) a).executeAction(); a.Destroy(); } } } protected void Destroy() { Dead = true; if (!(this instanceof Laser) && !(this instanceof PowerUp)) { explosion.play(); } } protected Vector2D getCenter() { return new Vector2D(position.getX() + width / 2, position.getY() + height / 2); } public boolean isDead() { return Dead; } }
[ "christian.alexis.sm.16@gmail.com" ]
christian.alexis.sm.16@gmail.com
ed7feb85f472b7d3d490ed95bd3e03fa109480b9
50983bdd92d7c34814cad25be47746a5db2b803e
/app/src/main/java/qt/com/queuetracker/Model/ServiceItem.java
4e4b9eedc96f2db13d1148823ab534b224f66a80
[]
no_license
Harmeet12345/QueueTracker
a3426ac11d09dd85ba71c3aa4bf8675ffdd91435
58c5c0e3932aa82048350320e827d3eab940fa24
refs/heads/master
2021-01-19T03:28:07.515102
2016-05-06T11:29:01
2016-05-06T11:29:01
56,314,294
0
0
null
null
null
null
UTF-8
Java
false
false
1,139
java
package qt.com.queuetracker.Model; /** * Created by vinove on 28/3/16. */ public class ServiceItem { private String service_name; private String service_logo; private String service_id; private String service_durarion; private boolean isEmpty; public String getService_id() { return service_id; } public void setService_id(String service_id) { this.service_id = service_id; } public boolean getEmpty() { return isEmpty; } public void setEmpty(boolean empty) { isEmpty = empty; } public String getService_durarion() { return service_durarion; } public void setService_durarion(String service_durarion) { this.service_durarion = service_durarion; } public String getService_logo() { return service_logo; } public void setService_logo(String service_logo) { this.service_logo = service_logo; } public String getService_name() { return service_name; } public void setService_name(String service_name) { this.service_name = service_name; } }
[ "pankaj27pandey@gmail.com" ]
pankaj27pandey@gmail.com
a049111eb70b17251188bcb718a114f471126b25
45d0fdc8fbe904bb3ca2e5e1db05a4b672d20ecf
/Hibernate Dao App/src/org/cts/Test.java
34ec662de2a02a7a2eb474a2dbb27760b3bf38f2
[]
no_license
shaik27/javahibernate
b92e027a9def477a86ec84223ebafef8ac8e0c92
a337a361fcb36be8c305bdc3ff7d852cd994938f
refs/heads/master
2020-05-17T08:58:58.291726
2019-04-26T12:28:52
2019-04-26T12:28:52
183,620,925
0
0
null
null
null
null
UTF-8
Java
false
false
1,071
java
package org.cts; import java.util.List; import org.cts.dao.EmpDaoImpl; import org.cts.dao.EmployeeDao; import org.cts.entity.Employee; public class Test { public static void main(String[] args) { // TO Insert EmployeeDao dao = new EmpDaoImpl(); Employee emp1 = new Employee(); Employee emp = new Employee(2, "sam", "banglore"); Integer id = dao.insert(emp); System.out.println(id + " saved successfully"); // To Get int eid = 1; Employee e = dao.get(eid); System.out.println(e.getEid() + "\t" + e.getEname() + "\t" + e.getAddress()); // To Delete int eId = 3; dao.delete(eId); System.out.println(eId + " deleted successfully"); // To Update dao.update(4, "shaik", "delhi"); System.out.println(emp1.getEid() + "\t" + emp1.getEname() + "\t" + emp1.getAddress()); // To Get All Details List<Employee> employees = dao.getEmployees(); for (Employee empl : employees) { System.out.println(empl.getEid() + "\t" + empl.getEname() + "\t" + empl.getAddress()); } } }
[ "shaikmeharaj35@gmail.com" ]
shaikmeharaj35@gmail.com
5be6cd9bf5f095f6cba01cecb30f6e9f09516030
5801213ea443038d19f09719b85ac7daddd82e69
/config/config-manager/src/test/java/org/opendaylight/controller/config/manager/impl/util/InterfacesHelperTest.java
9a5452aa6caa237cc702d1b81b8b388d4520cfd0
[]
no_license
Karbit/OpenDayLight
99f670ef44b799f71cbc34881d598dd37e3b23ad
35dda9a4b446096ef38371516be861e89c27d98c
refs/heads/master
2020-05-20T06:49:29.728436
2013-11-29T13:51:46
2013-11-29T13:51:46
14,799,088
1
0
null
null
null
null
UTF-8
Java
false
false
1,546
java
/* * Copyright (c) 2013 Cisco Systems, 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 */ package org.opendaylight.controller.config.manager.impl.util; import static org.junit.Assert.assertEquals; import java.util.Set; import javax.management.MXBean; import org.junit.Test; import org.opendaylight.controller.config.spi.Module; import org.opendaylight.yangtools.concepts.Identifiable; import com.google.common.collect.Sets; public class InterfacesHelperTest { interface SuperA { } interface SuperBMXBean { } interface SuperC extends SuperA, SuperBMXBean { } class SuperClass implements SuperC { } @MXBean interface SubA { } abstract class SubClass extends SuperClass implements SubA, Module { } @Test public void testGetAllInterfaces() { Set<Class<?>> expected = Sets.<Class<?>> newHashSet(SuperA.class, SuperBMXBean.class, SuperC.class, SubA.class, Identifiable.class, Module.class); assertEquals(expected, InterfacesHelper.getAllInterfaces(SubClass.class)); } @Test public void testGetMXInterfaces() { Set<Class<?>> expected = Sets.<Class<?>> newHashSet(SuperBMXBean.class, SubA.class); assertEquals(expected, InterfacesHelper.getMXInterfaces(SubClass.class)); } }
[ "nxjql@126.com" ]
nxjql@126.com
adaeb288f763bf4b64d60f3afcef468c1e42c0af
de550d60612e20659a22b5b24823d3c06ba1ed5a
/JavaSE/src/day03/Solution.java
dbcfbe03c4d87e4acc16fcdecf4ee5e10e888538
[]
no_license
twinvest/Company_Algorithm2
d5fbec63cb058e59b1151ea90ae7e21c9544f28a
66fd8324ca5ee7d8ada02752f0c62dd777fa956c
refs/heads/master
2020-12-23T10:29:17.885066
2020-01-30T09:50:43
2020-01-30T09:50:43
237,124,254
1
0
null
null
null
null
UTF-8
Java
false
false
127
java
package day03; public class Solution { public static void main(String[] args) { // TODO Auto-generated method stub } }
[ "twinvest@naver.com" ]
twinvest@naver.com
2a1e20c934024b04b74a2621a699c84c2a95f0bc
88541645765e462e83c2721ac189d9fae6a32f4b
/APPSHIK/Android/ProductChange/app/src/main/java/com/android/productchange/api/HttpPostFile.java
92b61498d2ce87dae275cf34cfad712a0c7033fc
[]
no_license
ron4999/pvcong1994.github.io
4c04c6bcb6f50482f2b63aca1972f48c6292dbe9
aee81532286c8ffd4b36a4e101075788542cb69f
refs/heads/master
2022-04-13T14:28:52.232682
2020-04-08T11:55:25
2020-04-08T11:55:25
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,861
java
package com.android.productchange.api; import android.content.Context; import android.os.AsyncTask; import com.android.productchange.interfaces.HttpResponse; import java.io.BufferedReader; import java.io.DataOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.InputStreamReader; import java.net.URL; import javax.net.ssl.HttpsURLConnection; /** * <h1>Http Post File</h1> * * Task Post File log to API Log * * @author tien-lv * @since 2018-01-11. */ public class HttpPostFile extends AsyncTask<String, String, String> { /** * Http response */ private HttpResponse response; /** * File name */ private String fileName = ""; /** * Constructor HttpPost * * @param c context */ public HttpPostFile(Context c) { this.response = (HttpResponse) c; } /** * Set progress dialog loading. */ protected void onPreExecute() { } /** * Send request and get response to services API * * @param params String params for activity * @return result from API * @throws Exception from request fail * @see Exception */ @Override protected String doInBackground(String... params) { String lineEnd = "\r\n"; String twoHyphens = "--"; String boundary = "*****"; int maxBufferSize = 1024 * 1024; int bytesRead, bytesAvailable, bufferSize; byte[] buffer; try { // set url from params URL url = new URL(params[0]); FileInputStream fileInputStream = new FileInputStream( new File(params[1])); // init connection to server with https HttpsURLConnection httpsURLConnection = (HttpsURLConnection) url.openConnection(); httpsURLConnection.setRequestMethod(Config.METHOD_POST); httpsURLConnection.setDoInput(true); httpsURLConnection.setDoOutput(true); httpsURLConnection.setUseCaches(false); httpsURLConnection.setRequestProperty(Config.PROPERTY_KEY, Config.PROPERTY_VALUE_POST_FILE); httpsURLConnection.setRequestProperty(Config.CONNECTION_KEY, Config.CONNECTION_VALUE); httpsURLConnection.setRequestProperty(Config.ENCTYPE_KEY, Config.PROPERTY_VALUE_POST_FILE); httpsURLConnection.setRequestProperty(Config.PROPERTY_KEY, Config.PROPERTY_VALUE_POST_FILE + ";" + Config.BOUNDARY + "=" + boundary); httpsURLConnection.setRequestProperty(Config.UPLOADFILE, params[1]); httpsURLConnection.setRequestProperty(Config.API_KEY, Config.API_KEY_VALUE); DataOutputStream dataOutputStream = new DataOutputStream( httpsURLConnection.getOutputStream()); // writing bytes to data output stream dataOutputStream.writeBytes(twoHyphens + boundary + lineEnd); dataOutputStream.writeBytes(Config.CONTENT_DISPOSITION + params[1] + "\"" + lineEnd); dataOutputStream.writeBytes(lineEnd); // create a buffer of maximum size bytesAvailable = fileInputStream.available(); bufferSize = Math.min(bytesAvailable, maxBufferSize); buffer = new byte[bufferSize]; bytesRead = fileInputStream.read(buffer, 0, bufferSize); while (bytesRead > 0) { dataOutputStream.write(buffer, 0, bufferSize); bytesAvailable = fileInputStream.available(); bufferSize = Math.min(bytesAvailable, maxBufferSize); bytesRead = fileInputStream.read(buffer, 0, bufferSize); } // send multipart form data necessary after file data... dataOutputStream.writeBytes(lineEnd); dataOutputStream.writeBytes(twoHyphens + boundary + twoHyphens + lineEnd); fileInputStream.close(); dataOutputStream.flush(); dataOutputStream.close(); int responseCode = httpsURLConnection.getResponseCode(); fileName = params[1]; if (responseCode == HttpsURLConnection.HTTP_OK) { BufferedReader in = new BufferedReader( new InputStreamReader(httpsURLConnection.getInputStream())); String line = in.readLine(); return (line != null ? line : ""); } else { return String.valueOf(responseCode); } } catch (Exception e) { return "Exception: " + e.getMessage(); } } /** * End progress loading * * @param result from API */ @Override protected void onPostExecute(String result) { response.progressFinish(result, 0, fileName); } }
[ "cong-pv@fujinet.vn" ]
cong-pv@fujinet.vn
979ce2f16b8cea10c24237433ddaf564295d4e37
fab96025ef998ab4997dd347c69a36a7b655b134
/studentdataforResultList[mam_Task]/StudentPassFail/src/ReduceClass.java
a898f4fac5414ebbf977a9dcbb99d82822a976b0
[]
no_license
arvindpe/MapReduceCode
98bef696191473a2144ecaa0c00d28a839b56eea
47c6690e3327ac7b6fde46d0be468316e700a793
refs/heads/master
2021-06-13T01:18:58.026239
2017-03-23T05:25:44
2017-03-23T05:25:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
796
java
import java.io.IOException; import org.apache.hadoop.io.NullWritable; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapreduce.Reducer; public class ReduceClass extends Reducer<Text,Text,NullWritable,Text> { public Text output=new Text(); public void reduce(Text key, Iterable<Text> values,Context context) throws IOException, InterruptedException { String status=null; for (Text val : values) { String str[]=val.toString().split(","); String name=str[0]; status=str[1]; output.set(name); } System.out.println("List of"+status+" students:"); context.write(NullWritable.get(), output); } }
[ "arvindpednekar2013@gmail.com" ]
arvindpednekar2013@gmail.com
8cea154494fae7f3f0e79ce20332c9d80af2cd03
e0e778d4a9cbb92b31498a32d16a36d5a3847f5f
/gridway-5.8/src/drmaa/org/ggf/drmaa/ResumeInconsistentStateException.java
1c6d988ed3eb0959f10aed29d6dbfac63caec974
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
SantanderMetGroup/DRM4G
d4173e4bb735184cfe4f5990ffd032c862466819
ff72e7c544795a050027088caa64883200227c8c
refs/heads/devel
2022-09-18T03:38:29.297144
2022-08-31T11:39:30
2022-08-31T11:39:30
73,944,879
0
5
NOASSERTION
2022-01-11T17:04:11
2016-11-16T17:38:18
C
UTF-8
Java
false
false
1,559
java
/* -------------------------------------------------------------------------- */ /* Copyright 2002-2011, GridWay Project Leads (GridWay.org) */ /* */ /* 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.ggf.drmaa; /** * Thrown when the job cannot be moved to a <b>RESUME</b> state. */ public class ResumeInconsistentStateException extends InconsistentStateException { public ResumeInconsistentStateException() { super(); } public ResumeInconsistentStateException(java.lang.String message) { super(message); } }
[ "carlos@3232fcf4-bb0b-194b-8ba9-96a9312bd5d0" ]
carlos@3232fcf4-bb0b-194b-8ba9-96a9312bd5d0
86e62bb7c6f756d75a8a3acee11c9440f4c089a4
8042507f429e5637c61aec1bf22aa94e06445151
/java_workspace/basic/src/control/continueDemo.java
0681e2102dce982d16ee96424a189d0242ea78b0
[]
no_license
onehobby/HTA-JAVA
a110b35a7f641596f82084e162f8ff5689c54f09
564e84e60f90093a12ef2a91512c5ba714d30e80
refs/heads/master
2021-05-25T22:31:48.369947
2020-07-21T08:59:51
2020-07-21T08:59:51
253,947,863
0
0
null
null
null
null
UTF-8
Java
false
false
421
java
package control; public class continueDemo { public static void main(String[] args) { // continue // 반복문안에 있는 수행문을 실행하다가 continue가 실행되면 남아있는 // 수행문의 실행을 취소하고 증감식으로 이동해서 다음 번 반복을 하러 간다. for (int i=1; i<=10; i++) { if (i%3 == 0 ) { continue; } System.out.println(i); } } }
[ "zcx52111@naver.com" ]
zcx52111@naver.com
11f0902e1f08e01511f371e9889992a6d38d21ce
f41bdbc59cb6f1f48d6520a93f517fd44f83f153
/net/minecraft/world/ColorizerFoliage.java
72cb43c8c3a150fbc89a3fc7233b7aad33ae3ec6
[ "MIT" ]
permissive
BantorSchwanzVor/plotscanner-leak
f9ec02b2538fe51af94cfc807c7beb3ef158f106
cbf130076159711d939affb4b0343c46c3466107
refs/heads/master
2021-05-20T12:02:47.993998
2020-04-01T21:23:59
2020-04-01T21:23:59
252,285,321
0
0
null
null
null
null
UTF-8
Java
false
false
907
java
package net.minecraft.world; public class ColorizerFoliage { private static int[] foliageBuffer = new int[65536]; public static void setFoliageBiomeColorizer(int[] foliageBufferIn) { foliageBuffer = foliageBufferIn; } public static int getFoliageColor(double temperature, double humidity) { humidity *= temperature; int i = (int)((1.0D - temperature) * 255.0D); int j = (int)((1.0D - humidity) * 255.0D); return foliageBuffer[j << 8 | i]; } public static int getFoliageColorPine() { return 6396257; } public static int getFoliageColorBirch() { return 8431445; } public static int getFoliageColorBasic() { return 4764952; } } /* Location: C:\Users\BSV\AppData\Local\Temp\Rar$DRa6216.20396\Preview\Preview.jar!\net\minecraft\world\ColorizerFoliage.class * Java compiler version: 8 (52.0) * JD-Core Version: 1.1.3 */
[ "germangamera@gmail.com" ]
germangamera@gmail.com
ac1aea51a16d0d84d1c6f58ef54e5dd3523894dd
e61fe869fcf0820878da44f26d4f1b3949dc35fb
/classeMorgan/Association.java
97ea69ddc1bf6c3132f2c4d2c3cec3cfbe16b23a
[]
no_license
Mounik/AssoSoft
f20c7755c1b7b3cc934288e7f367713a3f997688
a54b078dfca1273b54c3fae952a9f27b8c005c33
refs/heads/master
2020-04-11T12:37:59.862621
2018-12-21T08:50:27
2018-12-21T08:50:27
161,786,913
0
0
null
null
null
null
UTF-8
Java
false
false
923
java
package classeProjet; public class Association { private String nom; private String tel; private String mail; private String adresse; public Association() { nom = "AssoVelo"; tel = "0322485696"; mail = "AssoVelo@gmail.com"; adresse = "2 rue roubilon"; } public Association(String nom, String tel, String mail, String adresse) { this.nom = nom; this.tel = tel; this.mail = mail; this.adresse = adresse; } public void setNom(String nom) { this.nom = nom; } public void setTel(String tel) { this.tel = tel; } public void setMail(String mail) { this.mail = mail; } public void setAdresse(String adresse) { this.adresse = adresse; } public String getNom() { return nom; } public String getTel() { return tel; } public String getMail() { return mail; } public String getAdresse() { return adresse; } }
[ "noreply@github.com" ]
noreply@github.com
9d9c6c116ac6ca4ed010c361a694266611904b11
089b0879fb1a9c9bf4e7b79e467fd957cf39af39
/TestProduct.java
2754dddaa19c757579332ba3e1c215b14664da73
[]
no_license
sonali-pati895/ECommerce
5335e33419e8f07aae950b1636ae17c97b6bbae8
199e4e4efac69e55bc2e67ac3085515bfe6ceb06
refs/heads/main
2023-01-01T09:47:03.161623
2020-10-21T15:23:19
2020-10-21T15:23:19
305,974,044
0
0
null
null
null
null
UTF-8
Java
false
false
477
java
package assignSE; import java.util.Scanner; public class TestProduct { public static void main(String[] args) { int id; String name; String descr; double price; Scanner input = new Scanner(System.in); System.out.println("Enter the product info:"); id= input.nextInt(); name = input.next(); descr=input.next(); price = input.nextDouble(); Product p=new Product( id, name, descr, price); p.display(); } }
[ "noreply@github.com" ]
noreply@github.com
0ae44d87defe951663116eab218c50426efe5952
2fe5b8398f875a20274e945f84ef74007f115d2d
/src/Nhanvienparttime.java
a1379f9d2fa44ed108a5d45b6a24de184c1e0447
[]
no_license
PXM98/phamanh
7f0f649bce86ae75c5ce430cf6bfeb4f562ade0d
4e7e13a99443ea2dd0f1771556ce2d97e2004e31
refs/heads/master
2023-04-30T16:06:04.454297
2021-05-05T11:29:27
2021-05-05T11:29:27
347,376,721
0
0
null
null
null
null
UTF-8
Java
false
false
425
java
package model; import NV.Configs; public class NhanVienPartTime extends NhanVien { private int giolamviec; public NhanVienPartTime(String ten, int giolamviec) { this.ten = ten; this.giolamviec = giolamviec; } public String LoaiNhanVien() { return "Nhan vien thoi vu"; } public void tinhLuong() { luong = Configs.LUONG_NHAN_VIEN_PART_TIME_MOI_GIO * giolamviec; } }
[ "manhxx98@gmail.com" ]
manhxx98@gmail.com
caf3f7aebdd504d20730dd6589ac2311de521963
6efdacf54e958768e066e395a26dbe2857a778fa
/com/javalec/ex/lec13/inheritance/ParentClass.java
f9c4164d7bd82214e5eed3b8b9d4edc1b25bc237
[]
no_license
motorjjang/java
bc190e6853c1729d0bc558d698c0c70a201b7c1a
436caa02cfcb61c49bfa5e5fe729fccb4b3bd93d
refs/heads/master
2022-12-13T08:27:16.191310
2020-08-27T22:46:26
2020-08-27T22:46:26
255,377,240
0
0
null
null
null
null
UTF-8
Java
false
false
368
java
package com.javalec.ex.lec13.inheritance; public class ParentClass { public ParentClass() { // TODO Auto-generated constructor stub } public void method1() { // TODO Auto-generated method stub System.out.println("ParentClass method1"); } public void method2() { // TODO Auto-generated method stub System.out.println("ParentClass method2"); } }
[ "motorjjang@nate.com" ]
motorjjang@nate.com
ac9c92b62ec7f1a5495acf5f24aa42f2adfbc3b9
0af8b92686a58eb0b64e319b22411432aca7a8f3
/large-multiproject/project35/src/test/java/org/gradle/test/performance35_3/Test35_248.java
e2063637b31d76a34ac1e5df2aac133ba15f02fa
[]
no_license
gradle/performance-comparisons
b0d38db37c326e0ce271abebdb3c91769b860799
e53dc7182fafcf9fedf07920cbbea8b40ee4eef4
refs/heads/master
2023-08-14T19:24:39.164276
2022-11-24T05:18:33
2022-11-24T05:18:33
80,121,268
17
15
null
2022-09-30T08:04:35
2017-01-26T14:25:33
null
UTF-8
Java
false
false
292
java
package org.gradle.test.performance35_3; import static org.junit.Assert.*; public class Test35_248 { private final Production35_248 production = new Production35_248("value"); @org.junit.Test public void test() { assertEquals(production.getProperty(), "value"); } }
[ "cedric.champeau@gmail.com" ]
cedric.champeau@gmail.com
9427e060ce358ebc24bec258ea421cbf719370c9
3a359fbf466102a5d607fe06a883726d559adb37
/src/main/java/com/peyman/gestione_allievi/web/controller/mappers/AllievoMapper.java
b2cba0db418d6be8c54101a2a83af9343254b937
[]
no_license
peyman1987/Gestione-Allievi
5c0e430d226182adee94e6b2ef5ea7d09b8e1a85
4fb6cda2935e02e9ccde7bde72d49a8bada3b92d
refs/heads/main
2023-03-06T20:06:56.460054
2021-02-21T19:01:47
2021-02-21T19:01:47
330,720,550
0
0
null
null
null
null
UTF-8
Java
false
false
380
java
package com.peyman.gestione_allievi.web.controller.mappers; import com.peyman.gestione_allievi.domain.Allievo; import com.peyman.gestione_allievi.web.model.AllievoDto; import org.mapstruct.Mapper; @Mapper(uses = {DateMapper.class}) public interface AllievoMapper { AllievoDto allievoToAllievoDto(Allievo allievo); Allievo allievoDtoToAllievo(AllievoDto allievoDto); }
[ "peyman_em@yahoo.com" ]
peyman_em@yahoo.com
d9688de94e8c4d7ba0e00507cbf6a557b1b52362
6f9b28be5c23b0cdf537e300fa93fa607c78c895
/src/main/java/io/choerodon/agile/api/dto/BurnDownReportCoordinateDTO.java
29d3d2b538dcc26feaeb48987dac5db1cfd095a1
[ "Apache-2.0" ]
permissive
wmz831/agile-service
f0b8b47b0c5152df6323cf05b78b7907fd0ace1c
74868e68be977c1772c73641fb1cdc5f28480e4f
refs/heads/master
2020-04-14T15:32:03.882332
2019-01-02T09:07:00
2019-01-02T09:07:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,868
java
package io.choerodon.agile.api.dto; import io.choerodon.agile.infra.common.utils.StringUtil; import java.io.Serializable; import java.util.Date; /** * @author dinghuang123@gmail.com * @since 2018/9/4 */ public class BurnDownReportCoordinateDTO implements Serializable { public BurnDownReportCoordinateDTO(Integer start, Integer add, Integer done, Integer left, String name, Date startDate, Date endDate) { this.start = start; this.add = add; this.done = done; this.left = left; this.name = name; this.startDate = startDate; this.endDate = endDate; } private Integer start; private Integer add; private Integer done; private Integer left; private String name; private Date startDate; private Date endDate; public Integer getStart() { return start; } public void setStart(Integer start) { this.start = start; } public Integer getAdd() { return add; } public void setAdd(Integer add) { this.add = add; } public Integer getDone() { return done; } public void setDone(Integer done) { this.done = done; } public Integer getLeft() { return left; } public void setLeft(Integer left) { this.left = left; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Date getStartDate() { return startDate; } public void setStartDate(Date startDate) { this.startDate = startDate; } public Date getEndDate() { return endDate; } public void setEndDate(Date endDate) { this.endDate = endDate; } @Override public String toString() { return StringUtil.getToString(this); } }
[ "dinghuang123@gmail.com" ]
dinghuang123@gmail.com
85b965abeb382fb5c7638e9d87f54d0de27b6100
74f77e7f1aee30f3c1c9f1f9ffea91b9d6b728a1
/2uzubook/src/controller/OneInput.java
8be5888c3cd6a60e4278b3d11b3b4feff0156ea0
[]
no_license
pkr91/2uzubook
71fe5960c97c33bec66592c6a7d5c56824186e84
23d41c6cef70a1eff090be8f2721c8a0773d91f6
refs/heads/master
2021-08-14T08:50:30.873833
2017-11-15T06:12:33
2017-11-15T06:12:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,551
java
package controller; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.json.simple.JSONArray; import org.json.simple.JSONObject; import etc.EtcDAO; import resume.ResumeDAO; import user.UserDAO; @WebServlet("/OneInput") public class OneInput extends HttpServlet { private static final long serialVersionUID = 1L; ResumeDAO database; EtcDAO database2; UserDAO database3; public OneInput() { database=ResumeDAO.getInstance(); database2=EtcDAO.getInstance(); database3=UserDAO.getInstance(); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { JSONArray jarr=database.select_keyword(); request.setAttribute("KeywordArray", jarr); HttpSession session=request.getSession(); String userID=(String) session.getAttribute("id"); if(session.getAttribute("id")==null){ response.sendRedirect("/2uzubook/login.jsp"); return; } JSONArray licenses=database.select_resume_add_keyword(userID, 1); JSONArray awds=database.select_resume_add_keyword(userID, 2); JSONArray clubs=database.select_resume_add_keyword(userID, 3); System.out.println(licenses); System.out.println(licenses); System.out.println(licenses); JSONArray projects=database.select_resume_add_keyword(userID, 4); JSONArray tests=database.select_resume_add_keyword(userID, 5); JSONArray conferences=database.select_resume_add_keyword(userID, 6); JSONArray volunteers=database2.select_resume_add_keyword(userID, 1); JSONArray readings=database2.select_resume_add_keyword(userID, 2); //유저 정보 받아오기 JSONArray ja=database3.executeAndGet("SELECT * FROM USER WHERE id=?", userID); JSONObject userData=(JSONObject)ja.get(0); int major=(Integer)userData.get("major"); userData.put("majorName", database3.majorToString(major)); userData.put("licenses", licenses); userData.put("awards",awds); userData.put("clubs",clubs); userData.put("projects",projects); userData.put("tests",tests); userData.put("conferences",conferences); userData.put("volunteers",volunteers); userData.put("readings",readings); System.out.println(userData); request.setAttribute("JSONObject", userData); request.getRequestDispatcher("/oneinput.jsp").forward(request, response); } }
[ "qazxc5735@gmail.com" ]
qazxc5735@gmail.com
b7ca0c502898eaec6d48b6f1dadee7e9957a8fd8
4137ea380ef1fba4e4b11c2bae879a416f0488c9
/Phojon/src/utils/Ray.java
e2485909a390cb2a5200c00366d0c98a88b08612
[]
no_license
juliusmh/JavaPathtracing
93ed76e8a731d2e8be1fa18c9d53a4dedaca7353
ab53a09ae7d2781067faed6a7406e27d2d385723
refs/heads/master
2021-01-17T08:17:00.024840
2016-07-18T15:41:53
2016-07-18T15:41:53
60,296,974
2
0
null
null
null
null
UTF-8
Java
false
false
477
java
package utils; public class Ray { private Vector3 origin; //The origin of the Ray private Vector3 dir; //The direction of the Ray public Ray(Vector3 origin, Vector3 dir) { this.origin = origin; this.dir = dir; } //GETTERS AND SETTERS public Vector3 getOrigin() { return origin; } public void setOrigin(Vector3 origin) { this.origin = origin; } public Vector3 getDir() { return dir; } public void setDir(Vector3 dir) { this.dir = dir; } }
[ "juliusmh@web.de" ]
juliusmh@web.de
6ec6e6671e9f97126dc9460463250b210545e765
c6c75ff36941b681246600097a540f967d0d2dfc
/src/behavioural/chainofresponsibility/pattern/JuniorDoctor.java
c5e0bedec2620e8ee28b1fc213b19358045894dc
[]
no_license
Praveenkupati/designPatternsGoF
fa172da90dce756a0e1ca09a4d3da1658c2512dd
cb5303196f665f7a19b583eef717655c4b18af99
refs/heads/master
2023-03-17T14:41:14.359466
2020-04-25T04:33:27
2020-04-25T04:33:27
null
0
0
null
null
null
null
UTF-8
Java
false
false
814
java
package behavioural.chainofresponsibility.pattern; public class JuniorDoctor implements Doctor { private Doctor successor; public JuniorDoctor(Doctor doctor) { this.successor = doctor; } @Override public void checkPatient(String name, String symptoms) { String severity = checkSeverity(symptoms); if (severity.equals("low")) { System.out.println("Patient treated by Junior Doctor"); } else { System.out.println("Severity not low -> directing it to next doctor"); this.successor.checkPatient(name, symptoms); } } public String checkSeverity(String symptoms) { System.out.println("Patient being checked by Junior Doctor"); if (symptoms.contains("fever") || symptoms.contains("cough") || symptoms.contains("cold")) { return "low"; } else { return "high"; } } }
[ "vijay.srj@gmail.com" ]
vijay.srj@gmail.com
1d75fec70f6c520b8173c3fef0e83e4dd2014ee6
2b68d0ec31f27be61db1dc585281cf674fb53b37
/libs/download/mp3_examples/CreateSequence.java
e7cb54272b64c9e263a58c0ac2c719e7cdf6fcd0
[]
no_license
veltzer/myworld-jee
02b7f9bfec8f8428855477fe265bc68b4fa4ac2d
f8deb517e943ca2fe90a83ad545e9b3d2bd9b89b
refs/heads/master
2023-07-13T00:29:08.646754
2023-07-01T14:39:15
2023-07-01T14:39:15
38,682,471
0
0
null
null
null
null
UTF-8
Java
false
false
6,610
java
package org.meta.sound.examples; /* * CreateSequence.java * * This file is part of jsresources.org */ /* * Copyright (c) 2000 by Matthias Pfisterer * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * - Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * - Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ /* |<--- this code is formatted to fit into 80 columns --->| */ import java.io.File; import java.io.IOException; import javax.sound.midi.Sequence; import javax.sound.midi.MidiEvent; import javax.sound.midi.MidiMessage; import javax.sound.midi.MidiSystem; import javax.sound.midi.ShortMessage; import javax.sound.midi.Track; import javax.sound.midi.InvalidMidiDataException; /** <titleabbrev>CreateSequence</titleabbrev> <title>Creating a Sequence</title> <formalpara><title>Purpose</title> <para> Shows how to construct a Sequence object with a Track and MidiEvents in memory and save it to a Standard MIDI File (SMF). </para></formalpara> <formalpara><title>Usage</title> <para> <cmdsynopsis> <command>java CreateSequence</command> <arg choice="plain"><replaceable class="parameter">midi_file</replaceable></arg> </cmdsynopsis> </para> </formalpara> <formalpara><title>Parameters</title> <variablelist> <varlistentry> <term><option><replaceable class="parameter">midi_file</replaceable></option></term> <listitem><para>the name of the file to save to as a Standard Midi File.</para></listitem> </varlistentry> </variablelist> </formalpara> <formalpara><title>Bugs, limitations</title> <para>None </para> </formalpara> <formalpara><title>Source code</title> <para> <ulink url="CreateSequence.java.html">CreateSequence.java</ulink> </para> </formalpara> */ public class CreateSequence { /* This velocity is used for all notes. */ private static final int VELOCITY = 64; public static void main(String[] args) { if (args.length != 1) { printUsageAndExit(); } File outputFile = new File(args[0]); Sequence sequence = null; try { sequence = new Sequence(Sequence.PPQ, 1); } catch (InvalidMidiDataException e) { e.printStackTrace(); System.exit(1); } /* Track objects cannot be created by invoking their constructor directly. Instead, the Sequence object does the job. So we obtain the Track there. This links the Track to the Sequence automatically. */ Track track = sequence.createTrack(); // first chord: C major track.add(createNoteOnEvent(60, 0)); track.add(createNoteOnEvent(64, 0)); track.add(createNoteOnEvent(67, 0)); track.add(createNoteOnEvent(72, 0)); track.add(createNoteOffEvent(60, 1)); track.add(createNoteOffEvent(64, 1)); track.add(createNoteOffEvent(67, 1)); track.add(createNoteOffEvent(72, 1)); // second chord: f minor N track.add(createNoteOnEvent(53, 1)); track.add(createNoteOnEvent(65, 1)); track.add(createNoteOnEvent(68, 1)); track.add(createNoteOnEvent(73, 1)); track.add(createNoteOffEvent(63, 2)); track.add(createNoteOffEvent(65, 2)); track.add(createNoteOffEvent(68, 2)); track.add(createNoteOffEvent(73, 2)); // third chord: C major 6-4 track.add(createNoteOnEvent(55, 2)); track.add(createNoteOnEvent(64, 2)); track.add(createNoteOnEvent(67, 2)); track.add(createNoteOnEvent(72, 2)); track.add(createNoteOffEvent(64, 3)); track.add(createNoteOffEvent(72, 3)); // forth chord: G major 7 track.add(createNoteOnEvent(65, 3)); track.add(createNoteOnEvent(71, 3)); track.add(createNoteOffEvent(55, 4)); track.add(createNoteOffEvent(65, 4)); track.add(createNoteOffEvent(67, 4)); track.add(createNoteOffEvent(71, 4)); // fifth chord: C major track.add(createNoteOnEvent(48, 4)); track.add(createNoteOnEvent(64, 4)); track.add(createNoteOnEvent(67, 4)); track.add(createNoteOnEvent(72, 4)); track.add(createNoteOffEvent(48, 8)); track.add(createNoteOffEvent(64, 8)); track.add(createNoteOffEvent(67, 8)); track.add(createNoteOffEvent(72, 8)); /* Now we just save the Sequence to the file we specified. The '0' (second parameter) means saving as SMF type 0. Since we have only one Track, this is actually the only option (type 1 is for multiple tracks). */ try { MidiSystem.write(sequence, 0, outputFile); } catch (IOException e) { e.printStackTrace(); System.exit(1); } } private static MidiEvent createNoteOnEvent(int nKey, long lTick) { return createNoteEvent(ShortMessage.NOTE_ON, nKey, VELOCITY, lTick); } private static MidiEvent createNoteOffEvent(int nKey, long lTick) { return createNoteEvent(ShortMessage.NOTE_OFF, nKey, 0, lTick); } private static MidiEvent createNoteEvent(int nCommand, int nKey, int nVelocity, long lTick) { ShortMessage message = new ShortMessage(); try { message.setMessage(nCommand, 0, // always on channel 1 nKey, nVelocity); } catch (InvalidMidiDataException e) { e.printStackTrace(); System.exit(1); } MidiEvent event = new MidiEvent(message, lTick); return event; } private static void printUsageAndExit() { out("usage:"); out("java CreateSequence <midifile>"); System.exit(1); } private static void out(String strMessage) { System.out.println(strMessage); } } /*** CreateSequence.java ***/
[ "mark.veltzer@gmail.com" ]
mark.veltzer@gmail.com
cd9b9ccf8cf571e8abbea1ef691e6725539fcb4f
febf1a99cbbc7a8d578bd535a8189c432dfcd114
/knarts/plugins/gov.vha.knart.composite/src/org/hl7/knowledgeartifact/r2/LookupConstraint.java
6bdbcb6e5ad6e38f568885588ba3d15452d8688a
[]
no_license
swmuir/knarts
b870571419de2baaf7fe2001b4dedf680fd54d02
09f6c0a0c7429399720278feea51af4cad916c75
refs/heads/master
2020-12-20T13:31:04.614345
2020-04-01T21:14:58
2020-04-01T21:14:58
236,081,888
0
0
null
null
null
null
UTF-8
Java
false
false
5,246
java
/** */ package org.hl7.knowledgeartifact.r2; import org.hl7.elm.r1.Expression; /** * <!-- begin-user-doc --> * A representation of the model object '<em><b>Lookup Constraint</b></em>'. * <!-- end-user-doc --> * * <!-- begin-model-doc --> * This constraint constructs a "lookup" list for the * value range. * The constraint type must be List * * <!-- end-model-doc --> * * <p> * The following features are supported: * </p> * <ul> * <li>{@link org.hl7.knowledgeartifact.r2.LookupConstraint#getItems <em>Items</em>}</li> * <li>{@link org.hl7.knowledgeartifact.r2.LookupConstraint#getDisplayField <em>Display Field</em>}</li> * <li>{@link org.hl7.knowledgeartifact.r2.LookupConstraint#isStrictSelection <em>Strict Selection</em>}</li> * </ul> * * @see org.hl7.knowledgeartifact.r2.R2Package#getLookupConstraint() * @model extendedMetaData="name='LookupConstraint' kind='elementOnly'" * @generated */ public interface LookupConstraint extends RangeConstraint { /** * Returns the value of the '<em><b>Items</b></em>' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * <!-- begin-model-doc --> * The expression returns a list of items that * form * the range of values. * * <!-- end-model-doc --> * @return the value of the '<em>Items</em>' containment reference. * @see #setItems(Expression) * @see org.hl7.knowledgeartifact.r2.R2Package#getLookupConstraint_Items() * @model containment="true" required="true" * extendedMetaData="kind='element' name='items' namespace='##targetNamespace'" * @generated */ Expression getItems(); /** * Sets the value of the '{@link org.hl7.knowledgeartifact.r2.LookupConstraint#getItems <em>Items</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param value the new value of the '<em>Items</em>' containment reference. * @see #getItems() * @generated */ void setItems(Expression value); /** * Returns the value of the '<em><b>Display Field</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * <!-- begin-model-doc --> * The field from the returned expression objects * that is set as the field to display. * It is required when the list * elements are non-primitive types * * <!-- end-model-doc --> * @return the value of the '<em>Display Field</em>' attribute. * @see #setDisplayField(String) * @see org.hl7.knowledgeartifact.r2.R2Package#getLookupConstraint_DisplayField() * @model dataType="org.eclipse.emf.ecore.xml.type.String" * extendedMetaData="kind='attribute' name='displayField'" * @generated */ String getDisplayField(); /** * Sets the value of the '{@link org.hl7.knowledgeartifact.r2.LookupConstraint#getDisplayField <em>Display Field</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param value the new value of the '<em>Display Field</em>' attribute. * @see #getDisplayField() * @generated */ void setDisplayField(String value); /** * Returns the value of the '<em><b>Strict Selection</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * <!-- begin-model-doc --> * If strictSelection is set to true, the value * entered by the user must be * an item from the returned list. If * this is set * to false, the value may not be restricted to the * returned list. * * <!-- end-model-doc --> * @return the value of the '<em>Strict Selection</em>' attribute. * @see #isSetStrictSelection() * @see #unsetStrictSelection() * @see #setStrictSelection(boolean) * @see org.hl7.knowledgeartifact.r2.R2Package#getLookupConstraint_StrictSelection() * @model unsettable="true" dataType="org.eclipse.emf.ecore.xml.type.Boolean" * extendedMetaData="kind='attribute' name='strictSelection'" * @generated */ boolean isStrictSelection(); /** * Sets the value of the '{@link org.hl7.knowledgeartifact.r2.LookupConstraint#isStrictSelection <em>Strict Selection</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param value the new value of the '<em>Strict Selection</em>' attribute. * @see #isSetStrictSelection() * @see #unsetStrictSelection() * @see #isStrictSelection() * @generated */ void setStrictSelection(boolean value); /** * Unsets the value of the '{@link org.hl7.knowledgeartifact.r2.LookupConstraint#isStrictSelection <em>Strict Selection</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #isSetStrictSelection() * @see #isStrictSelection() * @see #setStrictSelection(boolean) * @generated */ void unsetStrictSelection(); /** * Returns whether the value of the '{@link org.hl7.knowledgeartifact.r2.LookupConstraint#isStrictSelection <em>Strict Selection</em>}' attribute is set. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return whether the value of the '<em>Strict Selection</em>' attribute is set. * @see #unsetStrictSelection() * @see #isStrictSelection() * @see #setStrictSelection(boolean) * @generated */ boolean isSetStrictSelection(); } // LookupConstraint
[ "sean.muir@jkmsoftware.com" ]
sean.muir@jkmsoftware.com
8368ff45efb6454eb1251129f6b025a73d866ff9
8265c3105bff96270878ed93e565b6e8ef4cd695
/Foundry/src/osl/manager/basic/StreamInputActorImpl.java
2c3a9cfa7d0911621f452c1f411bcbb385577dd9
[ "MIT", "LicenseRef-scancode-warranty-disclaimer", "LicenseRef-scancode-unknown-license-reference" ]
permissive
azakeriyan/org.rebecalang.jacco
c6f056df131904d1b82fa4575f12b049dd024d7f
ec975c3aeb995d512a2fc2980cdb4aeea8c84a45
refs/heads/master
2021-01-01T19:01:22.573891
2015-08-18T20:46:01
2015-08-18T20:46:01
40,995,603
0
0
null
null
null
null
UTF-8
Java
false
false
35,490
java
package osl.manager.basic; import java.io.IOException; import kilim.pausable; import osl.manager.ActorCreateRequest; import osl.manager.ActorImpl; import osl.manager.ActorManager; import osl.manager.ActorManagerName; import osl.manager.ActorMsgRequest; import osl.manager.ActorName; import osl.manager.ActorRequest; import osl.manager.RemoteCodeException; import osl.manager.StreamInputActor; import osl.service.ServiceException; import osl.service.ServiceName; import osl.service.ServiceNotFoundException; import osl.util.WaitQueue; /** This class defines the implementation of an actor used to manage an input stream on behalf of external actors. We require an implementation (rather than an <em>Actor</em>) because if a security manager is running (i.e. startfoundry was specified with the -secure option), then user-written actors will not have direct access to several standard streams (e.g. System.out). Since instances of <em>ActorImpl</em> are privileged they may control such streams and provide their services to specific actors. The interface exported to external actors is defined by the <em>StreamInputActor</em> interface. In the current implementation, this actor will always use <em>System.in</em> as the encapsulated input stream. <p> @author Mark Astley @version $Revision: 1.2 $ ($Date: 1998/07/18 18:59:48 $) @see osl.manager.basic.StreamInputActor */ public class StreamInputActorImpl extends ActorImpl implements StreamInputActor { /** * */ private static final long serialVersionUID = 1178506284039882972L; /** The manager which manages this implementation. */ protected ActorManager ourManager; /** The queue which holds incoming requests. */ protected WaitQueue<ActorMsgRequest> mailQueue; ///////////////////////////////////////////////////////////////////////// // Manager Interface Functions: // // These methods are intended to be invoked by extensions of // the ActorManager abstract class. // ///////////////////////////////////////////////////////////////////////// /** This method is called by a manager to initialize an actor implementation after it is instantiated. The manager provides a reference to itself, a reference giving the name of the new actor, and a create request describing the new <em>Actor</em> that should be created and managed. After calling this method, a manager will call the run method in this class to start the actor executing. Note that the protection of this method prevents it from being called external to <tt>osl.manager</tt>. This was done to prevent arbitrary classes from initializing new actors. However, managers in different packages may invoke this method using <em>implInitialize</em>. <p> For this implementation, the manager reference and actor name are saved, but the actor create request is discarded since no internal actor is actually created. <p> @param <b>ourMgr</b> The <em>ActorManager</em> which should be used by this actor implementation to invoke actor services. @param <b>you</b> The <em>ActorName</em> that should be used as the name of the new actor. @param <b>rtClass</b> The run-time <em>Class</em> of the user-written actor that should be instantiated by this implementation. This class will always be an extension of the <em>Actor</em> class. @param <b>initArgs</b> The array of arguments to pass to the constructor of the user-defined actor when it is instantiated. @see osl.manager.ActorManager#implInitialize */ protected void actorInitialize(ActorManager ourMgr, ActorName you, ActorCreateRequest req) { ourManager = ourMgr; self = you; mailQueue = new WaitQueue<ActorMsgRequest>(); } /** This method is called by a manager to deliver a new message to the local actor. This method is protected so that it has package level protection and therefore may not be invoked directly by user-written actor code. <p> For this implementation, we deposit the new message in our mail queue so that it can be processed in the main run loop. <p> @param <b>msg</b> The <em>ActorMsgRequest</em> structure to be delivered. This structure must be maintained by the actor as it is required if an exception is returned to the manager. */ protected void actorDeliver(ActorMsgRequest msg) { mailQueue.enqueue(msg); } /** This method is called by the new manager of an actor implementation just after migration has occurred. The implementation is expected to perform any re-initialization necessary after a migration (e.g. rebuilding transient fields). This method will be called before the implementations thread is restarted. <p> This method should never be called for this implementation as <em>StreamInputActorImpl</em>s will never migrate. If this method IS called for some reason then a runtime exception is thrown. <p> @param <b>ourMgr</b> A reference to the new manager of the implementation after migration has occurred. @exception java.lang.RuntimeException Thrown if this method is ever called. */ protected void actorPostMigrateRebuild(ActorManager ourMgr) { throw new RuntimeException("<StreamInputActorImpl.actorPostMigrateRebuild> shold NEVER be called!"); } ///////////////////////////////////////////////////////////////////////// // Actor Interface Functions: // // None of these methods should ever be called since no internal // actor is ever created. If a method IS called then throw a // RuntimeException. // ///////////////////////////////////////////////////////////////////////// /** Request a message to be sent. The message argument is forwarded to the manager. If the RPC field of the message is set to true then the caller is blocked while the RPC takes place. This method is protected so that it has package level protection and therefore may not be invoked directly by user-written actor code.<p> This method should never be called in this implementation since no internal actor is ever created.<p> @param <b>msg</b> The <em>ActorMsgRequest</em> describing the message to send. @return If this is an RPC request, then the return value from the message call is returned. Otherwise, null is returned. @exception osl.manager.RemoteCodeException Thrown only if this is an RPC exception which throws an exception during invocation. An exception thrown in any other case is an error. @exception java.lang.RuntimeException Thrown if this method is ever called. @see osl.manager.Actor#send(ActorName, String) @see osl.manager.Actor#call(ActorName, String) */ protected Object implSend(ActorName dest, String meth, Object[] args, boolean byCopy) throws RemoteCodeException { throw new RuntimeException("<StreamInputActorImpl.implSend> should NEVER be called!"); } @pausable protected Object implCall(ActorName dest, String meth, Object[] args, boolean byCopy) { throw new RuntimeException("<StreamInputActorImpl.implCall> should NEVER be called!"); } /** Request a new actor to be created. The request argument is forwarded to the manager and the returned name is passed on to the <em>Actor</em> caller. This method is protected so that it has package level protection and therefore may not be invoked directly by user-written actor code.<p> This method should never be called in this implementation since no internal actor is ever created.<p> @param <b>req</b> The <em>ActorCreateRequest</em> describing the new actor to create. @return The <em>ActorName</em> of the new actor. @exception java.lang.SecurityException Thrown if the behavior of the new actor is not a subclass of <em>Actor</em>. @exception osl.manager.RemoteCodeException Thrown as a wrapper for any other error that is encountered while attempting the create. Note that such errors may also be thrown asynchronously. @exception java.lang.RuntimeException Thrown if this method is ever called. @see osl.manager.Actor#create(String) @see osl.manager.Actor#create(Class) @see osl.manager.Actor#create(ActorManagerName, String) @see osl.manager.Actor#create(ActorManagerName, Class) */ protected ActorName implCreate(ActorCreateRequest req) throws SecurityException, RemoteCodeException { throw new RuntimeException("<StreamInputActorImpl.implCreate> should NEVER be called!"); } /** Request that this actor wishes to be migrated to a new location. By convention, this call is meant to indicate a request rather than serving as a notice to immediately migrate the actor. Normally, the implementation will record the request but wait to migrate the actor until the current message being processed has completed. Once this occurs the actor is migrated and restarted at its new node. This method is protected so that it has package level protection and therefore may not be invoked directly by user-written actor code.<p> This method should never be called in this implementation since no internal actor is ever created.<p> @param <b>loc</b> The <em>ActorManagerName</em> of the node to migrate to. @exception java.lang.RuntimeException Thrown if this method is ever called. @see osl.manager.Actor#migrate @see osl.manager.Actor#cancelMigrate */ protected void implMigrate(ActorManagerName loc) { throw new RuntimeException("<StreamInputActorImpl.implMigrate> should NEVER be called!"); } /** Request a service invocation on the named node service. This request is forwarded to the actor manager and the appropriate return value is provided. This method is protected so that it has package level protection and therefore may not be invoked directly by user-written actor code.<p> This method should never be called in this implementation since no internal actor is ever created.<p> @param <b>name</b> The <em>ServiceName</em> describing the service to invoke. @param <b>args</b> The <em>Object</em> argument to pass to the service invocation function. @return The <em>Object</em> returned as a result of the service invocation. @exception osl.service.ServiceNotFoundException Thrown if no instance of the named service can be found on this node. @exception osl.service.ServiceException Thrown if the service throws an exception while processing the request. @exception java.lang.RuntimeException Thrown if this method is ever called. @see osl.manager.Actor#invokeService */ protected Object implInvokeService(ServiceName name, String meth, Object[] args) throws ServiceNotFoundException, ServiceException { throw new RuntimeException("<StreamInputActorImpl.implInvokeService> should NEVER be called!"); } /** Request to remove this actor from the system. Normally, this method will not return as the actor is immediately removed from the system. Note that any actor garbage collection process is ignored in this call so that this actor may be removed even though it is accessible by other actors. <p> This method should never be called in this implementation since no internal actor is ever created.<p> @param <b>reason</b> A <em>String</em> giving a "reason" for the removal. This string should normally be appended to the log for the actor before removing it from the system. @exception java.lang.RuntimeException Thrown if this method is ever called. @see osl.manager.Actor#destroy */ protected void implDestroy(String reason) { throw new RuntimeException("<StreamInputActorImpl.implDestroy> should NEVER be called!"); } ///////////////////////////////////////////////////////////////////////// // StreamInputActor Interface Functions: // // These methods are required by the StreamInputActor interface // we implement. // ///////////////////////////////////////////////////////////////////////// /** Read the next byte of data from an input stream. The value returned is an <em>Integer</em> in the range <tt>0</tt> to <tt>255</tt> (i.e. a character). This method blocks until a byte of data is available, or end-of-file is reached. If end-of-file is encountered then a -1 is returned. Normally, this method will be invoked using the "call" actor operation, as this is the only way to obtain the data returned from this method. <p> @return An <em>Integer</em> containing the next byte of data or -1 if end-of-file is reached. @exception java.io.IOException Thrown if an I/O error occurs while reading the attached stream. */ public Integer read() throws IOException { return System.in.read(); } /** Read the next byte of data from an input stream and send it to a specified actor. The value returned is an <em>Integer</em> in the range <tt>0</tt> to <tt>255</tt> (i.e. a character). This method blocks until a byte of data is available, or end-of-file is reached. If end-of-file is encountered then a -1 is returned. The result is sent to the actor with name <b>client</b> by invoking method <b>method</b>. Thus, <b>client</b> is expected to define a method with signature:<p> * <blockquote><code> * public <em>type</em> <b>method</b>(<em>Integer</em>); * </code></blockquote> where <em>type</em> may be any legal return type. Any error resulting from the sending of the result (e.g. NoSuchMethodException, RemoteCodeException, etc) is ignored by the <em>StreamInputActor</em> (but it IS logged to the Actor log file). Normally, this method is used by actors wishing to perform asynchronous I/O. <p> @param <b>client</b> The <em>ActorName</em> of the actor which should receive the data. @param <b>method</b> The <em>String</em> name of the method in <b>client</b> which will accept the data. @exception java.io.IOException Thrown if an I/O error occurs while reading the attached stream. For asynchronous calls, this exception is normally returned as an invocation of the asynchException" method. @see osl.manager.StreamInputActor#read() */ public void read(ActorName client, String method) throws IOException { send(client, method, System.in.read()); } /** Read an array of bytes from the input stream and return them to the caller. The maximum number of bytes to read is specified by <b>max</b>. This method blocks until input is available. Normally, this method will be invoked using the "call" actor operation, as this is the only way to obtain the data returned from this method. <p> @param <b>max</b> An <em>Integer</em> giving the maximum number of bytes to read from the stream. @return A <b>Byte</b> array giving the data read from the stream. The return value is <tt>null</tt> if no data was available because end-of-file was encountered. Otherwise, the length of the array indicates the actual number of bytes read. @exception java.io.IOException Thrown if an I/O error occurs while reading the attached stream, or if <b>max</b> is less than one. */ public Byte[] read(Integer max) throws IOException { int M = max.intValue(); if (M < 1) throw new IOException("argument max must be greater than zero"); byte b[] = new byte[M]; int num = System.in.read(b); if (num == -1) return null; Byte[] retValue = new Byte[num]; for(int i=0; i<num; i++) retValue[i] = b[i]; return retValue; } /** Read an array of bytes from the input stream and send them to a specified actor. The maximum number of bytes to read is specified by <b>max</b>. This method blocks until input is available. The result is sent to the actor with name <b>client</b> by invoking method <b>method</b>. Thus, <b>client</b> is expected to define a method with signature:<p> * <blockquote><code> * public <em>type</em> <b>method</b>(<em>Byte[]</em>); * </code></blockquote> where <em>type</em> may be any legal return type. Any error resulting from the sending of the result (e.g. NoSuchMethodException, RemoteCodeException, etc) is ignored by the <em>StreamInputActor</em> (but it IS logged to the Actor log file). Normally, this method is used by actors wishing to perform asynchronous I/O. <p> @param <b>client</b> The <em>ActorName</em> of the actor which should receive the data. @param <b>method</b> The <em>String</em> name of the method in <b>client</b> which will accept the data. @param <b>max</b> An <em>Integer</em> giving the maximum number of bytes to read from the stream. @exception java.io.IOException Thrown if an I/O error occurs while reading the attached stream, or if <b>max</b> is less than one. @see osl.manager.StreamInputActor#read(Integer) */ public void read(ActorName client, String method, Integer max) throws IOException { send(client, method, read(max)); } /** Skip over and discard <b>n</b> bytes of data from the input stream. Depending on the internal <em>InputStream</em>, the actual number of bytes skipped may vary. The number of bytes skipped is returned as the result of this method. Normally, this method will be invoked using the "call" actor operation, as this is the only way to obtain the data returned from this method. <p> @param <b>n</b> A <em>Long</em> giving the number of bytes to be skipped. @return An <em>Long</em> giving the actual number of bytes skipped. @exception java.io.IOException Thrown if an I/O error occurs while skipping bytes. */ public Long skip(Long n) throws IOException { return System.in.skip(n.longValue()); } /** Skip over and discard <b>n</b> bytes of data from the input stream. Depending on the internal <em>InputStream</em>, the actual number of bytes skipped may vary. The number of bytes skipped is sent to the actor with name <b>client</b> by invoking method <b>method</b>. Thus, <b>client</b> is expected to define a method with signature:<p> * <blockquote><code> * public <em>type</em> <b>method</b>(<em>Long</em>); * </code></blockquote> where <em>type</em> may be any legal return type. Any error resulting from the sending of the result (e.g. NoSuchMethodException, RemoteCodeException, etc) is ignored by the <em>StreamInputActor</em> (but it IS logged to the Actor log file). Normally, this method is used by actors wishing to perform asynchronous I/O. <p> @param <b>client</b> The <em>ActorName</em> of the actor which should receive the number of bytes skipped. @param <b>method</b> The <em>String</em> name of the method in <b>client</b> which will accept the number of bytes skipped. @param <b>n</b> A <em>Long</em> giving the number of bytes to be skipped. @exception java.io.IOException Thrown if an I/O error occurs while skipping bytes. @see osl.manager.StreamInputActor#skip(Long) */ public void skip(ActorName client, String method, Long n) throws IOException { send(client, method, skip(n)); } /** Return the number of bytes that can be read from the internal input stream without blocking. The number of bytes available is returned as an <em>Integer</em> to the caller. Normally, this method will be invoked using the "call" actor operation, as this is the only way to obtain the data returned from this method. <p> @return An <em>Integer</em> giving the number of bytes that can be read from this input stream without blocking. @exception java.io.IOException Thrown if an I/O error occurs while attempting to determine the number of bytes available. */ public Integer available() throws IOException { return System.in.available(); } /** Determine the number of bytes that can be read from the internal input stream without blocking, and send the result to the specified caller. The number of bytes available is sent to the actor with name <b>client</b> by invoking method <b>method</b>. Thus, <b>client</b> is expected to define a method with signature:<p> * <blockquote><code> * public <em>type</em> <b>method</b>(<em>Integer</em>); * </code></blockquote> where <em>type</em> may be any legal return type. Any error resulting from the sending of the result (e.g. NoSuchMethodException, RemoteCodeException, etc) is ignored by the <em>StreamInputActor</em> (but it IS logged to the Actor log file). Normally, this method is used by actors wishing to perform asynchronous I/O. <p> @param <b>client</b> The <em>ActorName</em> of the actor which should receive the number of bytes available. @param <b>method</b> The <em>String</em> name of the method in <b>client</b> which will accept the number of bytes available. @exception java.io.IOException Thrown if an I/O error occurs while attempting to determine the number of bytes available. @see osl.manager.StreamInputActor#available() */ public void available(ActorName client, String method) throws IOException { send(client, method, available()); } /** Close the internal input stream. As this method has no return value, it may be called either synchronously or asynchronously. @exception java.io.IOException Thrown if an I/O error occurs while attempting to close the stream. */ public void close() throws IOException { System.in.close(); } /** Mark the current position in the internal stream. Later calls to <em>reset</em> will reposition the internal stream at the last marked position. A <em>readlimit</em> may be specified which indicates the number of bytes which may be read before the mark position becomes invalid. As this method has no return value, it may be called either synchronously or asynchronously.<p> @param <b>readlimit</b> An <em>Integer</em> indicating the maximum number of bytes that can be read before the mark position becomes invalid. @exception java.io.IOException Thrown if an I/O error occurs while placing the mark. */ public void mark(Integer readlimit) { System.in.mark(readlimit.intValue()); } /** Reposition the internal stream to the position marked by a previous call to <em>mark</em>. As this method has no return value, it may be called either synchronously or asynchronously.<p> @exception java.io.IOException Thrown if the internal stream has not been marked, or if the previously placed mark has been invalidated. */ public void reset() throws IOException { System.in.reset(); } /** Test if the internal input stream supports the <em>mark</em> and <em>reset</em> methods. A <em>Boolean</em> is returned to the caller indicating the result of the query. Normally, this method will be invoked using the "call" actor operation, as this is the only way to obtain the data returned from this method. <p> @return A <em>Boolean</em> indicating <tt>true</tt> if <em>mark</em> and <em>reset</em> are supported, and <tt>false</tt> otherwise. */ public Boolean markSupported() { return new Boolean(System.in.markSupported()); } /** Test if the internal input stream supports the <em>mark</em> and <em>reset</em> methods. The <em>Boolean</em> result is sent to the actor with name <b>client</b> by invoking method <b>method</b>. Thus, <b>client</b> is expected to define a method with signature:<p> * <blockquote><code> * public <em>type</em> <b>method</b>(<em>Boolean</em>); * </code></blockquote> where <em>type</em> may be any legal return type. Any error resulting from the sending of the result (e.g. NoSuchMethodException, RemoteCodeException, etc) is ignored by the <em>StreamInputActor</em> (but it IS logged to the Actor log file). Normally, this method is used by actors wishing to perform asynchronous I/O. <p> @param <b>client</b> The <em>ActorName</em> of the actor which should receive the <em>markSupported</em> status @param <b>method</b> The <em>String</em> name of the method in <b>client</b> which will accept the <em>markSupported</em> status. @see osl.manager.StreamInputActor#markSupported() */ public void markSupported(ActorName client, String method) { send(client, method, markSupported()); } /** Read a line of characters from the internal input stream. A line is any sequence of characters terminated by a newline. This call will block until either a newline terminates a sequence of characters, or end-of-file is encountered. In either case, a <em>Character</em> array containing the characters read (minus the newline terminator) is returned to the caller. If no characters were available (e.g. because end-of-file was encountered immediately), then <tt>null</tt> is returned. Normally, this method will be invoked using the "call" actor operation, as this is the only way to obtain the data returned from this method. <p> @return A <em>Character</em> array containing all the characters read up to a terminating newline or end-of-file, or <tt>null</tt> if no characters were available do to end-of-file. @exception java.io.IOException Thrown if an I/O error occurs while reading a line of characters. */ public Character[] readln() throws IOException { int current = 0; char[] readChars = new char[10]; int next; next = System.in.read(); if (next == -1) return null; while ( (next != -1) && (next != '\n') ) { readChars[current++] = (char) next; if (current == readChars.length) { char[] copy = new char[readChars.length * 2]; System.arraycopy(readChars, 0, copy, 0, current); readChars = copy; } next = (char) System.in.read(); } Character[] retVal = new Character[current]; for(int i=0; i<current; i++) retVal[i] = readChars[i]; return retVal; } /** Read a line of characters from the internal input stream. A line is any sequence of characters terminated by a newline. This call will block until either a newline terminates a sequence of characters, or end-of-file is encountered. In either case, a <em>Character</em> array containing the characters read (minus the newline terminator) is sent to the actor with name <b>client</b> by invoking method <b>method</b>. If no characters were available (e.g. because end-of-file was encountered immediately), then <tt>null</tt> is sent to <b>client</b>. Thus, <b>client</b> is expected to define a method with signature:<p> * <blockquote><code> * public <em>type</em> <b>method</b>(<em>Character</em>); * </code></blockquote> where <em>type</em> may be any legal return type. Any error resulting from the sending of the result (e.g. NoSuchMethodException, RemoteCodeException, etc) is ignored by the <em>StreamInputActor</em> (but it IS logged to the Actor log file). Normally, this method is used by actors wishing to perform asynchronous I/O. <p> @param <b>client</b> The <em>ActorName</em> of the actor which should receive the line of characters. @param <b>method</b> The <em>String</em> name of the method in <b>client</b> which should recieve the line of characters. @exception java.io.IOException Thrown if an I/O error occurs while reading a line of characters. @see osl.manager.StreamInputActor#readln() */ public void readln(ActorName client, String method) throws IOException { send(client, method, readln()); } ///////////////////////////////////////////////////////////////////////// // Main Run Loop ///////////////////////////////////////////////////////////////////////// /** The main run loop for this implementation. All messages are processed within this loop and replies are generated and sent as necessary. */ public void _runExecute() { ActorMsgRequest nextMsg = null; Object rVal = null; String mName = null; Object[] mArgs = null; try { // Log.println("<StreamInputActorImpl.run> Stream actor started with name: " + self); while (true) { if (!mailQueue.empty()) { // Get the next message to process nextMsg = (ActorMsgRequest) mailQueue.peekFront(); mName = nextMsg.method; mArgs = nextMsg.methodArgs; rVal = null; try { // Figure out which method to process based on the // arguments and make the appropriate call. This is // currently pretty ugly but, c'est la vie. if ( (mName.equals("asynchException")) && (mArgs.length == 2) && (mArgs[0] instanceof ActorRequest) && (mArgs[1] instanceof Exception) ) { // We just log these messages. // Log.println("Received exception for request: " + mArgs[0]); // Log.println("Exception stack trace follows:"); // Log.logExceptionTrace((Exception)mArgs[1]); } else if ( (mName.equals("read")) && (mArgs.length == 0) ) { rVal = read(); } else if ( (mName.equals("read")) && (mArgs.length == 2) && (mArgs[0] instanceof ActorName) && (mArgs[1] instanceof String) ) { read((ActorName) mArgs[0], (String) mArgs[1]); } else if ( (mName.equals("read")) && (mArgs.length == 1) && (mArgs[0] instanceof Integer) ) { rVal = read((Integer) mArgs[0]); } else if ( (mName.equals("read")) && (mArgs.length == 3) && (mArgs[0] instanceof ActorName) && (mArgs[1] instanceof String) && (mArgs[2] instanceof Integer) ) { read((ActorName) mArgs[0], (String) mArgs[1], (Integer) mArgs[2]); } else if ( (mName.equals("skip")) && (mArgs.length == 1) && (mArgs[0] instanceof Long) ) { rVal = skip((Long) mArgs[0]); } else if ( (mName.equals("skip")) && (mArgs.length == 3) && (mArgs[0] instanceof ActorName) && (mArgs[1] instanceof String) && (mArgs[2] instanceof Long) ) { skip((ActorName) mArgs[0], (String) mArgs[1], (Long) mArgs[2]); } else if ( (mName.equals("available")) && (mArgs.length == 0) ) { rVal = available(); } else if ( (mName.equals("available")) && (mArgs.length == 2) && (mArgs[0] instanceof ActorName) && (mArgs[1] instanceof String) ) { available((ActorName) mArgs[0], (String) mArgs[1]); } else if ( (mName.equals("close")) && (mArgs.length == 0) ) { close(); } else if ( (mName.equals("mark")) && (mArgs.length == 1) && (mArgs[0] instanceof Integer) ) { mark((Integer) mArgs[0]); } else if ( (mName.equals("reset")) && (mArgs.length == 0) ) { reset(); } else if ( (mName.equals("markSupported")) && (mArgs.length == 0) ) { rVal = markSupported(); } else if ( (mName.equals("markSupported")) && (mArgs.length == 2) && (mArgs[0] instanceof ActorName) && (mArgs[1] instanceof String) ) { markSupported((ActorName) mArgs[0], (String) mArgs[1]); } else if ( (mName.equals("readln")) && (mArgs.length == 0) ) { rVal = readln(); } else if ( (mName.equals("readln")) && (mArgs.length == 2) && (mArgs[0] instanceof ActorName) && (mArgs[1] instanceof String) ) { readln((ActorName) mArgs[0], (String) mArgs[1]); } else { // Throw a NoSuchMethodException. This will be ignored // if the original message is asynchException, in which // case we just log it. String argVals = "("; for(int i=0; i<mArgs.length; i++) argVals = argVals + mArgs[0].getClass().toString() + ", "; argVals = argVals + ")"; throw new NoSuchMethodException(mName + argVals); } } catch (Exception e) { // Any exception caught here is sent back to the original // caller as an asynchException message. Object[] args = new Object[2]; ActorMsgRequest errMsg = new ActorMsgRequest(self, nextMsg.sender, "asynchException", args, false); args[0] = nextMsg; args[1] = e; errMsg.originator = self; mgrActorSend(ourManager, errMsg); } // If this message is an RPC request, then send out the // reply message if (nextMsg.RPCRequest) { Object[] returnIt = new Object[1]; ActorMsgRequest theReply = new ActorMsgRequest(self, nextMsg.sender, "__RPCReply", returnIt, false); returnIt[0] = rVal; theReply.originator = self; mgrActorSend(ourManager, theReply); } // Dequeue the message once it has been processed. mailQueue.dequeue(); //ActorMsgRequestPool.getInstance().put(mailQueue.dequeue()); } else // See if the mail queue is still empty. If it is then // provide a hint to our scheduler and put this thread to // sleep. Otherwise we automatically go back and pick off // the message. synchronized (mailQueue) { if (mailQueue.empty()) { mailQueue.wait(); } } } } catch (Throwable e) { // We catch a throwable here rather than an exception so we get // EVERYTHING that might cause this actor to fail (unless we // catch a ThreadDeath message, in which case we just throw it // again). We then package things into a RemoteCodeException // for delivery to our manager. The manager should either kill // us or restart us by recalling start(). if (e instanceof ThreadDeath) throw (ThreadDeath) e; else mgrActorFatalError(ourManager, new RemoteCodeException("Error in run loop of ActorImpl:", e)); } } /** A send method similar to that in <em>Actor</em> which allows the <em>StreamInputActor</em> interface methods to send messags. */ void send(ActorName target, String method, Object arg) { try { Object[] args = new Object[1]; ActorMsgRequest newMsg = new ActorMsgRequest(self, target, method, args); args[0] = arg; newMsg.originator = self; mgrActorSend(ourManager, newMsg); } catch (Exception e) { throw new RuntimeException("Exception while sending reply: " + e); } } }
[ "arvinzakeriyan@gmail.com" ]
arvinzakeriyan@gmail.com
5e7366e2ddad9f1b260487b0c6662147aa50c9ea
98543e0c7181a07c3cc6f2c10f35300682731cb3
/src/main/java/locationservice/services/CityService.java
22b6e3f4d83675d49bbb2f74036f3dacc7233d2d
[]
no_license
BWoodwar22/LocationInformation
0050ee5879b30e6eb85c405fdff14cb1db82e91b
32115d5d42d2c6c0f647bebe7caef9f4f20f85b9
refs/heads/master
2020-04-01T22:48:49.781026
2018-10-19T05:15:36
2018-10-19T05:15:36
153,727,324
0
0
null
null
null
null
UTF-8
Java
false
false
306
java
package locationservice.services; public interface CityService { /** * Get the city name for the supplied location * * @param location A LocationData object * @return The same LocationData object with the city name field filled */ public LocationData getCityName(LocationData location); }
[ "38512064+Tibbleton@users.noreply.github.com" ]
38512064+Tibbleton@users.noreply.github.com
3c8a6e95814c18eafcdd43546361dab22813aee4
37603e0763bf6f17582f20ca4edae44b8e6ca1fe
/src/Data/DataStorage.java
105502fd843cd24941be575694300e52f70b8f68
[]
no_license
vinaykchavan/FXBlotter
7332e7a9e563d1a8c4b286a07450bb921c93f525
8362393d435716dec671da76644471831c1c6936
refs/heads/master
2020-07-06T14:06:49.290862
2019-08-18T18:42:30
2019-08-18T18:42:30
203,042,684
0
0
null
null
null
null
UTF-8
Java
false
false
257
java
package Data; import java.util.concurrent.ConcurrentHashMap; public class DataStorage { public static ConcurrentHashMap<String,TradeStore> map=new ConcurrentHashMap<String, TradeStore>(); } class TradeStore { String currency; int quantity; }
[ "noreply@github.com" ]
noreply@github.com
d03b6b06125fe9c6e18fa52623cf2eb89851eb3a
4e00186d3c91e909c0fd9a5370469e27b035b932
/src/main/java/com/yshuoo/jvm/classloader/MyTest17.java
1a61d66c01e0f01130b97b648bc296ebf29379d6
[]
no_license
TigerTurbo/jvm_lecture
5e062348fc26251a917ed786bb5edec40be1bd6e
77a260c9732e2deb51b1caf180be0ff233dc3c7f
refs/heads/master
2022-07-03T19:24:34.346667
2021-05-11T07:16:15
2021-05-11T07:16:15
219,739,236
0
0
null
2020-07-02T01:14:11
2019-11-05T12:25:10
Java
UTF-8
Java
false
false
687
java
package com.yshuoo.jvm.classloader; public class MyTest17 { public static void main(String[] args) throws Exception{ // 将系统类加载器当做loader1的父加载器 MyTest16 loader1 = new MyTest16("loader1"); Class<?> clazz = loader1.loadClass("com.yshuoo.jvm.classloader.MySample"); System.out.println("class: " + clazz.hashCode()); /** * 如果注释掉该行,那么并不会实例化MySample对象,即MySample构造方法不会被调用 * 因此不会实例化MyCat对象,即没有对MyCat进行主动使用,这里不会加载MyCat Class */ // Object object = clazz.newInstance(); } }
[ "751308615@qq.com" ]
751308615@qq.com
ac77bce749daae5fd2908fcb412dcccf6b74d3fc
0a3d8f73ed34b285cf876f9d4e32ab69aeaee457
/functional_programming/combinatorPattern/CustomerValidatorService.java
bc5bb55621b89619528f71768f7ef2e3a3755df5
[]
no_license
sawan848/ds-algo
cc772bbbd922803fc961f662efc9e5deb6690188
91c8003347fb183512947f85ff23f25489ada0ad
refs/heads/master
2023-03-20T04:04:18.923079
2021-02-25T13:27:24
2021-02-25T13:27:24
268,716,022
7
0
null
null
null
null
UTF-8
Java
false
false
760
java
package combinatorPattern; import java.time.LocalDate; import java.time.Period; /* * @author:Saawan * @created:[11/1/2020],Sunday * Time:6:44 PM */ public class CustomerValidatorService { private boolean isEmailValid(String email){ return email.contains("@"); } private boolean isPhoneNumberValid(String phoneNumber){ return phoneNumber.startsWith("+0"); } private boolean isAdult(LocalDate date){ return Period.between(date,LocalDate.now()).getYears()>16 ; } public boolean isValid(Customer customer){ return isEmailValid(customer.getEmail())&& isPhoneNumberValid(customer.getPhoneNumber())&& isAdult(customer.getDob()); } }
[ "noreply@github.com" ]
noreply@github.com
5735d2a7ad9b4fbd7c4b8a99035eaff6bc3129c0
f49a8e6f6565ecf5c1de6193081c5a31ea73505c
/src/test/java/com/example/employee/EmployeeDetailProjectApplicationTests.java
8da4990570027eba0b1473bc48401b2759213a94
[]
no_license
gopiikrishnacse/spring-employee-project
434502d7ace3bf7d0ed7eb92e6464cddc86891e7
db8b385a2f8ddd8506be2e1cd5213fe50abe3039
refs/heads/master
2023-05-28T20:40:58.343471
2021-06-13T16:17:21
2021-06-13T16:17:21
376,582,056
0
0
null
null
null
null
UTF-8
Java
false
false
227
java
package com.example.employee; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class EmployeeDetailProjectApplicationTests { @Test void contextLoads() { } }
[ "krishna.gopi135@gmail.com" ]
krishna.gopi135@gmail.com
5303d6d829de855daa20300eb64840efc88e8583
a383f3c6c32b7d7fb86e16f80f422bca2a1ea873
/imooc-springboot-starter/src/main/java/com/imook/mapper/SysUserMapper.java
be848614f8a1306c155aaf92a5a21cef0911a122
[]
no_license
toryeLi/javaTest01
43d0759826e4520fee915bdfa6dab803f087c9e4
30de30ad2f2a993f564740106d2a5e3b83db2b89
refs/heads/master
2020-03-21T17:04:12.570382
2018-06-28T00:46:53
2018-06-28T00:46:53
138,811,435
0
0
null
null
null
null
UTF-8
Java
false
false
152
java
package com.imook.mapper; import com.imook.pojo.SysUser; import com.imook.utils.MyMapper; public interface SysUserMapper extends MyMapper<SysUser> { }
[ "torey6061@qq.com" ]
torey6061@qq.com
4d001cfd676ff386bf8e5c9b051358fe261c1911
33efbb27f397ab6faaf59d439d879e1ffd6d17d0
/src/main/java/kr/sys4u/spring/instagram/web/controller/post/PostController.java
c1e7d98b688012ff063f87ee7451f41cab9f2747
[]
no_license
Woonieyoon/TeamB
e5dee57886647067d7c32688eb3b18bec7fa42db
cfec538ac74641161c97430b18774826ab2ff7d4
refs/heads/master
2020-05-16T02:30:35.641946
2019-04-22T06:02:47
2019-04-22T06:02:47
182,632,242
0
0
null
null
null
null
UTF-8
Java
false
false
2,187
java
package kr.sys4u.spring.instagram.web.controller.post; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.SessionAttribute; import org.springframework.web.multipart.MultipartFile; import kr.sys4u.spring.instagram.core.dto.member.Member; import kr.sys4u.spring.instagram.core.dto.post.Post; import kr.sys4u.spring.instagram.core.service.post.HashtagService; import kr.sys4u.spring.instagram.core.service.post.PostService; import kr.sys4u.spring.instagram.exception.NotEqualUserInfoException; import kr.sys4u.spring.instagram.web.controller.AbstractController; @Controller public class PostController extends AbstractController { @Autowired private PostService postService; @Autowired protected HashtagService hashtagService; @PostMapping("/post/insert.do") public @ResponseBody String insertPost(@SessionAttribute("loginMember") Member member, @RequestParam("postImageFile") MultipartFile files, Post post, @RequestParam("hashtag") String hashtag){ post.setHashtags(hashtagService.parseHashtag(hashtag)); postService.insertPost(member, post, files); return "success"; } @PostMapping("/post/update.do") public @ResponseBody String updatePost(@SessionAttribute("loginMember") Member member, Post post, @RequestParam("hashtag") String hashtag, @RequestParam("memberNoOfPost") int memberNoOfPost) { if(memberNoOfPost != member.getNo()) { throw new NotEqualUserInfoException(); } post.setHashtags(hashtagService.parseHashtag(hashtag)); postService.updatePost(member, post); return "success"; } @PostMapping("/post/delete.do") public @ResponseBody String deletePost(@SessionAttribute("loginMember") Member member, @RequestParam("memberNoOfPost") int memberNoOfPost, @RequestParam("no") int postNo) { if(memberNoOfPost != member.getNo()) { throw new NotEqualUserInfoException(); } postService.deletePost(postNo); return "success"; } }
[ "sungwon126@naver.com" ]
sungwon126@naver.com
ea0796542bf8ac37858c925c0bf8d12339ad7ecc
a31071f4085fc3631ae1ff1891d2df0e654dbd19
/src/main/java/com/test/netty/server/handlers/ServerInboundHandler.java
c95cb84761e4a5a61b90e7143bf9764b415b2636
[]
no_license
jibojun/netty-test
f33c6b82166fb20d90916aef3ad2b13caaecd0c3
7aa43a53d8c27cf2addcabeddd8d620495ccfef4
refs/heads/master
2020-03-24T18:07:33.688734
2018-08-29T15:54:05
2018-08-29T15:54:05
142,883,231
1
0
null
null
null
null
UTF-8
Java
false
false
1,038
java
package com.test.netty.server.handlers; import com.test.netty.common.BaseRequest; import com.test.netty.common.BaseResponse; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelInboundHandlerAdapter; /** * @Author: Bojun Ji * @Description: * @Date: 2018/7/30_11:14 PM */ public class ServerInboundHandler extends ChannelInboundHandlerAdapter { @Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { BaseRequest request=(BaseRequest)msg; System.out.println("server received data:"+request.getData()+ ",request id is:"+request.getRequestId()); BaseResponse response=new BaseResponse(); response.setRequestId(request.getRequestId()); response.setResult("success"); response.setError("no error"); ctx.channel().write(response); } @Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { System.out.println(cause); ctx.close(); } }
[ "jbj19910123@163.com" ]
jbj19910123@163.com
bf45ac84e8fc33a8498165f059e6fa369eb588ac
26d8f1279768888bbb793f5c222d08f35a2c57fa
/src/main/java/com/defence/config/LocaleConfiguration.java
48232da28229eb706203356b1b062f51e9df26b8
[]
no_license
song121382/consum
866afe7ac115236f4196f2c6d2f6d5a265406af3
13a716e42c9b9f94213ac0293e6845f8eaee6c8a
refs/heads/master
2020-05-17T00:51:49.522318
2019-04-25T10:17:46
2019-04-25T10:17:46
183,410,382
0
0
null
null
null
null
UTF-8
Java
false
false
1,054
java
package com.defence.config; import io.github.jhipster.config.locale.AngularCookieLocaleResolver; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.LocaleResolver; import org.springframework.web.servlet.config.annotation.*; import org.springframework.web.servlet.i18n.LocaleChangeInterceptor; @Configuration public class LocaleConfiguration implements WebMvcConfigurer { @Bean(name = "localeResolver") public LocaleResolver localeResolver() { AngularCookieLocaleResolver cookieLocaleResolver = new AngularCookieLocaleResolver(); cookieLocaleResolver.setCookieName("NG_TRANSLATE_LANG_KEY"); return cookieLocaleResolver; } @Override public void addInterceptors(InterceptorRegistry registry) { LocaleChangeInterceptor localeChangeInterceptor = new LocaleChangeInterceptor(); localeChangeInterceptor.setParamName("language"); registry.addInterceptor(localeChangeInterceptor); } }
[ "songxiangfu@forenms.com" ]
songxiangfu@forenms.com
78e7a3b39892e1b449f829862670b7bb37eafca3
0d072053c2efa03170c0d06dc4d89d7937918c2e
/MyApplication9/app/src/main/java/com/ckdtech/www/myapplication/MainActivity.java
1e050df1f590d4f587f493c3a254922a2cf35f84
[]
no_license
IshankDua/AndroidBatch1
9158b8ff3a9baa1bc7aa5e5a75fdec846e979b4c
56da3e4135be148726dac3373b3ce94bf148781e
refs/heads/master
2020-06-16T07:21:14.450432
2019-07-06T07:39:16
2019-07-06T07:39:16
195,511,191
0
0
null
null
null
null
UTF-8
Java
false
false
344
java
package com.ckdtech.www.myapplication; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } }
[ "ishank@github.com" ]
ishank@github.com
c91a1739cd251cbce5c2b87f4723a5845d201ae3
a398291af05d626e21e8dab7e4ce42fe0a568f44
/app/src/main/java/krt/com/jtab/Fragments/ArtistsFragment.java
9859c87aaa0a44cedefc8f6fecb68a9d5a992ca3
[]
no_license
dmitry-khudin/JTab
9461aa906192c02ea9a389ef2db928b4c26c4fbd
cbd75de5ffe8536db1c521ef4f2e7b7136c7f51d
refs/heads/master
2020-06-16T12:50:47.866953
2016-11-30T17:05:31
2016-11-30T17:05:31
75,100,804
0
0
null
null
null
null
UTF-8
Java
false
false
5,515
java
package krt.com.jtab.Fragments; import android.content.Context; import android.net.Uri; import android.os.Bundle; import android.support.v4.app.Fragment; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.SearchView; import android.widget.SectionIndexer; import android.widget.TextView; import java.util.ArrayList; import java.util.Collections; import java.util.List; import krt.com.jtab.Adapters.ArtistsAdapter; import krt.com.jtab.Adapters.SideSelector; import krt.com.jtab.Adapters.SongsAdapter; import krt.com.jtab.MainActivity; import krt.com.jtab.Models.ArtistModel; import krt.com.jtab.Models.SongModel; import krt.com.jtab.R; import krt.com.jtab.Utils.Constants; import static android.content.ContentValues.TAG; public class ArtistsFragment extends Fragment { // TODO: Rename parameter arguments, choose names that match // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER private static final String ARG_PARAM1 = "param1"; private static final String ARG_PARAM2 = "param2"; // TODO: Rename and change types of parameters private String mParam1; private String mParam2; private View mainView; SideSelector sideSelector; ListView listView; List<ArtistModel> artistModelList; List<ArtistModel> listDataArtists = new ArrayList<>(); List<Character> sectionlist = new ArrayList<>(); SearchView searchView; public ArtistsFragment() { // Required empty public constructor } /** * Use this factory method to create a new instance of * this fragment using the provided parameters. * * @param param1 Parameter 1. * @param param2 Parameter 2. * @return A new instance of fragment ArtistsFragment. */ // TODO: Rename and change types and number of parameters public static ArtistsFragment newInstance(String param1, String param2) { ArtistsFragment fragment = new ArtistsFragment(); Bundle args = new Bundle(); args.putString(ARG_PARAM1, param1); args.putString(ARG_PARAM2, param2); fragment.setArguments(args); return fragment; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getArguments() != null) { mParam1 = getArguments().getString(ARG_PARAM1); mParam2 = getArguments().getString(ARG_PARAM2); } } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment mainView = inflater.inflate(R.layout.fragment_artists, container, false); initView(); return mainView; } private void initView() { listView = (ListView) mainView.findViewById(R.id.list_view); TextView titleText = (TextView) mainView.findViewById(R.id.textView4); artistModelList = Constants.listArtists; Collections.sort(artistModelList); searchView = (SearchView) mainView.findViewById(R.id.searchView); List<String> items = new ArrayList<String>(); searchView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { // searchView.onActionViewExpanded(); searchView.setIconified(false); } }); titleText.setText(mParam2); sideSelector = (SideSelector) mainView.findViewById(R.id.side_selector); searchFilter(""); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { MainActivity mainActivity = (MainActivity) getActivity(); if (!listDataArtists.get(i).isHeader()) mainActivity.replaceFragment(4, null, listDataArtists.get(i)); } }); searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String s) { return false; } @Override public boolean onQueryTextChange(String s) { searchFilter(s); return false; } }); } private void searchFilter(String str) { listDataArtists.clear(); sectionlist.clear(); for (ArtistModel songModel : artistModelList) { if (!str.equals("") && !songModel.getName().toLowerCase().startsWith(str.toLowerCase())) continue;; char prefix = Character.toUpperCase(songModel.getName().charAt(0)); int l = sectionlist.size(); if (l == 0 || sectionlist.get(l - 1) != prefix) { listDataArtists.add(new ArtistModel(String.valueOf(prefix))); listDataArtists.add(songModel); sectionlist.add(prefix); } else { listDataArtists.add(songModel); } } ArtistsAdapter adapter = new ArtistsAdapter(listDataArtists, mainView.getContext()); listView.setAdapter(adapter); sideSelector.UpDate(sectionlist); sideSelector.setListView(listView); } }
[ "boglaukin812@outlook.com" ]
boglaukin812@outlook.com
6852756b257ea3fec02c7b1f24878ab1046bf982
cd6cfb020af04c4e08046b4f63f292048e859d10
/src/main/java/jp/co/daitoku_sh/dfcm/common/db/model/TblUri01BodyKey.java
f17a55ebe07a569e3227d9ae6398466a98f8a3b7
[]
no_license
ka-kou/hello-world
460045d66f589699cc3e5b3bb6a5d7cb68de1174
3bc0dab3123cbf2549a910591c73eca825ad0a24
refs/heads/master
2020-04-01T05:57:49.952578
2017-08-15T07:02:34
2017-08-15T07:02:34
152,927,261
0
0
null
null
null
null
UTF-8
Java
false
false
2,564
java
package jp.co.daitoku_sh.dfcm.common.db.model; public class TblUri01BodyKey { /** * This field was generated by MyBatis Generator. This field corresponds to the database column TBL_URI01_BODY.Den_No * @mbggenerated Fri Nov 20 18:31:17 ICT 2015 */ private Long denNo; /** * This field was generated by MyBatis Generator. This field corresponds to the database column TBL_URI01_BODY.Den_Idx * @mbggenerated Fri Nov 20 18:31:17 ICT 2015 */ private Short denIdx; /** * This field was generated by MyBatis Generator. This field corresponds to the database column TBL_URI01_BODY.Cust_Den_Row * @mbggenerated Fri Nov 20 18:31:17 ICT 2015 */ private Short custDenRow; /** * This method was generated by MyBatis Generator. This method returns the value of the database column TBL_URI01_BODY.Den_No * @return the value of TBL_URI01_BODY.Den_No * @mbggenerated Fri Nov 20 18:31:17 ICT 2015 */ public Long getDenNo() { return denNo; } /** * This method was generated by MyBatis Generator. This method sets the value of the database column TBL_URI01_BODY.Den_No * @param denNo the value for TBL_URI01_BODY.Den_No * @mbggenerated Fri Nov 20 18:31:17 ICT 2015 */ public void setDenNo(Long denNo) { this.denNo = denNo; } /** * This method was generated by MyBatis Generator. This method returns the value of the database column TBL_URI01_BODY.Den_Idx * @return the value of TBL_URI01_BODY.Den_Idx * @mbggenerated Fri Nov 20 18:31:17 ICT 2015 */ public Short getDenIdx() { return denIdx; } /** * This method was generated by MyBatis Generator. This method sets the value of the database column TBL_URI01_BODY.Den_Idx * @param denIdx the value for TBL_URI01_BODY.Den_Idx * @mbggenerated Fri Nov 20 18:31:17 ICT 2015 */ public void setDenIdx(Short denIdx) { this.denIdx = denIdx; } /** * This method was generated by MyBatis Generator. This method returns the value of the database column TBL_URI01_BODY.Cust_Den_Row * @return the value of TBL_URI01_BODY.Cust_Den_Row * @mbggenerated Fri Nov 20 18:31:17 ICT 2015 */ public Short getCustDenRow() { return custDenRow; } /** * This method was generated by MyBatis Generator. This method sets the value of the database column TBL_URI01_BODY.Cust_Den_Row * @param custDenRow the value for TBL_URI01_BODY.Cust_Den_Row * @mbggenerated Fri Nov 20 18:31:17 ICT 2015 */ public void setCustDenRow(Short custDenRow) { this.custDenRow = custDenRow; } }
[ "hiepit07@gmail.com" ]
hiepit07@gmail.com
3c3a01b19016941dc58939d2d9c48751bb9c02a0
c95ae94eb02626950d77c2d9266ae49252a60c25
/src/com/class32Again/HashSetIntro.java
1918d68fb7e4db498087ece683ebdf60515b4ddf
[]
no_license
Mikac1982/Java_Code
40d4c669f6d79458be0ea5dd4dafef07dab981ed
fb097759e3cf16c1eedfa9efae4c95ac05135089
refs/heads/master
2020-05-07T21:05:08.302775
2019-05-15T02:14:20
2019-05-15T02:14:20
180,888,535
0
0
null
null
null
null
UTF-8
Java
false
false
1,190
java
package com.class32Again; import java.util.HashSet; import java.util.Iterator; public class HashSetIntro { public static void main(String[] args) { HashSet<Integer> hset=new HashSet<>(); hset.add(12); hset.add(32); hset.add(34); hset.add(99); System.out.println(hset.size()); // 3 System.out.println(hset); // [32, 34, 99, 12] -there is NO ORDER System.out.println(hset.contains(32)); // true System.out.println(hset.contains(55)); // false hset.add(12); //can not have duplicates hset.add(32); System.out.println(hset.size()); // 4 System.out.println(hset.isEmpty()); // false hset.remove(34); System.out.println(hset); // [32, 99, 12] //to RETRIVE ALL THE VALUES from hashset //1. using Advanced for loop System.out.println("------using Advanced For Loop-------"); for(int num:hset) { System.out.println(num); } //2. using Iterator System.out.println("-------using Iterator-------"); Iterator<Integer> it=hset.iterator(); //returns 1 Iterator Object while(it.hasNext()) { System.out.println(it.next()); } hset.clear(); // removes all the elements from the list System.out.println(hset); // [] } }
[ "sibalic.milena@gmail.com" ]
sibalic.milena@gmail.com
ed7b03bf7d7e12435659b7f4933f84ac8f42b4c3
30a7d039d35c22c338458143276dee18477c4aba
/Javarush/test/level14/lesson08/home09/Hrivna.java
019c42bbdc0bc57c4fd79a3172e3e9f3621565e8
[]
no_license
LozAnatoly/Projects
250de8118f603c90bb358f8f0ef572743952922f
b9488eeb194f29f0e1751ed8a72beb4745717a61
refs/heads/master
2021-01-21T08:08:49.294483
2017-03-16T09:25:43
2017-03-16T09:25:43
83,339,103
0
0
null
null
null
null
UTF-8
Java
false
false
286
java
package com.javarush.test.level14.lesson08.home09; /** * Created by Anatoly on 11/26/16. */ public class Hrivna extends Money { public Hrivna(double amount) { super(amount); } @Override public String getCurrencyName() { return "HRN"; } }
[ "anatolii.lozov@gmail.com" ]
anatolii.lozov@gmail.com
7be7297dd75ef2e23bb9122f2016d9968834cc30
37dd6fa379a50f400b75861fa078d19b7c29c484
/app/src/main/java/com/yerbaguy/doubleme/DoubleMeActivity.java
f101b0234b4859da5cfb5f156b9324dd23982611
[]
no_license
yerbaguy/PracticeExercise-client-app
d0977f659f41c44f5ecd7eae902929c632e21e37
8ec5081946753c44ac3331a5e811bc2da43bef0a
refs/heads/master
2021-07-14T19:22:19.100591
2017-10-14T12:15:01
2017-10-14T12:15:01
106,923,605
0
0
null
null
null
null
UTF-8
Java
false
false
7,285
java
package com.yerbaguy.doubleme; import android.os.AsyncTask; import android.renderscript.ScriptGroup; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import org.json.JSONException; import org.json.JSONObject; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.Writer; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; import java.nio.Buffer; public class DoubleMeActivity extends AppCompatActivity { //EditText inputValue = null; EditText inputValue; String value; Integer doubledValue = 0; Button doubleMe; TextView textViewDoubleMe; TextView textViewSecond; //public static String request = "lkjasdf"; public static String engword = "lkjasdf"; //public static final String URL = ("http://10.0.2.2:8080/PracticeWordsServlet/DoubleMeServlet?param1=" + request); public static final String URL = ("http://10.0.2.2:8080/PracticeExercise/rest/json/metallica/post"); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_double_me); inputValue = (EditText) findViewById(R.id.inputNum); doubleMe = (Button) findViewById(R.id.doubleMe); textViewDoubleMe = (TextView) findViewById(R.id.textViewDoubleMe); textViewSecond = (TextView) findViewById(R.id.textViewSecond); doubleMe.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { value = inputValue.getText().toString(); textViewDoubleMe.setText(value); JSONObject post_dict = new JSONObject(); try { post_dict.put("value", value); } catch (JSONException e) { e.printStackTrace(); } GetXMLTask getxmlTask = new GetXMLTask(); //getxmlTask.execute(new String [] { URL}) getxmlTask.execute(String.valueOf(post_dict)); } }); } //class GETXMLTask extends AsyncTask<String, Void, String> { class GetXMLTask extends AsyncTask<String, String, String> { @Override //protected String doInBackground(String... urls) { protected String doInBackground(String... params) { String JSONResponse = null; String JSONData = params[0]; HttpURLConnection urlConnection = null; BufferedReader reader = null; try { URL url = new URL("http://10.0.2.2:8080/PracticeExercise/rest/json/metallica/post"); urlConnection = (HttpURLConnection) url.openConnection(); urlConnection.setDoOutput(true); urlConnection.setRequestMethod("POST"); urlConnection.setRequestProperty("Content-Type", "application/json"); urlConnection.setRequestProperty("Accept", "application/json"); Writer writer = new BufferedWriter(new OutputStreamWriter(urlConnection.getOutputStream(), "UTF-8")); Log.d("JSONData",JSONData); writer.write("kljasdf"); writer.flush(); //added writer.close(); urlConnection.connect(); //added // OutputStream os = urlConnection.getOutputStream(); // BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(os, "UTF-8")); // writer.write(JSONData); // writer.flush(); // writer.close(); // os.close(); // urlConnection.connect(); InputStream inputStream = urlConnection.getInputStream(); StringBuffer stringBuffer = new StringBuffer(); if (stringBuffer == null) { return null; } reader = new BufferedReader(new InputStreamReader(inputStream)); String inputLine; while (( inputLine = reader.readLine()) != null) stringBuffer.append(inputLine + "\n"); if (stringBuffer.length() == 0) { return null; } JSONResponse = stringBuffer.toString(); String TAG = ""; Log.i(TAG, JSONResponse); return JSONResponse; //return null; //return stringBuffer.toString(); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { if (urlConnection != null) { urlConnection.disconnect(); } if (reader != null) { try { reader.close(); } catch (IOException e) { e.printStackTrace(); } } } // String output = null; // for (String url: urls) { // output = getOutputFromUrl(url); // } // return output; return null; } private String getOutputFromUrl(String url) { StringBuffer output = new StringBuffer(""); try { InputStream stream = getHttpConnection(url); BufferedReader buffer = new BufferedReader( new InputStreamReader(stream)); String s = ""; while (( s = buffer.readLine()) != null) { output.append(s); } } catch (IOException e1) { e1.printStackTrace(); } return output.toString(); } private InputStream getHttpConnection(String urlString) throws IOException { InputStream stream = null; URL url = new URL(urlString); URLConnection connection = url.openConnection(); try { HttpURLConnection httpConnection = (HttpURLConnection) connection; httpConnection.setRequestMethod("POST"); httpConnection.connect(); if (httpConnection.getResponseCode() == HttpURLConnection.HTTP_OK) { stream = httpConnection.getInputStream(); } } catch (Exception ex) { ex.printStackTrace(); } return stream; } @Override protected void onPostExecute(String output) { // outputText.setText(output); //textViewDoubleMe.setText(output); textViewSecond.setText(output); } } }
[ "root@localhost.localdomain" ]
root@localhost.localdomain
b27f97de4c35ad456e96357326bfa323d288f791
3409524d033204aeebc64862ea9a23b330ef7a26
/app/src/main/java/bteem/com/loadingzonedriver/global/SessionManager.java
53706805958a385956886b8bf5aa08853c1e3301
[]
no_license
bteemgit/LoadingZoneDriver_lat
e6539bf645932d1102b2d3e667597767dcc787c3
10bc0367cc7829338ae0fa77ee0b6ccf9b5e8f98
refs/heads/master
2021-01-01T04:01:51.219081
2017-10-19T10:17:23
2017-10-19T10:17:23
97,102,586
0
0
null
null
null
null
UTF-8
Java
false
false
1,586
java
package bteem.com.loadingzonedriver.global; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import bteem.com.loadingzonedriver.modules.login.LoginActivity; /** * Created by admin on 1/11/2017. */ public class SessionManager { // Shared preferences file name private static final String PREF_NAME = "Driver_loadingZone"; private static final String KEY_IS_LOGGEDIN = "isLoggedIn"; // Shared Preferences SharedPreferences pref; SharedPreferences.Editor editor; Context _context; // Shared pref mode int PRIVATE_MODE = 0; public SessionManager(Context context) { this._context = context; pref = _context.getSharedPreferences(PREF_NAME, PRIVATE_MODE); editor = pref.edit(); } public void setLogin(boolean isLoggedIn) { editor.putBoolean(KEY_IS_LOGGEDIN, isLoggedIn); // commit changes editor.commit(); } public boolean isLoggedIn() { return pref.getBoolean(KEY_IS_LOGGEDIN, false); } public void logoutUser(){ // Clearing all data from Shared Preferences editor.clear(); editor.commit(); // After logout redirect user to Loing Activity Intent i = new Intent(_context, LoginActivity.class); // Closing all the Activities i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); // Add new Flag to start new Activity i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // Staring Login Activity _context.startActivity(i); } }
[ "muhammed.savad@bteem.com" ]
muhammed.savad@bteem.com
4cc520e87377e3e1144f893a920bdb26ff6cf872
14be90af192d46736c2babb9792acb0c9ebc8212
/src/main/java/ProductManager/Product_Utils.java
1f1f9b1d4685515dcad38c385ca6776a94ba36b4
[]
no_license
werasiri-su/neversitup_test
73fc88006a31b649d0c9ee595145c2446bfbf44e
7c251851acdc712b9465a7ece8ff266474ff8e31
refs/heads/main
2023-06-01T12:05:33.701929
2021-06-13T03:39:49
2021-06-13T03:39:49
376,375,220
0
2
null
null
null
null
UTF-8
Java
false
false
2,949
java
package ProductManager; import DatabaseManager.DatabaseService; import com.mongodb.BasicDBObject; import com.mongodb.DBObject; import model.Product; import java.util.Calendar; import java.util.Date; import static java.util.Calendar.HOUR_OF_DAY; import static java.util.Calendar.getInstance; import static utils.GlobalUtils.getHostName; public class Product_Utils { public static void createProduct(Product product){ BasicDBObject query = new BasicDBObject(); try { Calendar calendar = getInstance(); Date date = calendar.getTime(); calendar.setTime(date); calendar.add(HOUR_OF_DAY, 25); String host = getHostName(); query.put("_id", product.getProductNo()); query.put("productNo", product.getProductNo()); query.put("name", product.getName()); query.put("product", product.getProductNo()); query.put("totalPrice", product.getPrice()); query.put("stock", product.getStock()); query.put("updateBy", host); query.put("updateDate", date); query.put("createBy", host); query.put("createDate", date); } catch (Exception e) { System.out.println("mongo error"); } DatabaseService.createProduct(query); } public static void updateProduct(Product product){ BasicDBObject query = new BasicDBObject(); DBObject mod = new BasicDBObject(); BasicDBObject onInsert = new BasicDBObject(); try { Calendar calendar = getInstance(); Date date = calendar.getTime(); calendar.setTime(date); String host = getHostName(); query.put("productNo", product.getProductNo()); BasicDBObject set = new BasicDBObject(); set.put("name", product.getName()); set.put("price", product.getPrice()); set.put("stock", product.getStock()); set.put("updateBy", host); set.put("updateDate", date); onInsert.put("createBy", host); onInsert.put("createDate", date); onInsert.put("_id", product.getProductNo()); mod.put("$set", set); mod.put("$setOnInsert", onInsert); } catch (Exception e) { System.out.println("mongo error"); } DatabaseService.updateProduct(query, mod); } public static void deleteProduct(String productNo) { BasicDBObject query = new BasicDBObject(); query.put("productNo", productNo); DatabaseService.deleteProduct(query); } public static Product readProduct(String productNo){ BasicDBObject query = new BasicDBObject(); query.put("productNo", productNo); return DatabaseService.readProduct(query); } }
[ "noreply@github.com" ]
noreply@github.com
d0aa3013bf5fd05be04ba1ab56b9509a65c45f18
6653a2c66e5dd54b7ade4d81eec84bb1ccf10029
/app/src/test/java/co/example/lutfillahmafazi/worldscientist/ExampleUnitTest.java
9c2945c190c8831dc8847f0a468934930d3f1dab
[]
no_license
LuthfillahMafazi/WorldScientist
3a89003b8676b9993da9e6628e51d728ccfc699c
a76fa3bcc4f2dca6d0e6dc8aa33f0dae69ab83f7
refs/heads/master
2020-04-08T04:10:51.963106
2018-11-25T06:56:57
2018-11-25T06:56:57
159,006,296
1
0
null
null
null
null
UTF-8
Java
false
false
402
java
package co.example.lutfillahmafazi.worldscientist; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() { assertEquals(4, 2 + 2); } }
[ "luthfimafazi18@gmail.com" ]
luthfimafazi18@gmail.com
8fad3849d26abc5702ddb9d818f9427270950f86
329354985421b33957202bbb8d9bffa446ebbf6d
/src/main/java/cn/com/sparkle/raptor/core/buff/CycleAllocateBuff.java
40c9126d8f32ece2d0ae017333cc0bcf0b3230c9
[ "Apache-2.0" ]
permissive
qinannmj/FireFly
2a10dc00c2fa93793205b9c2c9621b2a37e1c336
9c500b2f7bea69c1a8dafff5b40f27f6d5d401f6
refs/heads/master
2021-01-15T17:07:12.204506
2015-06-25T06:06:06
2015-06-25T06:06:06
22,204,304
2
0
null
null
null
null
UTF-8
Java
false
false
606
java
package cn.com.sparkle.raptor.core.buff; public class CycleAllocateBuff extends AllocateBytesBuff implements CycleBuff { private volatile int refCnt = 1; BuffPool pool; public CycleAllocateBuff(BuffPool pool, int capacity, boolean isDirectMem) { super(capacity, isDirectMem); this.pool = pool; } @Override public synchronized void close() { if (pool != null) { if (refCnt == 1) { pool.close(this); } else { --refCnt; } } } @Override public BuffPool getPool() { return pool; } @Override public void incRef() { ++refCnt; } }
[ "'qinannmj@163.com'" ]
'qinannmj@163.com'
ad9020386047a129f524a39d8b30d5f5c8f13385
e9c9342ace5b778788041dbefb3a99bf217b2ca5
/team_retarded/src/main/java/application/ui/AddProductUIAction.java
f2b678619b3feb1c666dc3de3fa9647b4cab9251
[]
no_license
dimzulu/java2_thursday_online_2020_autumn
bf33687b2d890372df52aa38a142715d6c2d494a
6b155fa01bb0af3ebbf22b7cfe620f8755425389
refs/heads/master
2023-01-25T04:33:24.356893
2020-11-25T21:02:15
2020-11-25T21:02:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,713
java
package application.ui; import application.core.requests.AddProductRequest; import application.core.responses.AddProductResponse; import application.core.services.AddProductService; import java.util.Scanner; public class AddProductUIAction implements UIAction { private final AddProductService service; public AddProductUIAction(AddProductService service) { this.service = service; } @Override public void execute() { Scanner scanner = new Scanner(System.in); System.out.print("Please, enter new product name: "); String name = scanner.nextLine(); System.out.print("Please, enter new product description: "); String description = scanner.nextLine(); double price; do { price = getPrice(); } while (price < 0); AddProductResponse response = service.execute(new AddProductRequest(name, description, price)); if (response.hasErrors()) { response.getErrors().forEach(coreError -> System.out.println("Error in the field - " + coreError.getField() + ": " + coreError.getMessage())); } else { System.out.println("Product number " + response.getProductId() + " was added successfully"); } } private double getPrice() { Scanner scanner = new Scanner(System.in); System.out.print("Please, enter new product price: "); String price = scanner.nextLine(); price = price.replaceAll("\\s+", ""); try { return Double.parseDouble(price); } catch (NumberFormatException ex) { System.out.println("Incorrect value, try again "); } return -1; } }
[ "olegs.volaks@gmail.com" ]
olegs.volaks@gmail.com
a298c607b161a3110c302d6b528290d082f91a93
3f77e14f0df3cfc07417d22ab464ae3ebb515204
/G3Final/src/main/java/com/cy/pj/common/vo/CheckBox.java
09e94d727881c012501785c63bc35775784080af
[]
no_license
SangClair/ManageSys
dd83f5e19e539b45ffeb6dd245023c33b4311c6e
fb45ff625ca9de5ffaddd3bf84da6eaa0a2a6a23
refs/heads/master
2022-10-26T06:34:37.183964
2020-03-14T06:01:54
2020-03-14T06:01:54
247,213,630
0
0
null
2022-10-12T20:37:39
2020-03-14T04:49:12
JavaScript
UTF-8
Java
false
false
266
java
package com.cy.pj.common.vo; import java.io.Serializable; import lombok.Data; @Data public class CheckBox implements Serializable{ /** * */ private static final long serialVersionUID = 1367148212994311592L; Integer id; String name; }
[ "China2020@China2020-PC" ]
China2020@China2020-PC
7fa86cc66407553e444e5238f62ddf73d39cd12b
db4c62a0fcbb0eb8ff086e7f1e433d08c10e70a8
/day3/src/q17/MultiplicationTable.java
b67a064b2be8c5e51dfbe5fea71a0e5bc658936f
[]
no_license
CSAB403/day3
2c670ba015b5d184d3b01051e5acdf425611601b
392bcac758b675ddc340c8bc04814c8e4a63df2d
refs/heads/main
2023-07-17T19:40:49.535455
2021-08-24T14:00:30
2021-08-24T14:00:30
399,354,886
0
0
null
null
null
null
UTF-8
Java
false
false
329
java
package q17; import java.util.Scanner; public class MultiplicationTable { public static void main(String[] args) { int n,m,i=1,sum; Scanner sc=new Scanner(System.in); n=sc.nextInt(); m=sc.nextInt(); while(i<=m) { sum=i*n; System.out.println("the multiplication of 5 is"+sum); i++; } } }
[ "noreply@github.com" ]
noreply@github.com
9f5c1dfdd83f2bf143aabdcbcd5bddd686e12553
1148cace0785d8389330f3f3906260670140212d
/app/src/main/java/com/rsah/koperasi/customfonts/AutoCompleteTextViewSFProDisplayRegular.java
fef3cf88ed8844348b01cda535c19bb1aa20c6c8
[]
no_license
bambangm88/KoperasiFix
f11798242e6f0fc195d034b71fef540735c876fe
4c12a8a8b91f587c1db5c229f8936e8e6a81fe2c
refs/heads/master
2023-03-28T02:54:52.049352
2021-04-01T01:52:01
2021-04-01T01:52:01
349,709,715
0
0
null
null
null
null
UTF-8
Java
false
false
882
java
package com.rsah.koperasi.customfonts; import android.content.Context; import android.graphics.Typeface; import android.util.AttributeSet; public class AutoCompleteTextViewSFProDisplayRegular extends androidx.appcompat.widget.AppCompatAutoCompleteTextView { public AutoCompleteTextViewSFProDisplayRegular(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); init(); } public AutoCompleteTextViewSFProDisplayRegular(Context context, AttributeSet attrs) { super(context, attrs); init(); } public AutoCompleteTextViewSFProDisplayRegular(Context context) { super(context); init(); } private void init() { if (!isInEditMode()) { setTypeface(Typeface.createFromAsset(getContext().getAssets(), "fonts/NeoSans_Pro_Regular.ttf")); } } }
[ "bambangm88@gmail.com" ]
bambangm88@gmail.com
7350d22769de581b488a8971359088556f019783
7994e29e1bb5edc9d2e1310b18bd38649533f02c
/src/main/java/com/nkostiv/loadbalancer/BalancerFactoryType.java
561e67731a34e8c5277e5f60a5094b4e1aa5a966
[]
no_license
nkostiv/load-balancer
3f827f92ebab50aac24b4eea368def758cfa4f8c
aad3e49490c457b8c0f5f4ad6d884a7bb3f1dd4b
refs/heads/master
2022-11-28T17:55:40.181209
2020-08-09T17:53:52
2020-08-09T17:53:52
286,278,857
0
0
null
null
null
null
UTF-8
Java
false
false
599
java
package com.nkostiv.loadbalancer; import com.nkostiv.loadbalancer.impl.LoadBalancer; import com.nkostiv.loadbalancer.impl.SequentialLoadBalancer; import com.nkostiv.loadbalancer.impl.WeightLoadBalancer; public enum BalancerFactoryType { SEQUENTIAL() { @Override public LoadBalancer getLoadBalancer() { return new SequentialLoadBalancer(); } }, WEIGHT_BALANCED() { @Override public LoadBalancer getLoadBalancer() { return new WeightLoadBalancer(); } }; public abstract LoadBalancer getLoadBalancer(); }
[ "Nazariy_Kostiv@epam.com" ]
Nazariy_Kostiv@epam.com
0b6130ac46eca91e9ede8dd795bd5943b1bb61be
350d781efcd3dd780d9b2a1fbc1e1b4efe731296
/src/hoofdstuk_8/Opdarcht_2.java
f9907d941f8f800bc7d689c0752deecd27a0d2ac
[]
no_license
nevilleblackson/programmeren_java
57c830de336f3a3990d3f788a06b02d9181f0351
fa102907a535a235d21c92034f3b1e8dedea3202
refs/heads/master
2020-12-24T12:20:20.252004
2016-11-25T12:17:44
2016-11-25T12:17:44
73,055,417
1
0
null
null
null
null
UTF-8
Java
false
false
1,668
java
package hoofdstuk_8; import java.awt.*; import java.applet.*; import java.awt.event.*; public class Opdarcht_2 extends Applet { Button mannen; Button vrouwen; Button jongens; Button meisjes; int M; int V; int J; int Me; public void init() { mannen = new Button("Mannen"); vrouwen = new Button("vrouwen"); jongens = new Button("jongens"); meisjes = new Button("meisjes"); mannen.addActionListener(new mannenListener()); vrouwen.addActionListener(new vrouwenListener()); jongens.addActionListener(new jongensListener()); meisjes.addActionListener(new meisjesListener()); add(mannen); add(meisjes); add(vrouwen); add(jongens); } public void paint(Graphics g) { g.drawString("" + M, 100, 100); g.drawString("" + Me, 150, 100); g.drawString("" + V, 200, 100); g.drawString("" + J, 250, 100); } class mannenListener implements ActionListener { public void actionPerformed(ActionEvent e) { M = M +1; repaint(); } } class vrouwenListener implements ActionListener { public void actionPerformed(ActionEvent e) { V = V + 1; repaint(); } } class jongensListener implements ActionListener { public void actionPerformed(ActionEvent e) { J = J +1; repaint(); } } class meisjesListener implements ActionListener { public void actionPerformed(ActionEvent e) { Me = Me + 1; repaint(); } } }
[ "nblackson@roc-dev.com" ]
nblackson@roc-dev.com
7e3af9ee6130a571eb3b1217305e2feb5f46ada3
4e87e7076805978b660ad0fa9be8c81687999ae9
/hotfixlib/src/main/java/com/itxiaox/hotfixlib/ArrayUtils.java
d4f49e889fa55fb241bd266463133ea2e9b12a82
[]
no_license
itxiaox/HotFixLab
96288a24c13ee5bca29209a90fd1642ab3c7192c
85cad0b6161325d1d0c8c63ebd3cb809c0368878
refs/heads/master
2020-06-28T22:54:55.898521
2019-08-21T00:57:45
2019-08-21T00:57:45
200,363,609
0
0
null
null
null
null
UTF-8
Java
false
false
1,218
java
package com.itxiaox.hotfixlib; import java.lang.reflect.Array; public class ArrayUtils { /** * 合并数组 * @param arrayList 前数组(插队数组) * @param arrayRhs 后数组(已有数组) * @return 处理后的新数组 */ public static Object combineArray(Object arrayList,Object arrayRhs){ //获得一个数组的Class对象,通过Arrayh.newInstance()可以反射生成数组对象 Class<?> localClass = arrayList.getClass().getComponentType(); //前数组的长度 int i = Array.getLength(arrayList); //新数组总长度 = 前数组长度 + 后数组长度 int j = i + Array.getLength(arrayRhs); //生成数组对象 Object result = Array.newInstance(localClass, j); for (int k = 0; k < j; ++k) { if ( k < i){ // 从0 开始遍历,如果前数组有值,添加到新数组的第一个位置 Array.set(result,k,Array.get(arrayRhs,k)); }else { //添加完前数组,再添加后数组,合并完成 Array.set(result,k,Array.get(arrayRhs,k-i)); } } return result; } }
[ "it_xiaox@163.com" ]
it_xiaox@163.com
429e0da0398a4f5a0f72cf6bf0f348cb1150c3dd
3fa085a522a26f29d31ae5c0fc781d23c753547b
/src/main/java/com/muru/problems/general/ConvertDecimalToAnyBase.java
8ab4e7ebcb77a8262203ad2e43f2e5e8b3ac7719
[]
no_license
murugavelpsg/algos
9617bd551af047b4fa4d8009f0a06e465e0de792
36c41e6d019c3e7c8177e9efa52ceb076257b33d
refs/heads/master
2021-01-16T23:40:10.764174
2017-01-27T07:01:58
2017-01-27T07:01:58
51,132,047
0
1
null
null
null
null
UTF-8
Java
false
false
1,016
java
package com.muru.problems.general; import javax.xml.bind.ValidationException; /** * Created by msivagna on 6/10/16. */ public class ConvertDecimalToAnyBase { /** * PROBLEM: 3 * Convert decimal to a base between 2 and 16 * @return */ public String convertDecimalToABaseBetween2And16(int number, int base) throws ValidationException { if(number < 0) { throw new ValidationException("input cannot be negative"); } if (base < 2 || base > 16) { throw new ValidationException("Base cannot be less than 2 or greater than 16"); } if (number == 0) { return "0"; } String baseMap = "0123456789ABCDEF"; StringBuilder stringBuilder = new StringBuilder(); while (number > 0) { int remainder = number % base; stringBuilder.append(baseMap.charAt(remainder)); number = number / base; } return stringBuilder.reverse().toString(); } }
[ "msivagna@cisco.com" ]
msivagna@cisco.com
92f3d549983117a2402ee932093a759973e19e3c
89621f640eb9cd00e7b4134518dbc26426eebfb0
/app/src/main/java/com/khush/instaco/RegisterActivity.java
9f6066605fb373a699255c5b9f305a8629e84380
[]
no_license
Khush7068/InstaCo
2d28717a61ec999721f85d351edf6629f789a2da
fb6c725704705039e7aca9f3256460e292b63bf6
refs/heads/master
2020-07-10T02:27:22.992986
2019-08-25T05:11:30
2019-08-25T05:11:30
204,143,270
1
0
null
null
null
null
UTF-8
Java
false
false
5,112
java
package com.khush.instaco; import android.app.ProgressDialog; import android.content.Intent; import android.os.Bundle; import android.text.TextUtils; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.Task; import com.google.firebase.auth.AuthResult; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseUser; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import java.util.HashMap; public class RegisterActivity extends AppCompatActivity { EditText username, fullname, email, password; Button register; TextView txt_login; FirebaseAuth auth; DatabaseReference reference; ProgressDialog pd; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_register); username = findViewById(R.id.username); email = findViewById(R.id.email); fullname = findViewById(R.id.fullname); password = findViewById(R.id.password); register = findViewById(R.id.register); txt_login = findViewById(R.id.txt_login); auth = FirebaseAuth.getInstance(); txt_login.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { startActivity(new Intent(RegisterActivity.this, LoginActivity.class)); } }); register.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { pd = new ProgressDialog(RegisterActivity.this); pd.setMessage("Please wait..."); pd.show(); String str_username = username.getText().toString(); String str_fullname = fullname.getText().toString(); String str_email = email.getText().toString(); String str_password = password.getText().toString(); if (TextUtils.isEmpty(str_username) || TextUtils.isEmpty(str_fullname) || TextUtils.isEmpty(str_email) || TextUtils.isEmpty(str_password)){ Toast.makeText(RegisterActivity.this, "All fields are required!", Toast.LENGTH_SHORT).show(); } else if(str_password.length() < 6){ Toast.makeText(RegisterActivity.this, "Password must have 6 characters!", Toast.LENGTH_SHORT).show(); } else { register(str_username, str_fullname, str_email, str_password); } } }); } public void register(final String username, final String fullname, String email, String password){ auth.createUserWithEmailAndPassword(email, password) .addOnCompleteListener(RegisterActivity.this, new OnCompleteListener<AuthResult>() { @Override public void onComplete(@NonNull Task<AuthResult> task) { if (task.isSuccessful()){ FirebaseUser firebaseUser = auth.getCurrentUser(); String userID = firebaseUser.getUid(); reference = FirebaseDatabase.getInstance().getReference().child("Users").child(userID); HashMap<String, Object> map = new HashMap<>(); map.put("id", userID); map.put("username", username.toLowerCase()); map.put("fullname", fullname); map.put("imageurl", "https://firebasestorage.googleapis.com/v0/b/letschat-94f19.appspot.com/o/placeholders.png?alt=media&token=3367ad6e-d3d1-4049-9991-6951facc5a27"); map.put("bio", ""); reference.setValue(map).addOnCompleteListener(new OnCompleteListener<Void>() { @Override public void onComplete(@NonNull Task<Void> task) { if (task.isSuccessful()){ pd.dismiss(); Intent intent = new Intent(RegisterActivity.this, MainActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); } } }); } else { pd.dismiss(); Toast.makeText(RegisterActivity.this, "You can't register with this email or password", Toast.LENGTH_SHORT).show(); } } }); } }
[ "khush.7068@gmail.com" ]
khush.7068@gmail.com
789a7eb08ac1828389cff9eb6dcbf69d4dae1f36
832adcdeb34c5ba6ba7d9ac6f1be01619711579d
/src/day170719/interfaces/part2/CleaningBot.java
0ca7a453d37648704aa483c4d008cd69e50d96f2
[]
no_license
Duelist256/CoreJava
208d5281988350e3a178ddefbebdba21ed6473b9
1fb5461691a7ac47ebd97577a8d5dd22171adb74
refs/heads/master
2021-01-21T15:19:44.807973
2017-09-10T13:51:19
2017-09-10T13:51:19
95,383,213
1
0
null
null
null
null
UTF-8
Java
false
false
395
java
package day170719.interfaces.part2; import java.util.Arrays; import java.util.List; /** * Created by Duelist on 19.07.2017. */ public class CleaningBot { public static void main(String[] args) { List<Cleanable> roomObjects = Arrays.asList(new Table(), new Chair(), new Violin(), new Drum()); for (Cleanable obj : roomObjects) { obj.clean(); } } }
[ "selykov.iw@yandex.ru" ]
selykov.iw@yandex.ru
f2f57b6798a297c9aa789cc04ffade92c712fd0a
ea4be74d86b89c48cc381f0234024872d4cb0556
/app/src/main/java/com/teamvallartas/autodue/DateDialog.java
312c19b929ae86b0154f8a6e59f021fd762896a4
[]
no_license
jsenar/Autodue
5754c9ebdc9f128250b1ba49428a083474b1f9b5
0923b15df3ae19647b35a8b6e25460242c568024
refs/heads/master
2021-01-10T09:25:09.759601
2015-12-05T22:41:46
2015-12-05T22:41:46
45,435,795
0
0
null
2015-12-02T03:25:43
2015-11-03T02:16:02
Java
UTF-8
Java
false
false
1,024
java
package com.teamvallartas.autodue; import android.annotation.SuppressLint; import android.app.*; import android.app.Dialog; import android.app.DialogFragment; import android.widget.*; import android.view.View; import android.os.*; import java.util.Calendar; /** * Created by evahuynh on 11/8/15. */ @SuppressLint("ValidFragment") public class DateDialog extends DialogFragment implements DatePickerDialog.OnDateSetListener { EditText txtDate; public DateDialog( View view) { txtDate = (EditText) view; } public Dialog onCreateDialog(Bundle savedInstanceState){ final Calendar c = Calendar.getInstance(); int year = c.get(Calendar.YEAR); int month = c.get(Calendar.MONTH); int day = c.get(Calendar.DAY_OF_MONTH); return new DatePickerDialog( getActivity(), this, year, month, day); } public void onDateSet( DatePicker view, int year, int month, int day){ String date = (month+1)+"/"+day+"/"+year; txtDate.setText(date); } }
[ "evahuynh@Evas-MacBook-Pro.local" ]
evahuynh@Evas-MacBook-Pro.local
43ce983a341f6b009a492b17fbe8852f7455720a
bae9425ecaacdc3cbe158a77d4b4db3959e5f4df
/src/main/java/com/bftcom/gui/referenceList/ReferenceListController.java
3f656d0dc9604806214568c2e401d623baafa4c4
[]
no_license
Wolfram2323/bc_lite_offline
ddfaddd003c2878f2ecbeaf264e3966de99e97f4
2359f848b60937a1809d87658372c3d3d1dc50ed
refs/heads/master
2020-05-29T11:52:51.165698
2016-12-23T12:45:09
2016-12-23T12:45:09
68,727,766
0
0
null
null
null
null
UTF-8
Java
false
false
2,474
java
package com.bftcom.gui.referenceList; import com.bftcom.gui.utils.Message; import javafx.collections.ObservableList; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.scene.Node; import javafx.scene.control.TableColumn; import javafx.scene.control.TableView; import javafx.stage.Stage; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.net.URL; import java.util.List; import java.util.ResourceBundle; /** * Created by k.nikitin on 13.11.2016. */ public class ReferenceListController implements Initializable { @FXML private TableView table; private Object controller; private String param; @Override public void initialize(URL location, ResourceBundle resources) { } public void createTable(List<?> entityList, List<TableColumn> columnList, Class tvObject, Object controller, String param){ this.controller = controller; this.param = param; if(columnList.size() > 0){ columnList.forEach(table.getColumns()::add); } if(entityList.size() > 0){ entityList.forEach(entity->{ try { Constructor constructor = tvObject.getConstructor(entity.getClass()); table.getItems().add(constructor.newInstance(entity)); } catch (NoSuchMethodException|IllegalAccessException|InstantiationException|InvocationTargetException e) { e.printStackTrace(); Message.throwExceptionForJavaFX(e,"Произошла ошибка загрузки справочника", null,false); } }); } } @FXML private void cancel(ActionEvent event){ Stage stage = (Stage)((Node)event.getSource()).getScene().getWindow(); stage.close(); } @FXML private void select(ActionEvent event){ try { Method method = controller.getClass().getDeclaredMethod("parseDataFromReference", ObservableList.class, String.class); method.invoke(controller, table.getSelectionModel().getSelectedItems(), param); Stage stage = (Stage)((Node)event.getSource()).getScene().getWindow(); stage.close(); } catch (NoSuchMethodException|IllegalAccessException|InvocationTargetException e) { e.printStackTrace(); } } }
[ "k.nikitin@bftcom.com" ]
k.nikitin@bftcom.com
7a1428c409d55b50a3e03f68405a08bcb2199f46
c09a7d9c7c2d25e16a8574c2a4d47dc09ab1a018
/de.hswt.anap.ui.vaadin/src/main/java/de/hswt/anap/ui/vaadin/handler/payload/ValidationResultPayload.java
b135198141b168deac497305933671d3b1a28519
[ "Apache-2.0" ]
permissive
TLetzel/AnalyticsPlus
d8367cb21f6918b640ff877b707bd8839274a07f
5a2a7f0be50ef1b13f9d93120a89d2bb93875cca
refs/heads/master
2021-05-12T01:22:23.308585
2018-07-27T11:20:45
2018-07-27T11:20:45
117,558,139
2
2
Apache-2.0
2018-07-27T11:20:47
2018-01-15T14:51:13
CSS
UTF-8
Java
false
false
1,422
java
/* * Copyright 2015-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * 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 de.hswt.anap.ui.vaadin.handler.payload; import java.util.HashMap; import java.util.List; import java.util.Map; import de.hswt.anap.model.RuleType; import de.hswt.anap.model.ValidationResult; public class ValidationResultPayload { private Map<RuleType, List<ValidationResult>> validationResults; private RuleType currentRuleType; public ValidationResultPayload( Map<RuleType, List<ValidationResult>> validationResults, RuleType currentRuleType) { this.validationResults = validationResults; this.currentRuleType = currentRuleType; } public Map<RuleType, List<ValidationResult>> getValidationResults() { return new HashMap<>(validationResults); } public RuleType getCurrentRuleType() { return currentRuleType; } }
[ "T.Letzel@tum.de" ]
T.Letzel@tum.de
288f251acda02a40fbe2330daaf81947116b7b59
c3c60a07cc5921928405e4c373fe5330b6a511bc
/acorn/src/javaclass/ds_linked.java
bc8ea97020fdcd7cc28a8b9522d3dfa6dc65450c
[]
no_license
kangmihee/EX_java
7ad467f3f421d08c7f6e1e964c9bc2b2a7a5fdb1
876ba09cd51f885b65ac29670619e4a7a47f8c8d
refs/heads/master
2020-07-02T03:46:54.167755
2019-08-09T06:38:18
2019-08-09T06:38:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,489
java
package javaclass; //자료구조 : 데이터를 저장하는 구조 //저장형태에 따라 구분방법 //stack : LIFO, FILO //Queue : FIFO 대기열 : memory, printer의 속도차 //데이터 저장방법 //배열/list/hash(hash함수: 키를 주소값 mapping하는 함수) //1)배열 : 연속적인 메모리 공간에 저장, 삽입삭제가 불량 //2)list : 데이터의 앞이나 뒤에 다음데이터의 주소를 붙임 //메모리 공간은 낭비하지만, 메모리를 효율적으로 사용가능 //삽입, 삭제 용이 //3)hash함수 : 검색속도가 가장 빠름(연관메모리) //저장형태 : 키이 + 데이터 형식, 키이를 주소값으로 변환 //프로그램 발전 형태 //구조적 프로그래밍 -> 객체 지향 프로그래밍 -> 일반화 프로그래밍 -> 함수화 프로그래밍 //순서적으로 실행 -> 데이터 + 함수 // -> 오버로딩과 오버라이딩 -> 대표타입사용 (T타입...모든타입으로 사용가능하다) // -> 함수이름은 같은데 ( T -> int, T -> float ) // T add(T a, T b){ // return a + b; } //Collection => oracle에서도 Collection //자바의 자료구조 = 상속 + Generic 을 이용해서 작업 // Iterable (반복자) => COllection => List, Queue, Set import java.util.*; public class ds_linked { public static void main(String[] args) { Vector<String> v = new Vector<String>(); //문자열을 담는 백테로 정의 //메모리 + 함수 v.add("대한"); //iterator 주소만 배열식으로 저장 v.add("민국"); v.add("만세"); Iterator<String> itr = v.iterator(); //Iterator(반복자) //reference 복사, 주소복사 while(itr.hasNext()){ System.out.println(itr.next()); //순서적으로 데이터를 처리하도록 인덱스 //next()는 자신이 가리키는 데이터저장소에서 현재위치를 순차적으로 하나 증가해서 이동하는 것 } ArrayList<String> list = new ArrayList<String>(); v.add("대한"); v.add("민국"); v.add("만세"); System.out.println(list); Iterator itr_list = list.iterator(); while(itr_list.hasNext()){ System.out.println(itr_list.next()); } for(String obj:v){ //for in System.out.println(obj); } for(int i=0;i<v.size();i++){ //종료값은 size로 System.out.println(v.get(i)); //get 함수를 이용한 요소 접근 } //람다함수 전, 자바에서 함수를 사용하려면 : 반드시 Class를 이용 //foreach문 다음에는 함수 //lambda함수 - python개념 : 무영함수 //(int a, int b) -> {return a+b;} //javascript - web browser에서 작동하는 script : 웹에 동적 효과 부여 System.out.println("foreach문 사용 :"); //함수화 프로그래밍 v.forEach(a->{ System.out.println(a); //문자열은 기본이 포인터 (1차원 배열, 배열은 기본포인터) }); System.out.println(" foreachRemainimg() :"); Iterator<String> itr_2 = v.iterator(); itr_2.forEachRemaining(a->{ System.out.println(a); }); } } //출력결과: //대한 //민국 //만세 //[] //대한 //민국 //만세 //대한 //민국 //만세 //대한 //민국 //만세 //대한 //민국 //만세 //foreach문 사용 : //대한 //민국 //만세 //대한 //민국 //만세 // foreachRemainimg() : //대한 //민국 //만세 //대한 //민국 //만세
[ "acorn@acorn-PC" ]
acorn@acorn-PC
19a0ca986c7e88d3bdea160d7d73a8b5a7a76d72
d5d40e6b214ee15b0b63f87bba2220aef64c0a4c
/net.sf.smbt.gps/src-services/net/sf/smbt/gps/services/GarminService.java
61e4de6d6d442ab3eb3a7d123733879555a289e4
[]
no_license
lucascraft/ubiquisense
adb2cc6cc2615bd8440d825be9a4bf59a854799b
70c4a0c0790c3b37346c2e7117190802e5441ba5
refs/heads/master
2021-01-10T21:48:42.021551
2015-08-13T21:17:34
2015-08-13T21:17:34
37,203,783
0
2
null
null
null
null
UTF-8
Java
false
false
1,501
java
/*********************************************************************************** * Ubiquisense - A smart ambient utilities framework * * Copyright (c) 2012, Lucas Bigeardel * * The library is released under: * * A) LGPL * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General * Public License along with this library; if not, write to the * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA * * B) EPL * * 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: * Lucas Bigeardel <lucas.bigeardel@gmail.com> - Initial API and implementation ***********************************************************************************/ package net.sf.smbt.gps.services; public class GarminService { }
[ "lucas.bigeardel@gmail.com" ]
lucas.bigeardel@gmail.com
3d66cb16af0e5e5607d63dbaa9d7d34ccb2a1bfa
31a310871ebe2eee2f5e3ffe566f32c80991107e
/skolkval/grottflykt/submissions/partially_accepted/SlowSolver.java
6d10ebf6dc5c76d4d792af3f3eef317e0604db9b
[]
no_license
Kodsport/swedish-olympiad-2014
a6f7cf6e686d8bf7d547122c0ae4ffab4888aae8
276bdd5ec3cd820f86fb1e969a6684e0ef5bb50e
refs/heads/master
2022-10-03T04:30:51.192666
2022-09-09T22:46:25
2022-09-09T22:46:25
15,631,546
0
1
null
2022-07-26T10:47:52
2014-01-04T12:19:02
Roff
UTF-8
Java
false
false
2,301
java
import java.util.*; import java.io.*; public class SlowSolver { static final char WALL = '#', EMPTY = '.', BEAR = 'B', PLAYER = 'S', EXIT = 'U'; static final char[] DIR_CHARS = {'V', 'H', 'U', 'N'}; static int[] d; static char[] grid; static int W, H; static int player, bear; static char[] res; public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(System.out); StringTokenizer st = new StringTokenizer(in.readLine()); int w = Integer.parseInt(st.nextToken()); int h = Integer.parseInt(st.nextToken()); W = w+2; H = h+2; d = new int[] {-1, 1, -W, W}; grid = new char[W*H]; for (int i = 0; i < W; i++) { grid[i] = grid[W*(H-1) + i] = WALL; } for (int i = 1; i <= h; i++) { grid[W*i] = grid[W*i + W - 1] = WALL; String s = in.readLine(); for (int j = 1; j <= w; j++) { char c = s.charAt(j-1); if (c == BEAR) { bear = W*i + j; c = EMPTY; } else if (c == PLAYER) { player = W*i + j; c = EMPTY; } grid[W*i + j] = c; } } for (int maxDepth = 0; ; maxDepth++) { if (solve(0, maxDepth)) { out.println(String.valueOf(res)); break; } } in.close(); out.close(); } static int dist(int p1, int p2) { return Math.abs(p1/W - p2/W) + Math.abs(p1%W - p2%W); } static boolean solve(int depth, int maxDepth) { if (grid[player] == EXIT) { res = new char[depth]; return true; } if (player == bear || depth == maxDepth) return false; int oldPlayer = player, oldBear = bear; for (int playerDir = 0; playerDir < 4; playerDir++) { int newPlayer = player + d[playerDir]; if (newPlayer != bear && grid[newPlayer] != WALL) { player = newPlayer; // Move bear int movesLeft = 2; for (int bearDir = 0; bearDir < 4; bearDir++) { int newBear = bear + d[bearDir]; if (movesLeft > 0 && grid[newBear] != WALL && dist(newBear, player) < dist(bear, player)) { bear = newBear; movesLeft--; bearDir--; } } boolean success = solve(depth + 1, maxDepth); player = oldPlayer; bear = oldBear; if (success) { res[depth] = DIR_CHARS[playerDir]; return true; } } } return false; } }
[ "erik.odenman@gmail.com" ]
erik.odenman@gmail.com
864605c6a62ced5b064e529f0a4a6d2349d66daf
376ea7c8ead1ab743a4d567c46b34b8dc3cf632f
/src/Interface13_Impl2.java
94002ecdff45707b3f3ed1a6b664a5e16e83046d
[]
no_license
bradleysixx/insomniapk-client
ed2180dca6fc8bdf38b82b6a6ad9685fd5e218b7
2c47ee9f5fc86c30d742bef9c55859d0088c2ae5
refs/heads/master
2022-01-20T02:02:26.587366
2019-03-26T05:19:36
2019-03-26T05:19:36
177,716,974
0
0
null
null
null
null
UTF-8
Java
false
false
103
java
/* Interface13_Impl2 - Decompiled by JODE * */ interface Interface13_Impl2 extends Interface13 { }
[ "37641668+bradleysixx@users.noreply.github.com" ]
37641668+bradleysixx@users.noreply.github.com
1975bae4b2a8fa58cd3aac1da2acabd5f2c660f8
f25f087ed1c785b1ad575d78a4128c873f992bf5
/JDBCProj1/src/com/nt/jdbc/CLOBRetrieve.java
327b70c56b42677f18b71c0dc2e7161904ab8a25
[]
no_license
DebasishHJavaKing/JavaWorld
029cb1e4ba70fa6df2daeaaa2a968b967cdb048f
175dc3a5bba10d224b500826e6469227c285285d
refs/heads/master
2023-06-26T01:49:53.709340
2021-07-17T22:23:12
2021-07-17T22:23:12
264,805,683
0
0
null
null
null
null
UTF-8
Java
false
false
3,174
java
package com.nt.jdbc; import java.io.FileWriter; import java.io.IOException; import java.io.Reader; import java.io.Writer; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.Scanner; public class CLOBRetrieve { private static final String CLOB_RERIEVE_QUERY="SELECT ENO,ENAME,EADDRS,RESUME FROM EMPALL WHERE ENO=?"; public static void main(String[] args) { Scanner sc=null; int eno=0; Connection con=null; PreparedStatement ps=null; ResultSet rs=null; String name=null,addrs=null; Reader reader=null; Writer writer =null; char[] buffer=new char[2048]; int count=0; try { //read inputs sc=new Scanner(System.in); if(sc!=null) { System.out.println("Enter employee number::"); eno=sc.nextInt(); } //register JDBC driver s/w Class.forName("oracle.jdbc.driver.OracleDriver"); //establish the connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system", "manager"); //create PreparedStatement obj having pre-comipled SQL Query if(con!=null) ps=con.prepareStatement(CLOB_RERIEVE_QUERY); //set values to query params if(ps!=null) ps.setInt(1, eno); //execute the SQL query if(ps!=null) { rs=ps.executeQuery(); } //process the ResultSEt object if(rs!=null) { if(rs.next()) { eno=rs.getInt(1); name=rs.getString(2); addrs=rs.getString(3); reader=rs.getCharacterStream(4); //create Writer stream pointing dest text file writer =new FileWriter("new_resume.txt"); //use buffer based streams logics to copy the content while((count=reader.read(buffer))!=-1) { writer.write(buffer,0,count); } System.out.println("CLOB Retrieved"); System.out.println(eno+" "+name+" "+addrs); } else { System.out.println("Record not found"); } } }//try catch(ClassNotFoundException cnf) { cnf.printStackTrace(); } catch(SQLException se) { se.printStackTrace(); } catch(Exception e) { e.printStackTrace(); } finally { //close jdbc objs try { if(rs!=null) rs.close(); } catch(SQLException se) { se.printStackTrace(); } try { if(ps!=null) ps.close(); } catch(SQLException se) { se.printStackTrace(); } try { if(con!=null) con.close(); } catch(SQLException se) { se.printStackTrace(); } try { if(reader!=null) reader.close(); } catch(IOException ioe) { ioe.printStackTrace(); } try { if(writer!=null) writer.close(); } catch(IOException se) { se.printStackTrace(); } try { if(sc!=null) sc.close(); } catch(Exception e) { e.printStackTrace(); } }//finally }//main }//class
[ "TL@gmail.com" ]
TL@gmail.com
81c87f9c28e8fc72dc133f23ed6eb4ca9e3201d6
1a8c07f919c3222d194e3b290ce1ad1bc8661ea1
/app/src/main/java/com/example/techsavanna/melvinscart/QuickOrder.java
4149379a575cc5d6566dcfee86ac84dba83e2d2b
[]
no_license
Fordclifford/ShoppingCart
22b8564ad41747e078fa8fc2723db702d228c67f
0f83d6f82c7aa3056445e83c8f6b49d4d55bbc4a
refs/heads/master
2020-04-16T18:04:54.554829
2019-01-15T06:59:01
2019-01-15T06:59:01
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,745
java
package com.example.techsavanna.melvinscart; import android.app.SearchManager; import android.content.Context; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.SearchView; import android.view.Menu; import android.view.MenuInflater; import android.view.View; import android.widget.ProgressBar; import android.widget.TextView; import android.widget.Toast; import com.example.techsavanna.melvinscart.adapters.CustomerAdapter; import com.example.techsavanna.melvinscart.helper.Product; import com.example.techsavanna.melvinscart.helper.ApiInterfaceProduct; import com.example.techsavanna.melvinscart.helper.ApiProduct; import java.util.List; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; public class QuickOrder extends AppCompatActivity { private RecyclerView recyclerView; private RecyclerView.LayoutManager layoutManager; private List<Product> productList; private CustomerAdapter customerAdapter; private ApiInterfaceProduct apiInterfaceProduct; ProgressBar progressBar; TextView search; String[] item; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_quick_order); progressBar = findViewById(R.id.prograss); recyclerView = findViewById(R.id.recyclerViewqo); layoutManager = new LinearLayoutManager(this); recyclerView.setLayoutManager(layoutManager); recyclerView.setHasFixedSize(true); fetchProduct("prod", "m"); } public void fetchProduct(String type, String key) { apiInterfaceProduct = ApiProduct.getApiProduct().create(ApiInterfaceProduct.class); Call<List<Product>> call = apiInterfaceProduct.getProduct(type, key); call.enqueue(new Callback<List<Product>>() { @Override public void onResponse(Call<List<Product>> call, Response<List<Product>> response) { progressBar.setVisibility(View.GONE); productList = response.body(); customerAdapter = new CustomerAdapter(productList, QuickOrder.this); recyclerView.setAdapter(customerAdapter); customerAdapter.notifyDataSetChanged(); } @Override public void onFailure(Call<List<Product>> call, Throwable t) { progressBar.setVisibility(View.GONE); Toast.makeText(QuickOrder.this, "Error\n" + t.toString(), Toast.LENGTH_LONG).show(); } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.menu, menu); SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); SearchView searchView = (SearchView) menu.findItem(R.id.search).getActionView(); searchView.setSearchableInfo( searchManager.getSearchableInfo(getComponentName())); searchView.setIconifiedByDefault(false); searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { //System.out.print("Errot new ::"+query); fetchProduct("prod", query); return false; } @Override public boolean onQueryTextChange(String newText) { fetchProduct("prod", newText); return false; } }); return true; } }
[ "peterson9munene@gmail.com" ]
peterson9munene@gmail.com
4527c600a54a3795a9ce041dab938b5864af7a8d
7ee709db6967587dcf6a3f75f725fc69b7ed91af
/190621/src/Ex0210.java
432aa74de1a165ab5efb303cb956ca8a715e8f41
[]
no_license
kumdori/java_smhrd
316bcdc5a63dfb0afd69ce993365d36b679791d5
efe31360751f71b8c895c684216c67d68b7c98df
refs/heads/master
2020-06-05T02:40:38.192995
2019-07-17T04:39:11
2019-07-17T04:39:11
192,285,266
0
1
null
null
null
null
UTF-8
Java
false
false
1,339
java
import java.util.Scanner; public class Ex0210 { public static void main(String[] args) { /* 2-1 다이어트 관리 프로그램 * 1. 현재 몸무게와 목표 몸무게를 입력 받고 주차 별 감량 몸무게를 입력 받으세요. * 2. 목표 몸무게를 달성하면 축하한다는 문구를 출력하고 입력을 멈추세요. * 화면예) * 현재 몸무게: 80 * 목표 몸무게: 70 * 1주차 감량 몸무게: 2 * 2주차 감량 몸무게: 3 * 3주차 감량 몸무게: 4 * 4주차 감량 몸무게: 5 * 66kg 달성!! 축하합니다! * */ int actWeight = 0; int objWeight = 0; int count = 0; Scanner scan = new Scanner(System.in); System.out.print("현재 몸무게: "); actWeight = scan.nextInt(); while (true) { System.out.print("목표 몸무게: "); objWeight = scan.nextInt(); if (actWeight>objWeight) { break; } else { System.out.println("목표 몸무게가 더 높습니다. 다시 입력해 주세요."); } } while (actWeight > objWeight) { count += 1; System.out.print(count + "주차 감량 몸무게: "); int lossWeight = scan.nextInt(); actWeight-=lossWeight; } System.out.println(actWeight+"kg 달성!! 축하합니다."); scan.close(); } }
[ "SM14@DESKTOP-G8C6S9Q" ]
SM14@DESKTOP-G8C6S9Q
1c969a13bb035119eb798fa351a0553f5652ddf5
b6b5981f9d6dc2590e91681d965613a83bb50e5b
/mailselect/src/main/java/ru/mail/plugins/ms/MailRuSelectSrv.java
e81eec13e8739a0d90000feb74cc5d2b2906f558
[]
no_license
ttowkach/mailru-jira-plugins-select
d3a8becca6ae9de4da3433acc27c0e9c88d0ff98
deec7771cd58a726d089bac5331a0ffab8c8ddee
refs/heads/master
2020-12-29T03:06:50.153072
2016-10-31T14:25:26
2016-10-31T14:25:26
7,373,944
0
0
null
null
null
null
UTF-8
Java
false
false
6,991
java
/* * Created by Andrey Markelov 29-08-2012. * Copyright Mail.Ru Group 2012. All rights reserved. */ package ru.mail.plugins.ms; import java.util.Set; import java.util.TreeSet; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.CacheControl; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import org.apache.log4j.Logger; import com.atlassian.crowd.embedded.api.User; import com.atlassian.jira.ComponentManager; import com.atlassian.jira.project.Project; import com.atlassian.jira.project.ProjectManager; import com.atlassian.jira.security.PermissionManager; import com.atlassian.jira.security.Permissions; import com.atlassian.jira.util.json.JSONException; import com.atlassian.jira.util.json.JSONObject; /** * This service manages store CF values. * * @author Andrey Markelov */ @Path("/mailruselectsrv") public class MailRuSelectSrv { /** * Logger. */ private final Logger log = Logger.getLogger(MailRuSelectSrv.class); /** * Mail.Ru select manager. */ private final MailSelectMgr msMgr; /** * Permission manager. */ private final PermissionManager perMgr; /** * Project manager. */ private final ProjectManager prMgr; /** * Constructor. */ public MailRuSelectSrv( MailSelectMgr msMgr, PermissionManager perMgr, ProjectManager prMgr) { this.msMgr = msMgr; this.perMgr = perMgr; this.prMgr = prMgr; } @POST @Path("/additem") @Produces({MediaType.APPLICATION_JSON}) public Response addItem(@Context HttpServletRequest req) { User user = ComponentManager.getInstance().getJiraAuthenticationContext().getLoggedInUser(); if (user == null) { log.error("MailRuSelectSrv::addItem - User is not logged"); return Response.serverError().build(); } String projKey = req.getParameter("projKey"); String cfKey = req.getParameter("cfKey"); String cfVal = req.getParameter("cfVal"); if (projKey == null || cfKey == null || cfVal == null || projKey.length() == 0 || cfKey.length() == 0 || cfVal.length() == 0) { log.error("MailRuSelectSrv::addItem - Incorrect parameters"); return Response.serverError().build(); } if (!projKey.equals(Consts.GROBAL_CF_PROJ)) { Project proj = prMgr.getProjectObjByKey(projKey); if (proj == null) { log.error("MailRuSelectSrv::addItem - Project doesn't exist"); return Response.serverError().build(); } if (!perMgr.hasPermission(Permissions.ADMINISTER, user) && !perMgr.hasPermission(Permissions.PROJECT_ADMIN, proj, user)) { log.error("MailRuSelectSrv::addItem - User has no permissions"); return Response.serverError().build(); } } else { if (!perMgr.hasPermission(Permissions.ADMINISTER, user)) { log.error("MailRuSelectSrv::addItem - User has no permissions"); return Response.serverError().build(); } } Set<String> vals = msMgr.getValues(projKey, cfKey); vals.add(cfVal); msMgr.setValue(projKey, cfKey, vals); return Response.ok().build(); } @POST @Path("/deleteitem") @Produces({MediaType.APPLICATION_JSON}) public Response deleteItem(@Context HttpServletRequest req) { User user = ComponentManager.getInstance().getJiraAuthenticationContext().getLoggedInUser(); if (user == null) { log.error("MailRuSelectSrv::deleteItem - User is not logged"); return Response.serverError().build(); } String projKey = req.getParameter("projKey"); String cfKey = req.getParameter("cfKey"); String cfVal = req.getParameter("cfVal"); if (projKey == null || cfKey == null || cfVal == null || projKey.length() == 0 || cfKey.length() == 0 || cfVal.length() == 0) { log.error("MailRuSelectSrv::deleteItem - Incorrect parameters"); return Response.serverError().build(); } if (!projKey.equals(Consts.GROBAL_CF_PROJ)) { Project proj = prMgr.getProjectObjByKey(projKey); if (proj == null) { log.error("MailRuSelectSrv::deleteItem - Project doesn't exist"); return Response.serverError().build(); } if (!perMgr.hasPermission(Permissions.ADMINISTER, user) && !perMgr.hasPermission(Permissions.PROJECT_ADMIN, proj, user)) { log.error("MailRuSelectSrv::deleteItem - User has no permissions"); return Response.serverError().build(); } } else { if (!perMgr.hasPermission(Permissions.ADMINISTER, user)) { log.error("MailRuSelectSrv::deleteItem - User has no permissions"); return Response.serverError().build(); } } Set<String> vals = msMgr.getValues(projKey, cfKey); vals.remove(cfVal); msMgr.setValue(projKey, cfKey, vals); return Response.ok().build(); } @GET @Path("/getinfo") @Produces({MediaType.APPLICATION_JSON}) public Response getFieldInfo(@Context HttpServletRequest req) throws JSONException { User user = ComponentManager.getInstance().getJiraAuthenticationContext().getLoggedInUser(); if (user == null) { log.error("MailRuSelectSrv::getFieldInfo - User is not logged"); return Response.serverError().build(); } String cfIdStr = req.getParameter("cfid"); String project = req.getParameter("project"); try { Long.parseLong(cfIdStr); } catch (NumberFormatException nex) { log.error("MailRuSelectSrv::getFieldInfo - Incorrect parameters"); return Response.serverError().build(); } Set<String> values = new TreeSet<String>(); if (project == null || project.length() == 0) { values.addAll(msMgr.getValues(Consts.GROBAL_CF_PROJ, "customfield_" + cfIdStr)); } else { values.addAll(msMgr.getValues(project, "customfield_" + cfIdStr)); } JSONObject json = new JSONObject(); json.put("values", values); CacheControl cc = new CacheControl(); cc.setNoCache(true); cc.setNoStore(true); cc.setMaxAge(0); return Response.ok(values.toString()).cacheControl(cc).build(); } }
[ "a.markelov@corp.mail.ru" ]
a.markelov@corp.mail.ru
918d6a09dc1e07e50427eb7fb85d7eacba58799e
19973063485c4d041222e5d918fe682a038d12a8
/src/main/java/com/ungs/revivir/vista/menu/servicios/VentanaServiciosABM.java
00281fb92483beeb8d0eb31538c8523c96fafacd
[]
no_license
benescence/Revivir
f5a37de88bccfa9d09dd904b97892d90248990f0
5cdfc52b16ce8c836dda5a1f0ada5ffb0fe25fef
refs/heads/master
2022-07-11T12:13:41.582794
2022-04-05T02:33:12
2022-04-05T02:33:12
163,328,767
0
0
null
2022-06-21T00:53:35
2018-12-27T19:20:59
Java
UTF-8
Java
false
false
1,752
java
package com.ungs.revivir.vista.menu.servicios; import java.awt.Dimension; import javax.swing.JScrollPane; import javax.swing.border.EmptyBorder; import com.ungs.revivir.negocios.manager.ServicioManager; import com.ungs.revivir.vista.tablas.TablaServicios; import com.ungs.revivir.vista.util.Boton; import com.ungs.revivir.vista.util.contenedores.PanelHorizontal; import com.ungs.revivir.vista.util.contenedores.PanelVertical; import com.ungs.revivir.vista.util.contenedores.VentanaInterna; public class VentanaServiciosABM extends VentanaInterna { private static final long serialVersionUID = 1L; private TablaServicios tabla; private Boton btnAgregar, btnModificar, btnEliminar; public VentanaServiciosABM() { super("Gestion de servicios", 500, 500); tabla = new TablaServicios(ServicioManager.traerActivos()); JScrollPane panelTabla = new JScrollPane(tabla); Dimension dimBoton = new Dimension(100, 25); btnAgregar = new Boton("Agregar", dimBoton); btnModificar = new Boton("Modificar", dimBoton); btnEliminar = new Boton("Eliminar", dimBoton); PanelHorizontal panelBotones = new PanelHorizontal(); panelBotones.setBorder(new EmptyBorder(10, 0, 0, 0)); panelBotones.add(btnAgregar); panelBotones.add(btnModificar); panelBotones.add(btnEliminar); PanelVertical panelPrincipal = new PanelVertical(); panelPrincipal.setBorder(new EmptyBorder(10, 10, 10, 10)); setContentPane(panelPrincipal); panelPrincipal.add(panelTabla); panelPrincipal.add(panelBotones); } public TablaServicios getTabla() { return tabla; } public Boton botonAgregar() { return btnAgregar; } public Boton botonModificar() { return btnModificar; } public Boton botonEliminar() { return btnEliminar; } }
[ "carloscaballeromorel@gmail.com" ]
carloscaballeromorel@gmail.com
fecd60dc65dc996321f65b838725918688520b49
9914c0886367c88ef7c599bba217608171e512b6
/accountapi/src/main/java/com/apimsa/labs/account/doc/SwaggerConfig.java
0b533051fd3d218ff711fb7c7ea438a3d1b03fc9
[]
no_license
labamol/apimsalab
fd25895c34b20ccd53998f7b3cd9400218fe0de4
f72d11762c4961d3f8fe5a8b2daf15cdcd5cb4b0
refs/heads/master
2020-06-30T02:42:56.345449
2020-04-21T13:20:34
2020-04-21T13:20:34
200,696,527
0
0
null
2020-04-21T13:20:35
2019-08-05T17:05:05
Java
UTF-8
Java
false
false
1,120
java
package com.apimsa.labs.account.doc; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import springfox.documentation.builders.ApiInfoBuilder; import springfox.documentation.builders.PathSelectors; import springfox.documentation.builders.RequestHandlerSelectors; import springfox.documentation.service.ApiInfo; import springfox.documentation.spi.DocumentationType; import springfox.documentation.spring.web.plugins.Docket; import springfox.documentation.swagger2.annotations.EnableSwagger2; import static springfox.documentation.builders.PathSelectors.regex; import static com.google.common.base.Predicates.or; import springfox.documentation.swagger2.annotations.EnableSwagger2; // to have swagger docs generated for this spring boot service at http://localhost:8080/swagger-ui.html. @Configuration @EnableSwagger2 public class SwaggerConfig { @Bean public Docket api() { return new Docket(DocumentationType.SWAGGER_2) .select() .apis(RequestHandlerSelectors.any()) .paths(PathSelectors.any()).build(); } }
[ "noreply@github.com" ]
noreply@github.com
46bc5f01ec22bcb44cb6393715bd4e5073669168
0a5592baffd61ef14441797737db84c21dfeb348
/src/main/java/ru/ifmo/CRUD/CRUDneo.java
908a6b3f40ee5fcdfe8568423beebb0a14f35f95
[]
no_license
nastasiatm/NoSQLBase
9bfe10bbc0aea7bb2aca988a385d304bdc9b44e5
3e1b76fa73c56797682f32c8202f20b62a096e90
refs/heads/master
2021-01-20T03:14:38.370234
2017-06-09T08:34:03
2017-06-09T08:34:03
89,515,494
0
0
null
null
null
null
UTF-8
Java
false
false
6,268
java
package ru.ifmo.CRUD; import org.springframework.context.ApplicationContext; import org.springframework.stereotype.Component; import ru.ifmo.model.graph.Building; import ru.ifmo.model.graph.Group; import ru.ifmo.model.graph.Worker; import ru.ifmo.repository.graph.WorkerGraphRep; import java.util.HashMap; import java.util.Map; import java.util.Random; import java.util.Scanner; /** * Created by anastasia on 17.05.17. */ @Component public class CRUDneo { Scanner in = new Scanner(System.in); //ApplicationContext ctx; //WorkerGraphRep workerGraphRep = ctx.getBean(WorkerGraphRep.class); public void neoLoop(ApplicationContext ctx) { try { while (true) { printMenu(); String command = in.next(); switch (command) { case "1": if (addWorker(ctx)) { System.out.println("\nWorker was actually added"); } else { System.out.println("\nSomething wrong"); } break; case "2": if (getWorkers(ctx)) { System.out.println("\nAll workers"); } else { System.out.println("\nSomething wrong"); } break; case "3": if (getWorkerById(ctx)) { System.out.println("\nOne worker"); } else { System.out.println("\nSomething wrong"); } break; case "4": if (updateWorker(ctx)) { System.out.println("\nUpdate One worker"); } else { System.out.println("\nSomething wrong"); } break; case "5": if (deleteWorker(ctx)) { System.out.println("Delete One worker"); } else { System.out.println("Something wrong"); } break; case "q": return; default: System.out.println("Not a command. Retry input"); break; } } } catch (Exception ex){ System.out.print(ex.toString()); } } private boolean addWorker (ApplicationContext ctx) { try{ WorkerGraphRep workerGraphRep = ctx.getBean(WorkerGraphRep.class); Random random = new Random(); Worker worker = new Worker(); Group group = new Group(); System.out.print("Input type of work"); String type = in.next(); group.setTypeOfWork(type); worker.setGroup(group); System.out.print("Input name"); String name = in.next(); worker.setName(name); System.out.print("Input surname"); String surname = in.next(); worker.setSurname(surname); System.out.print("Input old"); Integer old = in.nextInt(); worker.setOld(old); System.out.print("Input passport data"); String data = in.next(); worker.setPassportData(data); worker.setRegistration(random.nextBoolean()); worker.setTeamLeader(random.nextBoolean()); worker.setSalary(random.nextInt(200000)+15000); workerGraphRep.save(worker); return true; } catch (Exception ex) { System.out.print(ex.toString()); return false; } } private boolean getWorkerById (ApplicationContext ctx) { try{ WorkerGraphRep workerGraphRep = ctx.getBean(WorkerGraphRep.class); System.out.print("Input ID"); Long id = in.nextLong(); System.out.print(workerGraphRep.findOne(id).toString()); return true; } catch (Exception ex) { System.out.print(ex.toString()); return false; } } private boolean getWorkers (ApplicationContext ctx) { try{ WorkerGraphRep workerGraphRep = ctx.getBean(WorkerGraphRep.class); Iterable<Worker> workers = workerGraphRep.findAll(); for(Worker s : workers){ System.out.print(s.toString()+"\n"); } return true; } catch (Exception ex) { System.out.print(ex.toString()); return false; } } private boolean updateWorker (ApplicationContext ctx) { try{ WorkerGraphRep workerGraphRep = ctx.getBean(WorkerGraphRep.class); System.out.print("Input ID"); Long id = in.nextLong(); System.out.print("Input new name"); String name = in.next(); workerGraphRep.findOne(id).setName(name); return true; } catch (Exception ex) { System.out.print(ex.toString()); return false; } } private boolean deleteWorker (ApplicationContext ctx) { try{ WorkerGraphRep workerGraphRep = ctx.getBean(WorkerGraphRep.class); System.out.print("Input ID"); Long id = in.nextLong(); workerGraphRep.delete(id); return true; } catch (Exception ex) { System.out.print(ex.toString()); return false; } } private void printMenu() { StringBuilder builder = new StringBuilder("\tSelect command\n"); builder.append("1. Add worker\n"); builder.append("2. Get all workers\n"); builder.append("3. Get worker by id\n"); builder.append("4. Update worker\n"); builder.append("5. Delete worker by id\n"); builder.append("q. Quit"); System.out.println(builder.toString()); } }
[ "nastasiatm@gmail.com" ]
nastasiatm@gmail.com
358cb20635f24a596734db30c38b04d2c7574944
e1532151fcb9ae942ce2bbdd66629a088473bff3
/mvnw/src/test/java/com/miw/database/JdbcUserDaoTest.java
60a0532a488cb63b37927f7fcbb1c37bb580a9d4
[]
no_license
nijadNazarli/bankSinatra
5a77cc08ef64fc1bf04fd152d6937bdc7935d73e
4fd37e12b12fc57981ac23cb1c60a8134027ee10
refs/heads/main
2023-08-03T02:45:30.581447
2021-09-25T16:48:54
2021-09-25T16:48:54
407,084,640
0
0
null
null
null
null
UTF-8
Java
false
false
819
java
package com.miw.database; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import static org.junit.jupiter.api.Assertions.*; @SpringBootTest class JdbcUserDaoTest { @Autowired private JdbcUserDao userDao; @Test void getUserByEmail() { String emailAdmin = "admin@admin.com"; String emailClient = "test3@test.com"; System.out.println("Admin from database: " + userDao.getUserByEmail(emailAdmin)); System.out.println("Client from database: " + userDao.getUserByEmail(emailClient)); } @Test void getRoleByEmail() { } @Test void getRoleByID() { } @Test void getIDByEmail() { } }
[ "nijad.nazarli@hva.nl" ]
nijad.nazarli@hva.nl
911fd63a841b7f72400254ffec1852c918a7d086
96c9f686b3ee5e0364eb5e8859c9e7a020f0ea8b
/bus-image/src/main/java/org/aoju/bus/image/metric/internal/hl7/HL7ServiceRegistry.java
db2f7cbc4386ee5f48c3a26a83c88a4dc445af74
[ "MIT" ]
permissive
jiyulongxu/bus
083f7702ba06121b652f7bd82ce2bbdeac4e3109
1bc7b539fc541f4205ded8a6edd4282e4ad89c59
refs/heads/master
2023-02-03T07:27:46.277793
2020-12-20T01:22:23
2020-12-20T01:22:23
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,549
java
/********************************************************************************* * * * The MIT License (MIT) * * * * Copyright (c) 2015-2020 aoju.org and other contributors. * * * * Permission is hereby granted, free of charge, to any person obtaining a copy * * of this software and associated documentation files (the "Software"), to deal * * in the Software without restriction, including without limitation the rights * * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * * copies of the Software, and to permit persons to whom the Software is * * furnished to do so, subject to the following conditions: * * * * The above copyright notice and this permission notice shall be included in * * all copies or substantial portions of the Software. * * * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * * THE SOFTWARE. * * * ********************************************************************************/ package org.aoju.bus.image.metric.internal.hl7; import org.aoju.bus.core.lang.Symbol; import org.aoju.bus.image.metric.Connection; import java.net.Socket; import java.util.ArrayList; import java.util.HashMap; /** * @author Kimi Liu * @version 6.1.6 * @since JDK 1.8+ */ public class HL7ServiceRegistry extends DefaultHL7Listener { private final ArrayList<HL7Service> services = new ArrayList<>(); private final HashMap<String, HL7MessageListener> listeners = new HashMap<>(); public synchronized void addHL7Service(HL7Service service) { services.add(service); for (String messageType : service.getMessageTypes()) listeners.put(messageType, service); } public synchronized boolean removeHL7Service(HL7Service service) { if (!services.remove(service)) return false; for (String messageType : service.getMessageTypes()) listeners.remove(messageType); return true; } @Override public UnparsedHL7Message onMessage(HL7Application hl7App, Connection conn, Socket s, UnparsedHL7Message msg) throws HL7Exception { HL7MessageListener listener = listeners.get(msg.msh().getMessageType()); if (listener == null) { listener = listeners.get(Symbol.STAR); if (listener == null) return super.onMessage(hl7App, conn, s, msg); } return listener.onMessage(hl7App, conn, s, msg); } }
[ "839536@qq.com" ]
839536@qq.com
4a17762cd0581f7b304d092fb49752b9b27dc7d6
fc160694094b89ab09e5c9a0f03db80437eabc93
/java-compute/samples/snippets/generated/com/google/cloud/compute/v1/serviceattachments/get/SyncGet.java
f3ec7dd4bb2e8e0a66b109b18dc80bcb658ba24e
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
googleapis/google-cloud-java
4f4d97a145e0310db142ecbc3340ce3a2a444e5e
6e23c3a406e19af410a1a1dd0d0487329875040e
refs/heads/main
2023-09-04T09:09:02.481897
2023-08-31T20:45:11
2023-08-31T20:45:11
26,181,278
1,122
685
Apache-2.0
2023-09-13T21:21:23
2014-11-04T17:57:16
Java
UTF-8
Java
false
false
1,970
java
/* * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.google.cloud.compute.v1.samples; // [START compute_v1_generated_ServiceAttachments_Get_sync] import com.google.cloud.compute.v1.GetServiceAttachmentRequest; import com.google.cloud.compute.v1.ServiceAttachment; import com.google.cloud.compute.v1.ServiceAttachmentsClient; public class SyncGet { public static void main(String[] args) throws Exception { syncGet(); } public static void syncGet() throws Exception { // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ServiceAttachmentsClient serviceAttachmentsClient = ServiceAttachmentsClient.create()) { GetServiceAttachmentRequest request = GetServiceAttachmentRequest.newBuilder() .setProject("project-309310695") .setRegion("region-934795532") .setServiceAttachment("serviceAttachment-398467656") .build(); ServiceAttachment response = serviceAttachmentsClient.get(request); } } } // [END compute_v1_generated_ServiceAttachments_Get_sync]
[ "noreply@github.com" ]
noreply@github.com
a404a41659e6918e9abb145819bfa9fd2b558633
fa1408365e2e3f372aa61e7d1e5ea5afcd652199
/src/testcases/CWE129_Improper_Validation_of_Array_Index/s02/CWE129_Improper_Validation_of_Array_Index__File_array_write_no_check_68b.java
5d28288e4a742713d286c4eff9dd58b971d64129
[]
no_license
bqcuong/Juliet-Test-Case
31e9c89c27bf54a07b7ba547eddd029287b2e191
e770f1c3969be76fdba5d7760e036f9ba060957d
refs/heads/master
2020-07-17T14:51:49.610703
2019-09-03T16:22:58
2019-09-03T16:22:58
206,039,578
1
2
null
null
null
null
UTF-8
Java
false
false
2,822
java
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE129_Improper_Validation_of_Array_Index__File_array_write_no_check_68b.java Label Definition File: CWE129_Improper_Validation_of_Array_Index.label.xml Template File: sources-sinks-68b.tmpl.java */ /* * @description * CWE: 129 Improper Validation of Array Index * BadSource: File Read data from file (named c:\data.txt) * GoodSource: A hardcoded non-zero, non-min, non-max, even number * Sinks: array_write_no_check * GoodSink: Write to array after verifying index * BadSink : Write to array without any verification of index * Flow Variant: 68 Data flow: data passed as a member variable in the "a" class, which is used by a method in another class in the same package * * */ package testcases.CWE129_Improper_Validation_of_Array_Index.s02; import testcasesupport.*; import javax.servlet.http.*; public class CWE129_Improper_Validation_of_Array_Index__File_array_write_no_check_68b { public void badSink() throws Throwable { int data = CWE129_Improper_Validation_of_Array_Index__File_array_write_no_check_68a.data; /* Need to ensure that the array is of size > 3 and < 101 due to the GoodSource and the large_fixed BadSource */ int array[] = { 0, 1, 2, 3, 4 }; /* POTENTIAL FLAW: Attempt to write to array at location data, which may be outside the array bounds */ array[data] = 42; /* Skip reading back data from array since that may be another out of bounds operation */ } /* goodG2B() - use goodsource and badsink */ public void goodG2BSink() throws Throwable { int data = CWE129_Improper_Validation_of_Array_Index__File_array_write_no_check_68a.data; /* Need to ensure that the array is of size > 3 and < 101 due to the GoodSource and the large_fixed BadSource */ int array[] = { 0, 1, 2, 3, 4 }; /* POTENTIAL FLAW: Attempt to write to array at location data, which may be outside the array bounds */ array[data] = 42; /* Skip reading back data from array since that may be another out of bounds operation */ } /* goodB2G() - use badsource and goodsink */ public void goodB2GSink() throws Throwable { int data = CWE129_Improper_Validation_of_Array_Index__File_array_write_no_check_68a.data; /* Need to ensure that the array is of size > 3 and < 101 due to the GoodSource and the large_fixed BadSource */ int array[] = { 0, 1, 2, 3, 4 }; /* FIX: Verify index before writing to array at location data */ if (data >= 0 && data < array.length) { array[data] = 42; } else { IO.writeLine("Array index out of bounds"); } } }
[ "bqcuong2212@gmail.com" ]
bqcuong2212@gmail.com
8947cf1d331169575d6c46b463ed665e899cc6f3
6e498099b6858eae14bf3959255be9ea1856f862
/src/com/facebook/buck/jvm/java/abi/source/ResolvedTypeKind.java
aa0fbccc3a0bd1a9265f56d7ddbc167a9a55e2c4
[ "Apache-2.0" ]
permissive
Bonnie1312/buck
2dcfb0791637db675b495b3d27e75998a7a77797
3cf76f426b1d2ab11b9b3d43fd574818e525c3da
refs/heads/master
2020-06-11T13:29:48.660073
2019-06-26T19:59:32
2019-06-26T21:06:24
193,979,660
2
0
Apache-2.0
2019-09-22T07:23:56
2019-06-26T21:24:33
Java
UTF-8
Java
false
false
1,019
java
/* * Copyright 2017-present Facebook, 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 com.facebook.buck.jvm.java.abi.source; enum ResolvedTypeKind { /** Type would resolve successfully. */ RESOLVED_TYPE, /** Type would resolve as an {@link javax.lang.model.type.ErrorType}. */ ERROR_TYPE, /** The compiler would crash trying to resolve the type. */ CRASH; public ResolvedTypeKind merge(ResolvedTypeKind other) { return (this.compareTo(other) >= 0) ? this : other; } }
[ "facebook-github-bot@users.noreply.github.com" ]
facebook-github-bot@users.noreply.github.com
f8deab038ddd9142ce8b988066dc8c358a32a675
e675b1b8167973afe040ed1533ddc569ac77343d
/src/main/java/com/iqbal/masterthesis/cargomailparser/visitor/LDRateVisitor.java
8b7cf9f086eaf52f639d60476ed3a4c7d93d75e3
[]
no_license
muhammadiqbal/MasterThesisFinal
94df4bcdff5b3b3dbbf929a522dfa553ab30d9a5
2099b2e1084d0512cb8c01f82b1b330d0b422008
refs/heads/master
2020-04-19T03:18:17.011213
2019-03-05T11:07:11
2019-03-05T11:07:11
167,928,239
0
0
null
null
null
null
UTF-8
Java
false
false
3,410
java
package com.iqbal.masterthesis.cargomailparser.visitor; import com.iqbal.masterthesis.cargomailparser.LDRateBaseVisitor; import com.iqbal.masterthesis.cargomailparser.LDRateParser.Discharging_rateContext; import com.iqbal.masterthesis.cargomailparser.LDRateParser.Loading_discharging_rateContext; import com.iqbal.masterthesis.cargomailparser.LDRateParser.Loading_rateContext; import com.iqbal.masterthesis.cargomailparser.languagemodel.LDRate; /** * LDRateVisitor */ public class LDRateVisitor extends LDRateBaseVisitor<LDRate> { @Override public LDRate visitLoading_discharging_rate(Loading_discharging_rateContext ctx) { float dischargingRate = 0; float loadingRate = 0; //validate the parsed entities //if the entities found is not complete return null if(ctx.RATE_NOMINAL().size()<1 || ctx.RATE_TYPE().size()<1 ) return null; // get the first occurence ofloading discharing rate loadingRate = Float.parseFloat(ctx.RATE_NOMINAL().get(0).getText().replaceAll("[.,]", "")); // if there's only one loading rate type found assume both value are same dischargingRate = loadingRate; if(ctx.RATE_NOMINAL().size()>1){ dischargingRate = Float.parseFloat(ctx.RATE_NOMINAL().get(1).getText().replaceAll("[.,]", "")); } String loadingRateType = ctx.RATE_TYPE().get(0).getText(); // if there's only one declaration of rate type get the first occurence as a default String dischargingRateType = loadingRateType; // there are more than one declaration of rate type // set the dischargng rate as the second occurence if(ctx.RATE_TYPE().size() > 1 ){ dischargingRateType = ctx.RATE_TYPE().get(1).getText(); } return new LDRate(loadingRate, dischargingRate, loadingRateType, dischargingRateType); } // @Override // public LDRate visitLoading_discharging_rate(Loading_discharging_rateContext ctx) { // float dischargingRate = 0; // float loadingRate = 0; // //validate the parsed entities // //if the entities found is not complete return null // if(ctx.RATE_NOMINAL() == null || ctx.RATE_TYPE() == null ) // return null; // // get the first occurence ofloading discharing rate // loadingRate = Float.parseFloat(ctx.RATE_NOMINAL().getText().replaceAll("[.,]", "")); // if(ctx.RATE_NOMINAL() != null) // dischargingRate = Float.parseFloat(ctx.RATE_NOMINAL().getText().replaceAll("[.,]", "")); // String loadingRateType = ctx.RATE_TYPE().getText(); // // there's only one declaration of rate type get the first occurence as a default // String dischargingRateType = loadingRateType; // // there are more than one declaration of rate type // // set the dischargng rate as the second occurence // dischargingRateType = ctx.RATE_TYPE().getText(); // return new LDRate(loadingRate, dischargingRate, loadingRateType, dischargingRateType); // } @Override public LDRate visitLoading_rate(Loading_rateContext ctx) { return super.visitLoading_rate(ctx); } @Override public LDRate visitDischarging_rate(Discharging_rateContext ctx) { return super.visitDischarging_rate(ctx); } }
[ "iqbalms.iqbal@gmail.com" ]
iqbalms.iqbal@gmail.com
c11e01be94d0389f28a0fcd950ed7b2967be24ed
bac69b5073a87349ae2601d83fa77620019ea11a
/app/src/main/java/com/tokenbank/tokeninformation/util/SnackBarUtil.java
2c670e412878c89ba1ca1a62a65cf84a96fae647
[]
no_license
tokenbankteam/tb_android_information
2e1331e39e85064005d511449bc41e1ae6f0e607
ee417913b6c14f2441eeff0b4b913ae521f9b7af
refs/heads/master
2020-03-18T01:48:14.179913
2019-03-03T05:36:35
2019-03-03T05:36:35
134,160,459
0
1
null
null
null
null
UTF-8
Java
false
false
650
java
package com.tokenbank.tokeninformation.util; import android.support.annotation.NonNull; import android.support.design.widget.Snackbar; import android.view.View; /** * Author: Clement * Create: 2018/5/20 * Desc: */ public class SnackBarUtil { private static final int DURATION = Snackbar.LENGTH_SHORT; /** * 显示snackBar * * @param view * @param content */ public static void show(@NonNull View view, String content) { Snackbar.make(view, content, DURATION).show(); } public static void show(@NonNull View view, int resId) { Snackbar.make(view, resId, DURATION).show(); } }
[ "1928856034@qq.com" ]
1928856034@qq.com
9be129edb3b6c22fa5488cfc3e8b5b8417de1533
25dda177960acd0a8fbcf508646313b72a6f936c
/src/main/java/DuDCL/Toto/A.java
c5c24c347a1b606ba40d1c1771dc47a39ae93e8d
[]
no_license
cdelourme/TP1_dudcl
898912e0b907fd469e7913165236d8bd77481991
25734a0eda4b225a15b176bd3c3e989fba70fe88
refs/heads/master
2021-05-31T22:42:19.827600
2016-03-31T08:38:48
2016-03-31T08:38:48
null
0
0
null
null
null
null
UTF-8
Java
false
false
299
java
package DuDCL.Toto; public class A { String prenom; String Nom; public String getPrenom() { return prenom; } public void setPrenom(String prenom) { this.prenom = prenom; } public String getNom() { return Nom; } public void setNom(String nom) { Nom = nom; } }
[ "TotoPower@148.60.13.228" ]
TotoPower@148.60.13.228
7fa9aded5b6f16e7486f4edf1c3240f13ec1b552
8750d07218943caf28b28beff5274892ac729fa5
/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/InitKamelet.java
072cd223a039379e31c8d8f638655156ab195488
[ "Apache-2.0" ]
permissive
mrk-andreev/camel
1ab25048f17d4e60db0c00c457fe1e35557c5cd0
c13498dcb43bf8bdd2252483addbeefc1d150190
refs/heads/master
2023-08-26T23:14:25.780115
2021-11-07T07:06:48
2021-11-07T07:06:48
293,794,733
0
0
Apache-2.0
2021-02-20T07:20:30
2020-09-08T11:51:17
Java
UTF-8
Java
false
false
4,487
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.camel.dsl.jbang.core.commands; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.util.concurrent.Callable; import org.apache.camel.CamelException; import org.apache.camel.dsl.jbang.core.common.exceptions.ResourceAlreadyExists; import org.apache.camel.dsl.jbang.core.templates.VelocityTemplateParser; import picocli.CommandLine; import picocli.CommandLine.Command; import picocli.CommandLine.Option; @Command(name = "kamelet", description = "Provide init templates for kamelets") class InitKamelet extends AbstractInitKamelet implements Callable<Integer> { //CHECKSTYLE:OFF @Option(names = { "-h", "--help" }, usageHelp = true, description = "Display the help and sub-commands") private boolean helpRequested = false; //CHECKSTYLE:ON @CommandLine.ArgGroup(exclusive = true, multiplicity = "1") private ProcessOptions processOptions; static class ProcessOptions { //CHECKSTYLE:OFF @Option(names = { "--bootstrap" }, description = "Bootstrap the Kamelet template generator - download the properties file for editing") private boolean bootstrap = false; //CHECKSTYLE:ON @Option(names = { "--properties-path" }, defaultValue = "", description = "Kamelet name") private String propertiesPath; } @Option(names = { "--base-resource-location" }, defaultValue = "github:apache", hidden = true, description = "Where to download the resources from (used for development/testing)") private String baseResourceLocation; @Option(names = { "--branch" }, defaultValue = "main", hidden = true, description = "The branch to use when downloading resources from (used for development/testing)") private String branch; @Option(names = { "--destination" }, defaultValue = "work", description = "The destination directory where to download the files") private String destination; @Override public Integer call() throws Exception { if (processOptions.bootstrap) { bootstrap(); } else { generateTemplate(); } return 0; } private int generateTemplate() throws IOException, CamelException { setBranch(branch); setResourceLocation(baseResourceLocation, "camel-kamelets:templates/init-template.kamelet.yaml.vm"); File workDirectory = new File(destination); File localTemplateFile; try { localTemplateFile = resolveResource(workDirectory); } catch (ResourceAlreadyExists e) { System.err.println(e.getMessage()); return 1; } localTemplateFile.deleteOnExit(); VelocityTemplateParser templateParser = new VelocityTemplateParser( localTemplateFile.getParentFile(), processOptions.propertiesPath); File outputFile; try { outputFile = templateParser.getOutputFile(workDirectory); } catch (ResourceAlreadyExists e) { System.err.println(e.getMessage()); return 1; } try (FileWriter fw = new FileWriter(outputFile)) { templateParser.parse(localTemplateFile.getName(), fw); System.out.println("Template file was written to " + outputFile); } return 0; } private int bootstrap() throws IOException, CamelException { try { super.bootstrap(branch, baseResourceLocation, destination); return 0; } catch (ResourceAlreadyExists e) { System.err.println(e.getMessage()); return 1; } } }
[ "orpiske@users.noreply.github.com" ]
orpiske@users.noreply.github.com
7806718eec87c5dcdb5bdedeb12622d15c0f46d4
4a3b2bc7f5910c0dcfc68be0c1c79ec875a05d0a
/src/main/java/com/abc/application/QuartzListener.java
b45ff8964b96e9d805ed98cf0c4533f031cd7b56
[]
no_license
aloneweizai/yyglxt
d0201bb864fd45b5eb09cb789c3123cd813e90ee
a0871058410265bd810f5f1da26170e63446383a
refs/heads/master
2020-03-13T05:50:17.703739
2018-04-25T10:42:04
2018-04-25T10:42:04
130,894,131
0
0
null
null
null
null
UTF-8
Java
false
false
4,537
java
package com.abc.application; import com.abc.job.*; import com.abc.service.TaskService; import com.abc.soa.request.cms.task.ScheduleJob; import com.abc.soa.request.cms.task.TaskBo; import com.abc.soa.request.cms.task.TaskDataListBo; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.CommandLineRunner; import org.springframework.context.annotation.Configuration; import java.util.List; /** * Created by stuy on 2017/7/7. */ @Configuration public class QuartzListener implements CommandLineRunner { @Autowired public QuartzCmsJob quartzJob; private static final Logger logger = LoggerFactory.getLogger(QuartzListener.class); private final TaskService taskService; public QuartzListener(TaskService taskServices) { this.taskService = taskServices; } /** * 定时任务初始化 * @param strings * @throws Exception */ @Override public void run(String... strings) throws Exception { // TaskDataListBo datalist = taskService.findTask(); // if(datalist!=null){ // List<TaskBo> list=datalist.getDataList(); // if(list!=null&&list.size()>0){ // for(TaskBo taskBo : list){ // if("1".equals(taskBo.getIsEnable())){ // ScheduleJob scheduleJob = getScheduleJob(taskBo); // try { // if(scheduleJob!=null){ // logger.info("启动定时任务:[定时任务名称:"+scheduleJob.getJobName()+" | 定时任务分组编号: "+scheduleJob.getJobGroup()+"]"); // quartzJob.execute(scheduleJob); // }else{ // logger.info("启动定时任务失败,缺少必要参数"); // } // } catch (Exception e) { // e.printStackTrace(); // } // } // } // } // } } private ScheduleJob getScheduleJob(TaskBo taskBo){ /*if(taskBo.getTaskId()==null||taskBo.getTaskName()==null||"".equals(taskBo.getTaskName())){ return null; }*/ ScheduleJob scheduleJob=new ScheduleJob(); /*scheduleJob.setJobId(taskBo.getTaskId()); scheduleJob.setJobName(taskBo.getTaskName()); scheduleJob.setJobGroup("group_"+taskBo.getTaskId()); switch (taskBo.getTaskIntervalUnit()){ case 1: if(taskBo.getIntervalMinute()!=0){ scheduleJob.setCronExpression("0 0/"+taskBo.getIntervalMinute()+" * * * ?"); } break; case 2: if(taskBo.getIntervalMinute()!=0) scheduleJob.setCronExpression("0 * 0/"+taskBo.getIntervalMinute()+" * * ?"); break; case 3: if(taskBo.getMinute()!=0&&taskBo.getHour()!=0) scheduleJob.setCronExpression("0 "+taskBo.getMinute()+" "+taskBo.getHour()+" * * ?"); break; case 4: if(taskBo.getMinute()!=0&&taskBo.getHour()!=0&&taskBo.getDayOfWeek()!=0) scheduleJob.setCronExpression("0 "+taskBo.getMinute()+" "+taskBo.getHour()+" * * "+taskBo.getDayOfWeek()); break; default: if(taskBo.getMinute()!=0&&taskBo.getHour()!=0&&taskBo.getDayOfMonth()!=0) scheduleJob.setCronExpression("0 "+taskBo.getMinute()+" "+taskBo.getHour()+" "+taskBo.getDayOfMonth()+" * ?"); } switch (taskBo.getTaskType()){ case "1": scheduleJob.setJobClass(QuartzCmsIndexFactory.class); break; case "2": scheduleJob.setJobClass(QuartzCmsColumnFactory.class); break; case "3": scheduleJob.setJobClass(QuartzCmsContentFactory.class); break; case "4": scheduleJob.setJobClass(QuartzCmsCollectionFactory.class); break; default: scheduleJob.setJobClass(QuartzCmsDistributeFactory.class); } scheduleJob.setJobStatus(taskBo.getIsEnable());*/ if(scheduleJob.getCronExpression()!=null&&!"".equals(scheduleJob.getCronExpression())) return scheduleJob; else return null; } }
[ "aloneweizai@163.com" ]
aloneweizai@163.com
a6b3d4ebf9da7b5cd433ee8d41591ec53ceb580d
8ba8c9b4e9534a05d62589c7e1cb25a9cce36006
/src/be/intecbrussel/Alles/zoo/Wolf.java
cf3ab904e44c9f3720d4535bd2d30a43174a5546
[]
no_license
Khuramalicontact/JavaFundamental
7e414d32c55bd38709fd90a47bb419afa6a3902f
dbbc79cba90529fe86ac4a1f364d97d16aa290b0
refs/heads/master
2020-08-30T07:55:49.836653
2019-11-26T14:39:59
2019-11-26T14:39:59
218,311,471
0
0
null
null
null
null
UTF-8
Java
false
false
73
java
package be.intecbrussel.Alles.zoo; public class Wolf extends Animal { }
[ "khuramalicontact@gmail.com" ]
khuramalicontact@gmail.com
d980aa406c6a30ae439d15d3f1b250f913a11058
73458087c9a504dedc5acd84ecd63db5dfcd5ca1
/src/android/support/v4/app/bb.java
9b5960d470e53279569eecde11c73a4079d6465e
[]
no_license
jtap60/com.estr
99ff2a6dd07b02b41a9cc3c1d28bb6545e68fb27
8b70bf2da8b24c7cef5973744e6054ef972fc745
refs/heads/master
2020-04-14T02:12:20.424436
2018-12-30T10:56:45
2018-12-30T10:56:45
163,578,360
0
0
null
null
null
null
UTF-8
Java
false
false
449
java
package android.support.v4.app; import android.graphics.Rect; import android.transition.Transition; import android.transition.Transition.EpicenterCallback; final class bb extends Transition.EpicenterCallback { bb(Rect paramRect) {} public Rect onGetEpicenter(Transition paramTransition) { return a; } } /* Location: * Qualified Name: android.support.v4.app.bb * Java Class Version: 6 (50.0) * JD-Core Version: 0.7.1 */
[ "reverseengineeringer@hackeradmin.com" ]
reverseengineeringer@hackeradmin.com
66c34cbdb48f8a4028c6c1873e851171aa4cb557
04d83501ed2b1c49b97d7d2baa29ae47f927369d
/wiki/tags/release-0.6.2/jamwiki/src/main/java/org/jamwiki/servlets/ServletUtil.java
b003d1ee3ae90eabd1e30ea18adbe64fd65f8f2e
[]
no_license
Eljah/jamwiki
a207fac211a5d7977d175d26352771f51a4d2560
466275bd61bde092e1d0bb9d3c2491fb3b6968a3
refs/heads/master
2021-01-10T17:13:14.829006
2013-03-20T05:41:42
2013-03-20T05:41:42
46,241,623
1
0
null
null
null
null
UTF-8
Java
false
false
30,948
java
/** * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE, version 2.1, dated February 1999. * * This program is free software; you can redistribute it and/or modify * it under the terms of the latest version of the GNU Lesser General * Public License as published by the Free Software Foundation; * * 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program (LICENSE.txt); if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.jamwiki.servlets; import java.io.File; import java.util.Collection; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.Locale; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import net.sf.ehcache.Element; import org.apache.commons.fileupload.disk.DiskFileItemFactory; import org.apache.commons.fileupload.servlet.ServletFileUpload; import org.apache.commons.io.FilenameUtils; import org.jamwiki.Environment; import org.jamwiki.WikiBase; import org.jamwiki.WikiException; import org.jamwiki.WikiMessage; import org.jamwiki.model.Category; import org.jamwiki.model.Role; import org.jamwiki.model.Topic; import org.jamwiki.model.VirtualWiki; import org.jamwiki.model.Watchlist; import org.jamwiki.model.WikiFileVersion; import org.jamwiki.model.WikiUser; import org.jamwiki.parser.ParserInput; import org.jamwiki.parser.ParserDocument; import org.jamwiki.utils.LinkUtil; import org.jamwiki.utils.NamespaceHandler; import org.jamwiki.utils.Utilities; import org.jamwiki.utils.WikiCache; import org.jamwiki.utils.WikiLink; import org.jamwiki.utils.WikiLogger; import org.jamwiki.utils.WikiUtil; import org.springframework.util.StringUtils; import org.springframework.web.servlet.ModelAndView; /** * Utility methods useful when processing JAMWiki servlet requests. */ public class ServletUtil { private static final WikiLogger logger = WikiLogger.getLogger(ServletUtil.class.getName()); protected static final String JSP_ERROR = "error-display.jsp"; protected static final String JSP_LOGIN = "login.jsp"; public static final String PARAMETER_PAGE_INFO = "pageInfo"; public static final String PARAMETER_TOPIC = "topic"; public static final String PARAMETER_TOPIC_OBJECT = "topicObject"; public static final String PARAMETER_VIRTUAL_WIKI = "virtualWiki"; public static final String PARAMETER_WATCHLIST = "watchlist"; private static final String SPRING_REDIRECT_PREFIX = "redirect:"; /** * */ private ServletUtil() { } /** * This method ensures that the left menu, logo, and other required values * have been loaded into the session object. * * @param request The servlet request object. * @param next A ModelAndView object corresponding to the page being * constructed. */ private static void buildLayout(HttpServletRequest request, ModelAndView next) { String virtualWikiName = WikiUtil.getVirtualWikiFromURI(request); if (virtualWikiName == null) { logger.severe("No virtual wiki available for page request " + request.getRequestURI()); virtualWikiName = WikiBase.DEFAULT_VWIKI; } VirtualWiki virtualWiki = retrieveVirtualWiki(virtualWikiName); // build the layout contents String leftMenu = ServletUtil.cachedContent(request.getContextPath(), request.getLocale(), virtualWikiName, WikiBase.SPECIAL_PAGE_LEFT_MENU, true); next.addObject("leftMenu", leftMenu); next.addObject("defaultTopic", virtualWiki.getDefaultTopicName()); next.addObject("virtualWiki", virtualWiki.getName()); next.addObject("logo", Environment.getValue(Environment.PROP_BASE_LOGO_IMAGE)); String bottomArea = ServletUtil.cachedContent(request.getContextPath(), request.getLocale(), virtualWiki.getName(), WikiBase.SPECIAL_PAGE_BOTTOM_AREA, true); next.addObject("bottomArea", bottomArea); next.addObject(ServletUtil.PARAMETER_VIRTUAL_WIKI, virtualWiki.getName()); Integer cssRevision = new Integer(0); try { cssRevision = WikiBase.getDataHandler().lookupTopic(virtualWiki.getName(), WikiBase.SPECIAL_PAGE_STYLESHEET, false, null).getCurrentVersionId(); } catch (Exception e) {} next.addObject("cssRevision", cssRevision); } /** * Build a map of links and the corresponding link text to be used as the * tab menu links for the WikiPageInfo object. */ private static LinkedHashMap buildTabMenu(HttpServletRequest request, WikiPageInfo pageInfo) { LinkedHashMap links = new LinkedHashMap(); WikiUser user = WikiUtil.currentUser(); String pageName = pageInfo.getTopicName(); String virtualWiki = WikiUtil.getVirtualWikiFromURI(request); try { if (pageInfo.getAdmin()) { if (user.hasRole(Role.ROLE_SYSADMIN)) { links.put("Special:Admin", new WikiMessage("tab.admin.configuration")); links.put("Special:Maintenance", new WikiMessage("tab.admin.maintenance")); links.put("Special:Roles", new WikiMessage("tab.admin.roles")); } if (user.hasRole(Role.ROLE_TRANSLATE)) { links.put("Special:Translation", new WikiMessage("tab.admin.translations")); } } else if (pageInfo.getSpecial()) { links.put(pageName, new WikiMessage("tab.common.special")); } else { String article = WikiUtil.extractTopicLink(pageName); String comments = WikiUtil.extractCommentsLink(pageName); links.put(article, new WikiMessage("tab.common.article")); links.put(comments, new WikiMessage("tab.common.comments")); if (ServletUtil.isEditable(virtualWiki, pageName, user)) { String editLink = "Special:Edit?topic=" + Utilities.encodeForURL(pageName); if (StringUtils.hasText(request.getParameter("topicVersionId"))) { editLink += "&topicVersionId=" + request.getParameter("topicVersionId"); } links.put(editLink, new WikiMessage("tab.common.edit")); } String historyLink = "Special:History?topic=" + Utilities.encodeForURL(pageName); links.put(historyLink, new WikiMessage("tab.common.history")); if (ServletUtil.isMoveable(virtualWiki, pageName, user)) { String moveLink = "Special:Move?topic=" + Utilities.encodeForURL(pageName); links.put(moveLink, new WikiMessage("tab.common.move")); } if (user.hasRole(Role.ROLE_USER)) { Watchlist watchlist = WikiUtil.currentWatchlist(request, virtualWiki); boolean watched = (watchlist.containsTopic(pageName)); String watchlistLabel = (watched) ? "tab.common.unwatch" : "tab.common.watch"; String watchlistLink = "Special:Watchlist?topic=" + Utilities.encodeForURL(pageName); links.put(watchlistLink, new WikiMessage(watchlistLabel)); } if (pageInfo.isUserPage()) { WikiLink wikiLink = LinkUtil.parseWikiLink(pageName); String contributionsLink = "Special:Contributions?contributor=" + Utilities.encodeForURL(wikiLink.getArticle()); links.put(contributionsLink, new WikiMessage("tab.common.contributions")); } String linkToLink = "Special:LinkTo?topic=" + Utilities.encodeForURL(pageName); links.put(linkToLink, new WikiMessage("tab.common.links")); if (user.hasRole(Role.ROLE_ADMIN)) { String manageLink = "Special:Manage?topic=" + Utilities.encodeForURL(pageName); links.put(manageLink, new WikiMessage("tab.common.manage")); } String printLink = "Special:Print?topic=" + Utilities.encodeForURL(pageName); links.put(printLink, new WikiMessage("tab.common.print")); } } catch (Exception e) { logger.severe("Unable to build tabbed menu links", e); } return links; } /** * Build a map of links and the corresponding link text to be used as the * user menu links for the WikiPageInfo object. */ private static LinkedHashMap buildUserMenu() { LinkedHashMap links = new LinkedHashMap(); WikiUser user = WikiUtil.currentUser(); if (user.hasRole(Role.ROLE_ANONYMOUS) && !user.hasRole(Role.ROLE_EMBEDDED)) { links.put("Special:Login", new WikiMessage("common.login")); links.put("Special:Account", new WikiMessage("usermenu.register")); } if (user.hasRole(Role.ROLE_USER)) { String userPage = NamespaceHandler.NAMESPACE_USER + NamespaceHandler.NAMESPACE_SEPARATOR + user.getUsername(); String userCommentsPage = NamespaceHandler.NAMESPACE_USER_COMMENTS + NamespaceHandler.NAMESPACE_SEPARATOR + user.getUsername(); String username = user.getUsername(); if (StringUtils.hasText(user.getDisplayName())) { username = user.getDisplayName(); } links.put(userPage, new WikiMessage("usermenu.user", username)); links.put(userCommentsPage, new WikiMessage("usermenu.usercomments")); links.put("Special:Watchlist", new WikiMessage("usermenu.watchlist")); } if (user.hasRole(Role.ROLE_USER) && !user.hasRole(Role.ROLE_NO_ACCOUNT)) { links.put("Special:Account", new WikiMessage("usermenu.account")); } if (user.hasRole(Role.ROLE_USER) && !user.hasRole(Role.ROLE_EMBEDDED)) { links.put("Special:Logout", new WikiMessage("common.logout")); } if (user.hasRole(Role.ROLE_SYSADMIN)) { links.put("Special:Admin", new WikiMessage("usermenu.admin")); } else if (user.hasRole(Role.ROLE_TRANSLATE)) { links.put("Special:Translation", new WikiMessage("tab.admin.translations")); } return links; } /** * Retrieve the content of a topic from the cache, or if it is not yet in * the cache then add it to the cache. * * @param context The servlet context for the topic being retrieved. May * be <code>null</code> if the <code>cook</code> parameter is set to * <code>false</code>. * @param locale The locale for the topic being retrieved. May be * <code>null</code> if the <code>cook</code> parameter is set to * <code>false</code>. * @param virtualWiki The virtual wiki for the topic being retrieved. * @param topicName The name of the topic being retrieved. * @param cook A parameter indicating whether or not the content should be * parsed before it is added to the cache. Stylesheet content (CSS) is not * parsed, but most other content is parsed. * @return The parsed or unparsed (depending on the <code>cook</code> * parameter) topic content. */ protected static String cachedContent(String context, Locale locale, String virtualWiki, String topicName, boolean cook) { String content = null; String key = WikiCache.key(virtualWiki, topicName); Element cacheElement = WikiCache.retrieveFromCache(WikiBase.CACHE_PARSED_TOPIC_CONTENT, key); if (cacheElement != null) { content = (String)cacheElement.getObjectValue(); return (content == null) ? null : new String(content); } try { Topic topic = WikiBase.getDataHandler().lookupTopic(virtualWiki, topicName, false, null); content = topic.getTopicContent(); if (cook) { ParserInput parserInput = new ParserInput(); parserInput.setContext(context); parserInput.setLocale(locale); parserInput.setVirtualWiki(virtualWiki); parserInput.setTopicName(topicName); content = WikiUtil.parse(parserInput, null, content); } WikiCache.addToCache(WikiBase.CACHE_PARSED_TOPIC_CONTENT, key, content); } catch (Exception e) { logger.warning("error getting cached page " + virtualWiki + " / " + topicName, e); return null; } return content; } /** * Initialize topic values for a Topic object. This method will check to * see if a topic with the specified name exists, and if it does exist * then that topic will be returned. Otherwise a new topic will be * initialized, setting initial parameters such as topic name, virtual * wiki, and topic type. * * @param virtualWiki The virtual wiki name for the topic being * initialized. * @param topicName The name of the topic being initialized. * @return A new topic object with basic fields initialized, or if a topic * with the given name already exists then the pre-existing topic is * returned. * @throws Exception Thrown if any error occurs while retrieving or * initializing the topic object. */ protected static Topic initializeTopic(String virtualWiki, String topicName) throws Exception { WikiUtil.validateTopicName(topicName); Topic topic = WikiBase.getDataHandler().lookupTopic(virtualWiki, topicName, false, null); if (topic != null) { return topic; } topic = new Topic(); topic.setName(topicName); topic.setVirtualWiki(virtualWiki); WikiLink wikiLink = LinkUtil.parseWikiLink(topicName); String namespace = wikiLink.getNamespace(); if (namespace != null) { if (namespace.equals(NamespaceHandler.NAMESPACE_CATEGORY)) { topic.setTopicType(Topic.TYPE_CATEGORY); } else if (namespace.equals(NamespaceHandler.NAMESPACE_TEMPLATE)) { topic.setTopicType(Topic.TYPE_TEMPLATE); } } return topic; } /** * Determine if a user has permission to edit a topic. * * @param virtualWiki The virtual wiki name for the topic in question. * @param topicName The name of the topic in question. * @param user The current Wiki user, or <code>null</code> if there is * no current user. * @return <code>true</code> if the user is allowed to edit the topic, * <code>false</code> otherwise. */ protected static boolean isEditable(String virtualWiki, String topicName, WikiUser user) throws Exception { if (user == null || !user.hasRole(Role.ROLE_EDIT_EXISTING)) { // user does not have appropriate permissions return false; } if (!user.hasRole(Role.ROLE_EDIT_NEW) && WikiBase.getDataHandler().lookupTopic(virtualWiki, topicName, false, null) == null) { // user does not have appropriate permissions return false; } Topic topic = WikiBase.getDataHandler().lookupTopic(virtualWiki, topicName, false, null); if (topic == null) { // new topic, edit away... return true; } if (topic.getAdminOnly() && (user == null || !user.hasRole(Role.ROLE_ADMIN))) { return false; } if (topic.getReadOnly()) { return false; } return true; } /** * Determine if a user has permission to move a topic. * * @param virtualWiki The virtual wiki name for the topic in question. * @param topicName The name of the topic in question. * @param user The current Wiki user, or <code>null</code> if there is * no current user. * @return <code>true</code> if the user is allowed to move the topic, * <code>false</code> otherwise. */ protected static boolean isMoveable(String virtualWiki, String topicName, WikiUser user) throws Exception { if (user == null || !user.hasRole(Role.ROLE_MOVE)) { // no permission granted to move pages return false; } Topic topic = WikiBase.getDataHandler().lookupTopic(virtualWiki, topicName, false, null); if (topic == null) { // cannot move a topic that doesn't exist return false; } if (topic.getReadOnly()) { return false; } if (topic.getAdminOnly() && (user == null || !user.hasRole(Role.ROLE_ADMIN))) { return false; } return true; } /** * Examine the request object, and see if the requested topic or page * matches a given value. * * @param request The servlet request object. * @param value The value to match against the current topic or page name. * @return <code>true</code> if the value matches the current topic or * page name, <code>false</code> otherwise. */ protected static boolean isTopic(HttpServletRequest request, String value) { try { String topic = WikiUtil.getTopicFromURI(request); if (!StringUtils.hasText(topic)) { return false; } if (value != null && topic.equals(value)) { return true; } } catch (Exception e) {} return false; } /** * Utility method for adding categories associated with the current topic * to the ModelAndView object. This method adds a hashmap of category * names and sort keys to the session that can then be retrieved for * display during rendering. * * @param next The current ModelAndView object used to return rendering * information. * @param virtualWiki The virtual wiki name for the topic being rendered. * @param topicName The name of the topic that is being rendered. */ protected static void loadCategoryContent(ModelAndView next, String virtualWiki, String topicName) throws Exception { String categoryName = topicName.substring(NamespaceHandler.NAMESPACE_CATEGORY.length() + NamespaceHandler.NAMESPACE_SEPARATOR.length()); next.addObject("categoryName", categoryName); Collection categoryTopics = WikiBase.getDataHandler().lookupCategoryTopics(virtualWiki, topicName, Topic.TYPE_ARTICLE); next.addObject("categoryTopics", categoryTopics); next.addObject("numCategoryTopics", new Integer(categoryTopics.size())); Collection categoryImages = WikiBase.getDataHandler().lookupCategoryTopics(virtualWiki, topicName, Topic.TYPE_IMAGE); next.addObject("categoryImages", categoryImages); next.addObject("numCategoryImages", new Integer(categoryImages.size())); Collection tempSubcategories = WikiBase.getDataHandler().lookupCategoryTopics(virtualWiki, topicName, Topic.TYPE_CATEGORY); LinkedHashMap subCategories = new LinkedHashMap(); for (Iterator iterator = tempSubcategories.iterator(); iterator.hasNext();) { Category category = (Category)iterator.next(); String value = category.getChildTopicName().substring(NamespaceHandler.NAMESPACE_CATEGORY.length() + NamespaceHandler.NAMESPACE_SEPARATOR.length()); subCategories.put(category.getChildTopicName(), value); } next.addObject("subCategories", subCategories); next.addObject("numSubCategories", new Integer(subCategories.size())); } /** * This method ensures that values required for rendering a JSP page have * been loaded into the ModelAndView object. Examples of values that * may be handled by this method include topic name, username, etc. * * @param request The current servlet request object. * @param next The current ModelAndView object. * @param pageInfo The current WikiPageInfo object, containing basic page * rendering information. */ protected static void loadDefaults(HttpServletRequest request, ModelAndView next, WikiPageInfo pageInfo) throws Exception { if (next.getViewName() != null && next.getViewName().startsWith(ServletUtil.SPRING_REDIRECT_PREFIX)) { // if this is a redirect, no need to load anything return; } // load cached top area, nav bar, etc. ServletUtil.buildLayout(request, next); if (!StringUtils.hasText(pageInfo.getTopicName())) { pageInfo.setTopicName(WikiUtil.getTopicFromURI(request)); } pageInfo.setUserMenu(ServletUtil.buildUserMenu()); pageInfo.setTabMenu(ServletUtil.buildTabMenu(request, pageInfo)); next.addObject(ServletUtil.PARAMETER_PAGE_INFO, pageInfo); } /** * Utility method for parsing a multipart servlet request. This method returns * an iterator of FileItem objects that corresponds to the request. * * @param request The servlet request containing the multipart request. * @return Returns an iterator of FileItem objects the corresponds to the request. * @throws Exception Thrown if any problems occur while processing the request. */ protected static Iterator processMultipartRequest(HttpServletRequest request) throws Exception { // Create a factory for disk-based file items DiskFileItemFactory factory = new DiskFileItemFactory(); factory.setRepository(new File(Environment.getValue(Environment.PROP_FILE_DIR_FULL_PATH))); ServletFileUpload upload = new ServletFileUpload(factory); upload.setHeaderEncoding("UTF-8"); upload.setSizeMax(Environment.getLongValue(Environment.PROP_FILE_MAX_FILE_SIZE)); return upload.parseRequest(request).iterator(); } /** * Modify the current ModelAndView object to create a Spring redirect * response, meaning that the view name becomes "redirect:" followed by * the redirection target. * * @param next The current ModelAndView object, which will be reset by * this method. * @param virtualWiki The virtual wiki name for the page being redirected * to. * @param destination The topic or page name that is the redirection * target. An example might be "Special:Login". */ protected static void redirect(ModelAndView next, String virtualWiki, String destination) throws Exception { String target = LinkUtil.buildInternalLinkUrl(null, virtualWiki, destination); String view = ServletUtil.SPRING_REDIRECT_PREFIX + target; next.clear(); next.setViewName(view); } /** * Given a virtual wiki name, return a <code>VirtualWiki</code> object. * If there is no virtual wiki available with the given name then the * default virtual wiki is returned. * * @param virtualWikiName The name of the virtual wiki that is being * retrieved. * @return A <code>VirtualWiki</code> object. If there is no virtual * wiki available with the given name then the default virtual wiki is * returned. */ public static VirtualWiki retrieveVirtualWiki(String virtualWikiName) { VirtualWiki virtualWiki = null; if (virtualWikiName == null) { virtualWikiName = WikiBase.DEFAULT_VWIKI; } // FIXME - the check here for initialized properties is due to this // change being made late in a release cycle. Revisit in a future // release & clean this up. if (Environment.getBooleanValue(Environment.PROP_BASE_INITIALIZED)) { try { virtualWiki = WikiBase.getDataHandler().lookupVirtualWiki(virtualWikiName); } catch (Exception e) {} } if (virtualWiki == null) { logger.severe("No virtual wiki found for " + virtualWikiName); virtualWiki.setName(WikiBase.DEFAULT_VWIKI); virtualWiki.setDefaultTopicName(Environment.getValue(Environment.PROP_BASE_DEFAULT_TOPIC)); } return virtualWiki; } /** * Utility method used when redirecting to an error page. * * @param request The servlet request object. * @param t The exception that is the source of the error. * @return Returns a ModelAndView object corresponding to the error page display. */ protected static ModelAndView viewError(HttpServletRequest request, Throwable t) { if (!(t instanceof WikiException)) { logger.severe("Servlet error", t); } ModelAndView next = new ModelAndView("wiki"); WikiPageInfo pageInfo = new WikiPageInfo(); pageInfo.setPageTitle(new WikiMessage("error.title")); pageInfo.setContentJsp(JSP_ERROR); pageInfo.setSpecial(true); if (t instanceof WikiException) { WikiException we = (WikiException)t; next.addObject("messageObject", we.getWikiMessage()); } else { next.addObject("messageObject", new WikiMessage("error.unknown", t.toString())); } try { ServletUtil.loadDefaults(request, next, pageInfo); } catch (Exception err) { logger.severe("Unable to load default layout", err); } return next; } /** * Utility method used when redirecting to a login page. * * @param request The servlet request object. * @param pageInfo The current WikiPageInfo object, which contains * information needed for rendering the final JSP page. * @param topic The topic to be redirected to. Valid examples are * "Special:Admin", "StartingPoints", etc. * @param messageObject A WikiMessage object to be displayed on the login * page. * @return Returns a ModelAndView object corresponding to the login page * display. * @throws Exception Thrown if any error occurs during processing. */ protected static ModelAndView viewLogin(HttpServletRequest request, WikiPageInfo pageInfo, String topic, WikiMessage messageObject) throws Exception { ModelAndView next = new ModelAndView("wiki"); pageInfo.reset(); String virtualWikiName = WikiUtil.getVirtualWikiFromURI(request); String target = request.getParameter("target"); if (!StringUtils.hasText(target)) { if (!StringUtils.hasText(topic)) { VirtualWiki virtualWiki = WikiBase.getDataHandler().lookupVirtualWiki(virtualWikiName); topic = virtualWiki.getDefaultTopicName(); } target = topic; if (StringUtils.hasText(request.getQueryString())) { target += "?" + request.getQueryString(); } } next.addObject("target", target); pageInfo.setPageTitle(new WikiMessage("login.title")); pageInfo.setContentJsp(JSP_LOGIN); pageInfo.setSpecial(true); if (messageObject != null) { next.addObject("messageObject", messageObject); } return next; } /** * Utility method used when viewing a topic. * * @param request The current servlet request object. * @param next The current Spring ModelAndView object. * @param pageInfo The current WikiPageInfo object, which contains * information needed for rendering the final JSP page. * @param topicName The topic being viewed. This value must be a valid * topic that can be loaded as a org.jamwiki.model.Topic object. * @throws Exception Thrown if any error occurs during processing. */ protected static void viewTopic(HttpServletRequest request, ModelAndView next, WikiPageInfo pageInfo, String topicName) throws Exception { String virtualWiki = WikiUtil.getVirtualWikiFromURI(request); if (!StringUtils.hasText(virtualWiki)) { virtualWiki = WikiBase.DEFAULT_VWIKI; } Topic topic = ServletUtil.initializeTopic(virtualWiki, topicName); if (topic.getTopicId() <= 0) { // topic does not exist, display empty page next.addObject("notopic", new WikiMessage("topic.notcreated", topicName)); } WikiMessage pageTitle = new WikiMessage("topic.title", topicName); viewTopic(request, next, pageInfo, pageTitle, topic, true); } /** * Utility method used when viewing a topic. * * @param request The current servlet request object. * @param next The current Spring ModelAndView object. * @param pageInfo The current WikiPageInfo object, which contains * information needed for rendering the final JSP page. * @param pageTitle The title of the page being rendered. * @param topic The Topic object for the topic being displayed. * @param sectionEdit Set to <code>true</code> if edit links should be displayed * for each section of the topic. * @throws Exception Thrown if any error occurs during processing. */ protected static void viewTopic(HttpServletRequest request, ModelAndView next, WikiPageInfo pageInfo, WikiMessage pageTitle, Topic topic, boolean sectionEdit) throws Exception { // FIXME - what should the default be for topics that don't exist? if (topic == null) { throw new WikiException(new WikiMessage("common.exception.notopic")); } WikiUtil.validateTopicName(topic.getName()); if (topic.getTopicType() == Topic.TYPE_REDIRECT && (request.getParameter("redirect") == null || !request.getParameter("redirect").equalsIgnoreCase("no"))) { Topic child = WikiUtil.findRedirectedTopic(topic, 0); if (!child.getName().equals(topic.getName())) { pageInfo.setRedirectName(topic.getName()); pageTitle = new WikiMessage("topic.title", child.getName()); topic = child; } } String virtualWiki = topic.getVirtualWiki(); String topicName = topic.getName(); WikiUser user = WikiUtil.currentUser(); if (sectionEdit && !ServletUtil.isEditable(virtualWiki, topicName, user)) { sectionEdit = false; } ParserInput parserInput = new ParserInput(); parserInput.setContext(request.getContextPath()); parserInput.setLocale(request.getLocale()); parserInput.setWikiUser(user); parserInput.setTopicName(topicName); parserInput.setUserIpAddress(request.getRemoteAddr()); parserInput.setVirtualWiki(virtualWiki); parserInput.setAllowSectionEdit(sectionEdit); ParserDocument parserDocument = new ParserDocument(); String content = WikiUtil.parse(parserInput, parserDocument, topic.getTopicContent()); // FIXME - the null check should be unnecessary if (parserDocument != null && parserDocument.getCategories().size() > 0) { LinkedHashMap categories = new LinkedHashMap(); for (Iterator iterator = parserDocument.getCategories().keySet().iterator(); iterator.hasNext();) { String key = (String)iterator.next(); String value = key.substring(NamespaceHandler.NAMESPACE_CATEGORY.length() + NamespaceHandler.NAMESPACE_SEPARATOR.length()); categories.put(key, value); } next.addObject("categories", categories); } topic.setTopicContent(content); if (topic.getTopicType() == Topic.TYPE_CATEGORY) { loadCategoryContent(next, virtualWiki, topic.getName()); } if (topic.getTopicType() == Topic.TYPE_IMAGE || topic.getTopicType() == Topic.TYPE_FILE) { Collection fileVersions = WikiBase.getDataHandler().getAllWikiFileVersions(virtualWiki, topicName, true); for (Iterator iterator = fileVersions.iterator(); iterator.hasNext();) { // update version urls to include web root path WikiFileVersion fileVersion = (WikiFileVersion)iterator.next(); String url = FilenameUtils.normalize(Environment.getValue(Environment.PROP_FILE_DIR_RELATIVE_PATH) + "/" + fileVersion.getUrl()); url = FilenameUtils.separatorsToUnix(url); fileVersion.setUrl(url); } next.addObject("fileVersions", fileVersions); if (topic.getTopicType() == Topic.TYPE_IMAGE) { next.addObject("topicImage", new Boolean(true)); } else { next.addObject("topicFile", new Boolean(true)); } } pageInfo.setSpecial(false); pageInfo.setTopicName(topicName); next.addObject(ServletUtil.PARAMETER_TOPIC_OBJECT, topic); if (pageTitle != null) { pageInfo.setPageTitle(pageTitle); } } /** * Utility method for setting a cookie. This method will overwrite an existing * cookie of the same name if such a cookie already exists. * * @param response The servlet response object. * @param cookieName The name of the cookie to be set. * @param cookieValue The value of the cookie to be set. * @param cookieAge The length of time before the cookie expires, specified in seconds. * @throws Exception Thrown if any error occurs while setting cookie values. */ public static void addCookie(HttpServletResponse response, String cookieName, String cookieValue, int cookieAge) throws Exception { Cookie cookie = null; // after confirming credentials cookie = new Cookie(cookieName, cookieValue); cookie.setMaxAge(cookieAge); response.addCookie(cookie); } }
[ "wrh2@f65b7e76-0091-dd46-87ae-4bc0c949c03e" ]
wrh2@f65b7e76-0091-dd46-87ae-4bc0c949c03e
6d8ba9acab8cda30f013ae24921c1879d0e926e1
929db90b02d8d43acfa343f934cb87ddadcebc01
/app/src/main/java/com/example/user/moviedata/PublicStrings.java
dcd051a2cdad06b6b4c79de27c104460a7fae40a
[]
no_license
PhillBenoit/MovieData
fae80c4567fc12c69285ffb36e8fa1a465ed4247
4c1d2b5942bea1bc554da398c3512cf141f096c3
refs/heads/master
2021-01-01T04:53:13.288600
2017-08-20T20:02:20
2017-08-20T20:02:20
97,260,775
0
0
null
null
null
null
UTF-8
Java
false
false
1,541
java
package com.example.user.moviedata; import android.content.Context; //strings used throughout the program public class PublicStrings { private static String getFromRes(int id, Context c) { return c.getString(id); } public static String BASE_IMAGE_URL(Context c) {return getFromRes(R.string.picture_url, c);} public static final String //intent item names details_intent_item = "MOVIE_PARCEL", poster_intent_item_url = "POSTER_URL", poster_intent_item_id = "MOVIE_ID", reviews_intent_item = "ID", //favorites labels add_favorite = "Add To Favorites", remove_favorite = "Remove From Favorites", //output for details release_date_prefix = "Release Date: ", popularity_prefix = "Popularity: ", vote_average_prefix = "Vote Average: ", poster_not_available_message = "POSTER NOT AVAILABLE", //Used in MovieDataObject to start all url image returns base_image_url = "https://image.tmdb.org/t/p/w500", //Used to help find null URLs null_string = "null", //Base search URL used to build search queries base_search_url = "https://api.themoviedb.org/3/movie/%s?api_key=%s", //Base reviews/trailers URL base_details_url = "https://api.themoviedb.org/3/movie/%d/%s?api_key=%s&language=en-US", //base youtube url base_youtube_url = "http://www.youtube.com/watch?v=%s"; }
[ "phillbenoit@users.noreply.github.com" ]
phillbenoit@users.noreply.github.com
dba507e5aaf8ea0cd2cbd342564166efebd777eb
18038c59a38c511ca97041370a1f29ada36e8ee4
/pay-autotest-web/src/main/java/com/gigold/pay/autotest/rspDto/IfSysMockInfoRspDto.java
ba9b698dbc14322f22f6998ba3173b9d7eac6f67
[]
no_license
MRchenkuan/autotest
83485cff08fd7d97f404cc5dbcbaa1b449d381fc
641c3298321d5f90c91953383b158e7f5c37ac88
refs/heads/master
2021-06-18T20:10:53.180956
2019-09-02T08:09:08
2019-09-02T08:09:09
205,807,379
0
0
null
2021-06-04T02:10:16
2019-09-02T08:07:12
Java
UTF-8
Java
false
false
1,401
java
/** * Title: IfSysMockRspDto.java<br/> * Description: <br/> * Copyright: Copyright (c) 2015<br/> * Company: gigold<br/> * */ package com.gigold.pay.autotest.rspDto; import com.gigold.pay.autotest.bo.IfSysMock; import com.gigold.pay.framework.core.ResponseDto; import java.util.List; /** * Title: IfSysMockRspDto<br/> * Description: <br/> * Company: gigold<br/> * * @author xiebin * @date 2015年12月2日下午1:36:56 * */ public class IfSysMockInfoRspDto extends ResponseDto { /** serialVersionUID */ private static final long serialVersionUID = 1L; private IfSysMock mock; private List mockFieldReferList; private List mockReferList; private List referTo; private List relayOn; public List getReferTo() { return referTo; } public void setReferTo(List referTo) { this.referTo = referTo; } public List getRelayOn() { return relayOn; } public void setRelayOn(List relayOn) { this.relayOn = relayOn; } public List getMockFieldReferList() { return mockFieldReferList; } public void setMockFieldReferList(List mockFieldReferList) { this.mockFieldReferList = mockFieldReferList; } public List getMockReferList() { return mockReferList; } public void setMockReferList(List mockReferList) { this.mockReferList = mockReferList; } public IfSysMock getMock() { return mock; } public void setMock(IfSysMock mock) { this.mock = mock; } }
[ "393667111@qq.com" ]
393667111@qq.com
3fe93abb2a4c371210b1413543048e3be039cc16
9ecec61d51e5a53ecc87290190aeb90962a324d2
/src/rover/Location.java
ae55748c2e9f8c1a047f717a4a7ba470559bec0c
[]
no_license
trikitrok/MarsRoverKataByThreeApprentices
caddb8c787abeaad0d356024a98d6799b7acdda0
ec47034a6668ab5d1adf91d32d89feb55d9c797d
refs/heads/master
2016-09-06T19:08:29.981071
2014-05-12T01:57:21
2014-05-12T01:57:21
18,614,589
0
0
null
null
null
null
UTF-8
Java
false
false
1,992
java
package rover; import rover.location.Orientation; import rover.location.Position; import rover.worlds.ObstacleFoundException; public class Location { private Position position; private Orientation orientation; private World world; public Location(Position position, Orientation orientation, World world) { this.position = position; this.orientation = orientation; this.world = world; } public Location displace(int displacement) { Position tentativePosition = this.orientation.move(displacement, this.position); if (this.world.hasObstacleAt(tentativePosition)) { throw new ObstacleFoundException(); } Position newPosition = this.world.wrap(tentativePosition); return new Location(newPosition, this.orientation, this.world); } public Location rotateLeft() { return new Location(this.position, this.orientation.rotateLeft(), this.world); } public Location rotateRight() { return new Location(this.position, this.orientation.rotateRight(), this.world); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Location other = (Location) obj; if (orientation != other.orientation) return false; if (position == null) { if (other.position != null) return false; } else if (!position.equals(other.position)) return false; if (world == null) { if (other.world != null) return false; } else if (!world.equals(other.world)) return false; return true; } @Override public String toString() { return "Location [position=" + position + ", orientation=" + orientation + ", world=" + world + "]"; } }
[ "trikitrok@gmail.com" ]
trikitrok@gmail.com
f9239268ad9f3930636493adbf5b3baae094a4dc
f0ec6e0dedd677d6c0a3eab9b5aad51d17fdcb26
/src/com/highradius/spring/managerImpl/SakilaManager.java
d7043ac04dc91632d5e62433eb851d92830374a0
[]
no_license
geek1822/Sakila-Movie
fd1850cdbec90765c0ab739273decaa45d24e27f
744ab2c5e57a726ab9fbb6a10c97986df8ad530b
refs/heads/main
2023-08-12T10:10:24.720302
2021-10-18T14:21:38
2021-10-18T14:21:38
418,412,202
0
0
null
null
null
null
UTF-8
Java
false
false
1,820
java
package com.highradius.spring.managerImpl; import java.util.HashMap; import com.highradius.spring.daoImpl.SakilaDao; import com.highradius.spring.manager.SakilaManagerInterface; import com.highradius.spring.model.FilmPojo; public class SakilaManager implements SakilaManagerInterface{ // Sakila DAO Object Instance private SakilaDao sakilaDao; public SakilaDao getSakilaDao() { return sakilaDao; } public void setSakilaDao(SakilaDao sakilaDao) { this.sakilaDao = sakilaDao; } // Data Sanity Check for NULL [Handling Corner Cases] public FilmPojo dataSanityCheck(FilmPojo obj) { if(obj.getDescription() == "") obj.setDescription(null); if(obj.getRelease_year() == null || obj.getRelease_year() == 0) obj.setRelease_year(null); if(obj.getLanguage_name() == "") obj.setLanguage_name("English"); // if(obj.getDirector() == "") // obj.setDirector(" "); if(obj.getRating() == "") obj.setRating(null); if(obj.getSpecial_features() == "") obj.setSpecial_features(null); return obj; } public HashMap<String, Object> getSakilaData(Integer start, Integer limit) { return sakilaDao.getSakilaData(start, limit); } public HashMap<String, Object> getSakilaLangData() { return sakilaDao.getSakilaLangData(); } public HashMap<String, Object> addSakilaData(FilmPojo obj) { return sakilaDao.addSakilaData(dataSanityCheck(obj)); } public HashMap<String, Object> editSakilaData(FilmPojo obj) { return sakilaDao.editSakilaData(dataSanityCheck(obj)); } public HashMap<String, Object> deleteSakilaData(String del_filmIds) { return sakilaDao.deleteSakilaData(del_filmIds); } }
[ "noreply@github.com" ]
noreply@github.com
9da975042192ce06cf5d8830784d1003ab9910dc
b67a6e6dc7249f3ff02d6c21bb6e84e7576854a4
/src/java/grabamovie/core/OrderCancelledException.java
5a7a2cfacdeb34f08b16ed0fae973e812210640b
[]
no_license
Zyniel/GrabAMovie
b6584fe01808adc433e3ad3a867ae842969d1ce7
8a687ff707aaa7d088b085a6f6e1631cb3774846
refs/heads/master
2016-09-06T13:28:01.737884
2014-08-23T14:43:28
2014-08-23T14:43:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
403
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package grabamovie.core; /** * * @author OCanada */ public class OrderCancelledException extends Exception { public OrderCancelledException() { super("Order has been cancelled."); } public OrderCancelledException(String message) { super(message); } }
[ "cabannes.francois.divers@gmail.com" ]
cabannes.francois.divers@gmail.com
d9dfab1343b1cfa2f02734d7b2413c872938618c
2aaab47eeade7e088a157eba087dad52ec848640
/src/main/java/com/staples/search/controllers/LoginController.java
3c76095a6956f76ebb928a8ee91b257615763d7b
[]
no_license
yinchao2/spring-tutorial
4a3fecffb9d31db3e6c60a44c6eafc944ab48ebc
49ae964daccf8f13cd93e4e8599c571f2610bde8
refs/heads/master
2016-09-05T16:05:31.292817
2015-01-11T06:24:43
2015-01-11T06:24:43
27,193,190
0
0
null
2015-01-11T06:24:44
2014-11-26T19:41:14
Java
UTF-8
Java
false
false
2,707
java
package com.staples.search.controllers; import java.security.Principal; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.validation.BindingResult; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import com.staples.search.dao.FormValidationGroup; import com.staples.search.dao.Message; import com.staples.search.dao.User; import com.staples.search.service.UsersService; @Controller public class LoginController { private UsersService usersService; @Autowired public void setUserService(UsersService userService) { this.usersService = userService; } @RequestMapping("/login") public String showLogin() { return "login"; } @RequestMapping("/denied") public String showDenied() { return "denied"; } @RequestMapping("/messages") public String showMessages() { return "messages"; } @RequestMapping("/admin") public String showAdmin(Model model) { model.addAttribute("users", usersService.getAllUsers()); return "admin"; } @RequestMapping("/loggedout") public String showLoggedOut() { return "loggedout"; } @RequestMapping("/newaccount") public String showNewAccount(Model model) { model.addAttribute("user", new User()); return "newaccount"; } @RequestMapping(value="/createaccount", method=RequestMethod.POST) public String createAccount(@Validated(FormValidationGroup.class) User user, BindingResult result) { if(result.hasErrors()) { return "newaccount"; } // check if username already exist if(usersService.exists(user.getUsername())) { result.rejectValue("username", "DuplicateKey.user.username"); return "newaccount"; } user.setAuthority("ROLE_USER"); user.setEnabled(true); usersService.create(user); return "accountcreated"; } @RequestMapping(value="/getmessages", method=RequestMethod.GET, produces="application/json") @ResponseBody public Map<String, Object> getMessages(Principal principal) { List<Message> messages = null; if(principal == null) { messages = new ArrayList<Message>(); } else { String username = principal.getName(); messages = usersService.getMessages(username); } Map<String, Object> data = new HashMap<String, Object>(); data.put("messages", messages); data.put("number", messages.size()); return data; } }
[ "yin_chao@ymail.com" ]
yin_chao@ymail.com
64a4364eaef86f0d6831bd00862eefc1e584a728
6716d4897f0fdf9fbe7a8061a09f9bbcfc52b87a
/bytebank-herdado-conta/src/TesteContas.java
0f07de6a3f4494896fc79d64af9ca7a29722a73f
[]
no_license
jpferreiradev/carreirajavaalura
7f4b945780936b471b2b7cec2a6a0ccc32576885
236d483459afcbc7f4c03e7d94157632ccb52052
refs/heads/master
2022-04-15T05:58:41.861930
2020-04-08T15:02:15
2020-04-08T15:02:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
358
java
public class TesteContas { public static void main(String[] args) { ContaCorrente cc = new ContaCorrente(111, 111); cc.deposita(100.0); ContaPoupanca cp = new ContaPoupanca(222, 222); cp.deposita(200.0); cc.transfere(10.0, cp); System.out.println("CC:" + cc.getSaldo()); System.out.println("CP:"+ cp.getSaldo()); } }
[ "jotepauder01@gmail.com" ]
jotepauder01@gmail.com
61f2b2694033922755d74d636b21a5f9c537bed8
5faa149c78c3e2563203587967f7df0eb054bec5
/MybatisDao/src/main/java/makoto/service/ServiceDemo.java
caad5f519a6ea719253fbca72798464246e6bf2d
[]
no_license
makotogu/Java_SSM_learning
ba44bd2daa38844cdf93b2be5b6df275a1136603
bbb21ea2706ade25deaaf08d27d4e700e9ad3415
refs/heads/main
2023-06-08T04:22:21.530012
2021-06-29T02:12:34
2021-06-29T02:12:34
380,472,150
8
2
null
2021-06-29T02:12:35
2021-06-26T10:13:38
JavaScript
UTF-8
Java
false
false
935
java
package makoto.service; import makoto.dao.UserMapper; import makoto.domain.User; import org.apache.ibatis.io.Resources; import org.apache.ibatis.session.SqlSession; import org.apache.ibatis.session.SqlSessionFactory; import org.apache.ibatis.session.SqlSessionFactoryBuilder; import java.io.IOException; import java.io.InputStream; import java.util.List; public class ServiceDemo { public static void main(String[] args) throws IOException { InputStream resourceAsStream = Resources.getResourceAsStream("SqlMapConfig.xml"); SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(resourceAsStream); SqlSession sqlSession = sqlSessionFactory.openSession(); UserMapper mapper = sqlSession.getMapper(UserMapper.class); List<User> all = mapper.findAll(); System.out.println(all); User user = mapper.findById(1); System.out.println(user); } }
[ "jianwangp@icloud.com" ]
jianwangp@icloud.com
21bd5b9a9b5d58924f03a53f0237e5ea73339a5c
1f5c68f68b12b314d062c8c94b4824a533b4a7a3
/com/planet_ink/coffee_mud/Abilities/Specializations/Proficiency_Staff.java
a6a86001c74e4f64993432e78c44e564ac422c89
[ "Apache-2.0" ]
permissive
leonlee/CoffeeMud
ff29abc60a77d03675375a9097572780a14b86c3
c35383fc53bd3947b6b8579a581e9eb792e15ef9
refs/heads/master
2020-06-09T15:47:32.771688
2016-12-08T07:12:47
2016-12-08T07:12:47
76,030,486
1
0
null
2016-12-09T11:38:35
2016-12-09T11:38:34
null
UTF-8
Java
false
false
1,895
java
package com.planet_ink.coffee_mud.Abilities.Specializations; import com.planet_ink.coffee_mud.core.interfaces.*; import com.planet_ink.coffee_mud.core.*; import com.planet_ink.coffee_mud.core.collections.*; import com.planet_ink.coffee_mud.Abilities.interfaces.*; import com.planet_ink.coffee_mud.Areas.interfaces.*; import com.planet_ink.coffee_mud.Behaviors.interfaces.*; import com.planet_ink.coffee_mud.CharClasses.interfaces.*; import com.planet_ink.coffee_mud.Commands.interfaces.*; import com.planet_ink.coffee_mud.Common.interfaces.*; import com.planet_ink.coffee_mud.Exits.interfaces.*; import com.planet_ink.coffee_mud.Items.interfaces.*; import com.planet_ink.coffee_mud.Libraries.interfaces.*; import com.planet_ink.coffee_mud.Locales.interfaces.*; import com.planet_ink.coffee_mud.MOBS.interfaces.*; import com.planet_ink.coffee_mud.Races.interfaces.*; import java.util.*; /* Copyright 2016-2016 Bo Zimmerman 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. */ public class Proficiency_Staff extends Proficiency_Weapon { @Override public String ID() { return "Proficiency_Staff"; } private final static String localizedName = CMLib.lang().L("Staff Proficiency"); @Override public String name() { return localizedName; } public Proficiency_Staff() { super(); weaponClass=Weapon.CLASS_STAFF; } }
[ "bo@zimmers.net" ]
bo@zimmers.net
4083163daef5a51869d0e8a2d6ba24678d0049a9
6d024c2c00ad9d38d15fc77a47a0f7b6643e2989
/back/src/main/java/com/example/eBImission/repository/CartRepository.java
beb6142c40d5c58007af5fae10367c776a62e11e
[]
no_license
oriyou/eBImission
40f86b8c6401a06c3c1206c4c655d10095468616
d878df83574a20730f0b588e63b93f5fe7cdc4dc
refs/heads/master
2023-04-18T12:16:44.221533
2021-04-30T04:09:39
2021-04-30T04:09:39
355,460,702
0
0
null
2021-04-22T05:22:39
2021-04-07T08:00:55
Vue
UTF-8
Java
false
false
735
java
package com.example.eBImission.repository; import com.example.eBImission.entity.Cart; import org.springframework.data.r2dbc.repository.Query; import org.springframework.data.repository.reactive.ReactiveCrudRepository; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import java.awt.print.Pageable; public interface CartRepository extends ReactiveCrudRepository<Cart, String> { @Query("SELECT * FROM om_cart ORDER BY REG_DTTM DESC") Flux<Cart> findAllCartOrderByRegDttm(); Flux<Cart> findCartBylrtrNo(String lrtrNo); @Query("UPDATE SET odQty = :odQty WHERE cartSn = :cartSn") Mono<Cart> updateCartOdQty(String cartSn, int odQty); Mono<Integer> deleteCartByCartSn(String cartSn); }
[ "fldhflsj1@gmail.com" ]
fldhflsj1@gmail.com