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
7b83e715348a4bd77c11db8c769a034d6e5b8575
5c8b7185e2f3799cc66b6818aa4ee583485c7829
/com/planet_ink/coffee_mud/Items/Basic/GenChair.java
74b7ec474fe228500cb489af35f68cfbff84489d
[ "Apache-2.0" ]
permissive
cmk8514/BrainCancerMud
6ec70a47afac7a9239a6181554ce309b211ed790
cc2ca1defc9dd9565b169871c8310a3eece2500a
refs/heads/master
2021-04-07T01:28:52.961472
2020-03-21T16:29:03
2020-03-21T16:29:03
248,631,086
1
1
null
null
null
null
UTF-8
Java
false
false
1,268
java
package com.planet_ink.coffee_mud.Items.Basic; import com.planet_ink.coffee_mud.Items.interfaces.RawMaterial; import com.planet_ink.coffee_mud.core.interfaces.Rideable; /* Copyright 2002-2017 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 GenChair extends GenRideable { @Override public String ID() { return "GenChair"; } public GenChair() { super(); readableText = ""; setName("a generic chair"); basePhyStats.setWeight(150); setDisplayText("a generic chair is here."); setDescription(""); material=RawMaterial.RESOURCE_OAK; baseGoldValue=5; basePhyStats().setLevel(1); setRiderCapacity(1); setRideBasis(Rideable.RIDEABLE_SIT); recoverPhyStats(); } }
[ "cscordias@gmail.com" ]
cscordias@gmail.com
0b897037c0c1229152cea773ca57f600a7536fc6
507e427ad5dbb2e73a95a127cb9a0adab3ff3256
/src/test/java/com/infosupport/examplepipeline/ExamplePipelineApplicationTests.java
c1f761dcf33c7a4143370168f8bb08c94ac496d3
[]
no_license
nrg500/example-pipeline
792d34057de5e79d5edc88add1c34066a86f427d
bc2bfa0bd1b16a59c456e05d5ccf7827be05f0e6
refs/heads/master
2020-05-22T00:09:45.798449
2019-05-16T09:36:02
2019-05-16T09:36:02
186,165,744
0
0
null
null
null
null
UTF-8
Java
false
false
357
java
package com.infosupport.examplepipeline; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest public class ExamplePipelineApplicationTests { @Test public void contextLoads() { } }
[ "berwoutv@infosupport.com" ]
berwoutv@infosupport.com
296d18169b5f941e014c0b4e6333f2f047dc65d5
52e767e40e72e83eefa385110f506b24e71b944d
/MapReduce/Workshop/NGram/NGramJob.java
72332f9244e4ccdce96d3ae50f18bbcc9a4bf756
[]
no_license
sateeshfrnd/Hadoop-Workshop
ab5bbd137916ffeefce31932fa2e0749b7f9129a
774cc233c9b6f9731e72405d15296f5aaca91de5
refs/heads/master
2023-06-20T21:07:50.778926
2023-06-16T16:00:37
2023-06-16T16:00:37
28,442,865
0
0
null
null
null
null
UTF-8
Java
false
false
1,745
java
package com.satish.mapreduce.workshop.ngram; import java.io.IOException; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.Path; import org.apache.hadoop.io.IntWritable; import org.apache.hadoop.io.LongWritable; import org.apache.hadoop.io.NullWritable; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapreduce.Job; import org.apache.hadoop.mapreduce.Mapper; import org.apache.hadoop.mapreduce.lib.input.FileInputFormat; import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat; import org.apache.hadoop.util.Tool; import org.apache.hadoop.util.ToolRunner; public class NGramJob implements Tool { private Configuration configuration; public static String N_VALUE = "N-GRAM-VALUE"; @Override public Configuration getConf() { return this.configuration; } @Override public void setConf(Configuration con) { this.configuration = con; } @Override public int run(String[] arg) throws Exception { configuration.setInt(N_VALUE, Integer.parseInt(arg[2])); Job ngramJob = new Job(getConf()); ngramJob.setJobName("N-Gram Job"); ngramJob.setJarByClass(this.getClass()); ngramJob.setMapperClass(NGramMapper.class); ngramJob.setMapOutputKeyClass(Text.class); ngramJob.setMapOutputValueClass(IntWritable.class); ngramJob.setReducerClass(NGramReducer.class); ngramJob.setOutputKeyClass(Text.class); ngramJob.setOutputValueClass(LongWritable.class); FileInputFormat.setInputPaths(ngramJob, new Path(arg[0])); FileOutputFormat.setOutputPath(ngramJob, new Path(arg[1])); return ngramJob.waitForCompletion(true) == true ? 0 : -1; } public static void main(String[] args) throws Exception { ToolRunner.run(new Configuration(), new NGramJob(), args); } }
[ "sateeshfrnd@users.noreply.github.com" ]
sateeshfrnd@users.noreply.github.com
c56dd83f6d21bcc4d9c40ce5f4f0e6a23f2c6002
2df303ea1217c92bdf6b7e5382b50f0893ed8b0e
/src/main/java/pivots/PivotsCached.java
7813b0c9ec796f0d41f9f82d7d5f47041e7bc303
[]
no_license
jleveau/BigData_Search
c4c1852f0fe6c6a95bb70cc5998794bd44d2dd56
083e74dc7bb8532d81620fc08dd0b18a6771c6f1
refs/heads/master
2020-12-24T09:31:13.540337
2017-01-06T21:21:23
2017-01-06T21:21:23
73,287,736
0
1
null
null
null
null
UTF-8
Java
false
false
1,716
java
package pivots; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.OutputStream; import java.net.URI; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configured; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.mapreduce.Job; import org.apache.hadoop.util.Tool; import org.apache.hadoop.util.ToolRunner; public class PivotsCached extends Configured implements Tool { public int run(String[] args) throws Exception { Configuration conf = getConf(); URI input_uri = new URI(args[0]); URI output_uri = new URI("/resources/pivots"); Integer k = new Integer(args[1]); Job job = Job.getInstance(conf, "Kmeans"); FileSystem hdfs = FileSystem.get(input_uri,conf); BufferedReader reader = new BufferedReader(new InputStreamReader(hdfs.open(new Path(input_uri)))); OutputStream output = hdfs.create(new Path(output_uri)); String line; reader.readLine(); int i=0; while (i<k && (line = reader.readLine()) != null){ String[] splits = line.split(","); try { //Check if splits[4] is a valid double Double.parseDouble(splits[4]); output.write(splits[4].getBytes()); output.write("\n".getBytes()); i++; } catch(NumberFormatException e){ } } reader.close(); output.close(); return 0; } public static void main(String args[]) throws Exception { //Take 3 parameters : input output k System.exit(ToolRunner.run(new PivotsCached(), args)); } }
[ "julien.leveau@etu.u-bordeaux1.fr" ]
julien.leveau@etu.u-bordeaux1.fr
4f2d80522ff9352d4f836f9f530f1f7435c08bd6
e25ceb60edb0c4946475d0715424d534413cb7ad
/DialerApp/app/src/main/java/com/example/dna/dialerapp/adapter/CallLogsAdapter.java
176cfdeed9714f6793b14bf8df2ac18c02aa242a
[]
no_license
thinkAhead312/Native_Android
84ac9ba7b096ef050cb245ab8c23c729f2b18ca2
38dbb5e6f3456c6b1ef39cb4e7b7fa228d51ef3f
refs/heads/master
2020-05-21T21:03:37.764009
2017-09-08T05:38:04
2017-09-08T05:38:04
64,926,827
0
0
null
null
null
null
UTF-8
Java
false
false
3,616
java
package com.example.dna.dialerapp.adapter; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.provider.CallLog; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.LinearLayout; import android.widget.RelativeLayout; import android.widget.TextView; import android.widget.Toast; import com.example.dna.dialerapp.R; import com.example.dna.dialerapp.ViewSms; import com.example.dna.dialerapp.model.CallLogs; import com.example.dna.dialerapp.model.Contact; import com.example.dna.dialerapp.model.Sms; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.List; /** * Created by dna on 8/2/16. */ public class CallLogsAdapter extends ArrayAdapter<CallLogs> { List<CallLogs> callLogsItem = null; Context context; public CallLogsAdapter(Context context, int resourceId, List<CallLogs> callLogsItem) { super(context, resourceId, callLogsItem); this.callLogsItem = callLogsItem; this.context = context; } /*private view holder class*/ private class ViewHolder { TextView txtCallName, txtCallType, txtCallDuration, txtcallDate, txtCallNumber; LinearLayout call_logs_Layout; } public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder = null; CallLogs logsItem = getItem(position); String display = ""; LayoutInflater mInflater = (LayoutInflater) context .getSystemService(Activity.LAYOUT_INFLATER_SERVICE); // Here we set the appropriate view in accordance with the the view type as passed when the holder object is created if (convertView == null) { convertView = mInflater.inflate(R.layout.call_log_row, null); holder = new ViewHolder(); holder.txtCallName = (TextView) convertView.findViewById(R.id.txtCallName); holder.txtCallType = (TextView) convertView.findViewById(R.id.txtCallType); holder.txtCallDuration = (TextView) convertView.findViewById(R.id.txtCallDuration); holder.txtcallDate = (TextView) convertView.findViewById(R.id.txtCallDate); holder.txtCallNumber = (TextView) convertView.findViewById(R.id.txtCallNumber); holder.call_logs_Layout = (LinearLayout) convertView.findViewById(R.id.call_logs_Layout); convertView.setTag(holder); } else holder = (ViewHolder) convertView.getTag(); display = logsItem.getContactName(); if(display == null) { holder.txtCallName.setText(logsItem.getNumber()); } else { holder.txtCallName.setText(display); } int callTypeCode = Integer.parseInt(logsItem.getType()); switch(callTypeCode) { case CallLog.Calls.OUTGOING_TYPE: holder.txtCallType.setText("OutGoing"); break; case CallLog.Calls.INCOMING_TYPE: holder.txtCallType.setText("InComing"); break; case CallLog.Calls.MISSED_TYPE: holder.txtCallType.setText("MIssed"); break; } holder.txtCallDuration.setText(logsItem.getDuration()+"(seconds)"); Date callDayTime = new Date(Long.valueOf(logsItem.getDate())); holder.txtcallDate.setText(String.valueOf(callDayTime)); return convertView; } }
[ "jandrade@dnamicro.com" ]
jandrade@dnamicro.com
8971740f0fe656f53636288441a4c9bff82e6cb0
4707a24def36e46c9f79e78ae10dea3229ff7d77
/recipe-manager/src/main/java/com/monsanto/recipemanager/repository/RecipeRepository.java
e98e773b2bc71cb6b2e27952018fe0fc7cc03c0f
[]
no_license
vivaciousvivek/RecipeManager
16c2a9070e5b0bbf4594694ebb57ee44333ef2b3
b6ba24a99b1da20d67039eb3576c49b0a117a8ba
refs/heads/master
2020-03-27T01:22:09.589736
2018-08-27T15:23:31
2018-08-27T15:23:31
145,704,145
0
0
null
null
null
null
UTF-8
Java
false
false
440
java
package com.monsanto.recipemanager.repository; import com.monsanto.recipemanager.domain.Recipe; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import java.util.Optional; /** * @author VIVEK KUMAR SINGH * @since (2018-08-21 20:42:49) */ @Repository public interface RecipeRepository extends JpaRepository<Recipe, Integer> { Optional<Recipe> findByName(String name); }
[ "vvkvivek.singh@gmail.com" ]
vvkvivek.singh@gmail.com
b72c0d26fdc878f843df23f0bc7a5cfcb31d5c78
35652c59c780ba9442fcbe58dfcd7f895969c7de
/src/main/java/com/exsent/core/MethodOverride.java
2137c63cf9ab972c7422a771c6f613f668f45ad6
[ "MIT" ]
permissive
ValentinAhrend/ExsentCore
7ebfd6561a8cbe4e796f0cb44b87745cbac17dd0
6d63152b4914aa29058721852e4d85da57a05d85
refs/heads/master
2023-03-19T09:26:54.337841
2021-02-23T23:05:27
2021-02-23T23:05:27
341,688,876
0
0
null
null
null
null
UTF-8
Java
false
false
19,997
java
package com.exsent.core; /** * Created by Jim-Linus Valentin Ahrend on 1/30/21. * Located in com.exsent.app.example in AndroidAppExample **/ public enum MethodOverride { /* method_name $ length of class parameter array */ addContentView$android9view9View0android9view9ViewGroup9LayoutParams0(0), applyOverrideConfiguration$android9content9res9Configuration0(1), bindIsolatedService$android9content9Intent0int0java9lang9String0java9util9concurrent9Executor0android9content9ServiceConnection0(2), bindService$android9content9Intent0android9content9ServiceConnection0int0(3), bindService$android9content9Intent0int0java9util9concurrent9Executor0android9content9ServiceConnection0(4), checkCallingOrSelfPermission$java9lang9String0(5), checkCallingOrSelfUriPermission$android9net9Uri0int0(6), checkCallingPermission$java9lang9String0(7), checkCallingUriPermission$android9net9Uri0int0(8), checkPermission$java9lang9String0int0int0(9), checkSelfPermission$java9lang9String0(10), checkUriPermission$android9net9Uri0int0int0int0(11), checkUriPermission$android9net9Uri0java9lang9String0java9lang9String0int0int0int0(12), clearWallpaper$0(13), closeContextMenu$0(14), closeOptionsMenu$0(15), createConfigurationContext$android9content9res9Configuration0(16), createContextForSplit$java9lang9String0(17), createDeviceProtectedStorageContext$0(18), createDisplayContext$android9view9Display0(19), createPackageContext$java9lang9String0int0(20), createPendingResult$int0android9content9Intent0int0(21), databaseList$0(22), deleteDatabase$java9lang9String0(23), deleteFile$java9lang9String0(24), deleteSharedPreferences$java9lang9String0(25), dispatchGenericMotionEvent$android9view9MotionEvent0(26), dispatchKeyEvent$android9view9KeyEvent0(27), dispatchKeyShortcutEvent$android9view9KeyEvent0(28), dispatchPopulateAccessibilityEvent$android9view9accessibility9AccessibilityEvent0(29), dispatchTouchEvent$android9view9MotionEvent0(30), dispatchTrackballEvent$android9view9MotionEvent0(31), dump$java9lang9String0java9io9FileDescriptor0java9io9PrintWriter0java9lang9String_Array0(32), enforceCallingOrSelfPermission$java9lang9String0java9lang9String0(33), enforceCallingOrSelfUriPermission$android9net9Uri0int0java9lang9String0(34), enforceCallingPermission$java9lang9String0java9lang9String0(35), enforceCallingUriPermission$android9net9Uri0int0java9lang9String0(36), enforcePermission$java9lang9String0int0int0java9lang9String0(37), enforceUriPermission$android9net9Uri0int0int0int0java9lang9String0(38), enforceUriPermission$android9net9Uri0java9lang9String0java9lang9String0int0int0int0java9lang9String0(39), enterPictureInPictureMode$0(40), enterPictureInPictureMode$android9app9PictureInPictureParams0(41), equals$java9lang9Object0(42), fileList$0(43), findViewById$int0(44), finish$0(45), finishActivity$int0(46), finishActivityFromChild$android9app9Activity0int0(47), finishAffinity$0(48), finishAfterTransition$0(49), finishAndRemoveTask$0(50), finishFromChild$android9app9Activity0(51), getActionBar$0(52), getApplicationContext$0(53), getApplicationInfo$0(54), getAssets$0(55), getBaseContext$0(56), getCacheDir$0(57), getCallingActivity$0(58), getCallingPackage$0(59), getChangingConfigurations$0(60), getClassLoader$0(61), getCodeCacheDir$0(62), getComponentName$0(63), getContentResolver$0(64), getContentScene$0(65), getContentTransitionManager$0(66), getCurrentFocus$0(67), getDataDir$0(68), getDatabasePath$java9lang9String0(69), getDelegate$0(70), getDir$java9lang9String0int0(71), getDrawerToggleDelegate$0(72), getExternalCacheDir$0(73), getExternalCacheDirs$0(74), getExternalFilesDir$java9lang9String0(75), getExternalFilesDirs$String0(76), getExternalMediaDirs$0(77), getExtraData$java9lang9Class0(78), getFileStreamPath$java9lang9String0(79), getFilesDir$0(80), getFragmentManager$0(81), getIntent$0(82), getLastCustomNonConfigurationInstance$0(83), getLastNonConfigurationInstance$0(84), getLayoutInflater$0(85), getLifecycle$0(86), getLoaderManager$0(87), getLocalClassName$0(88), getMainExecutor$0(89), getMainLooper$0(90), getMaxNumPictureInPictureActions$0(91), getMenuInflater$0(92), getNoBackupFilesDir$0(93), getObbDir$0(94), getObbDirs$0(95), getOpPackageName$0(96), getPackageCodePath$0(97), getPackageManager$0(98), getPackageName$0(99), getPackageResourcePath$0(100), getParentActivityIntent$0(101), getPreferences$int0(102), getReferrer$0(103), getRequestedOrientation$0(104), getResources$0(105), getSharedPreferences$java9lang9String0int0(106), getSupportActionBar$0(107), getSupportFragmentManager$0(108), getSupportLoaderManager$0(109), getSupportParentActivityIntent$0(110), getSystemService$java9lang9String0(111), getSystemServiceName$java9lang9Class0(112), getTaskId$0(113), getTheme$0(114), getViewModelStore$0(115), getVoiceInteractor$0(116), getWallpaper$0(117), getWallpaperDesiredMinimumHeight$0(118), getWallpaperDesiredMinimumWidth$0(119), getWindow$0(120), getWindowManager$0(121), grantUriPermission$java9lang9String0android9net9Uri0int0(122), hasWindowFocus$0(123), hashCode$0(124), invalidateOptionsMenu$0(125), isActivityTransitionRunning$0(126), isChangingConfigurations$0(127), isDestroyed$0(128), isDeviceProtectedStorage$0(129), isFinishing$0(130), isImmersive$0(131), isInMultiWindowMode$0(132), isInPictureInPictureMode$0(133), isLocalVoiceInteractionSupported$0(134), isRestricted$0(135), isTaskRoot$0(136), isVoiceInteraction$0(137), isVoiceInteractionRoot$0(138), moveDatabaseFrom$android9content9Context0java9lang9String0(139), moveSharedPreferencesFrom$android9content9Context0java9lang9String0(140), moveTaskToBack$boolean0(141), navigateUpTo$android9content9Intent0(142), navigateUpToFromChild$android9app9Activity0android9content9Intent0(143), onActionModeFinished$android9view9ActionMode0(144), onActionModeStarted$android9view9ActionMode0(145), onActivityReenter$int0android9content9Intent0(146), onAttachFragment$android9app9Fragment0(147), onAttachFragment$androidx9fragment9app9Fragment0(148), onAttachedToWindow$0(149), onBackPressed$0(150), onConfigurationChanged$android9content9res9Configuration0(151), onContentChanged$0(152), onContextItemSelected$android9view9MenuItem0(153), onContextMenuClosed$android9view9Menu0(154), onCreate$android9os9Bundle0android9os9PersistableBundle0(155), onCreateContextMenu$android9view9ContextMenu0android9view9View0android9view9ContextMenu9ContextMenuInfo0(156), onCreateDescription$0(157), onCreateNavigateUpTaskStack$android9app9TaskStackBuilder0(158), onCreateOptionsMenu$android9view9Menu0(159), onCreatePanelMenu$int0android9view9Menu0(160), onCreatePanelView$int0(161), onCreateSupportNavigateUpTaskStack$androidx9core9app9TaskStackBuilder0(162), onCreateThumbnail$android9graphics9Bitmap0android9graphics9Canvas0(163), onCreateView$java9lang9String0android9content9Context0android9util9AttributeSet0(164), onCreateView$android9view9View0java9lang9String0android9content9Context0android9util9AttributeSet0(165), onDetachedFromWindow$0(166), onEnterAnimationComplete$0(167), onGenericMotionEvent$android9view9MotionEvent0(168), onGetDirectActions$android9os9CancellationSignal0java9util9function9Consumer0(169), onKeyDown$int0android9view9KeyEvent0(170), onKeyLongPress$int0android9view9KeyEvent0(171), onKeyMultiple$int0int0android9view9KeyEvent0(172), onKeyShortcut$int0android9view9KeyEvent0(173), onKeyUp$int0android9view9KeyEvent0(174), onLocalVoiceInteractionStarted$0(175), onLocalVoiceInteractionStopped$0(176), onLowMemory$0(177), onMenuOpened$int0android9view9Menu0(178), onMultiWindowModeChanged$boolean0(179), onSupportContentChanged$0(180), onSupportNavigateUp$0(181), onTopResumedActivityChanged$boolean0(182), onTouchEvent$android9view9MotionEvent0(183), onTrackballEvent$android9view9MotionEvent0(184), onTrimMemory$int0(185), onUserInteraction$0(186), onVisibleBehindCanceled$0(187), onWindowAttributesChanged$android9view9WindowManager9LayoutParams0(188), onWindowFocusChanged$boolean0(189), onWindowStartingActionMode$android9view9ActionMode9Callback0(190), onWindowStartingActionMode$android9view9ActionMode9Callback0int0(191), onWindowStartingSupportActionMode$androidx9appcompat9view9ActionMode9Callback0(192), openContextMenu$android9view9View0(193), openFileInput$java9lang9String0(194), openFileOutput$java9lang9String0int0(195), openOptionsMenu$0(196), openOrCreateDatabase$java9lang9String0int0android9database9sqlite9SQLiteDatabase9CursorFactory0(197), openOrCreateDatabase$java9lang9String0int0android9database9sqlite9SQLiteDatabase9CursorFactory0android9database9DatabaseErrorHandler0(198), overridePendingTransition$int0int0(199), supportRequestWindowFeature$int0(309), supportShouldUpRecreateTask$android9content9Intent0(310), supportStartPostponedEnterTransition$0(311), takeKeyEvents$boolean0(312), toString$0(313), triggerSearch$java9lang9String0android9os9Bundle0(314), unbindService$android9content9ServiceConnection0(315), unregisterActivityLifecycleCallbacks$android9app9Application9ActivityLifecycleCallbacks0(316), unregisterComponentCallbacks$android9content9ComponentCallbacks0(317), unregisterForContextMenu$android9view9View0(318), unregisterReceiver$android9content9BroadcastReceiver0(319), updateServiceGroup$android9content9ServiceConnection0int0int0(320), attachBaseContext$android9content9Context0(321), onApplyThemeResource$android9content9res9Resources9Theme0int0boolean0(322), onChildTitleChanged$android9app9Activity0java9lang9CharSequence0(323), onCreate$android9os9Bundle0(324), onCreateDialog$int0(325), onCreateDialog$int0android9os9Bundle0(326), onDestroy$0(327), onMultiWindowModeChanged$boolean0android9content9res9Configuration0(328), onNavigateUp$0(329), onNavigateUpFromChild$android9app9Activity0(330), onNewIntent$android9content9Intent0(331), onOptionsItemSelected$android9view9MenuItem0(332), onOptionsMenuClosed$android9view9Menu0(333), onPanelClosed$int0android9view9Menu0(334), onPause$0(335), onPerformDirectAction$java9lang9String0android9os9Bundle0android9os9CancellationSignal0java9util9function9Consumer0(336), onPictureInPictureModeChanged$boolean0(337), onPictureInPictureModeChanged$boolean0android9content9res9Configuration0(338), onPostCreate$android9os9Bundle0(339), onPostCreate$android9os9Bundle0android9os9PersistableBundle0(340), onPostResume$0(341), onPrepareDialog$int0android9app9Dialog0(342), onPrepareDialog$int0android9app9Dialog0android9os9Bundle0(343), onPrepareNavigateUpTaskStack$android9app9TaskStackBuilder0(344), onPrepareOptionsMenu$android9view9Menu0(345), onPreparePanel$int0android9view9View0android9view9Menu0(346), onProvideAssistContent$android9app9assist9AssistContent0(347), onProvideAssistData$android9os9Bundle0(348), onProvideKeyboardShortcuts$java9util9List0android9view9Menu0int0(349), onProvideReferrer$0(350), onRestart$0(351), onRestoreInstanceState$android9os9Bundle0(352), onRestoreInstanceState$android9os9Bundle0android9os9PersistableBundle0(353), onResume$0(354), onSaveInstanceState$android9os9Bundle0(355), onSaveInstanceState$android9os9Bundle0android9os9PersistableBundle0(356), onSearchRequested$0(357), onSearchRequested$android9view9SearchEvent0(358), onStateNotSaved$0(359), onStop$0(360), onTitleChanged$java9lang9CharSequence0int0(361), onActivityResult$int0int0android9content9Intent0(362), onResumeFragments$0(363), onRequestPermissionsResult$int0String_Array0int_Array0(364), onPointerCaptureChanged$boolean0(365), onUserLeaveHint$0(366), onNightModeChanged$int0(367), onPrepareSupportNavigateUpTaskStack$TaskStackBuilder0(368), onSupportActionModeFinished$ActionMode0(369), onSupportActionModeStarted$ActionMode0(370), onRetainCustomNonConfigurationInstance$0(371), onStart$0(372), sendBroadcast$android9content9Intent0(373), sendBroadcast$android9content9Intent0java9lang9String0(374), sendBroadcastAsUser$android9content9Intent0android9os9UserHandle0(377), sendBroadcastAsUser$android9content9Intent0android9os9UserHandle0java9lang9String0(378), sendOrderedBroadcast$android9content9Intent0java9lang9String0(381), sendOrderedBroadcast$android9content9Intent0java9lang9String0android9content9BroadcastReceiver0android9os9Handler0int0java9lang9String0android9os9Bundle0(382), sendOrderedBroadcastAsUser$android9content9Intent0android9os9UserHandle0java9lang9String0android9content9BroadcastReceiver0android9os9Handler0int0java9lang9String0android9os9Bundle0(385), sendStickyBroadcast$android9content9Intent0(388), sendStickyBroadcastAsUser$android9content9Intent0android9os9UserHandle0(389), sendStickyOrderedBroadcast$android9content9Intent0android9content9BroadcastReceiver0android9os9Handler0int0java9lang9String0android9os9Bundle0(390), sendStickyOrderedBroadcastAsUser$android9content9Intent0android9os9UserHandle0android9content9BroadcastReceiver0android9os9Handler0int0java9lang9String0android9os9Bundle0(391), setActionBar$android9widget9Toolbar0(392), setContentTransitionManager$android9transition9TransitionManager0(395), setContentView$int0(396), setContentView$android9view9View0(397), setEnterSharedElementCallback$android9app9SharedElementCallback0(401), setEnterSharedElementCallback$androidx9core9app9SharedElementCallback0(402), setExitSharedElementCallback$android9app9SharedElementCallback0(403), setExitSharedElementCallback$androidx9core9app9SharedElementCallback0(404), setFinishOnTouchOutside$boolean0(409), setImmersive$boolean0(410), setInheritShowWhenLocked$boolean0(411), setIntent$android9content9Intent0(412), setPictureInPictureParams$android9app9PictureInPictureParams0(416), setRequestedOrientation$int0(421), setShowWhenLocked$boolean0(425), setSupportActionBar$androidx9appcompat9widget9Toolbar0(426), setSupportProgress$int0(427), setSupportProgressBarIndeterminate$boolean0(428), setSupportProgressBarIndeterminateVisibility$boolean0(429), setSupportProgressBarVisibility$boolean0(430), setTheme$int0(432), setTitle$int0(434), setTitle$java9lang9CharSequence0(435), setTitleColor$int0(436), setTurnScreenOn$boolean0(437), setVisible$boolean0(438), setWallpaper$android9graphics9Bitmap0(441), setWallpaper$java9io9InputStream0(442), shouldShowRequestPermissionRationale$java9lang9String0(443), shouldUpRecreateTask$android9content9Intent0(444), showAssist$android9os9Bundle0(445), showLockTaskEscapeMessage$0(448), startActivities$android9content9Intent_Array0(451), startActivities$android9content9Intent_Array0android9os9Bundle0(452), startActivity$android9content9Intent0(453), startActivity$android9content9Intent0android9os9Bundle0(454), startActivityForResult$android9content9Intent0int0(457), startActivityForResult$android9content9Intent0int0android9os9Bundle0(458), startActivityFromChild$android9app9Activity0android9content9Intent0int0(461), startActivityFromChild$android9app9Activity0android9content9Intent0int0android9os9Bundle0(462), startActivityFromFragment$android9app9Fragment0android9content9Intent0int0(463), startActivityFromFragment$androidx9fragment9app9Fragment0android9content9Intent0int0(464), startActivityFromFragment$android9app9Fragment0android9content9Intent0int0android9os9Bundle0(465), startActivityFromFragment$androidx9fragment9app9Fragment0android9content9Intent0int0android9os9Bundle0(466), startActivityIfNeeded$android9content9Intent0int0(467), startActivityIfNeeded$android9content9Intent0int0android9os9Bundle0(468), startForegroundService$android9content9Intent0(469), startInstrumentation$android9content9ComponentName0java9lang9String0android9os9Bundle0(471), startIntentSender$android9content9IntentSender0android9content9Intent0int0int0int0(472), startIntentSender$android9content9IntentSender0android9content9Intent0int0int0int0android9os9Bundle0(473), startIntentSenderForResult$android9content9IntentSender0int0android9content9Intent0int0int0int0(474), startIntentSenderForResult$android9content9IntentSender0int0android9content9Intent0int0int0int0android9os9Bundle0(475), startIntentSenderFromChild$android9app9Activity0android9content9IntentSender0int0android9content9Intent0int0int0int0(476), startIntentSenderFromChild$android9app9Activity0android9content9IntentSender0int0android9content9Intent0int0int0int0android9os9Bundle0(477), startIntentSenderFromFragment$androidx9fragment9app9Fragment0android9content9IntentSender0int0android9content9Intent0int0int0int0android9os9Bundle0(478), startLocalVoiceInteraction$android9os9Bundle0(479), startLockTask$0(480), startManagingCursor$android9database9Cursor0(481), startNextMatchingActivity$android9content9Intent0(482), startNextMatchingActivity$android9content9Intent0android9os9Bundle0(483), startPostponedEnterTransition$0(484), startSearch$java9lang9String0boolean0android9os9Bundle0boolean0(485), startService$android9content9Intent0(486), stopLocalVoiceInteraction$0(489), stopLockTask$0(490), stopManagingCursor$android9database9Cursor0(491), stopService$android9content9Intent0(492), supportFinishAfterTransition$0(494), supportInvalidateOptionsMenu$0(495), supportNavigateUpTo$android9content9Intent0(496), supportPostponeEnterTransition$0(497), setContentView$View0ViewGroup9LayoutParams0params0(498), setTaskDescription$ActivityManager9TaskDescription0taskDescription0(499), setTheme$0Resources9Theme0theme0(500), recreate$0(501), registerComponentCallbacks$android9content9ComponentCallbacks0(503), registerForContextMenu$android9view9View0(504), registerReceiver$android9content9BroadcastReceiver0android9content9IntentFilter0(505), registerReceiver$android9content9BroadcastReceiver0android9content9IntentFilter0int0(506), registerReceiver$android9content9BroadcastReceiver0android9content9IntentFilter0java9lang9String0android9os9Handler0(507), registerReceiver$android9content9BroadcastReceiver0android9content9IntentFilter0java9lang9String0android9os9Handler0int0(508), releaseInstance$0(511), removeDialog$int0(512), removeStickyBroadcast$android9content9Intent0(513), removeStickyBroadcastAsUser$android9content9Intent0android9os9UserHandle0(514), reportFullyDrawn$0(515), requestDragAndDropPermissions$android9view9DragEvent0(516), requestPermissions$$java9lang9String_Array0int0(517), requestShowKeyboardShortcuts$$0(518), requestVisibleBehind$boolean0(519), requestWindowFeature$$int0(520), requireViewById$$int0(521), revokeUriPermission$android9net9Uri0int0(522), revokeUriPermission$java9lang9String0android9net9Uri0int0(523), runOnUiThread$$java9lang9Runnable0(524), setVrModeEnabled$boolean0ComponentName0(525); int id; MethodOverride(int id){ this.id = id; } }
[ "valentinahrend@gmail.com" ]
valentinahrend@gmail.com
a83af7aa3aa72d51147b19a1f7c19b9fb7b6df2b
26497e14aa16516e6cfc226cc45e30b068fa71f5
/KFDataExporter/src/kfl/converter/kf4/model/K4World.java
d10793587d7164451896b5ba6b769d2514c1a5ad
[ "MIT" ]
permissive
panktibardolia119933/KF4-to-KF6-Migration
5ed30f802b6676afd520edd71f6ccd06259c8a9d
261cf91acf866fe1f2f2909051a1e1d692c6e39e
refs/heads/master
2023-04-10T09:51:08.549942
2021-04-23T14:24:29
2021-04-23T14:24:29
343,442,243
0
1
null
null
null
null
UTF-8
Java
false
false
1,649
java
package kfl.converter.kf4.model; import java.io.Serializable; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import org.zoolib.ZID; public class K4World implements Serializable { private static final long serialVersionUID = 1L; private Map<ZID, K4Element> elements = new HashMap<ZID, K4Element>(); private List<K4Note> notes = new ArrayList<K4Note>(); private List<K4Author> authors = new ArrayList<K4Author>(); private List<K4Group> groups = new ArrayList<K4Group>(); private List<K4View> views = new ArrayList<K4View>(); private List<K4Attachment> attachments = new ArrayList<K4Attachment>(); private List<K4Log> logs = new ArrayList<K4Log>(); public void addElement(ZID id, K4Element element) { elements.put(id, element); if (element instanceof K4Note) { notes.add((K4Note) element); } if (element instanceof K4Author) { authors.add((K4Author) element); } if (element instanceof K4Group) { groups.add((K4Group) element); } if (element instanceof K4View) { views.add((K4View) element); } if (element instanceof K4Attachment) { attachments.add((K4Attachment) element); } } public K4Element get(ZID id) { return elements.get(id); } public void addLog(K4Log log) { logs.add(log); } public List<K4Log> getLogs() { return logs; } public List<K4Note> getNotes() { return notes; } public List<K4Author> getAuthors() { return authors; } public List<K4Group> getGroups() { return groups; } public List<K4View> getViews() { return views; } public List<K4Attachment> getAttachments() { return attachments; } }
[ "yoshiaki.matsuzawa@gmail.com" ]
yoshiaki.matsuzawa@gmail.com
d636152864f8f3bd1a93a70c023f6c10c494d162
7efcaa84ddb2d1da27470fbb991d4a4dce722dbe
/09mq/activemq-demo/src/main/java/io/byk/activemq/jms/topic/TopicSubscriber.java
08ff083a38b6a18b19900aab7bad07503af3666f
[]
no_license
Brikarl/JavaCourseCodes
c457959f27d7b8d90103f7ccac12e4d0a72b63ec
60c6258478576404e451f003a457588be636fac6
refs/heads/main
2023-03-12T05:28:49.734423
2021-02-19T08:16:55
2021-02-19T08:16:55
333,279,905
0
0
null
2021-01-27T02:31:04
2021-01-27T02:31:03
null
UTF-8
Java
false
false
587
java
package io.byk.activemq.jms.topic; import static io.byk.config.ActiveMqConfig.ACTIVE_MQ_TOPIC; import org.springframework.jms.annotation.JmsListener; import org.springframework.stereotype.Service; import lombok.extern.slf4j.Slf4j; /** * 主题消费者 * * @author boyunkai <boyunkai@kuaishou.com> * Created on 2021-02-05 */ @Service @Slf4j public class TopicSubscriber { @JmsListener(destination = ACTIVE_MQ_TOPIC, containerFactory = "myJmsContainerFactory") public void receiveMessage(String message) { log.info("<=========== 收到消息" + message); } }
[ "boyunkai@kuaishou.com" ]
boyunkai@kuaishou.com
1b796cace0d1fa685f1d3e482ff17efb5b13784a
410ddd0f6aab1474b441a308279d35a94d1cb69a
/app/src/main/java/com/hongyuan/fitness/util/BaseUtil.java
8466a20ff4641dd548a076853b9e37dbe96553b9
[]
no_license
cdj416/Fitness
580a1ff9826bed311891acb85bdd6697df8b6479
f053ba4217c4cd06a98635646626663bc1e2e43b
refs/heads/master
2021-07-07T18:47:08.691901
2019-09-06T06:36:45
2019-09-06T06:36:45
206,727,488
0
0
null
null
null
null
UTF-8
Java
false
false
1,090
java
package com.hongyuan.fitness.util; import android.text.TextUtils; import java.text.NumberFormat; public class BaseUtil { /* * 判断是否有值 * */ public static boolean isValue(Object value){ if(value == null || TextUtils.isEmpty(value.toString()) || "null".equals(value.toString())){ return false; } return true; } /* * json判断是否有数据 * */ public static boolean isJsonValue(Object value){ if(value == null || TextUtils.isEmpty(value.toString()) || "[]".equals(value.toString()) || "{}".equals(value.toString()) || "null".equals(value.toString())){ return false; } return true; } /* * 去零处理 * */ public static String getNoZoon(Object number){ String s = String.valueOf(number); if(s != null){ if(s.indexOf(".") > 0){ s = s.replaceAll("0+?$", "");//去掉多余的0 s = s.replaceAll("[.]$", "");//如最后一位是.则去掉 } } return s; } }
[ "179966827@qq.com" ]
179966827@qq.com
2a66fd475222fc8d7dacec73b1ff99e64c0ea337
82fedc79eddb77738f92482f8258e960883d1143
/src/com/liu/jdbc/domain/Student.java
6c3a9690c3a51faf337bd47bbc3fbb0425e21cd4
[]
no_license
blk711/SpringJDBC
147fc34b7dd137dff5483539b5540ecdaa3ed57a
c365797898570c8f6f0f7af80b3a6f7c914b6361
refs/heads/master
2021-07-09T21:56:28.776636
2017-10-10T09:29:17
2017-10-10T09:29:17
106,395,518
0
0
null
null
null
null
UTF-8
Java
false
false
154
java
package com.liu.jdbc.domain; import lombok.Data; @Data public class Student { private Long id; private String name; private Integer age; }
[ "711blk@gmail.com" ]
711blk@gmail.com
cddaf2927120eeced27c2454bd37fd5eb74f03a2
336514de795f61ac046af10474d31d17667ced90
/app/src/main/java/com/example/mariaa/weather/model/Clouds.java
c7affab0fdf40b7c9e9c05e72f32694d28a7aa82
[]
no_license
severianca/weather
62b4938243bd1940c29ba4c29d7bac68ee8f2f89
33699347a22f58cdd708b88e9f4e340b6755224f
refs/heads/master
2020-03-19T09:40:44.464285
2018-07-03T08:15:44
2018-07-03T08:15:44
136,308,807
0
0
null
null
null
null
UTF-8
Java
false
false
341
java
package com.example.mariaa.weather.model; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; public class Clouds { @SerializedName("all") @Expose private int all; public int getAll() { return all; } public void setAll(int all) { this.all = all; } }
[ "malub4@yandex.ru" ]
malub4@yandex.ru
6a517f6bfcab0b40e3594d5511fc8b4ecb54cfe1
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/23/23_5c1b2238b489a13f07e4fe3078162d51d9af2394/PseudoDamerauLevenshteinTest/23_5c1b2238b489a13f07e4fe3078162d51d9af2394_PseudoDamerauLevenshteinTest_t.java
4bb61742a8c893b84a906a94452b18a3d1df8802
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
11,858
java
package org.freeplane.features.filter; import java.util.ArrayList; import java.util.List; import org.junit.Assert; import org.freeplane.features.filter.PseudoDamerauLevenshtein.Alignment; import org.junit.Before; import org.junit.Test; public class PseudoDamerauLevenshteinTest { private PseudoDamerauLevenshtein PDL; private ArrayList<PseudoDamerauLevenshtein.Alignment> alignments; @Before public void setUp() { PDL = new PseudoDamerauLevenshtein(); //PDL.init("hobbys", "hobbies", true, true); alignments = new ArrayList<PseudoDamerauLevenshtein.Alignment>(); } // TODO: make minprob for developAlignments() configurable! @Test public void testSimpleFilterAlignments() { String searchTerm = "hobbys"; String searchText = "hobbies"; PDL.init(searchTerm, searchText, true, true); alignments.clear(); PseudoDamerauLevenshtein.Alignment ali1 = PDL.new Alignment(searchTerm, searchText, 1.0, 0, 5, 0, 0); PseudoDamerauLevenshtein.Alignment ali2 = PDL.new Alignment(searchTerm, searchText, 0.5, 0, 5, 0, 0); alignments.add(ali1); alignments.add(ali2); alignments = PseudoDamerauLevenshtein.filterAlignments(alignments); Assert.assertEquals(1, alignments.size()); Assert.assertEquals(ali1, alignments.get(0)); } @Test public void testSimpleFilterAlignments2() { String searchTerm = "hobbys"; String searchText = "hobbies"; PDL.init(searchTerm, searchText, true, true); alignments.clear(); PseudoDamerauLevenshtein.Alignment ali1 = PDL.new Alignment(searchTerm, searchText, 1.0, 0, 7, 0, 0); PseudoDamerauLevenshtein.Alignment ali2 = PDL.new Alignment(searchTerm, searchText, 1.0, 0, 7, 0, 0); alignments.add(ali1); alignments.add(ali2); alignments = PseudoDamerauLevenshtein.filterAlignments(alignments); Assert.assertEquals(1, alignments.size()); Assert.assertTrue(alignments.get(0) == ali1 ^ alignments.get(0) == ali2); } @Test //filterAlignments([Ali@1ff7a1e[hobb,0,67,0,4], Ali@1aa57fb[hobbi,0,67,0,5], Ali@763f5d[hobbi,0,67,0,5], // Ali@13a317a[hobbie,0,67,0,6], Ali@14a8cd1[hobbies,0,67,0,7], Ali@1630ab9[hobbies,0,67,0,7]]) public void testSimpleFilterAlignments3() { String searchTerm = "hobbys"; String searchText = "hobbies"; PDL.init(searchTerm, searchText, true, true); alignments.clear(); PseudoDamerauLevenshtein.Alignment ali1 = PDL.new Alignment(searchTerm, searchText, 0.67, 0, 4, 0, 0); PseudoDamerauLevenshtein.Alignment ali2 = PDL.new Alignment(searchTerm, searchText, 0.67, 0, 5, 0, 0); PseudoDamerauLevenshtein.Alignment ali3 = PDL.new Alignment(searchTerm, searchText, 0.67, 0, 5, 0, 0); PseudoDamerauLevenshtein.Alignment ali4 = PDL.new Alignment(searchTerm, searchText, 0.67, 0, 6, 0, 0); PseudoDamerauLevenshtein.Alignment ali5 = PDL.new Alignment(searchTerm, searchText, 0.67, 0, 7, 0, 0); PseudoDamerauLevenshtein.Alignment ali6 = PDL.new Alignment(searchTerm, searchText, 0.67, 0, 7, 0, 0); alignments.add(ali1); alignments.add(ali2); alignments.add(ali3); alignments.add(ali4); alignments.add(ali5); alignments.add(ali6); alignments = PseudoDamerauLevenshtein.filterAlignments(alignments); Assert.assertEquals(1,alignments.size()); Assert.assertTrue(alignments.get(0) == ali5 ^ alignments.get(0) == ali6); } @Test public void testSimpleFilterAlignments4() { String searchTerm = "fit"; String searchText = "xfityfitz"; PDL.init(searchTerm, searchText, true, true); alignments.clear(); PseudoDamerauLevenshtein.Alignment ali1 = PDL.new Alignment(searchTerm, searchText, 0.67, 1, 3, 0, 0); PseudoDamerauLevenshtein.Alignment ali2 = PDL.new Alignment(searchTerm, searchText, 0.67, 1, 5, 0, 0); PseudoDamerauLevenshtein.Alignment ali3 = PDL.new Alignment(searchTerm, searchText, 1.0, 0, 7, 0, 0); alignments.add(ali1); alignments.add(ali2); alignments.add(ali3); alignments = PseudoDamerauLevenshtein.filterAlignments(alignments); Assert.assertEquals(1, alignments.size()); Assert.assertTrue(alignments.get(0) == ali3); } //filterAlignments-unique([Ali@208aef23[fitf,0,67,1,5], Ali@8035a329[fi,0,67,1,3], Ali@28d2570b[fitz,0,67,4,8], // Ali@3820e7f9[fit,1,00,1,4], Ali@40684fe1[fit,1,00,4,7], Ali@5ab613ed[fi,0,67,4,6]]) @Test public void testSimpleFilterAlignments5() { String searchTerm = "fit"; String searchText = "xfitfitz"; PDL.init(searchTerm, searchText, true, true); alignments.clear(); PseudoDamerauLevenshtein.Alignment ali1 = PDL.new Alignment(searchTerm, searchText, 0.67, 1, 5, 0, 0); PseudoDamerauLevenshtein.Alignment ali2 = PDL.new Alignment(searchTerm, searchText, 0.67, 1, 3, 0, 0); PseudoDamerauLevenshtein.Alignment ali3 = PDL.new Alignment(searchTerm, searchText, 0.67, 4, 8, 0, 0); PseudoDamerauLevenshtein.Alignment ali4 = PDL.new Alignment(searchTerm, searchText, 1.0, 1, 4, 0, 0); PseudoDamerauLevenshtein.Alignment ali5 = PDL.new Alignment(searchTerm, searchText, 1.0, 4, 7, 0, 0); PseudoDamerauLevenshtein.Alignment ali6 = PDL.new Alignment(searchTerm, searchText, 0.67, 4, 6, 0, 0); alignments.add(ali1); alignments.add(ali2); alignments.add(ali3); alignments.add(ali4); alignments.add(ali5); alignments.add(ali6); alignments = PseudoDamerauLevenshtein.filterAlignments(alignments); Assert.assertEquals(2, alignments.size()); Assert.assertTrue(alignments.contains(ali4)); Assert.assertTrue(alignments.contains(ali5)); } @Test public void testSimpleFilterAlignments6() { String searchTerm = "refugee"; String searchText = "refuge x y"; PDL.init(searchTerm, searchText, true, true); alignments.clear(); PseudoDamerauLevenshtein.Alignment ali1 = PDL.new Alignment(searchTerm, "refug-e", 0.86, 0, 6, 0, 0); PseudoDamerauLevenshtein.Alignment ali2 = PDL.new Alignment(searchTerm, "refuge ", 0.86, 0, 7, 0, 0); // PseudoDamerauLevenshtein.Alignment ali1 = PDL.new Alignment(searchTerm, searchText, 0.71, 0, 5, 0, 0); // PseudoDamerauLevenshtein.Alignment ali2 = PDL.new Alignment(searchTerm, searchText, 0.86, 0, 6, 0, 0); // PseudoDamerauLevenshtein.Alignment ali3 = PDL.new Alignment(searchTerm, searchText, 0.86, 0, 6, 0, 0); // PseudoDamerauLevenshtein.Alignment ali4 = PDL.new Alignment(searchTerm, searchText, 0.86, 0, 7, 0, 0); // PseudoDamerauLevenshtein.Alignment ali5 = PDL.new Alignment(searchTerm, searchText, 0.71, 0, 8, 0, 0); // PseudoDamerauLevenshtein.Alignment ali6 = PDL.new Alignment(searchTerm, searchText, 0.71, 0, 8, 0, 0); alignments.add(ali1); alignments.add(ali2); // alignments.add(ali3); // alignments.add(ali4); // alignments.add(ali5); // alignments.add(ali6); alignments = PseudoDamerauLevenshtein.filterAlignments(alignments); Assert.assertEquals(1, alignments.size()); Assert.assertTrue(alignments.contains(ali1) ^ alignments.contains(ali2)); } @Test public void testSimpleFilterAlignments7() { String searchTerm = "thee"; String searchText = "The x y the"; PDL.init(searchTerm, searchText, true, true); alignments.clear(); PseudoDamerauLevenshtein.Alignment ali1 = PDL.new Alignment(searchTerm, "the ", 0.75, 0, 4, 0, 0); PseudoDamerauLevenshtein.Alignment ali2 = PDL.new Alignment(searchTerm, "the-", 0.75, 8, 11, 0, 0); PseudoDamerauLevenshtein.Alignment ali3 = PDL.new Alignment(searchTerm, "th-e", 0.75, 8, 11, 0, 0); alignments.add(ali1); alignments.add(ali2); alignments.add(ali3); alignments = PseudoDamerauLevenshtein.filterAlignments(alignments); Assert.assertEquals(2, alignments.size()); Assert.assertTrue(alignments.contains(ali1)); Assert.assertTrue(alignments.contains(ali2) ^ alignments.contains(ali3)); } @Test public void testSimpleFilterAlignments8() { String searchTerm = "jdsfaskd"; String searchText = "jsdaljasdf"; PDL.init(searchTerm, searchText, true, true); alignments.clear(); PseudoDamerauLevenshtein.Alignment ali1 = PDL.new Alignment("", "", 1.0, 2, 4, 0, 0); PseudoDamerauLevenshtein.Alignment ali2 = PDL.new Alignment("", "", 0.8, 3, 5, 0, 0); PseudoDamerauLevenshtein.Alignment ali3 = PDL.new Alignment("", "", 0.9, 4, 6, 0, 0); alignments.add(ali1); alignments.add(ali2); alignments.add(ali3); alignments = PseudoDamerauLevenshtein.filterAlignments(alignments); Assert.assertEquals(2, alignments.size()); Assert.assertTrue(alignments.contains(ali1) && alignments.contains(ali3)); alignments.clear(); ali1 = PDL.new Alignment("", "", 0.8, 2, 4, 0, 0); ali2 = PDL.new Alignment("", "", 0.9, 3, 5, 0, 0); ali3 = PDL.new Alignment("", "", 0.9, 4, 6, 0, 0); alignments.add(ali1); alignments.add(ali2); alignments.add(ali3); alignments = PseudoDamerauLevenshtein.filterAlignments(alignments); Assert.assertEquals(1, alignments.size()); Assert.assertTrue(alignments.contains(ali2)); } @Test public void testOverlapsWith() { // 0. [1,4] [1,4] => true Assert.assertTrue(PDL.new Alignment("", "", 0.0, 1, 4, 0, 0) .overlapsWith(PDL.new Alignment("", "", 0.0, 1, 4, 0, 0))); // 1. [1,2] [2,4] => false Assert.assertFalse(PDL.new Alignment("", "", 0.0, 1, 2, 0, 0) .overlapsWith(PDL.new Alignment("", "", 0.0, 2, 4, 0, 0))); // 2. [1,3] [2,5] => true Assert.assertTrue(PDL.new Alignment("", "", 0.0, 1, 3, 0, 0) .overlapsWith(PDL.new Alignment("", "", 0.0, 2, 5, 0, 0))); // 3. [1,5] [0,6] => true Assert.assertTrue(PDL.new Alignment("", "", 0.0, 1, 5, 0, 0) .overlapsWith(PDL.new Alignment("", "", 0.0, 0, 6, 0, 0))); // 4. [2,4] [1,2] => false Assert.assertFalse(PDL.new Alignment("", "", 0.0, 2, 4, 0, 0) .overlapsWith(PDL.new Alignment("", "", 0.0, 1, 2, 0, 0))); // 5. [2,5] [1,3] => true Assert.assertTrue(PDL.new Alignment("", "", 0.0, 2, 5, 0, 0) .overlapsWith(PDL.new Alignment("", "", 0.0, 1, 3, 0, 0))); } @Test public void testLongAlignment1() { PDL.init("thee", "The x y the", true, false); // alfdsj the aflsjd thex jlsadf thee. List<PseudoDamerauLevenshtein.Alignment> alis = PDL.computeAlignments(0.65); System.out.format("-------testLongAlignment1() final alignments:\n\n"); for (Alignment ali: alis) { ali.print(); for (Alignment ali2: alis) { if (ali == ali2) continue; Assert.assertFalse(ali.overlapsWith(ali2)); } } System.out.format("-------END OF testLongAlignment1() final alignments:\n\n"); } @Test public void testSimpleAlignments() { // TODO: special test for alignments! System.out.format("\n\n-------testSimpleAlignments() ------------------------\n"); PseudoDamerauLevenshtein DL = new PseudoDamerauLevenshtein(); //DL.init("AB", "CD", false, true); //DL.init("ACD", "ADE", false, true); //DL.init("AB", "XAB", false, true); //DL.init("AB", "XAB", true, true); //DL.init("fit", "xfity", true, true); //DL.init("fit", "xxfityyy", true, true); //DL.init("ABCD", "BACD", false, true); //DL.init("fit", "xfityfitz", true, true); //DL.init("fit", "xfitfitz", true, true); //DL.init("fit", "xfitfitfitfitz", true, true); //DL.init("setup", "set up", true, true); //DL.init("set up", "setup", true, true); //DL.init("hobbies", "hobbys", true, true); //DL.init("hobbys", "hobbies", true, true); //DL.init("thee", "The x y the jdlsjds salds", true, false); DL.init("Bismark", "... Bismarck lived...Bismarck reigned...", true, true); //DL.init("refugee", "refuge x y", true, true); //StringMatchingStrategy.APPROXIMATE_MATCHING_MINPROB List<PseudoDamerauLevenshtein.Alignment> alis = DL.computeAlignments(0.65); System.out.format("----------result of testSimpleAlignments() ---------------------\n\n"); for (Alignment ali: alis) { ali.print(); } } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
d81e5ce0c7c8fec941a70c605afbb76d1d675b49
569fc272e3fc5450ad579759541322d66c8c57a3
/src/main/java/likedriving/design/LibraryManagementSystem/Exceptions/UnableToPlaceOrder.java
084c092aea381a26c5611a72edaa65099cab5a07
[]
no_license
kunal-exuberant/incubator
daa27775f8a0a06ca3844aacebcddadc58a1c8a9
f6142ba95890aa8fb018f90447f9277359175f87
refs/heads/master
2022-12-09T18:17:26.431006
2020-08-14T07:41:41
2020-08-14T07:41:41
181,538,934
1
0
null
2022-11-16T08:24:16
2019-04-15T17:55:27
Java
UTF-8
Java
false
false
195
java
package likedriving.design.LibraryManagementSystem.Exceptions; public class UnableToPlaceOrder extends Exception{ public UnableToPlaceOrder(String message){ super(message); } }
[ "kunalsingh.k@kunal-exuberant.local" ]
kunalsingh.k@kunal-exuberant.local
a3476d25a5f109e15753acb51adf5b53a2d9b60b
394a56ac07462a7305e934de37c3ed3a5363f56a
/Pastas Extra/T4J Sprint4/T4J_WS/src/main/java/com/company/model/Data.java
14fe86147ec6a0888bf4dd87f2979147fae289d9
[]
no_license
pedro-miguez/upskill_java1_labprg_grupo3
69ab871772f2a2faba901ee894aea2f8fe7392bb
99bed16b491e8f0fbceb86e621cb9164e7722586
refs/heads/main
2023-03-24T02:26:43.964110
2021-03-22T10:50:54
2021-03-22T10:50:54
331,625,464
1
0
null
2021-03-19T18:00:07
2021-01-21T12:45:29
Java
UTF-8
Java
false
false
11,937
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.company.model; import exceptions.DiaInvalidoException; import exceptions.MesInvalidoException; import java.sql.Date; import java.time.LocalDate; import java.util.Calendar; /** * Representa uma data através do dia, mês e ano. * * @author Grupo 3 */ public class Data implements Comparable<Data> { /** * O ano da data. */ private int ano; /** * O mês da data. */ private Mes mes; /** * O dia da data. */ private int dia; /** * O ano por omissão. */ private static final int ANO_POR_OMISSAO = 1; /** * O mês por omissão. */ private static final Mes MES_POR_OMISSAO = Mes.JANEIRO; /** * O dia por omissão. */ private static final int DIA_POR_OMISSAO = 1; /** * Representa os dias da semana. */ private static enum DiaDaSemana { /** * Os dias da semana. */ DOMINGO { @Override public String toString() { return "Domingo"; } }, SEGUNDA { @Override public String toString() { return "Segunda-Feira"; } }, TERCA { @Override public String toString() { return "Terça-Feira"; } }, QUARTA { @Override public String toString() { return "Quarta-Feira"; } }, QUINTA { @Override public String toString() { return "Quinta-Feira"; } }, SEXTA { @Override public String toString() { return "Sexta-Feira"; } }, SABADO { @Override public String toString() { return "Sábado"; } }; /** * Devolve a designação do dia da semana cuja ordem é recebida por * parâmetro. * * @param ordemDiaDaSemana a ordem do dia da semana entre zero e seis, * inclusivé. A menor ordem corresponde ao * Domingo. * @return a designação do dia da semana. */ public static String designacaoDiaDaSemana(int ordemDiaDaSemana) { return DiaDaSemana.values()[ordemDiaDaSemana].toString(); } } /** * Representa os meses do ano. */ private static enum Mes { /** * Os meses do ano. */ JANEIRO(31) { @Override public String toString() { return "Janeiro"; } }, FEVEREIRO(28) { @Override public String toString() { return "Fevereiro"; } }, MARCO(31) { @Override public String toString() { return "Março"; } }, ABRIL(30) { @Override public String toString() { return "Abril"; } }, MAIO(31) { @Override public String toString() { return "Maio"; } }, JUNHO(30) { @Override public String toString() { return "Junho"; } }, JULHO(31) { @Override public String toString() { return "Julho"; } }, AGOSTO(31) { @Override public String toString() { return "Agosto"; } }, SETEMBRO(30) { @Override public String toString() { return "Setembro"; } }, OUTUBRO(31) { @Override public String toString() { return "Outubro"; } }, NOVEMBRO(30) { @Override public String toString() { return "Novembro"; } }, DEZEMBRO(31) { @Override public String toString() { return "Dezembro"; } }; /** * O número de dias de um mês. */ private int numeroDeDias; /** * Constrói um mês com o número de dias recebido por parâmetro. * * @param numeroDeDias o número de dias do mês. */ private Mes(int numeroDeDias) { this.numeroDeDias = numeroDeDias; } /** * Devolve o número de dias do mês do ano recebido por parâmetro. * * @param ano o ano do mês. * @return o número de dias do mês do ano. */ public int numeroDeDias(int ano) { if (ordinal() == 1 && Data.isAnoBissexto(ano)) { return numeroDeDias + 1; } return numeroDeDias; } /** * Devolve o mês cuja ordem é recebida por parâmetro. * * @param ordemDoMes a ordem do mês. * @return o mês cuja ordem é recebida por parâmetro. */ public static Mes obterMes(int ordemDoMes) { return Mes.values()[ordemDoMes - 1]; } } /** * Constrói uma instância de Data recebendo o ano, o mês e o dia. * * @param ano o ano da data. * @param mes o mês da data. * @param dia o dia da data. */ public Data(int ano, int mes, int dia) { setData(ano,mes,dia); } /** * Constrói uma instância de Data com a data por omissão. */ public Data() { ano = ANO_POR_OMISSAO; mes = MES_POR_OMISSAO; dia = DIA_POR_OMISSAO; } /** * Constrói uma instância de Data com as mesmas caraterísticas da data * recebida por parâmetro. * * @param outraData a data com as características a copiar. */ public Data(Data outraData) { ano = outraData.ano; mes = outraData.mes; dia = outraData.dia; } /** * Devolve o ano da data. * * @return ano da data */ public int getAno() { return ano; } /** * Devolve o mês da data. * * @return mês da data. */ public int getMes() { return mes.ordinal()+1; } /** * Devolve o dia da data. * * @return dia da data. */ public int getDia() { return dia; } /** * Modifica o ano, o mês e o dia da data. * * @param ano o novo ano da data. * @param mes o novo mês da data. * @param dia o novo dia da data. */ public final void setData(int ano, int mes, int dia) { if (mes < 1 || mes > 12) { throw new MesInvalidoException("Mês " + mes + " é inválido!!"); } if (dia < 1 || dia > Mes.obterMes(mes).numeroDeDias(ano)) { throw new DiaInvalidoException("Dia " + ano + "/" + mes + "/" + dia + " é inválido!!"); } this.ano = ano; this.mes = Mes.obterMes(mes); this.dia = dia; } /** * Devolve a descrição textual da data no formato: diaDaSemana, dia de mês * de ano. * * @return caraterísticas da data. */ @Override public String toString() { return String.format("%s, %d de %s de %d", diaDaSemana(), dia, mes, ano); } /** * Devolve a data no formato:%04d/%02d/%02d. * * @return caraterísticas da data. */ public String toAnoMesDiaString() { return String.format("%02d/%02d/%04d", dia, mes.ordinal()+1, ano); } public String dataSQLtoString() { return String.format("%04d-%02d-%02d", ano, mes.ordinal()+1, dia); } /** * Compara a data com o objeto recebido. * * @param outroObjeto o objeto a comparar com a data. * @return true se o objeto recebido representar uma data equivalente à * data. Caso contrário, retorna false. */ @Override public boolean equals(Object outroObjeto) { if (this == outroObjeto) { return true; } if (outroObjeto == null || getClass() != outroObjeto.getClass()) { return false; } Data outraData = (Data) outroObjeto; return ano == outraData.ano && mes.equals(outraData.mes) && dia == outraData.dia; } /** * Compara a data com a outra data recebida por parâmetro. * * @param outraData a data a ser comparada. * @return o valor 0 se a outraData recebida é igual à data; o valor -1 se * a outraData for posterior à data; o valor 1 se a outraData for * anterior à data. */ @Override public int compareTo(Data outraData) { return (outraData.isMaior(this)) ? -1 : (isMaior(outraData)) ? 1 : 0; } /** * Devolve o dia da semana da data. * * @return dia da semana da data. */ public String diaDaSemana() { int totalDias = contaDias(); totalDias = totalDias % 7; return DiaDaSemana.designacaoDiaDaSemana(totalDias); } /** * Devolve true se a data for maior do que a data recebida por parâmetro. Se * a data for menor ou igual à data recebida por parâmetro, devolve false. * * @param outraData a outra data com a qual se compara a data. * @return true se a data for maior do que a data recebida por parâmetro, * caso contrário devolve false. */ public boolean isMaior(Data outraData) { int totalDias = contaDias(); int totalDias1 = outraData.contaDias(); return totalDias > totalDias1; } /** * Devolve a diferença em número de dias entre a data e a data recebida por * parâmetro. * * @param outraData a outra data com a qual se compara a data para calcular * a diferença do número de dias. * @return diferença em número de dias entre a data e a data recebida por * parâmetro. */ public int diferenca(Data outraData) { int totalDias = contaDias(); int totalDias1 = outraData.contaDias(); return Math.abs(totalDias - totalDias1); } /** * Devolve a diferença em número de dias entre a data e a data recebida por * parâmetro com ano, mês e dia. * * @param ano o ano da data com a qual se compara a data para calcular a * diferença do número de dias. * @param mes o mês da data com a qual se compara a data para calcular a * diferença do número de dias. * @param dia o dia da data com a qual se compara a data para calcular a * diferença do número de dias. * @return diferença em número de dias entre a data e a data recebida por * parâmetro com ano, mês e dia. */ public int diferenca(int ano, int mes, int dia) { int totalDias = contaDias(); Data outraData = new Data(ano, mes, dia); int totalDias1 = outraData.contaDias(); return Math.abs(totalDias - totalDias1); } /** * Devolve true se o ano passado por parâmetro for bissexto. Se o ano * passado por parâmetro não for bissexto, devolve false. * * @param ano o ano a validar. * @return true se o ano passado por parâmetro for bissexto, caso contrário * devolve false. */ public static boolean isAnoBissexto(int ano) { return ano % 4 == 0 && ano % 100 != 0 || ano % 400 == 0; } /** * Devolve a data atual do sistema. * * @return a data atual do sistema. */ public static Data dataAtual() { Calendar hoje = Calendar.getInstance(); int ano = hoje.get(Calendar.YEAR); int mes = hoje.get(Calendar.MONTH) + 1; // janeiro é representado por 0. int dia = hoje.get(Calendar.DAY_OF_MONTH); return new Data(ano, mes, dia); } /** * Devolve o número de dias desde o dia 1/1/1 até à data. * * @return número de dias desde o dia 1/1/1 até à data. */ private int contaDias() { int totalDias = 0; for (int i = 1; i < ano; i++) { totalDias += isAnoBissexto(i) ? 366 : 365; } for (int i = 1; i < mes.ordinal()+1; i++) { totalDias += Mes.obterMes(i).numeroDeDias(ano); } totalDias += dia; return totalDias; } public Date getDataSQL() { return Date.valueOf(this.dataSQLtoString()); } }
[ "74573559+anibalfarraia2020@users.noreply.github.com" ]
74573559+anibalfarraia2020@users.noreply.github.com
259bd086960983522fb334686dd2e95b8540492a
f03f9da4e5fcc8191acfa5536d5a5ecadeb9f37f
/zuul-gateway-filter/src/main/java/com/bobo/zuul/filter/ErrorFilter.java
b145e49df66166d93bb36b0acbedb52af0927dc1
[]
no_license
j2eevip/springcloud-learning
d50efa067c7a719a9f6c190c3bcfa5b11aca119f
64ce8b21e67cebd429386977b391ed5713f4108c
refs/heads/master
2023-04-07T00:17:16.492620
2021-04-22T02:26:26
2021-04-22T02:26:26
360,366,393
0
0
null
null
null
null
UTF-8
Java
false
false
1,259
java
package com.bobo.zuul.filter; import javax.servlet.http.HttpServletRequest; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; import com.netflix.zuul.ZuulFilter; import com.netflix.zuul.context.RequestContext; /** * 自定义网关过滤器 * @author dengp * */ @Component public class ErrorFilter extends ZuulFilter{ private Logger logger = LoggerFactory.getLogger(ErrorFilter.class); /** * 过滤方法 */ @Override public Object run() { // 获取Request上下文 RequestContext rc = RequestContext.getCurrentContext(); HttpServletRequest request = rc.getRequest(); logger.info("LogFilter .... 请求的路径是{},请求提交的方式是{}", request.getRequestURL().toString(),request.getMethod()); return null; } /** * 是否开启过滤:默认false */ @Override public boolean shouldFilter() { // TODO Auto-generated method stub return true; } /** * 多个过滤器中的执行顺序,数值越小,优先级越高 */ @Override public int filterOrder() { // TODO Auto-generated method stub return 0; } /** * 过滤器的类型 */ @Override public String filterType() { // TODO Auto-generated method stub return "error"; } }
[ "easonhacker@gmail.com" ]
easonhacker@gmail.com
aea0fe61975f5ddb496238f3fc5afbcf3355d9be
51fa3cc281eee60058563920c3c9059e8a142e66
/Java/src/testcases/CWE400_Resource_Exhaustion/s02/CWE400_Resource_Exhaustion__listen_tcp_write_41.java
823331d965c939f71ab7d2c62c146e373946af2a
[]
no_license
CU-0xff/CWE-Juliet-TestSuite-Java
0b4846d6b283d91214fed2ab96dd78e0b68c945c
f616822e8cb65e4e5a321529aa28b79451702d30
refs/heads/master
2020-09-14T10:41:33.545462
2019-11-21T07:34:54
2019-11-21T07:34:54
223,105,798
1
4
null
null
null
null
UTF-8
Java
false
false
13,746
java
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE400_Resource_Exhaustion__listen_tcp_write_41.java Label Definition File: CWE400_Resource_Exhaustion.label.xml Template File: sources-sinks-41.tmpl.java */ /* * @description * CWE: 400 Resource Exhaustion * BadSource: listen_tcp Read count using a listening tcp connection * GoodSource: A hardcoded non-zero, non-min, non-max, even number * Sinks: write * GoodSink: Write to a file count number of times, but first validate count * BadSink : Write to a file count number of times * Flow Variant: 41 Data flow: data passed as an argument from one method to another in the same class * * */ package testcases.CWE400_Resource_Exhaustion.s02; import testcasesupport.*; import javax.servlet.http.*; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; import java.net.Socket; import java.net.ServerSocket; import java.util.logging.Level; import java.io.File; import java.io.FileOutputStream; import java.io.OutputStreamWriter; import java.io.BufferedWriter; public class CWE400_Resource_Exhaustion__listen_tcp_write_41 extends AbstractTestCase { private void badSink(int count ) throws Throwable { File file = new File("badSink.txt"); FileOutputStream streamFileOutput = new FileOutputStream(file); OutputStreamWriter writerOutputStream = new OutputStreamWriter(streamFileOutput, "UTF-8"); BufferedWriter writerBuffered = new BufferedWriter(writerOutputStream); int i; /* POTENTIAL FLAW: Do not validate count before using it as the for loop variant to write to a file */ for (i = 0; i < count; i++) { try { writerBuffered.write("Hello"); } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error with stream writing", exceptIO); } } /* Close stream reading objects */ try { if (writerBuffered != null) { writerBuffered.close(); } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error closing BufferedWriter", exceptIO); } try { if (writerOutputStream != null) { writerOutputStream.close(); } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error closing OutputStreamWriter", exceptIO); } try { if (streamFileOutput != null) { streamFileOutput.close(); } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error closing FileOutputStream", exceptIO); } } public void bad() throws Throwable { int count; count = Integer.MIN_VALUE; /* Initialize count */ { ServerSocket listener = null; Socket socket = null; BufferedReader readerBuffered = null; InputStreamReader readerInputStream = null; /* Read data using a listening tcp connection */ try { listener = new ServerSocket(39543); socket = listener.accept(); /* read input from socket */ readerInputStream = new InputStreamReader(socket.getInputStream(), "UTF-8"); readerBuffered = new BufferedReader(readerInputStream); /* POTENTIAL FLAW: Read count using a listening tcp connection */ String stringNumber = readerBuffered.readLine(); if (stringNumber != null) // avoid NPD incidental warnings { try { count = Integer.parseInt(stringNumber.trim()); } catch(NumberFormatException exceptNumberFormat) { IO.logger.log(Level.WARNING, "Number format exception parsing count from string", exceptNumberFormat); } } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error with stream reading", exceptIO); } finally { /* Close stream reading objects */ try { if (readerBuffered != null) { readerBuffered.close(); } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error closing BufferedReader", exceptIO); } try { if (readerInputStream != null) { readerInputStream.close(); } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error closing InputStreamReader", exceptIO); } /* Close socket objects */ try { if (socket != null) { socket.close(); } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error closing Socket", exceptIO); } try { if (listener != null) { listener.close(); } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error closing ServerSocket", exceptIO); } } } badSink(count ); } public void good() throws Throwable { goodG2B(); goodB2G(); } private void goodG2BSink(int count ) throws Throwable { File file = new File("badSink.txt"); FileOutputStream streamFileOutput = new FileOutputStream(file); OutputStreamWriter writerOutputStream = new OutputStreamWriter(streamFileOutput, "UTF-8"); BufferedWriter writerBuffered = new BufferedWriter(writerOutputStream); int i; /* POTENTIAL FLAW: Do not validate count before using it as the for loop variant to write to a file */ for (i = 0; i < count; i++) { try { writerBuffered.write("Hello"); } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error with stream writing", exceptIO); } } /* Close stream reading objects */ try { if (writerBuffered != null) { writerBuffered.close(); } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error closing BufferedWriter", exceptIO); } try { if (writerOutputStream != null) { writerOutputStream.close(); } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error closing OutputStreamWriter", exceptIO); } try { if (streamFileOutput != null) { streamFileOutput.close(); } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error closing FileOutputStream", exceptIO); } } /* goodG2B() - use goodsource and badsink */ private void goodG2B() throws Throwable { int count; /* FIX: Use a hardcoded number that won't cause underflow, overflow, divide by zero, or loss-of-precision issues */ count = 2; goodG2BSink(count ); } private void goodB2GSink(int count ) throws Throwable { /* FIX: Validate count before using it as the for loop variant to write to a file */ if (count > 0 && count <= 20) { File file = new File("goodSink.txt"); FileOutputStream streamFileOutput = new FileOutputStream(file); OutputStreamWriter writerOutputStream = new OutputStreamWriter(streamFileOutput, "UTF-8"); BufferedWriter writerBuffered = new BufferedWriter(writerOutputStream); int i; for (i = 0; i < count; i++) { try { writerBuffered.write("Hello"); } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error with stream writing", exceptIO); } } /* Close stream reading objects */ try { if (writerBuffered != null) { writerBuffered.close(); } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error closing BufferedWriter", exceptIO); } try { if (writerOutputStream != null) { writerOutputStream.close(); } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error closing OutputStreamWriter", exceptIO); } try { if (streamFileOutput != null) { streamFileOutput.close(); } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error closing FileOutputStream", exceptIO); } } } /* goodB2G() - use badsource and goodsink */ private void goodB2G() throws Throwable { int count; count = Integer.MIN_VALUE; /* Initialize count */ { ServerSocket listener = null; Socket socket = null; BufferedReader readerBuffered = null; InputStreamReader readerInputStream = null; /* Read data using a listening tcp connection */ try { listener = new ServerSocket(39543); socket = listener.accept(); /* read input from socket */ readerInputStream = new InputStreamReader(socket.getInputStream(), "UTF-8"); readerBuffered = new BufferedReader(readerInputStream); /* POTENTIAL FLAW: Read count using a listening tcp connection */ String stringNumber = readerBuffered.readLine(); if (stringNumber != null) // avoid NPD incidental warnings { try { count = Integer.parseInt(stringNumber.trim()); } catch(NumberFormatException exceptNumberFormat) { IO.logger.log(Level.WARNING, "Number format exception parsing count from string", exceptNumberFormat); } } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error with stream reading", exceptIO); } finally { /* Close stream reading objects */ try { if (readerBuffered != null) { readerBuffered.close(); } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error closing BufferedReader", exceptIO); } try { if (readerInputStream != null) { readerInputStream.close(); } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error closing InputStreamReader", exceptIO); } /* Close socket objects */ try { if (socket != null) { socket.close(); } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error closing Socket", exceptIO); } try { if (listener != null) { listener.close(); } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error closing ServerSocket", exceptIO); } } } goodB2GSink(count ); } /* Below is the main(). It is only used when building this testcase on * its own for testing or for building a binary to use in testing binary * analysis tools. It is not used when compiling all the testcases as one * application, which is how source code analysis tools are tested. */ public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException { mainFromParent(args); } }
[ "frank@fischer.com.mt" ]
frank@fischer.com.mt
be0787c7fcc33ddf7cf723e4780c848d0ac8bd8a
206672ee12a6ec865df5574cb226422c07ad62bb
/src/main/java/top/xiongmingcai/restful/service/CategoryService.java
ff93e14b09c92d9d5acba8b5db408ad23b2dbca5
[]
no_license
MingCaiXiong/spring-learn
9d9652639569e6f5898a321e11bc869895582ba2
d4cc234a91b7693318ee724180ea7c229190a240
refs/heads/main
2023-04-10T05:48:31.418912
2021-04-27T07:35:16
2021-04-27T07:35:16
357,574,339
1
0
null
null
null
null
UTF-8
Java
false
false
1,098
java
package top.xiongmingcai.restful.service; import top.xiongmingcai.restful.entity.Category; import java.util.List; /** * (Category)表服务接口 * * @author makejava * @since 2021-04-22 10:38:43 */ public interface CategoryService { /** * 通过ID查询单条数据 * * @param categoryId 主键 * @return 实例对象 */ Category queryById(Long categoryId); List<Category> selectAll(); /** * 查询多条数据 * * @param offset 查询起始位置 * @param limit 查询条数 * @return 对象列表 */ List<Category> queryAllByLimit(int offset, int limit); /** * 新增数据 * * @param category 实例对象 * @return 实例对象 */ Category insert(Category category); /** * 修改数据 * * @param category 实例对象 * @return 实例对象 */ Category update(Category category); /** * 通过主键删除数据 * * @param categoryId 主键 * @return 是否成功 */ boolean deleteById(Long categoryId); }
[ "xmc000@icloud.com" ]
xmc000@icloud.com
8dee9463c668f407ccfa8f6bf4a6f570ab271089
200feedb07735af0dff48804343dceb453f2ffd2
/Representative_data_Gen/SDG/src/adapters/EClassifierAdapter.java
24b29e4a770f673cf3b4d6db4f9f2e794fea2699
[]
no_license
Ghanem-Soltana/PoliSim
c9c1819535a6023e119f40e8fcb1e77ad8f6041a
b1e8328a71a1a3aff072725cf02ee5757e21d4d9
refs/heads/master
2020-05-31T08:04:52.042215
2019-06-04T10:15:29
2019-06-04T10:15:29
190,173,842
0
0
null
null
null
null
UTF-8
Java
false
false
5,551
java
package adapters; import java.lang.reflect.InvocationTargetException; import org.eclipse.emf.common.notify.Adapter; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.common.util.TreeIterator; import org.eclipse.emf.ecore.EAnnotation; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EClassifier; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EOperation; import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.EReference; import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.emf.ecore.ETypeParameter; import org.eclipse.emf.ecore.EcorePackage; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.util.BasicExtendedMetaData.EClassifierExtendedMetaData; import org.eclipse.emf.ecore.util.BasicExtendedMetaData.EClassifierExtendedMetaData.Holder; import org.eclipse.uml2.uml.DataType; public abstract class EClassifierAdapter <EC> implements EClassifier, Holder{ @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((origClassifier == null) ? 0 : origClassifier.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof EClassifierAdapter)) return false; EClassifierAdapter<?> other = (EClassifierAdapter<?>) obj; if (origClassifier == null) { if (other.origClassifier != null) return false; } else if (!origClassifier.equals(other.origClassifier)) return false; return true; } protected EC origClassifier; public EClassifierAdapter (EC newClassifier) { origClassifier = newClassifier; } @Override public abstract String getName(); @Override public void setName(String value) { throw new UnsupportedOperationException(); } @Override public EList<EAnnotation> getEAnnotations() { throw new UnsupportedOperationException(); } @Override public EAnnotation getEAnnotation(String source) { throw new UnsupportedOperationException(); } @Override public EClass eClass() { if (origClassifier instanceof Class) return EcorePackage.eINSTANCE.getEClass(); if (origClassifier instanceof DataType) return EcorePackage.eINSTANCE.getEDataType(); return EcorePackage.eINSTANCE.getEClassifier(); } @Override public Resource eResource() { throw new UnsupportedOperationException(); } @Override public abstract EObject eContainer(); @Override public EStructuralFeature eContainingFeature() { throw new UnsupportedOperationException(); } @Override public EReference eContainmentFeature() { throw new UnsupportedOperationException(); } @Override public EList<EObject> eContents() { throw new UnsupportedOperationException(); } @Override public TreeIterator<EObject> eAllContents() { throw new UnsupportedOperationException(); } @Override public boolean eIsProxy() { return false; } @Override public EList<EObject> eCrossReferences() { throw new UnsupportedOperationException(); } @Override public Object eGet(EStructuralFeature feature) { throw new UnsupportedOperationException(); } @Override public Object eGet(EStructuralFeature feature, boolean resolve) { throw new UnsupportedOperationException(); } @Override public void eSet(EStructuralFeature feature, Object newValue) { throw new UnsupportedOperationException(); } @Override public boolean eIsSet(EStructuralFeature feature) { throw new UnsupportedOperationException(); } @Override public void eUnset(EStructuralFeature feature) { throw new UnsupportedOperationException(); } @Override public Object eInvoke(EOperation operation, EList<?> arguments) throws InvocationTargetException { throw new UnsupportedOperationException(); } @Override public EList<Adapter> eAdapters() { throw new UnsupportedOperationException(); } @Override public boolean eDeliver() { throw new UnsupportedOperationException(); } @Override public void eSetDeliver(boolean deliver) { throw new UnsupportedOperationException(); } @Override public void eNotify(Notification notification) { throw new UnsupportedOperationException(); } @Override public abstract String getInstanceClassName(); @Override public void setInstanceClassName(String value) { throw new UnsupportedOperationException(); } @Override public abstract Class<?> getInstanceClass(); @Override public void setInstanceClass(Class<?> value) { throw new UnsupportedOperationException(); } @Override public Object getDefaultValue() { throw new UnsupportedOperationException(); } @Override public String getInstanceTypeName() { throw new UnsupportedOperationException(); } @Override public void setInstanceTypeName(String value) { throw new UnsupportedOperationException(); } @Override public abstract EPackage getEPackage(); @Override public EList<ETypeParameter> getETypeParameters() { throw new UnsupportedOperationException(); } @Override public boolean isInstance(Object object) { throw new UnsupportedOperationException(); } @Override public int getClassifierID(){ throw new UnsupportedOperationException(); } @Override public void setExtendedMetaData( EClassifierExtendedMetaData eClassifierExtendedMetaData) { // TODO Auto-generated method stub } @Override public EClassifierExtendedMetaData getExtendedMetaData() { // TODO Auto-generated method stub return null; } }
[ "sultana.ghanem@gmail.com" ]
sultana.ghanem@gmail.com
e9e43353e3eba81230f34cf23a61c4bdb4de164f
dfd7e70936b123ee98e8a2d34ef41e4260ec3ade
/analysis/reverse-engineering/decompile-fitts-20191031-2200/sources/com/google/android/gms/internal/firebase-perf/zzam.java
3c08ebb58b9939398d98984183ef67551aeb047a
[ "Apache-2.0" ]
permissive
skkuse-adv/2019Fall_team2
2d4f75bc793368faac4ca8a2916b081ad49b7283
3ea84c6be39855f54634a7f9b1093e80893886eb
refs/heads/master
2020-08-07T03:41:11.447376
2019-12-21T04:06:34
2019-12-21T04:06:34
213,271,174
5
5
Apache-2.0
2019-12-12T09:15:32
2019-10-07T01:18:59
Java
UTF-8
Java
false
false
1,018
java
package com.google.android.gms.internal.firebase-perf; import java.lang.ref.Reference; import java.lang.ref.ReferenceQueue; import java.util.List; import java.util.Vector; import java.util.concurrent.ConcurrentHashMap; final class zzam { private final ConcurrentHashMap<zzal, List<Throwable>> zzam = new ConcurrentHashMap<>(16, 0.75f, 10); private final ReferenceQueue<Throwable> zzan = new ReferenceQueue<>(); zzam() { } public final List<Throwable> zza(Throwable th, boolean z) { Reference poll = this.zzan.poll(); while (poll != null) { this.zzam.remove(poll); poll = this.zzan.poll(); } List<Throwable> list = (List) this.zzam.get(new zzal(th, null)); if (list != null) { return list; } Vector vector = new Vector(2); List<Throwable> list2 = (List) this.zzam.putIfAbsent(new zzal(th, this.zzan), vector); return list2 == null ? vector : list2; } }
[ "33246398+ajid951125@users.noreply.github.com" ]
33246398+ajid951125@users.noreply.github.com
b6116b08ce29d06f3dca7ab3c54f9ca364718e4f
548ee109090c7cb99e3926edaa33d9fb61eea8f9
/src/main/java/com/example/jdk/reflect/ReflectTest.java
5f5beb6f82b8e7cc7676ef9c9bf57cbb4db9783a
[]
no_license
foreversxg/spring-basic-demo
f38e4d2c2c65d201fe245baebb1f8839166ed2dc
16b0208ee3371c4425202dc377370e3fbb3b7ae3
refs/heads/master
2022-08-03T22:43:55.360793
2021-04-15T14:57:36
2021-04-15T14:57:36
176,640,889
0
1
null
2022-07-07T19:30:50
2019-03-20T02:57:43
Java
UTF-8
Java
false
false
803
java
package com.example.jdk.reflect; import java.lang.reflect.Field; import java.lang.reflect.Method; /** * @Author: shaoxiangen * @Date: Create in 2018/9/3 */ public class ReflectTest { public static void main(String[] args) throws IllegalAccessException { getDeclardMethod(); } public static void processPriverFiled() throws IllegalAccessException { Demo demo = new Demo(); demo.setName("abc"); Field[] fields = Demo.class.getDeclaredFields(); Field field = fields[0]; field.setAccessible(true); // 设为true才能操作私有变量 System.out.println(field.get(demo)); } public static void getDeclardMethod() { Method[] methods = Demo.class.getDeclaredMethods(); System.out.println(methods); } }
[ "shaoxiangen@corp.netease.com" ]
shaoxiangen@corp.netease.com
a763b4d8fd83a99e2b14cb86db1acc9b704078af
e87cda491bd753f3c3ffc6cb27c6746848ec95e5
/src/main/java/com/project/home/controller/IndexController.java
d89c8cda9b43fd50b2e79b3a9603534882ee2e61
[]
no_license
dimoni4/projects_home
e0ad54985f35388015f10ecfc2cfe7475062cc8a
c1b731c973891bfae7729e698e3f673a2724e801
refs/heads/master
2020-08-25T06:24:55.474431
2016-01-26T09:00:04
2016-01-26T09:00:04
38,312,689
2
2
null
null
null
null
UTF-8
Java
false
false
1,189
java
package com.project.home.controller; import com.project.home.models.entity.User; import com.project.home.repository.ProjectRepository; import com.project.home.repository.UserRepository; import com.project.home.service.UserSession; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; import java.security.Principal; @Controller public class IndexController { @Autowired private UserSession userSession; @Autowired UserRepository userRepository; @Autowired ProjectRepository projectRepository; @RequestMapping(value = {"/"}) protected ModelAndView index(Principal principal) throws Exception { User user; if(userSession.getUserId() == null ){ user = userRepository.findByEmail(principal.getName()); userSession.setUserId(user.getId()); } else { user = userRepository.getUser(userSession.getUserId()); } ModelAndView model = new ModelAndView("project/all"); model.addObject("user", user); model.addObject("projects", projectRepository.getAllProjects()); return model; } }
[ "vetrovs@ua.fm" ]
vetrovs@ua.fm
7a366304979317b3b46d7926dd657529eb00f0b9
455fb996051620eea815364a223e4c90496fca42
/flood-common/src/main/java/com/labym/flood/common/security/SecurityUtil.java
37168a17947f4f2ff2525f1b32301c3453b4eb35
[]
no_license
Labym/flood-cloud
a50bb5f6bf1be4f5a053feb9874ccba715196a8a
e570f832c83097d7fd2c2d8c99625819114f64a9
refs/heads/master
2020-03-17T18:27:54.374407
2018-05-31T03:29:27
2018-05-31T03:29:27
133,824,181
0
0
null
null
null
null
UTF-8
Java
false
false
141
java
package com.labym.flood.common.security; public class SecurityUtil { public static final Long currentUser(){ return 0L; } }
[ "zhangjingl02@hotmail.com" ]
zhangjingl02@hotmail.com
2af6df03ec2aa869000e9c8e90caa9eeec0b118d
0e5a939ed0052a0d947040e1b0b5e9b16dc51e06
/src/hw5/ULLMap.java
2fedd78d0e0899db08bcf13d50f713d4f4bfb21d
[]
no_license
Kartepolo/CS61B_works
4a090a1eae5636bd2d3b25aa77dcb2ff913afa8e
42eada60a88777ccd25c70c16fb079dcb8120a55
refs/heads/master
2021-01-10T16:45:52.619491
2016-01-19T05:10:34
2016-01-19T05:10:34
49,927,984
0
0
null
null
null
null
UTF-8
Java
false
false
4,316
java
import java.util.*; /* java.util.Set needed only for challenge problem. */ /** A data structure that uses a linked list to store pairs of keys and values. * Any key must appear at most once in the dictionary, but values may appear multiple * times. Supports get(key), put(key, value), and contains(key) methods. The value * associated to a key is the value in the last call to put with that key. * * For simplicity, you may assume that nobody ever inserts a null key or value * into your map. */ public class ULLMap<K,V> implements Map61B<K, V>,Iterable<K>{ /** Keys and values are stored in a linked list of Entry objects. * This variable stores the first pair in this linked list. You may * point this at a sentinel node, or use it as a the actual front item * of the linked list. */ private Entry front; private int size; public ULLMap(){ front = new Entry(null,null,null); size =0; } public Iterator<K> iterator(){ return new ULLMapIter(this); } public class ULLMapIter implements Iterator<K>{ public Entry p; public ULLMapIter(ULLMap<K,V> u){ p = front.next; } public K next(){ if (hasNext()){ K key = p.key; p = p.next; return key; } throw new NoSuchElementException(); } public boolean hasNext(){ return (p!=null); } public void remove() { throw new UnsupportedOperationException(); } } @Override public V get(K key) { Entry p = front.next.get(key); if (p!=null && p.val!=null){ return p.val; } return null; } @Override public void put(K key, V val) { Entry p = front; while(p.next!=null){ if (p.next.key.equals(key)){ p.next.val = val; return; } p = p.next; } p.next = new Entry(key,val,null); size++; } @Override public boolean containsKey(K key) { return front.next.get(key)!=null; } @Override public int size() { return size; } @Override public void clear() { size = 0; front.next = null; } /** Represents one node in the linked list that stores the key-value pairs * in the dictionary. */ private class Entry { /** Stores KEY as the key in this key-value pair, VAL as the value, and * NEXT as the next node in the linked list. */ public Entry(K k,V v, Entry n) { key = k; val = v; next = n; } /** Returns the Entry in this linked list of key-value pairs whose key * is equal to KEY, or null if no such Entry exists. */ public Entry get(K k) { Entry p = this; while(p!=null){ if(p.key.equals(k)){ return p; } p = p.next; } return null; } /** Stores the key of the key-value pair of this node in the list. */ private K key; /** Stores the value of the key-value pair of this node in the list. */ private V val; /** Stores the next Entry in the linked list. */ private Entry next; } /* Methods below are all challenge problems. Will not be graded in any way. * Autograder will not test these. */ @Override public V remove(K key) { Entry p = front.next.get(key); if (p!=null){ V v = p.val; p.val = null; return v; } return null; } @Override public V remove(K key, V value) { Entry p = front.next; V r = null; while(p.next!=null){ if(p.next.key==key&&p.next.val==value){ r = p.next.val; p.next = p.next.next; }else{ p = p.next; } } size--; return r; } @Override public Set<K> keySet() { Set<K> set=new HashSet<K>(); Entry p = front.next; while(p!=null){ set.add(p.key); } return set; } public static <K,V> ULLMap<V,K> invert(ULLMap<K,V> umap){ ULLMap<V,K> newmap = new ULLMap<V,K>(); for (K i : umap){ newmap.put(umap.get(i), i); } return newmap; } }
[ "karte_polo@126.com" ]
karte_polo@126.com
09dc845414a0e5982db23a30d6dfbb583fa35dfd
7a76970cb759bc12064f348835dfe5196c320e78
/开课吧Java基础内容/02-1数据类型转换、运算符、方法/Base/src/com/kkb/Demo05.java
7a9deb9cae04fa042bc728051fa083dc4c53f704
[]
no_license
make-process-everyday/Java_learn
5ab9e8f3e27819a793ad4a2aa6165c0be137b47b
0326db212a63521a9b350e3139492d1b29522a8a
refs/heads/master
2023-05-12T14:36:32.980537
2021-06-06T10:17:20
2021-06-06T10:17:20
342,742,554
0
0
null
null
null
null
UTF-8
Java
false
false
747
java
package com.kkb; /** * 算数运算符 * + - * / % */ public class Demo05 { public static void main(String[] args) { int n = 1234; System.out.println( n /1000 * 1000 ); //java中 两个整数相除 结果为整数 System.out.println( n /1000.0 * 1000 ); //java中 小数参数运算 ,结果为 小数 int m = 1; System.out.println("m+n的结果"); System.out.println(n + m); // + 两边都是数字时, 加法操作 System.out.println(n + m + "结果"); // + 两边若出现了 String类型, 数据的相连接的操作 System.out.println("结果" + n + m); // + 两边若出现了 String类型, 数据的相连接的操作 //结果12341 } }
[ "838727522@qq.com" ]
838727522@qq.com
151eba5eb8a8ed6e1871f95ac3f7d39b2b6387ba
79bfbb0a90c460f86d5ce46d18e1fc4695d27bca
/app/src/main/java/categories/ShoppingPlacesActivity.java
b2eaebb06f3a2c7097ff2042283f65f45226c50f
[]
no_license
ReemHazzaa/TourGuide
5175fe6dc5fb99971632864accbc46125648d2b2
a021410f638d6291b84a1535ac84d4825acd9c86
refs/heads/master
2020-04-08T09:38:35.483391
2019-01-13T14:49:33
2019-01-13T14:49:33
159,232,836
0
1
null
null
null
null
UTF-8
Java
false
false
3,924
java
package categories; import android.os.Build; import android.os.Bundle; import android.support.v4.content.ContextCompat; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.Window; import android.view.WindowManager; import android.widget.ListView; import com.example.reem.tourguide.R; import java.util.ArrayList; import customPlaceObjectsAndAdapters.ModernPlace; import customPlaceObjectsAndAdapters.ModernPlaceAdapter; /** * Created by Reem on 18,Nov,2018 */ public class ShoppingPlacesActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.places_list); // Handling the Toolbar Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); android.support.v7.app.ActionBar actionbar = getSupportActionBar(); actionbar.setDisplayHomeAsUpEnabled(true); actionbar.setTitle(R.string.shopping_title); actionbar.setHomeAsUpIndicator(R.drawable.baseline_arrow_back_ios_white_18); // Changing the status bar color Window window = this.getWindow(); // clear FLAG_TRANSLUCENT_STATUS flag: window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); // add FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS flag to the window window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); // finally change the color if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { window.setStatusBarColor(ContextCompat.getColor(this, R.color.colorPrimaryDark)); } // Create a list of ModernPlaces final ArrayList<ModernPlace> shoppingPlaces = new ArrayList<>(); shoppingPlaces.add(new ModernPlace(getString(R.string.shop_one_name), getString(R.string.first_shop_type), 2.5, getString(R.string.shop_one_address), R.string.shop_one_phone)); shoppingPlaces.add(new ModernPlace(getString(R.string.shop_two_name), getString(R.string.first_shop_type), 4.5, getString(R.string.shop_two_address), getString(R.string.shop_two_phone))); shoppingPlaces.add(new ModernPlace(getString(R.string.shop_three_name), getString(R.string.second_shop_type), 4.5, getString(R.string.shop_three_address), getString(R.string.shop_three_phone))); shoppingPlaces.add(new ModernPlace(getString(R.string.shop_four_name), getString(R.string.first_shop_type), 4.1, getString(R.string.shop_four_address), "")); shoppingPlaces.add(new ModernPlace(getString(R.string.shop_five_name), getString(R.string.third_shop_type), 3.2, getString(R.string.shop_five_address), getString(R.string.shop_five_phone))); shoppingPlaces.add(new ModernPlace(getString(R.string.shop_six_name), getString(R.string.first_shop_type), 4.4, getString(R.string.shop_six_address), "")); shoppingPlaces.add(new ModernPlace(getString(R.string.shop_seven_name), getString(R.string.first_shop_type), 0.0, getString(R.string.shop_seven_address), "")); shoppingPlaces.add(new ModernPlace(getString(R.string.shop_eight_name), getString(R.string.first_shop_type), 3.9, getString(R.string.shop_eight_address), getString(R.string.shop_eight_phone))); ModernPlaceAdapter adapter = new ModernPlaceAdapter(this, shoppingPlaces, android.R.color.background_light); ListView listView = findViewById(R.id.list); listView.setAdapter(adapter); } }
[ "reemhazzaa4@gmail.com" ]
reemhazzaa4@gmail.com
20752c1d9406e469a1881c66ae942c666f1db80d
5dc00a26d8e28d9d06f1431c77cf5b120fb5b8b1
/src/Problem201_300/Problem224.java
9976ea76f0ad64849344de6213a8e484be916e58
[]
no_license
mwindson/leetcode
013b0df456bdbe11846661cda026246cd259e60a
ee933a58e976523ce0ca9083e54db0ddb7514020
refs/heads/master
2022-11-25T08:37:07.541919
2022-11-04T06:56:00
2022-11-04T06:56:00
75,292,826
0
0
null
null
null
null
UTF-8
Java
false
false
1,477
java
package Problem201_300; import java.util.Stack; /** * Created by mwindson on 2017/4/9. */ public class Problem224 { public static void main(String[] args) { } public static int calculate(String s) { Stack<Integer> stack = new Stack<Integer>(); int result = 0; int number = 0; int sign = 1; for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); if (Character.isDigit(c)) { number = 10 * number + (int) (c - '0'); } else if (c == '+') { result += sign * number; number = 0; sign = 1; } else if (c == '-') { result += sign * number; number = 0; sign = -1; } else if (c == '(') { //we push the result first, then sign; stack.push(result); stack.push(sign); //reset the sign and result for the value in the parenthesis sign = 1; result = 0; } else if (c == ')') { result += sign * number; number = 0; result *= stack.pop(); //stack.pop() is the sign before the parenthesis result += stack.pop(); //stack.pop() now is the result calculated before the parenthesis } } if (number != 0) result += sign * number; return result; } }
[ "mwindson@163.com" ]
mwindson@163.com
06bd874c4a2e37752767fbacf30c130d6cb83a77
129c3020d0c2a5057495b24bc7ffd6a916b8f878
/JAVA_Algorithms/project/src/ca/qc/johnabbott/cs406/collections/list/LinkedList.java
36e883ce19c6194388dae0c3e4615c26db43a667
[]
no_license
DipeshPatel8/Projects
b31b81e2e98af5feb9ffab9ba2e21cf65788e520
e629f019a5dff7a85cc0eb681a877b3ca6cf52e4
refs/heads/master
2023-07-27T03:09:30.591493
2021-09-09T15:22:19
2021-09-09T15:22:19
295,824,578
0
0
null
null
null
null
UTF-8
Java
false
false
7,416
java
/* * Copyright (c) 2020 Ian Clement. All rights reserved. */ package ca.qc.johnabbott.cs406.collections.list; import ca.qc.johnabbott.cs406.serialization.Serializable; import ca.qc.johnabbott.cs406.serialization.SerializationException; import ca.qc.johnabbott.cs406.serialization.Serializer; import sun.net.www.content.text.Generic; import java.io.IOException; import java.util.Iterator; /** * An implementation of the List interface using unidirectional links, forming a "chain". * * @author Ian Clement */ public class LinkedList<T extends Serializable> implements List<T>, Serializable { public static final byte SERIAL_ID = 0x11; /* private inner class for link "chains" */ private static class Link<T> { T element; Link<T> next; public Link(T element) { this.element = element; } public Link() {} } /** * Move a reference `i` links along the chain. Returns null if `i` exceeds chain length. * @param i number of links to move. * @return the reference to the link after `i` moves. */ private Link<T> move(int i) { // move traversal forward i times. Link<T> current = head; for(int j=0; j<i && current != null; j++) current = current.next; return current; } /* a list is represented with a head "dummy" node to simplify the * add/remove operation implementation. */ private Link<T> head; /* a last reference is used to make list append operations * add(x), * add(size(), x) * more efficient */ private Link<T> last; private int size; public LinkedList() { // create a "dummy" link, representing an empty list last = head = null; size = 0; } @Override public void add(T element) { if(head == null) head = last = new Link<>(element); else { // add a new link at the end of the list, put last accordingly last.next = new Link<>(element); last = last.next; } size++; } @Override public void add(int position, T element) { if(position < 0 || position > size) throw new ListBoundsException(); // when "appending" call the add(x) method if(position == size) { add(element); return; } if(position == 0) { Link<T> tmp = head; head = new Link<>(element); head.next = tmp; } else { // move a link reference to the desired position (point to link "position") Link<T> current = move(position - 1); // place new link between "position" and "position + 1" Link<T> tmp = new Link<T>(element); tmp.next = current.next; current.next = tmp; } size++; } @Override public T remove(int position) { if(position < 0 || position >= size) throw new ListBoundsException(); T element; if(position == 0) { element = head.element; head = head.next; if(head.next == null) last = head; } else { // move a link pointer to the desired position (point to link "position") Link<T> current = move(position - 1); element = current.next.element; current.next = current.next.next; // reset the last if we're removing the last link if (current.next == null) last = current; } size--; return element; } @Override public void clear() { head = last = null; // remove all the links size = 0; } @Override public T get(int position){ if(position < 0 || position >= size) throw new ListBoundsException(); // move a link pointer to the desired position (point to link "position") Link<T> link = move(position); return link.element; } @Override public T set(int position, T element){ if(position < 0 || position >= size) throw new ListBoundsException(); // move a link pointer to the desired position (point to link "position") Link<T> current = move(position); T ret = current.element; current.element = element; return ret; } @Override public boolean isEmpty(){ return size() == 0; } @Override public int size(){ return size; } @Override public boolean contains(T element){ // simple linear search Link<T> current = head; while(current != null) { if(current.element.equals(element)) return true; current = current.next; } return false; } @Override public Iterator<T> iterator() { return new ListIterator(); } @Override public List<T> subList(int from, int to) { throw new RuntimeException("Not implemented."); } @Override public boolean remove(T element) { throw new RuntimeException("not implemented"); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append('['); for(Link<T> current = head; current != null; current = current.next) { sb.append(current.element); if(current.next != null) sb.append(", "); } sb.append(']'); return sb.toString(); } @Override public byte getSerialId() { return SERIAL_ID; } @Override public void serialize(Serializer serializer) throws IOException { serializer.write(size);// serialize size Link<T> tmp = head; //head value while(tmp.next != null){ // all values serializer.write(tmp.element); //serialize current value tmp = tmp.next;//get next value } serializer.write(tmp.element);//serialize last value } @Override public void deserialize(Serializer serializer) throws IOException, SerializationException { size = serializer.readInt();//get size for (int i = 0; i < size; i++) { add((T) serializer.readSerializable()); //add to list size--;//.add()increase size, so to avoid underflow error, reduce size by 1 to maintain initial size /*if(i == 0) { head.element = (T) serializer.readSerializable(); size++; }else { size++; set(i, (T) serializer.readSerializable()); }*/ } } /** * An iterator class for the link chain */ private class ListIterator implements Iterator<T> { // stores the current link in the traversal. private Link<T> traversal; public ListIterator() { traversal = head; } @Override public boolean hasNext() { return traversal != null; } @Override public T next() { T tmp = traversal.element; traversal = traversal.next; return tmp; } @Override public void remove() { throw new RuntimeException("Not implemented"); } } }
[ "1835217@johnabbottcollege.net" ]
1835217@johnabbottcollege.net
52858228393aaac9aa8652551ef7e8ca8431f647
1eb9b656ec1f79c8691b746644bccc6b80bb735b
/modules/junit4/junit4-core/src/test/java/org/testifyproject/junit4/InstanceProviderTest.java
fa5aea1e2b9e30b654d45531bc5c2992ca5d9362
[ "Apache-2.0" ]
permissive
testify-project/testify
caf1dc3648c9f2e4b368f0e8e48614ec5c521e9b
31588b3574d0b3194edf653825113885e83cb8e7
refs/heads/develop
2023-07-07T04:05:37.880031
2018-08-21T22:24:05
2018-08-21T22:24:05
78,854,439
10
1
Apache-2.0
2023-06-27T14:19:09
2017-01-13T14:05:35
Java
UTF-8
Java
false
false
1,035
java
/* * Copyright 2016-2017 Testify Project. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.testifyproject.junit4; import static org.assertj.core.api.AssertionsForClassTypes.assertThat; import org.junit.Test; import org.junit.runner.RunWith; import org.testifyproject.annotation.Real; /** * * @author saden */ @RunWith(UnitTest.class) public class InstanceProviderTest { @Real String hello; @Test public void verifyInjections() { assertThat(hello).isEqualTo("Hello"); } }
[ "sharmarke.aden@gmail.com" ]
sharmarke.aden@gmail.com
03d91922c1ca5a43d9562e556c453256e9290396
685db20da54d6cb2d1af17ff25d2be34b106f094
/src/main/java/Steps/Hook.java
248e5356a98993f217ad3cb2987072c9fb9fb919
[]
no_license
andres172/EbayExample
ea637e7467edd11ba65e6e21666f805a2bf18a90
3e650d5f58b0b72db25c0a650f23477e0508856e
refs/heads/master
2020-12-15T01:37:21.452250
2020-01-19T19:55:57
2020-01-19T19:55:57
234,948,299
0
0
null
2020-10-13T18:57:33
2020-01-19T18:49:59
JavaScript
UTF-8
Java
false
false
2,179
java
package Steps; import Base.BaseUtil; import cucumber.api.Scenario; import cucumber.api.java.After; import cucumber.api.java.Before; import io.github.bonigarcia.wdm.WebDriverManager; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.chrome.ChromeOptions; public class Hook extends BaseUtil { private BaseUtil base; public Hook(BaseUtil base){ this.base = base; } @Before public void InitializeTest(){ System.out.println("Opening the browser: Chrome"); WebDriverManager.chromedriver().version("78.0.3904.70").setup(); //Add new properties to ChromeDriver ChromeOptions options = new ChromeOptions(); // options.addArguments("start-maximized"); // options.addArguments("enable-automation"); // options.addArguments("--no-sandbox"); // options.addArguments("--disable-infobars"); // options.addArguments("--disable-dev-shm-usage"); // options.addArguments("--disable-browser-side-navigation"); // options.addArguments("--disable-gpu"); // options.addArguments("window-size=400,380"); options.addArguments("--ignore-certificate-errors"); // DesiredCapabilities capabilities = DesiredCapabilities.chrome(); // capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true); // capabilities.setCapability(ChromeOptions.CAPABILITY, options); //Old way to set up chrome driver from a path in your system (not recomended) // String rutaDriverChome ="/src/test/resources/chromedriver"; // System.setProperty("webdriver.chrome.driver",System.getProperty("user.dir")+rutaDriverChome); base.Driver = new ChromeDriver(options); // base.Driver = new ChromeDriver(); } @After public void TearDownTest(Scenario scenario){ if(scenario.isFailed()){ //take screenshot System.out.println(scenario.getName()); } System.out.println("Closing the browser: HOCK"); } }
[ "andre12200172@gmail.com" ]
andre12200172@gmail.com
5fbd022af6fd3ff8fc4aebfe3abe49eb7015788f
065c1f648e8dd061a20147ff9c0dbb6b5bc8b9be
/eclipseswt_cluster/45223/src_1.java
102d3ab8490f33325bfde3b2e99a6ec7c077a58c
[]
no_license
martinezmatias/GenPat-data-C3
63cfe27efee2946831139747e6c20cf952f1d6f6
b360265a6aa3bb21bd1d64f1fc43c3b37d0da2a4
refs/heads/master
2022-04-25T17:59:03.905613
2020-04-15T14:41:34
2020-04-15T14:41:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
26,816
java
/******************************************************************************* * Copyright (c) 2000, 2003 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.swt.examples.layoutexample; import org.eclipse.swt.*; import org.eclipse.swt.graphics.*; import org.eclipse.swt.widgets.*; import org.eclipse.swt.layout.*; import org.eclipse.swt.events.*; import org.eclipse.swt.custom.*; class FormLayoutTab extends Tab { /* Controls for setting layout parameters */ Combo marginHeight, marginWidth; /* The example layout instance */ FormLayout formLayout; /* TableEditors and related controls*/ TableEditor comboEditor, widthEditor, heightEditor; TableEditor leftEditor, rightEditor, topEditor, bottomEditor; CCombo combo; Text widthText, heightText; Button leftAttach, rightAttach, topAttach, bottomAttach; /* Constants */ final int COMBO_COL = 1; final int WIDTH_COL = 2; final int HEIGHT_COL = 3; final int LEFT_COL = 4; final int RIGHT_COL = 5; final int TOP_COL = 6; final int BOTTOM_COL = 7; final int MODIFY_COLS = 4; // The number of columns with combo or text editors final int TOTAL_COLS = 8; /** * Creates the Tab within a given instance of LayoutExample. */ FormLayoutTab(LayoutExample instance) { super(instance); } /** * Returns the constant for the alignment for an * attachment given a string. */ int alignmentConstant (String align) { if (align.equals("LEFT")) return SWT.LEFT; if (align.equals("RIGHT")) return SWT.RIGHT; if (align.equals("TOP")) return SWT.TOP; if (align.equals("BOTTOM")) return SWT.BOTTOM; if (align.equals("CENTER")) return SWT.CENTER; return SWT.DEFAULT; } /** * Returns a string representing the alignment for an * attachment given a constant. */ String alignmentString (int align) { switch (align) { case SWT.LEFT: return "LEFT"; case SWT.RIGHT: return "RIGHT"; case SWT.TOP: return "TOP"; case SWT.BOTTOM: return "BOTTOM"; case SWT.CENTER: return "CENTER"; } return "DEFAULT"; } /** * Update the attachment field in case the type of control * has changed. */ String checkAttachment (String oldAttach, FormAttachment newAttach) { String controlClass = newAttach.control.getClass().toString (); String controlType = controlClass.substring (controlClass.lastIndexOf ('.') + 1); int i = 0; while (i < oldAttach.length () && !Character.isDigit(oldAttach.charAt (i))) { i++; } String index = oldAttach.substring (i, oldAttach.indexOf (',')); return controlType + index + "," + newAttach.offset + ":" + alignmentString (newAttach.alignment); } /** * Creates the widgets in the "child" group. */ void createChildWidgets () { /* Add common controls */ super.createChildWidgets (); /* Resize the columns */ table.getColumn (LEFT_COL).setWidth (100); table.getColumn (RIGHT_COL).setWidth (100); table.getColumn (TOP_COL).setWidth (100); table.getColumn (BOTTOM_COL).setWidth (100); /* Add TableEditors */ comboEditor = new TableEditor (table); widthEditor = new TableEditor (table); heightEditor = new TableEditor (table); leftEditor = new TableEditor (table); rightEditor = new TableEditor (table); topEditor = new TableEditor (table); bottomEditor = new TableEditor (table); table.addMouseListener (new MouseAdapter () { public void mouseDown(MouseEvent e) { resetEditors(); index = table.getSelectionIndex (); Point pt = new Point (e.x, e.y); newItem = table.getItem (pt); if (newItem == null) return; TableItem oldItem = comboEditor.getItem (); if (newItem == oldItem || newItem != lastSelected) { lastSelected = newItem; return; } table.showSelection (); combo = new CCombo (table, SWT.READ_ONLY); createComboEditor (combo, comboEditor); widthText = new Text (table, SWT.SINGLE); widthText.setText (((String [])data.elementAt (index)) [WIDTH_COL]); createTextEditor (widthText, widthEditor, WIDTH_COL); heightText = new Text (table, SWT.SINGLE); heightText.setText (((String [])data.elementAt (index)) [HEIGHT_COL]); createTextEditor (heightText, heightEditor, HEIGHT_COL); leftAttach = new Button (table, SWT.PUSH); leftAttach.setText (LayoutExample.getResourceString ("Attach_Edit")); leftEditor.horizontalAlignment = SWT.LEFT; leftEditor.grabHorizontal = true; leftEditor.minimumWidth = leftAttach.computeSize (SWT.DEFAULT, SWT.DEFAULT).x; leftEditor.setEditor (leftAttach, newItem, LEFT_COL); leftAttach.addSelectionListener (new SelectionAdapter () { public void widgetSelected (SelectionEvent e) { Shell shell = tabFolderPage.getShell (); AttachDialog dialog = new AttachDialog (shell); dialog.setText (LayoutExample.getResourceString ("Left_Attachment")); dialog.setColumn (LEFT_COL); String attach = dialog.open (); newItem.setText (LEFT_COL, attach); resetEditors (); } }); rightAttach = new Button (table, SWT.PUSH); rightAttach.setText (LayoutExample.getResourceString ("Attach_Edit")); rightEditor.horizontalAlignment = SWT.LEFT; rightEditor.grabHorizontal = true; rightEditor.minimumWidth = rightAttach.computeSize (SWT.DEFAULT, SWT.DEFAULT).x; rightEditor.setEditor (rightAttach, newItem, RIGHT_COL); rightAttach.addSelectionListener (new SelectionAdapter () { public void widgetSelected (SelectionEvent e) { Shell shell = tabFolderPage.getShell (); AttachDialog dialog = new AttachDialog (shell); dialog.setText (LayoutExample.getResourceString ("Right_Attachment")); dialog.setColumn (RIGHT_COL); String attach = dialog.open (); newItem.setText (RIGHT_COL, attach); if (newItem.getText (LEFT_COL).endsWith (")")) newItem.setText (LEFT_COL, ""); resetEditors (); } }); topAttach = new Button (table, SWT.PUSH); topAttach.setText (LayoutExample.getResourceString ("Attach_Edit")); topEditor.horizontalAlignment = SWT.LEFT; topEditor.grabHorizontal = true; topEditor.minimumWidth = topAttach.computeSize (SWT.DEFAULT, SWT.DEFAULT).x; topEditor.setEditor (topAttach, newItem, TOP_COL); topAttach.addSelectionListener (new SelectionAdapter () { public void widgetSelected (SelectionEvent e) { Shell shell = tabFolderPage.getShell (); AttachDialog dialog = new AttachDialog (shell); dialog.setText (LayoutExample.getResourceString ("Top_Attachment")); dialog.setColumn (TOP_COL); String attach = dialog.open (); newItem.setText (TOP_COL, attach); resetEditors (); } }); bottomAttach = new Button (table, SWT.PUSH); bottomAttach.setText (LayoutExample.getResourceString ("Attach_Edit")); bottomEditor.horizontalAlignment = SWT.LEFT; bottomEditor.grabHorizontal = true; bottomEditor.minimumWidth = bottomAttach.computeSize (SWT.DEFAULT, SWT.DEFAULT).x; bottomEditor.setEditor (bottomAttach, newItem, BOTTOM_COL); bottomAttach.addSelectionListener (new SelectionAdapter () { public void widgetSelected (SelectionEvent e) { Shell shell = tabFolderPage.getShell (); AttachDialog dialog = new AttachDialog (shell); dialog.setText (LayoutExample.getResourceString ("Bottom_Attachment")); dialog.setColumn (BOTTOM_COL); String attach = dialog.open (); newItem.setText (BOTTOM_COL, attach); if (newItem.getText (TOP_COL).endsWith (")")) newItem.setText (TOP_COL, ""); resetEditors (); } }); for (int i=0; i<table.getColumnCount (); i++) { Rectangle rect = newItem.getBounds (i); if (rect.contains (pt)) { switch (i) { case 0: resetEditors (); break; case COMBO_COL : combo.setFocus (); break; case WIDTH_COL : widthText.setFocus (); break; case HEIGHT_COL : heightText.setFocus (); break; default : break; } } } } }); /* Add listener to add an element to the table */ add.addSelectionListener(new SelectionAdapter () { public void widgetSelected(SelectionEvent e) { TableItem item = new TableItem (table, 0); String [] insert = new String [] { String.valueOf (table.indexOf (item)), "Button", "-1", "-1", "0,0 (" + LayoutExample.getResourceString ("Default") + ")", "", "0,0 (" + LayoutExample.getResourceString ("Default") + ")", ""}; item.setText (insert); data.addElement (insert); resetEditors (); } }); } /** * Creates the control widgets. */ void createControlWidgets () { /* Controls the margins and spacing of the FormLayout */ String [] marginValues = new String [] {"0","3","5","10"}; Group marginGroup = new Group (controlGroup, SWT.NONE); marginGroup.setText (LayoutExample.getResourceString ("Margins")); GridLayout layout = new GridLayout (); layout.numColumns = 2; marginGroup.setLayout (layout); marginGroup.setLayoutData (new GridData (GridData.FILL_HORIZONTAL)); new Label (marginGroup, SWT.NONE).setText ("marginHeight"); marginHeight = new Combo (marginGroup, SWT.NONE); marginHeight.setItems (marginValues); marginHeight.select (0); marginHeight.addSelectionListener (selectionListener); marginHeight.addTraverseListener (traverseListener); GridData data = new GridData (GridData.FILL_HORIZONTAL); data.widthHint = 60; marginHeight.setLayoutData (data); new Label (marginGroup, SWT.NONE).setText ("marginWidth"); marginWidth = new Combo (marginGroup, SWT.NONE); marginWidth.setItems (marginValues); marginWidth.select (0); marginWidth.addSelectionListener (selectionListener); marginWidth.addTraverseListener (traverseListener); data = new GridData (GridData.FILL_HORIZONTAL); data.widthHint = 60; marginWidth.setLayoutData (data); /* Add common controls */ super.createControlWidgets (); /* Position the sash */ sash.setWeights (new int [] {6,4}); } /** * Creates the example layout. */ void createLayout () { formLayout = new FormLayout (); layoutComposite.setLayout (formLayout); } /** * Disposes the editors without placing their contents * into the table. */ void disposeEditors () { comboEditor.setEditor (null, null, -1); combo.dispose (); widthText.dispose (); heightText.dispose (); leftAttach.dispose (); rightAttach.dispose (); topAttach.dispose (); bottomAttach.dispose (); } /** * Generates code for the example layout. */ StringBuffer generateLayoutCode () { StringBuffer code = new StringBuffer (); code.append ("\t\tFormLayout formLayout = new FormLayout ();\n"); if (formLayout.marginHeight != 0) { code.append ("\t\tformLayout.marginHeight = " + formLayout.marginHeight + ";\n"); } if (formLayout.marginWidth != 0) { code.append ("\t\tformLayout.marginWidth = " + formLayout.marginWidth + ";\n"); } code.append ("\t\tshell.setLayout (formLayout);\n"); boolean first = true; for (int i = 0; i < children.length; i++) { Control control = children [i]; code.append (getChildCode (control, i)); FormData data = (FormData) control.getLayoutData (); if (data != null) { code.append ("\t\t"); if (first) { code.append ("FormData "); first = false; } code.append ("data = new FormData ();\n"); if (data.width != SWT.DEFAULT) { code.append ("\t\tdata.width = " + data.width + ";\n"); } if (data.height != SWT.DEFAULT) { code.append ("\t\tdata.height = " + data.height + ";\n"); } if (data.left != null) { if (data.left.control != null) { TableItem item = table.getItem (i); String controlString = item.getText (LEFT_COL); int index = new Integer (controlString.substring (controlString.indexOf (',') - 1, controlString.indexOf (','))).intValue (); code.append ("\t\tdata.left = new FormAttachment (" + names [index] + ", " + data.left.offset + ", SWT." + alignmentString (data.left.alignment) + ");\n"); } else { if (data.right != null || (data.left.numerator != 0 ||data.left.offset != 0)) { code.append ("\t\tdata.left = new FormAttachment (" + data.left.numerator + ", " + data.left.offset + ");\n"); } } } if (data.right != null) { if (data.right.control != null) { TableItem item = table.getItem (i); String controlString = item.getText (RIGHT_COL); int index = new Integer (controlString.substring (controlString.indexOf (',') - 1, controlString.indexOf (','))).intValue (); code.append ("\t\tdata.right = new FormAttachment (" + names [index] + ", " + data.right.offset + ", SWT." + alignmentString (data.right.alignment) + ");\n"); } else { code.append ("\t\tdata.right = new FormAttachment (" + data.right.numerator + ", " + data.right.offset + ");\n"); } } if (data.top != null) { if (data.top.control != null) { TableItem item = table.getItem (i); String controlString = item.getText (TOP_COL); int index = new Integer (controlString.substring (controlString.indexOf (',') - 1, controlString.indexOf (','))).intValue (); code.append ("\t\tdata.top = new FormAttachment (" + names [index] + ", " + data.top.offset + ", SWT." + alignmentString (data.top.alignment) + ");\n"); } else { if (data.bottom != null || (data.top.numerator != 0 ||data.top.offset != 0)) { code.append ("\t\tdata.top = new FormAttachment (" + data.top.numerator + ", " + data.top.offset + ");\n"); } } } if (data.bottom != null) { if (data.bottom.control != null) { TableItem item = table.getItem (i); String controlString = item.getText (BOTTOM_COL); int index = new Integer (controlString.substring (controlString.indexOf (',') - 1, controlString.indexOf (','))).intValue (); code.append ("\t\tdata.bottom = new FormAttachment (" + names [index] + ", " + data.bottom.offset + ", SWT." + alignmentString (data.bottom.alignment) + ");\n"); } else { code.append ("\t\tdata.bottom = new FormAttachment (" + data.bottom.numerator + ", " + data.bottom.offset + ");\n"); } } code.append ("\t\t" + names [i] + ".setLayoutData (data);\n"); } } return code; } /** * Returns the layout data field names. */ String [] getLayoutDataFieldNames() { return new String [] { "", "Control", "width", "height", "left", "right", "top", "bottom" }; } /** * Gets the text for the tab folder item. */ String getTabText () { return "FormLayout"; } /** * Takes information from TableEditors and stores it. */ void resetEditors () { resetEditors (false); } void resetEditors (boolean tab) { TableItem oldItem = comboEditor.getItem (); if (oldItem != null) { int row = table.indexOf (oldItem); try { new Integer (widthText.getText ()).intValue (); } catch (NumberFormatException e) { widthText.setText (oldItem.getText (WIDTH_COL)); } try { new Integer (heightText.getText ()).intValue (); } catch (NumberFormatException e) { heightText.setText (oldItem.getText (HEIGHT_COL)); } String [] insert = new String [] {String.valueOf (row), combo.getText (), widthText.getText (), heightText.getText ()}; data.setElementAt (insert, row); for (int i = 0 ; i < MODIFY_COLS; i++) { oldItem.setText (i, ((String [])data.elementAt (row)) [i]); } if (!tab) disposeEditors (); } setLayoutState (); refreshLayoutComposite (); setLayoutData (); layoutComposite.layout (true); layoutGroup.layout (true); } /** * Sets an attachment to the edge of a widget using the * information in the table. */ FormAttachment setAttachment (String attachment) { String control, align; int position, offset; int comma = attachment.indexOf (','); char first = attachment.charAt (0); if (Character.isLetter(first)) { /* Case where there is a control */ control = attachment.substring (0, comma); int i = 0; while (i < control.length () && !Character.isDigit (control.charAt (i))) { i++; } String end = control.substring (i); int index = new Integer (end).intValue (); Control attachControl = children [index]; int colon = attachment.indexOf (':'); try { offset = new Integer (attachment.substring (comma + 1, colon)).intValue (); } catch (NumberFormatException e) { offset = 0; } align = attachment.substring (colon + 1); return new FormAttachment (attachControl, offset, alignmentConstant (align)); } else { /* Case where there is a position */ try { position = new Integer (attachment.substring (0,comma)).intValue (); } catch (NumberFormatException e) { position = 0; } try { offset = new Integer (attachment.substring (comma + 1)).intValue (); } catch (NumberFormatException e) { offset = 0; } return new FormAttachment (position, offset); } } /** * Sets the layout data for the children of the layout. */ void setLayoutData () { Control [] children = layoutComposite.getChildren (); TableItem [] items = table.getItems (); FormData data; int width, height; String left, right, top, bottom; for (int i = 0; i < children.length; i++) { width = new Integer (items [i].getText (WIDTH_COL)).intValue (); height = new Integer (items [i].getText (HEIGHT_COL)).intValue (); data = new FormData (); if (width > 0) data.width = width; if (height > 0) data.height = height; left = items [i].getText (LEFT_COL); if (left.length () > 0) { data.left = setAttachment (left); if (data.left.control != null) { String attachment = checkAttachment (left, data.left); items [i].setText (LEFT_COL, attachment); } } right = items [i].getText (RIGHT_COL); if (right.length () > 0) { data.right = setAttachment (right); if (data.right.control != null) { String attachment = checkAttachment (right, data.right); items [i].setText (RIGHT_COL, attachment); } } top = items [i].getText (TOP_COL); if (top.length () > 0 ) { data.top = setAttachment (top); if (data.top.control != null) { String attachment = checkAttachment (top, data.top); items [i].setText (TOP_COL, attachment); } } bottom = items [i].getText (BOTTOM_COL); if (bottom.length () > 0) { data.bottom = setAttachment (bottom); if (data.bottom.control != null) { String attachment = checkAttachment (bottom, data.bottom); items [i].setText (BOTTOM_COL, attachment); } } children [i].setLayoutData (data); } } /** * Sets the state of the layout. */ void setLayoutState () { /* Set the margins and spacing */ try { formLayout.marginHeight = new Integer (marginHeight.getText ()).intValue (); } catch (NumberFormatException e) { formLayout.marginHeight = 0; marginHeight.select (0); } try { formLayout.marginWidth = new Integer (marginWidth.getText ()).intValue (); } catch (NumberFormatException e) { formLayout.marginWidth = 0; marginWidth.select (0); } } /** * <code>AttachDialog</code> is the class that creates a * dialog specific for this example. It creates a dialog * with controls to set the values in a FormAttachment. */ public class AttachDialog extends Dialog { String result = ""; String controlInput, positionInput, alignmentInput, offsetInput; int col = 0; public AttachDialog (Shell parent, int style) { super (parent, style); } public AttachDialog (Shell parent) { this (parent, 0); } public void setColumn (int col) { this.col = col; } public String open () { Shell parent = getParent (); final Shell shell = new Shell (parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL); shell.setText (getText ()); GridLayout layout = new GridLayout (); layout.numColumns = 3; layout.makeColumnsEqualWidth = true; shell.setLayout (layout); /* Find out what was previously set as an attachment */ TableItem newItem = leftEditor.getItem (); result = newItem.getText (col); String oldAttach = result; String oldPos = "0", oldControl = "", oldAlign = "DEFAULT", oldOffset = "0"; boolean isControl = false; if (oldAttach.length () != 0) { char first = oldAttach.charAt (0); if (Character.isLetter(first)) { /* We have a control */ isControl = true; oldControl = oldAttach.substring (0, oldAttach.indexOf (',')); oldAlign = oldAttach.substring (oldAttach.indexOf (':') + 1); oldOffset = oldAttach.substring (oldAttach.indexOf (',') + 1, oldAttach.indexOf (':')); } else { /* We have a position */ oldPos = oldAttach.substring (0, oldAttach.indexOf (',')); oldOffset = oldAttach.substring (oldAttach.indexOf (',') + 1); if (oldOffset.endsWith (")")) { // i.e. (Default) oldOffset = oldOffset.substring (0, oldOffset.indexOf (' ')); } } } /* Add position field */ final Button posButton = new Button (shell, SWT.RADIO); posButton.setText (LayoutExample.getResourceString ("Position")); posButton.setSelection (!isControl); final Combo position = new Combo (shell, SWT.NONE); position.setItems (new String [] {"0","25","50","75","100"}); position.setText (oldPos); position.setEnabled (!isControl); GridData data = new GridData (GridData.FILL_HORIZONTAL); data.horizontalSpan = 2; position.setLayoutData (data); /* Add control field */ final Button contButton = new Button (shell, SWT.RADIO); contButton.setText (LayoutExample.getResourceString ("Control")); contButton.setSelection (isControl); final Combo control = new Combo (shell, SWT.READ_ONLY); TableItem [] items = table.getItems (); TableItem currentItem = leftEditor.getItem (); for (int i = 0; i < table.getItemCount (); i++) { if (items [i].getText (0).length() > 0) { if (items [i] != currentItem) { control.add (items [i].getText (COMBO_COL) + i); } } } if (oldControl.length () != 0) control.setText (oldControl); else control.select (0); control.setEnabled (isControl); data = new GridData (GridData.FILL_HORIZONTAL); data.horizontalSpan = 2; control.setLayoutData (data); /* Add alignment field */ new Label (shell, SWT.NONE).setText (LayoutExample.getResourceString ("Alignment")); final Combo alignment = new Combo (shell, SWT.NONE); String[] alignmentValues; if (col == LEFT_COL || col == RIGHT_COL) { alignmentValues = new String [] {"SWT.LEFT", "SWT.RIGHT", "SWT.CENTER", "SWT.DEFAULT"}; } else { // col == TOP_COL || col == BOTTOM_COL alignmentValues = new String [] {"SWT.TOP", "SWT.BOTTOM", "SWT.CENTER", "SWT.DEFAULT"}; } alignment.setItems (alignmentValues); alignment.setText ("SWT." + oldAlign); alignment.setEnabled (isControl); data = new GridData (GridData.FILL_HORIZONTAL); data.horizontalSpan = 2; alignment.setLayoutData (data); /* Add offset field */ new Label (shell, SWT.NONE).setText (LayoutExample.getResourceString ("Offset")); final Text offset = new Text (shell, SWT.SINGLE | SWT.BORDER); offset.setText (oldOffset); data = new GridData (GridData.FILL_HORIZONTAL); data.horizontalSpan = 2; offset.setLayoutData (data); /* Add listeners for choosing between position and control */ posButton.addSelectionListener (new SelectionAdapter () { public void widgetSelected (SelectionEvent e) { position.setEnabled (true); control.setEnabled (false); alignment.setEnabled(false); } }); contButton.addSelectionListener (new SelectionAdapter () { public void widgetSelected (SelectionEvent e) { position.setEnabled (false); control.setEnabled (true); alignment.setEnabled(true); } }); Button clear = new Button (shell, SWT.PUSH); clear.setText (LayoutExample.getResourceString ("Clear")); clear.setLayoutData (new GridData (GridData.HORIZONTAL_ALIGN_END)); clear.addSelectionListener (new SelectionAdapter () { public void widgetSelected (SelectionEvent e) { result = ""; shell.close (); } }); /* OK button sets data into table */ Button ok = new Button (shell, SWT.PUSH); ok.setText (LayoutExample.getResourceString ("OK")); ok.setLayoutData (new GridData (GridData.HORIZONTAL_ALIGN_CENTER)); ok.addSelectionListener (new SelectionAdapter () { public void widgetSelected (SelectionEvent e) { controlInput = control.getText (); alignmentInput = alignment.getText ().substring (4); positionInput = position.getText (); if (positionInput.length () == 0) positionInput = "0"; try { new Integer (positionInput).intValue (); } catch (NumberFormatException except) { positionInput = "0"; } offsetInput = offset.getText (); if (offsetInput.length () == 0) offsetInput = "0"; try { new Integer (offsetInput).intValue (); } catch (NumberFormatException except) { offsetInput = "0"; } if (posButton.getSelection() || controlInput.length () == 0) { result = positionInput + "," + offsetInput; } else { result = controlInput + "," + offsetInput + ":" + alignmentInput; } shell.close (); } }); Button cancel = new Button (shell, SWT.PUSH); cancel.setText (LayoutExample.getResourceString ("Cancel")); cancel.setLayoutData (new GridData (GridData.HORIZONTAL_ALIGN_BEGINNING)); cancel.addSelectionListener (new SelectionAdapter () { public void widgetSelected (SelectionEvent e) { shell.close (); } }); shell.setDefaultButton (ok); shell.pack (); /* Center the dialog */ Point center = parent.getLocation (); center.x = center.x + (parent.getBounds ().width / 2) - (shell.getBounds ().width / 2); center.y = center.y + (parent.getBounds ().height / 2) - (shell.getBounds ().height / 2); shell.setLocation (center); shell.open (); Display display = shell.getDisplay (); while (!shell.isDisposed ()) { if (display.readAndDispatch ()) display.sleep (); } return result; } } }
[ "375833274@qq.com" ]
375833274@qq.com
bd934ab49151cbe5064eb0bcf4f537ecd3765561
1af7323b83ef66f0c53f9d2ce6fd1817e9adbe5c
/auth-service/src/main/java/com/jeorgius/jbackend/service/UserService.java
2e91a08d61d9669decbe6a08150e821789908592
[]
no_license
Jeorgius/JBackend
b3d513c956a1ac31176368df0240cce4437d266e
e4dc9f87760cf13b61baf43637ac6340da177eca
refs/heads/master
2023-03-22T23:27:15.419431
2022-08-09T22:03:08
2022-08-10T10:45:48
157,743,199
0
0
null
null
null
null
UTF-8
Java
false
false
2,684
java
package com.jeorgius.jbackend.service; import com.jeorgius.jbackend.dto.UserDetailsDto; import com.jeorgius.jbackend.dto.UserDto; import com.jeorgius.jbackend.dto.UserExtendedDto; import com.jeorgius.jbackend.enums.Role; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.oauth2.provider.token.TokenStore; import org.springframework.web.multipart.MultipartFile; import java.util.List; import java.util.Optional; public interface UserService extends UserDetailsService { Page<UserDto> findAll(Pageable pageable, boolean includeDeleted); Optional<UserDto> getCurrentUser(boolean exit); Page<UserDto> findAllByName(Pageable pageable, String name, boolean archived, Long opaId); Optional<UserDto> findById(Long id); Optional<UserDto> create(UserDto user); void delete(Long id); void restore(Long id); Optional<UserDto> update(UserDto userDto, Long id); boolean isSingularUserWithOpaIdAndRole(Long userId, Role role, Long opaId); boolean isDefaultSubjectSet(Long opaId, Role role, Long excludedUserId); List<Role> findRoles(); List<UserDto> findAllByOpaId(Long opaId); List<UserDto> findAllByOpaIdAndName(Long opaId, String name); Page<UserDto> findAllByOpaIdAndName(Pageable pageable, Long opaId, String name, boolean archived); Page<UserDto> findAllByOpaIdsAndNameAndRoles(List<Long> opaIds, String name, List<Role> roles, Pageable pageable); List<UserDto> findAllByNameAndRoleAndSubjectId(String name, String role, Long subjectId); Optional<List<UserDto>> searchSignersForChangeByName(String name, Long appealId); List<UserDto> findAllByNameAndRoleInOpa(String name, Role role); List<UserDto> searchByNameAndRoleAndOpa(Long opaId, String name, Role role, List<Long> notInIds, List<Long> subjectIds, List<Long> subsubjectIds); Optional<Long> setUserPassword(String verificationCode, String password); List<UserDto> findByRoleForCurrentOrganizationPersonalAreaExtended(Role role); List<UserDto> findByRoleForOrganizationPersonalAreaIdExtended(Role role, Long opaId, Long subjectId); List<UserDto> findByNameAndRoleAndSubjectInOpa(String name, Role role, Long subjectId); Page<UserExtendedDto> findByNameAndRoleAndSubjectAndOpaPage(String name, Role role, Long subjectId, Long subSubjectId, Long opaId, Pageable pageable); UserDetailsDto findUserDetails(Long id); void setTokenStore(TokenStore tokenStore); void sendRegistrationEmail(Long id); void importUsersFromXlsx(MultipartFile file); }
[ "georgy.zykov@firstlinesoftware.com" ]
georgy.zykov@firstlinesoftware.com
1b423403e8100228fae956d7dd2b7b61bcfbd0ce
cb3634622480f918540ff3ff38c96990a1926fda
/src/main/java/youdi/jvm/ch02/ClassLoaderDemo2.java
2c596fd63f74d666cd4f965060198b484cd138df
[]
no_license
jacksonyoudi/AlgorithmCode
cab2e13cd148354dd50a0487667d38c25bb1fd9b
216299d43ee3d179c11d8ca0783ae16e2f6d7c88
refs/heads/master
2023-04-28T07:38:07.423138
2022-10-23T12:45:01
2022-10-23T12:45:01
248,993,623
3
0
null
2023-04-21T20:44:40
2020-03-21T14:32:15
Go
UTF-8
Java
false
false
1,664
java
package youdi.jvm.ch02; import sun.misc.Launcher; import java.net.URL; /** * file:/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/jre/lib/resources.jar * file:/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/jre/lib/rt.jar * file:/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/jre/lib/sunrsasign.jar * file:/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/jre/lib/jsse.jar * file:/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/jre/lib/jce.jar * file:/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/jre/lib/charsets.jar * file:/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/jre/lib/jfr.jar * file:/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/jre/classes */ public class ClassLoaderDemo2 { public static void main(String[] args) { System.out.println("**************启动类加载器*******************"); URL[] urLs = Launcher.getBootstrapClassPath().getURLs(); for (URL element : urLs) { System.out.println(element.toExternalForm()); } System.out.println("****扩展类加载器**********"); String s = System.getProperty("java.ext.dirs"); for (String element : s.split(":")) { System.out.println(element); } // /Users/youdi/Library/Java/Extensions ///Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/jre/lib/ext ///Library/Java/Extensions ///Network/Library/Java/Extensions ///System/Library/Java/Extensions ///usr/lib/java } }
[ "liangchangyoujackson@gmail.com" ]
liangchangyoujackson@gmail.com
4a4be525d234fc854ba6fa8a4142618aa0737a88
cec00c63e3eea508c9835be0108868a77a4d9d00
/Fam/app/src/main/java/com/example/fam/ListActivity.java
d6d1178603c7e3d54fca95d2bf813b43357f34ab
[]
no_license
minjiyoo/tag.BBOYH
497251dad6ab62aebef3ea01e4a92d9d79d18026
7b6270b9f7b11188bb75de460407062589a54804
refs/heads/master
2020-12-25T21:34:06.762737
2016-08-26T08:07:18
2016-08-26T08:07:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
328
java
package com.example.fam; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; public class ListActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_list); } }
[ "areum9502@gmail.com" ]
areum9502@gmail.com
9bdad1c23b67f3cfb2b29e08e5b798ba5cff9b3c
8b777293a7e864e15ae6713be7757d1ee17dd719
/src/zaslonad/builderPatern/test/TestMain.java
071438ad22b14c2d5c2a3555308212f1bd2d135f
[]
no_license
rideau7c2/POJBuilder
0214fd9c538ff0fa7141e7079a80342329712af3
efe379649aad5030745b6cce80cfdd778651cec1
refs/heads/master
2021-01-10T05:11:32.674057
2015-06-05T05:54:22
2015-06-05T05:54:22
36,556,258
0
0
null
null
null
null
UTF-8
Java
false
false
1,127
java
package zaslonad.builderPatern.test; import zaslonad.builderPatern.builder.impl.HtmlBuilder; import zaslonad.builderPatern.builder.impl.TxtBuilder; import zaslonad.builderPatern.director.LoremIpsumDocumentDirector; import zaslonad.builderPatern.director.SampleLoremIpsumDocumentDirector; public class TestMain { public static void main(String[] args){ //test1(); //test2(); testHtmlBuilderWitchLoremIpsumDirector(); } private static void test2(){ LoremIpsumDocumentDirector director = new LoremIpsumDocumentDirector(new TxtBuilder(false)); director.construct(); } private static void test1(){ TxtBuilder builder = new TxtBuilder(false); TestDocumentDirector director = new TestDocumentDirector(builder); director.construct(); System.out.print(builder.build()); } private static void testHtmlBuilderWitchLoremIpsumDirector(){ HtmlBuilder builder = new HtmlBuilder(true); SampleLoremIpsumDocumentDirector director = new SampleLoremIpsumDocumentDirector(builder); director.construct(); builder.saveToFile("test"); System.out.print(builder.build()); } }
[ "rideau@wp.pl" ]
rideau@wp.pl
9bfffab9a055bc1dcb5d052a42ec588653a8a450
0e8498a1ae49d23ca9278eb2951ffbffbb27e6ab
/UDPtest/app/src/main/java/android/support/p000v4/app/ListFragment.java
d9b0b8e75baa96e3ef1c921661f4155c0666c3d8
[]
no_license
heerykk/app_copy_paste
9fc58c2f3af5de4fd96a52c005bfbfc0184b5783
866047297030299d0093ae13acec8b443e889399
refs/heads/master
2020-07-09T00:13:04.478709
2019-09-17T17:18:10
2019-09-17T17:18:10
203,818,148
0
1
null
null
null
null
UTF-8
Java
false
false
10,610
java
package android.support.p000v4.app; import android.content.Context; import android.os.Bundle; import android.os.Handler; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.animation.AnimationUtils; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.FrameLayout; import android.widget.FrameLayout.LayoutParams; import android.widget.LinearLayout; import android.widget.ListAdapter; import android.widget.ListView; import android.widget.ProgressBar; import android.widget.TextView; /* renamed from: android.support.v4.app.ListFragment */ public class ListFragment extends Fragment { static final int INTERNAL_EMPTY_ID = 16711681; static final int INTERNAL_LIST_CONTAINER_ID = 16711683; static final int INTERNAL_PROGRESS_CONTAINER_ID = 16711682; ListAdapter mAdapter; CharSequence mEmptyText; View mEmptyView; private final Handler mHandler = new Handler(); ListView mList; View mListContainer; boolean mListShown; private final OnItemClickListener mOnClickListener = new OnItemClickListener(this) { final /* synthetic */ ListFragment this$0; { ListFragment this$02 = r5; ListFragment listFragment = this$02; this.this$0 = this$02; } public void onItemClick(AdapterView<?> adapterView, View view, int i, long j) { AdapterView<?> parent = adapterView; View v = view; int position = i; long id = j; AdapterView<?> adapterView2 = parent; View view2 = v; int i2 = position; long j2 = id; this.this$0.onListItemClick((ListView) parent, v, position, id); } }; View mProgressContainer; private final Runnable mRequestFocus = new Runnable(this) { final /* synthetic */ ListFragment this$0; { ListFragment this$02 = r5; ListFragment listFragment = this$02; this.this$0 = this$02; } public void run() { this.this$0.mList.focusableViewAvailable(this.this$0.mList); } }; TextView mStandardEmptyView; public ListFragment() { } public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) { LayoutInflater layoutInflater2 = layoutInflater; ViewGroup viewGroup2 = viewGroup; Bundle bundle2 = bundle; Context context = getContext(); FrameLayout root = new FrameLayout(context); LinearLayout linearLayout = new LinearLayout(context); LinearLayout pframe = linearLayout; linearLayout.setId(INTERNAL_PROGRESS_CONTAINER_ID); pframe.setOrientation(1); pframe.setVisibility(8); pframe.setGravity(17); ProgressBar progress = new ProgressBar(context, null, 16842874); LayoutParams layoutParams = new LayoutParams(-2, -2); pframe.addView(progress, layoutParams); LayoutParams layoutParams2 = new LayoutParams(-1, -1); root.addView(pframe, layoutParams2); FrameLayout frameLayout = new FrameLayout(context); FrameLayout lframe = frameLayout; frameLayout.setId(INTERNAL_LIST_CONTAINER_ID); TextView textView = new TextView(context); TextView tv = textView; textView.setId(INTERNAL_EMPTY_ID); tv.setGravity(17); LayoutParams layoutParams3 = new LayoutParams(-1, -1); lframe.addView(tv, layoutParams3); ListView listView = new ListView(context); ListView lv = listView; listView.setId(16908298); lv.setDrawSelectorOnTop(false); LayoutParams layoutParams4 = new LayoutParams(-1, -1); lframe.addView(lv, layoutParams4); LayoutParams layoutParams5 = new LayoutParams(-1, -1); root.addView(lframe, layoutParams5); LayoutParams layoutParams6 = new LayoutParams(-1, -1); root.setLayoutParams(layoutParams6); return root; } public void onViewCreated(View view, Bundle bundle) { View view2 = view; Bundle savedInstanceState = bundle; View view3 = view2; Bundle bundle2 = savedInstanceState; super.onViewCreated(view2, savedInstanceState); ensureList(); } public void onDestroyView() { this.mHandler.removeCallbacks(this.mRequestFocus); this.mList = null; this.mListShown = false; this.mListContainer = null; this.mProgressContainer = null; this.mEmptyView = null; this.mStandardEmptyView = null; super.onDestroyView(); } public void onListItemClick(ListView listView, View view, int i, long j) { ListView listView2 = listView; View view2 = view; int i2 = i; long j2 = j; } public void setListAdapter(ListAdapter listAdapter) { ListAdapter adapter = listAdapter; ListAdapter listAdapter2 = adapter; boolean hadAdapter = this.mAdapter != null; this.mAdapter = adapter; if (this.mList != null) { this.mList.setAdapter(adapter); if (!this.mListShown && !hadAdapter) { setListShown(true, getView().getWindowToken() != null); } } } public void setSelection(int i) { int position = i; int i2 = position; ensureList(); this.mList.setSelection(position); } public int getSelectedItemPosition() { ensureList(); return this.mList.getSelectedItemPosition(); } public long getSelectedItemId() { ensureList(); return this.mList.getSelectedItemId(); } public ListView getListView() { ensureList(); return this.mList; } public void setEmptyText(CharSequence charSequence) { CharSequence text = charSequence; CharSequence charSequence2 = text; ensureList(); if (this.mStandardEmptyView != null) { this.mStandardEmptyView.setText(text); if (this.mEmptyText == null) { this.mList.setEmptyView(this.mStandardEmptyView); } this.mEmptyText = text; return; } throw new IllegalStateException("Can't be used with a custom content view"); } public void setListShown(boolean z) { setListShown(z, true); } public void setListShownNoAnimation(boolean z) { setListShown(z, false); } private void setListShown(boolean z, boolean z2) { boolean shown = z; boolean animate = z2; ensureList(); if (this.mProgressContainer == null) { throw new IllegalStateException("Can't be used with a custom content view"); } else if (this.mListShown != shown) { this.mListShown = shown; if (!shown) { if (!animate) { this.mProgressContainer.clearAnimation(); this.mListContainer.clearAnimation(); } else { this.mProgressContainer.startAnimation(AnimationUtils.loadAnimation(getContext(), 17432576)); this.mListContainer.startAnimation(AnimationUtils.loadAnimation(getContext(), 17432577)); } this.mProgressContainer.setVisibility(0); this.mListContainer.setVisibility(8); } else { if (!animate) { this.mProgressContainer.clearAnimation(); this.mListContainer.clearAnimation(); } else { this.mProgressContainer.startAnimation(AnimationUtils.loadAnimation(getContext(), 17432577)); this.mListContainer.startAnimation(AnimationUtils.loadAnimation(getContext(), 17432576)); } this.mProgressContainer.setVisibility(8); this.mListContainer.setVisibility(0); } } } public ListAdapter getListAdapter() { return this.mAdapter; } private void ensureList() { if (this.mList == null) { View view = getView(); View root = view; if (view != null) { if (!(root instanceof ListView)) { this.mStandardEmptyView = (TextView) root.findViewById(INTERNAL_EMPTY_ID); if (this.mStandardEmptyView != null) { this.mStandardEmptyView.setVisibility(8); } else { this.mEmptyView = root.findViewById(16908292); } this.mProgressContainer = root.findViewById(INTERNAL_PROGRESS_CONTAINER_ID); this.mListContainer = root.findViewById(INTERNAL_LIST_CONTAINER_ID); View findViewById = root.findViewById(16908298); View rawListView = findViewById; if (findViewById instanceof ListView) { this.mList = (ListView) rawListView; if (this.mEmptyView != null) { this.mList.setEmptyView(this.mEmptyView); } else if (this.mEmptyText != null) { this.mStandardEmptyView.setText(this.mEmptyText); this.mList.setEmptyView(this.mStandardEmptyView); } } else if (rawListView != null) { throw new RuntimeException("Content has view with id attribute 'android.R.id.list' that is not a ListView class"); } else { throw new RuntimeException("Your content must have a ListView whose id attribute is 'android.R.id.list'"); } } else { this.mList = (ListView) root; } this.mListShown = true; this.mList.setOnItemClickListener(this.mOnClickListener); if (this.mAdapter != null) { ListAdapter adapter = this.mAdapter; this.mAdapter = null; setListAdapter(adapter); } else if (this.mProgressContainer != null) { setListShown(false, false); } boolean post = this.mHandler.post(this.mRequestFocus); return; } throw new IllegalStateException("Content view not yet created"); } } }
[ "henry.k.adarkwa@gmail.com" ]
henry.k.adarkwa@gmail.com
7f8bc763e2075929daffaa42b019f11db2ecdd5b
736f6eb899ddd2e97c56c4dfb908deca1a2632a6
/hello/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/hello/impl/rev141210/HelloModule.java
da550a40d326dec501fb346c0a96737f6e163810
[]
no_license
uitgeholzerd/opendl-tutorial
150e94e4511dd78742956ab4d4e1494d18854bae
de1db55563e75e17b182aa4ded8192b56cbb90dc
refs/heads/master
2021-01-10T02:02:09.610317
2016-02-19T11:21:35
2016-02-19T11:21:35
51,983,082
1
0
null
null
null
null
UTF-8
Java
false
false
1,534
java
/* * Copyright © 2015 left 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.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.hello.impl.rev141210; import org.opendaylight.hello.impl.HelloProvider; public class HelloModule extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.hello.impl.rev141210.AbstractHelloModule { public HelloModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) { super(identifier, dependencyResolver); } public HelloModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.hello.impl.rev141210.HelloModule oldModule, java.lang.AutoCloseable oldInstance) { super(identifier, dependencyResolver, oldModule, oldInstance); } @Override public void customValidation() { // add custom validation form module attributes here. } @Override public java.lang.AutoCloseable createInstance() { HelloProvider provider = new HelloProvider(); getBrokerDependency().registerProvider(provider); return provider; } }
[ "uitgeholzerd@gmail.com" ]
uitgeholzerd@gmail.com
931f080e8f4e02c57940e2c7767b2033bbfd85a5
9fc138e18a1448fddfa0a3a3e4f6547a0ae569c8
/Exercises/Exercise3/Exercise3Part1/app/src/androidTest/java/edu/sjsu/android/exercise3part1/ExampleInstrumentedTest.java
30237c8a7ba61be978440d14863e70b2b3f1f23a
[]
no_license
abdurrahmanmohammad/CS175-Mobile-Device-Development
6b2d204e126eeef4e2741c3e7cd49692bc02fb27
36512958aa993395c8c88d9b258379268a426dac
refs/heads/main
2023-01-27T13:41:24.868030
2020-12-15T13:50:26
2020-12-15T13:50:26
300,692,590
1
2
null
null
null
null
UTF-8
Java
false
false
776
java
package edu.sjsu.android.exercise3part1; import android.content.Context; import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.ext.junit.runners.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); assertEquals("edu.sjsu.android.exercise3part1", appContext.getPackageName()); } }
[ "abdurrahmanmohammad02@gmail.com" ]
abdurrahmanmohammad02@gmail.com
fd839e3033f8bc24cd753603024ee9837bc1a757
bf21f14ee804d4090d6c1df139317243dc46878c
/src/factory/method/Arrumadeira.java
a16b2c0c840e3de7857ac590f1a369bacf97dd83
[]
no_license
DaviCorreia/PadraodeProjeto-FactoryMethod
284e3512109290a031b97d237d3e712dd5d60558
13085149e4ed5ee1eab0bc94a7b23256e52a6851
refs/heads/master
2020-09-19T22:26:22.225511
2019-11-27T01:19:21
2019-11-27T01:19:21
null
0
0
null
null
null
null
IBM852
Java
false
false
192
java
package factory.method; public class Arrumadeira implements Gastos { @Override public void exibirMenssagem() { System.out.println("Gasto: Arrumadeira\nTipo de gasto: Servišo"); } }
[ "davicorreia21@gmail.com" ]
davicorreia21@gmail.com
9d9d0097965644843cf9f3b3bbcf97c6aa5f2ee9
f2ec41692f165cfa3bea2bd3c639f5146dee3fe4
/src/main/java/com/yinchaxian/bookshop/mapper/ReplyMapper.java
d98c89ea050a67263efdb1e9c1c03d2277649b95
[]
no_license
zzzzffff6666/book-shop
3015551f1c0776417d8522375b5a0c8025ea386a
6982552d89bb295ce2df377836bd2a2655942bb3
refs/heads/master
2023-06-18T19:45:38.023223
2021-07-16T03:13:07
2021-07-16T03:13:07
383,702,815
0
0
null
null
null
null
UTF-8
Java
false
false
1,582
java
package com.yinchaxian.bookshop.mapper; import com.yinchaxian.bookshop.entity.Reply; import org.apache.ibatis.annotations.*; import java.util.List; public interface ReplyMapper { @Insert("insert into reply " + "values(#{replyId}, #{commentId}, #{userId}, #{username}, #{date}, #{content})") int insert(Reply reply); @Delete("delete from reply " + "where reply_id = #{replyId} " + "and user_id = #{userId}") int delete(int replyId, int userId); @Delete("delete from reply " + "where reply_id = #{replyId}") int deleteByAdmin(int replyId); @Update("update reply " + "set date = #{date}, " + "content = #{content} " + "where reply_id = #{replyId} " + "and user_id = #{userId}") int update(Reply reply); @Select("select * " + "from reply " + "where reply_id = #{replyId}") @ResultType(Reply.class) Reply select(int replyId); @Select("select * " + "from reply " + "where user_id = #{userId} " + "order by date desc") @ResultType(Reply.class) List<Reply> selectByUser(int userId); @Select("select * " + "from reply " + "where comment_id = #{commentId} " + "order by date desc") @ResultType(Reply.class) List<Reply> selectByComment(int commentId); @Select("select user_id " + "from reply " + "where reply_id = #{replyId}") @ResultType(Integer.class) int selectUserId(int replyId); }
[ "17770517023@163.com" ]
17770517023@163.com
c795dea161130e5b754760715fc57dd8abefd2ad
0204106b45b7ca939a495caaa2a4e2ee240775bb
/javase/src/day17/ThreadDemo13.java
e3edb82579ed822062a53526ba453eded23bbfcf
[]
no_license
ajsonx/JavaStudy
f14b6234d3757579bc41bc0966c89433a032b43c
f90c8ac7ed0e639aef97ef9256c3f417eaa49466
refs/heads/master
2020-04-04T21:01:47.647291
2019-08-06T08:54:28
2019-08-06T08:54:28
155,132,024
0
0
null
null
null
null
UTF-8
Java
false
false
2,406
java
package day17; import java.util.Scanner; /** * IO阻塞状态 * 当发生阻塞时,从Running切换到IO阻塞状态, * 当读写准备好条件满足时,不再阻塞, * 由阻塞状态,切换为到Runnable状态, * 重新等待被CPU调度,等待下一次时间片分配, * 才可进入Running状态 * * 当程序中涉及资源的读入,可提前缓存到内存中; * 如:提前读入文件或图片;BufferedInputStream;BufferedReader * 当程序要向外写出时,可先缓存在内存中,然后再集中向外写出 * 如:内存中的字符数组;BufferedOutputStream;PrintWriter * 信息队列(或队列中间件) * * 如果某个线程调用了wait()、join()或者sleep()函数被阻塞挂起, * 这个时候,调用该线程的interrupt()方法, * 该线程会打断,抛出个InterruptedException异常 * 注意:IOBlock状态,不会被interrupt()方法中断! * * jx: * 只有调用sleep join wait等方法时,再在线程外调用interrupt方法才会抛出异常 * IOBlock会阻塞当前线程。 * 打断线程 在run方法内获取当前线程是否被打断isInterrupt 然后去做判断,用于线程间协作 */ public class ThreadDemo13 { public static void main(String[] args) { Thread thread = new Thread(new Runnable() { @Override public void run() { Scanner sc = new Scanner(System.in); System.out.println("请输入一个整数:"); //for(;;){ //int num = sc.nextInt(); Thread currThread = Thread.currentThread(); boolean flag = currThread.isInterrupted(); if(flag == true){ //true表示被中断 sc.close(); }else{ System.out.println("未被打断"); } //} System.out.println("close"); } }); thread.start(); thread.interrupt(); new Thread(new Runnable(){ @Override public void run() { System.out.println("打断线程thread"); thread.interrupt(); } }).start(); /* * 如果某个线程调用了wait()、join()或�?�sleep()函数被阻塞挂起, * 这个时�?�,调用该线程的interrupt()方法�? * 该线程会打断,抛出个InterruptedException异常 * IOBlock状�?�,不会被interrupt()方法中断�? */ } }
[ "577429696@qq.com" ]
577429696@qq.com
413567db8fcc11839275701c9d318be054d6f84b
ce83ce73309401d5764f1c4bd9b8bc1da0c115ff
/src/main/java/ph/fingra/hadoop/dbms/parse/component/ComponentnewuserReader.java
54efbc95144804fa4e6e9ed0d0b972f19351c0db
[ "Apache-2.0" ]
permissive
david100gom/Fingra.ph_Hadoop
cab6e2169c8a337d2ccdbdfe3d884733203466fa
0172faca35097dc84b5c4958744afa77fa7635e7
refs/heads/master
2021-01-18T07:02:18.716541
2014-12-16T06:30:08
2014-12-16T06:31:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
10,211
java
/** * Copyright 2014 tgrape 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 ph.fingra.hadoop.dbms.parse.component; import java.io.BufferedReader; import java.io.DataInputStream; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStreamReader; import java.text.ParseException; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.regex.Pattern; import ph.fingra.hadoop.common.ConstantVars; import ph.fingra.hadoop.common.FingraphConfig; import ph.fingra.hadoop.common.LfsPathInfo; import ph.fingra.hadoop.common.domain.TargetDate; import ph.fingra.hadoop.common.util.ArgsOptionUtil; import ph.fingra.hadoop.common.util.DateTimeUtil; import ph.fingra.hadoop.dbms.parse.component.domain.Componentnewuser; public class ComponentnewuserReader { @SuppressWarnings("unused") private String mode; private String year; private String month; private String day; private String hour; private int week; private String date; private String datehour; private int dayofweek; private String fromdate; private String todate; private LfsPathInfo lfsPath = null; private String resultUri = null; private String getWeek() { if (this.week == 0) return null; return (this.week<10) ? "0"+this.week : String.valueOf(this.week); } public ComponentnewuserReader(FingraphConfig config, TargetDate target) throws IOException { this.mode = target.getRunmode(); if (target.getRunmode().equals(ConstantVars.RUNMODE_HOUR)) { this.year = target.getYear(); this.month = target.getMonth(); this.day = target.getDay(); this.hour = target.getHour(); this.week = target.getWeek(); this.date = this.year + "-" + this.month + "-" + this.day; this.datehour = this.year + "-" + this.month + "-" + this.day + " " + this.hour + ":00:00"; this.dayofweek = DateTimeUtil.getDayofWeekByDay(this.year, this.month, this.day); } else if (target.getRunmode().equals(ConstantVars.RUNMODE_DAY)) { this.year = target.getYear(); this.month = target.getMonth(); this.day = target.getDay(); this.week = target.getWeek(); this.date = this.year + "-" + this.month + "-" + this.day; this.dayofweek = DateTimeUtil.getDayofWeekByDay(this.year, this.month, this.day); } else if (target.getRunmode().equals(ConstantVars.RUNMODE_WEEK)) { this.year = target.getYear(); this.week = target.getWeek(); this.fromdate = DateTimeUtil.startDayOfWeek(this.year, this.week, "yyyy-MM-dd"); this.todate = DateTimeUtil.lastDayOfWeek(this.year, this.week, "yyyy-MM-dd"); } else if (target.getRunmode().equals(ConstantVars.RUNMODE_MONTH)) { this.year = target.getYear(); this.month = target.getMonth(); } else { throw new IOException("Invalid runmode for creating reader"); } this.lfsPath = new LfsPathInfo(config, target); this.resultUri = this.lfsPath.getComponentnewuser(); } private static class ComponentnewuserResultParser { private static final String COMPONENTNEWUSER_PATTERN_REGEX = "^[a-zA-Z0-9]*\\t" // appkey + "[a-zA-Z0-9]*\\t" // componentkey + "\\d*$"; // usercount private static Pattern COMPONENTNEWUSER_PATTERN; static { COMPONENTNEWUSER_PATTERN = Pattern.compile(COMPONENTNEWUSER_PATTERN_REGEX); } public static Componentnewuser parse(String src) throws ParseException { Componentnewuser vo = null; if (src == null || src.isEmpty()) { throw new ParseException("unable to parse empty string", 0); } if (COMPONENTNEWUSER_PATTERN.matcher(src).matches() == true) { vo = new Componentnewuser(); String[] values = src.split("\\t"); vo.setAppkey(values[0].trim()); vo.setComponentkey(values[1].trim()); try { vo.setUsercount(Long.parseLong(values[2].trim())); } catch (NumberFormatException e) { throw new ParseException("invalid number value", 0); } } else { throw new ParseException("invalid pattern string", 0); } return vo; } } public List<Componentnewuser> getComponentnewuserResults(String appkey) throws IOException { String uri = this.resultUri; List<Componentnewuser> list = new ArrayList<Componentnewuser>(); FileInputStream fstream = null; DataInputStream in = null; BufferedReader br = null; try { fstream = new FileInputStream(uri); in = new DataInputStream(fstream); br = new BufferedReader(new InputStreamReader(in)); String line; while ((line = br.readLine()) != null) { line = line.trim(); if (line.isEmpty()) continue; try { Componentnewuser vo = ComponentnewuserResultParser.parse(line); if (vo != null && vo.getAppkey().equals(appkey)) { vo.setYear(this.year); vo.setMonth(this.month); vo.setDay(this.day); vo.setHour(this.hour); vo.setWeek(this.getWeek()); vo.setDate(this.date); vo.setDatehour(this.datehour); vo.setDayofweek(this.dayofweek); vo.setFromdate(this.fromdate); vo.setTodate(this.todate); list.add(vo); } } catch (ParseException ignore) { continue; } } } catch (FileNotFoundException ignore) { ; } catch (IOException ioe) { throw ioe; } finally { if (br != null) br.close(); if (in != null) in.close(); if (fstream != null) fstream.close(); } return list; } public List<String> getAppkeyResults() throws IOException { String uri = this.resultUri; List<String> list = new ArrayList<String>(); FileInputStream fstream = null; DataInputStream in = null; BufferedReader br = null; try { fstream = new FileInputStream(uri); in = new DataInputStream(fstream); br = new BufferedReader(new InputStreamReader(in)); Set<String> appKeys = new HashSet<String>(); String line; while ((line = br.readLine()) != null) { line = line.trim(); if (line.isEmpty()) continue; try { Componentnewuser src = ComponentnewuserResultParser.parse(line); if (src != null && appKeys.contains(src.getAppkey()) == false) { list.add(src.getAppkey()); appKeys.add(src.getAppkey()); } } catch (ParseException ignore) { continue; } } } catch (FileNotFoundException ignore) { ; } catch (IOException ioe) { throw ioe; } finally { if (br != null) br.close(); if (in != null) in.close(); if (fstream != null) fstream.close(); } return list; } public static void main(String[] args) throws IOException { FingraphConfig config = new FingraphConfig(); TargetDate target = ArgsOptionUtil.getTargetDate("day", "2014-08-20"); ComponentnewuserReader reader = new ComponentnewuserReader(config, target); List<Componentnewuser> list = reader.getComponentnewuserResults("fin278318"); for (Componentnewuser vo : list) { System.out.println(vo.toString()); } System.out.println("--------------------"); target = ArgsOptionUtil.getTargetDate("week", "2014-34"); reader = new ComponentnewuserReader(config, target); list = reader.getComponentnewuserResults("fin278318"); for (Componentnewuser vo : list) { System.out.println(vo.toString()); } System.out.println("--------------------"); target = ArgsOptionUtil.getTargetDate("month", "2014-08"); reader = new ComponentnewuserReader(config, target); list = reader.getComponentnewuserResults("fin278318"); for (Componentnewuser vo : list) { System.out.println(vo.toString()); } System.exit(0); } }
[ "mycort@tgrape.com" ]
mycort@tgrape.com
d95ed93b71adc710fb9d1d98c5814cc761294844
4691acca4e62da71a857385cffce2b6b4aef3bb3
/core-java-modules/core-java-reflection-2/src/test/java/com/baeldung/reflection/access/privatemethods/InvokePrivateMethodsUnitTest.java
e98eb9ec7f9315d1bfdf3bbe7fd30dd41c2ddd77
[ "MIT" ]
permissive
lor6/tutorials
800f2e48d7968c047407bbd8a61b47be7ec352f2
e993db2c23d559d503b8bf8bc27aab0847224593
refs/heads/master
2023-05-29T06:17:47.980938
2023-05-19T08:37:45
2023-05-19T08:37:45
145,218,314
7
11
MIT
2018-08-18T12:29:20
2018-08-18T12:29:19
null
UTF-8
Java
false
false
1,168
java
package com.baeldung.reflection.access.privatemethods; import org.junit.jupiter.api.Test; import org.springframework.test.util.ReflectionTestUtils; import java.lang.reflect.Method; import static org.junit.jupiter.api.Assertions.assertEquals; class InvokePrivateMethodsUnitTest { private final long[] someLongArray = new long[] { 1L, 2L, 1L, 4L, 2L }; @Test void whenSearchingForLongValueInSubsequenceUsingReflection_thenTheCorrectIndexOfTheValueIsReturned() throws Exception { Method indexOfMethod = LongArrayUtil.class.getDeclaredMethod("indexOf", long[].class, long.class, int.class, int.class); indexOfMethod.setAccessible(true); assertEquals(2, indexOfMethod.invoke(LongArrayUtil.class, someLongArray, 1L, 1, someLongArray.length), "The index should be 2."); } @Test void whenSearchingForLongValueInSubsequenceUsingSpring_thenTheCorrectIndexOfTheValueIsReturned() throws Exception { int indexOfSearchTarget = ReflectionTestUtils.invokeMethod(LongArrayUtil.class, "indexOf", someLongArray, 1L, 1, someLongArray.length); assertEquals(2, indexOfSearchTarget, "The index should be 2."); } }
[ "noreply@github.com" ]
noreply@github.com
d35cfae79d8ed658b59882bf9523ba27bcb06c67
0746386f70f1f570d1c6e428162bbb5e68156956
/src/main/java/gb/common/agent/Ssh2Agent.java
6c826126f8fd1c152f7aecdd0a082de86614a916
[]
no_license
growin-infra/gbwebV2
bbda02a5fe06be7bec5439b4a0b2833e6f9e8d51
973e4d38dcd937569ea3ffe62c168d002e21e19b
refs/heads/master
2023-08-27T19:56:10.425981
2021-10-13T23:49:23
2021-10-13T23:49:23
414,807,791
0
0
null
null
null
null
UTF-8
Java
false
false
14,080
java
package gb.common.agent; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.RandomAccessFile; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.log4j.Logger; import ch.ethz.ssh2.ChannelCondition; import ch.ethz.ssh2.Connection; import ch.ethz.ssh2.Session; import ch.ethz.ssh2.StreamGobbler; public class Ssh2Agent { static Logger ssh2log = Logger.getLogger(Ssh2Agent.class); public static Map<String, Object> getData(String command, String id, String pw, String ip, int port, int timeout) throws Exception { Map<String, Object> map = null; Session sess = null; Connection conn = null; try { map = new HashMap<String, Object>(); conn = new Connection(ip, port); conn.connect(); boolean isAuthenticated = conn.authenticateWithPassword(id, pw); if (isAuthenticated == false) { ssh2log.error("Authentication failed."); } sess = conn.openSession(); sess.execCommand(command); InputStream stdout = sess.getStdout(); InputStream stderr = sess.getStderr(); BufferedReader br = new BufferedReader(new InputStreamReader(stdout)); while (true) { if ((stdout.available() == 0) && (stderr.available() == 0)) { int conditions = sess.waitForCondition(ChannelCondition.STDOUT_DATA | ChannelCondition.STDERR_DATA | ChannelCondition.EOF, timeout*1000); if ((conditions & ChannelCondition.TIMEOUT) != 0) { /* A timeout occured. */ map.put("value", "Timeout while waiting for data from peer."); break; } } String line = br.readLine(); if (line == null) break; map.put("value", line); } /* Show exit status, if available (otherwise "null") */ map.put("ExitCode", sess.getExitStatus()); // if (sess.getExitStatus() != null) { // } } catch (IOException e) { map.put("Exception", e.getMessage()); e.printStackTrace(); // throw new Exception(e.fillInStackTrace().toString()); ssh2log.error("getData IOException : ",e.fillInStackTrace()); } catch (Exception e) { map.put("Exception", e.getMessage()); ssh2log.error("getData Exception : ",e.fillInStackTrace()); } finally { if (sess != null) sess.close(); if (conn != null) conn.close(); } return map; } public static Map<String, Object> getData(String command, String id, String pw, String ip, int port) throws Exception { Map<String, Object> map = null; Session sess = null; Connection conn = null; try { map = new HashMap<String, Object>(); conn = new Connection(ip, port); conn.connect(); boolean isAuthenticated = conn.authenticateWithPassword(id, pw); if (isAuthenticated == false) { ssh2log.error("Authentication failed."); throw new Exception("Authentication failed."); } sess = conn.openSession(); sess.execCommand(command); InputStream stdout = sess.getStdout(); BufferedReader br = new BufferedReader(new InputStreamReader(stdout)); // byte[] buffer = new byte[8192]; while (true) { String line = br.readLine(); if (line == null) break; map.put("value", line); } /* Show exit status, if available (otherwise "null") */ map.put("ExitCode", sess.getExitStatus()); // if (sess.getExitStatus() != null) { // } } catch (IOException e) { e.printStackTrace(); // throw new Exception(e.fillInStackTrace().toString()); ssh2log.error("getData IOException : ",e.fillInStackTrace()); } finally { if (sess != null) sess.close(); if (conn != null) conn.close(); } return map; } public static Map<String, Object> backupRun(String command, String id, String pw, String ip, int port) throws Exception { Map<String, Object> map = null; Session sess = null; Connection conn = null; try { map = new HashMap<String, Object>(); conn = new Connection(ip, port); conn.connect(); boolean isAuthenticated = conn.authenticateWithPassword(id, pw); if (isAuthenticated == false) { ssh2log.error("Authentication failed."); throw new Exception("Authentication failed."); } sess = conn.openSession(); sess.execCommand(command); InputStream stdout = sess.getStdout(); BufferedReader br = new BufferedReader(new InputStreamReader(stdout)); while (true) { String line = br.readLine(); if (line == null) break; map.put("value", line); if (line.matches("(.*)BACKUP COMPLETE(.*)") || line.matches("(.*)BACKUP FAILED(.*)") || line.matches("(.*)BACKUP END(.*)") ) { break; } } /* Show exit status, if available (otherwise "null") */ // if (sess.getExitStatus() != null) { // } } catch (IOException e) { e.printStackTrace(); // throw new Exception(e.fillInStackTrace().toString()); ssh2log.error("backupRun IOException : ",e.fillInStackTrace()); } finally { if (sess != null) sess.close(); if (conn != null) conn.close(); } return map; } public static Map<String, Object> restoreRun(String command, String id, String pw, String ip, int port) throws Exception { Map<String, Object> map = null; Session sess = null; Connection conn = null; try { map = new HashMap<String, Object>(); conn = new Connection(ip, port); conn.connect(); boolean isAuthenticated = conn.authenticateWithPassword(id, pw); if (isAuthenticated == false) { // throw new Exception("Authentication failed."); ssh2log.error("Authentication failed."); } sess = conn.openSession(); sess.execCommand(command); InputStream stdout = sess.getStdout(); BufferedReader br = new BufferedReader(new InputStreamReader(stdout)); // byte[] buffer = new byte[8192]; while (true) { String line = br.readLine(); if (line == null) break; map.put("value", line); if (line.matches("(.*)RESTORE COMPLETE(.*)") || line.matches("(.*)RESTORE FAILED(.*)") || line.matches("(.*)RESTORE END(.*)") ) { break; } } /* Show exit status, if available (otherwise "null") */ // if (sess.getExitStatus() != null) { // } } catch (IOException e) { e.printStackTrace(); // throw new Exception(e.fillInStackTrace().toString()); ssh2log.error("restoreRun IOException : ",e.fillInStackTrace()); } finally { if (sess != null) sess.close(); if (conn != null) conn.close(); } return map; } public static Map<String, Object> getList(String command, String id, String pw, String ip, int port, int timeout) throws Exception { Map<String, Object> map = null; List<String> list = null; Session sess = null; Connection conn = null; try { map = new HashMap<String, Object>(); conn = new Connection(ip, port); conn.connect(); boolean isAuthenticated = conn.authenticateWithPassword(id, pw); if (isAuthenticated == false) { // throw new IOException("Authentication failed."); ssh2log.error("Authentication failed."); } sess = conn.openSession(); sess.execCommand(command); InputStream stdout = sess.getStdout(); InputStream stderr = sess.getStderr(); BufferedReader br = new BufferedReader(new InputStreamReader(stdout)); // byte[] buffer = new byte[8192]; list = new ArrayList<String>(); while (true) { if ((stdout.available() == 0) && (stderr.available() == 0)) { int conditions = sess.waitForCondition(ChannelCondition.STDOUT_DATA | ChannelCondition.STDERR_DATA | ChannelCondition.EOF, timeout*1000); if ((conditions & ChannelCondition.TIMEOUT) != 0) { /* A timeout occured. */ map.put("value", "Timeout while waiting for data from peer."); break; } } String line = br.readLine(); if (line == null) break; list.add(line); } map.put("value", list); /* Show exit status, if available (otherwise "null") */ // if (sess.getExitStatus() != null) { // } } catch (IOException e) { e.printStackTrace(); // throw new Exception(e.fillInStackTrace().toString()); ssh2log.error("getList IOException : ",e.fillInStackTrace()); } finally { if (sess != null) sess.close(); if (conn != null) conn.close(); } return map; } public static Map<String, Object> getList(String command, String id, String pw, String ip, int port) throws Exception { Map<String, Object> map = null; List<String> list = null; Session sess = null; Connection conn = null; try { map = new HashMap<String, Object>(); conn = new Connection(ip, port); conn.connect(); boolean isAuthenticated = conn.authenticateWithPassword(id, pw); if (isAuthenticated == false) { map.put("auth", "Authentication failed."); ssh2log.error("Authentication failed."); } sess = conn.openSession(); sess.execCommand(command); InputStream stdout = sess.getStdout(); BufferedReader br = new BufferedReader(new InputStreamReader(stdout)); list = new ArrayList<String>(); while (true) { String line = br.readLine(); if (line == null) break; list.add(line); } map.put("list", list); /* Show exit status, if available (otherwise "null") */ // if (sess.getExitStatus() != null) { // } } catch (IOException e) { e.printStackTrace(); // throw new Exception(e.fillInStackTrace().toString()); ssh2log.error("getList IOException : ",e.fillInStackTrace()); } finally { if (sess != null) sess.close(); if (conn != null) conn.close(); } return map; } @SuppressWarnings("resource") public static Map<String, Object> getLog(Map<String, Object> paramMap) throws Exception { Map<String, Object> resutlMap = null; Session sess = null; Connection conn = null; RandomAccessFile file = null; long startPoint = 0; long endPoint = 0; String command = "", filename = ""; String id = "", pw = "", ip = ""; int port; long preEndPoint = 0; try { resutlMap = new HashMap<String, Object>(); command = paramMap.get("command").toString(); filename = paramMap.get("filename").toString(); id = paramMap.get("id").toString(); pw = paramMap.get("pw").toString(); ip = paramMap.get("ip").toString(); port = Integer.parseInt(paramMap.get("port").toString()); preEndPoint = Long.parseLong(paramMap.get("preEndPoint").toString()); conn = new Connection(ip, port); conn.connect(); boolean isAuthenticated = conn.authenticateWithPassword(id, pw); if (isAuthenticated == false) { // throw new IOException("Authentication failed."); ssh2log.error("Authentication failed."); } sess = conn.openSession(); sess.execCommand(command); file = new RandomAccessFile(filename, "r"); endPoint = file.length(); startPoint = preEndPoint > 0 ? preEndPoint : endPoint < 2000 ? 0 : endPoint - 2000; file.seek(startPoint); InputStream stdout = new StreamGobbler(sess.getStdout()); BufferedReader br = new BufferedReader(new InputStreamReader(stdout)); StringBuilder sb = new StringBuilder(); while (true) { String line = br.readLine(); if (line == null) break; sb.append(line); sb.append("\n"); //화면에 로그 보내기 //ExcutePop.setpJTA03(sb.toString()); if (line.matches("(.*)BACKUP COMPLETE(.*)") || line.matches("(.*)BACKUP FAILED(.*)") || line.matches("(.*)BACKUP END(.*)") ) { break; } } } catch (IOException e) { e.printStackTrace(); throw new Exception(e.fillInStackTrace().toString()); } finally { if (sess != null) sess.close(); if (conn != null) conn.close(); } return resutlMap; } //was 직접호출 public static Map<String, Object> executeCmd(String cmd) throws Exception { Map<String, Object> map = null; try { map = new HashMap<String, Object>(); String szLine; // 응용 프로그램의 Runtime 객체를 얻는다 Runtime runtime = Runtime.getRuntime(); // 응용 프로그램의 서브 프로세스인 Process 객체를 얻는다 // Process process = runtime.exec("ls -al"); Process process = runtime.exec(cmd); // 응용 프로그램의 입력 스트림을 구한다. BufferedReader br = new BufferedReader(new InputStreamReader(process.getInputStream())); // 응용 프로그램의 입력 스트림에서 한 라인씩 읽어서 응용 프로그램의 표준 출력으로 보낸다 while (true) { szLine = br.readLine(); if (szLine == null) break; map.put("value", szLine); } } catch (Exception e) { e.printStackTrace(); } return map; } //was 직접호출 public static Map<String, Object> executeListCmd(String cmd) throws Exception { Map<String, Object> map = null; List<String> list = null; try { map = new HashMap<String, Object>(); String szLine; // 응용 프로그램의 Runtime 객체를 얻는다 Runtime runtime = Runtime.getRuntime(); // 응용 프로그램의 서브 프로세스인 Process 객체를 얻는다 // Process process = runtime.exec("ls -al"); Process process = runtime.exec(cmd); // 응용 프로그램의 입력 스트림을 구한다. BufferedReader br = new BufferedReader(new InputStreamReader(process.getInputStream())); // 응용 프로그램의 입력 스트림에서 한 라인씩 읽어서 응용 프로그램의 표준 출력으로 보낸다 list = new ArrayList<String>(); while (true) { szLine = br.readLine(); if (szLine == null) break; list.add(szLine); } map.put("value", list); } catch (Exception e) { e.printStackTrace(); } return map; } public static boolean isconnect(String id, String pw, String ip, int port) { boolean result = false; Connection conn = null; try { conn = new Connection(ip, port); conn.connect(); result = conn.authenticateWithPassword(id, pw); } catch (Exception e) { e.printStackTrace(); } finally { if (conn != null) conn.close(); } return result; } }
[ "freeson01@growin.co.kr" ]
freeson01@growin.co.kr
fc38fba5b9d2f171876043b46675876640bd3df3
318f20a144a6bedfa1a7b5fc45705d0528bae0a4
/JSON + XML Processing/Products Shop/src/main/java/app/servicesImpl/ProductServiceImpl.java
cc30b825462fb0ef74462baf7e764d3cdfdd5110
[ "MIT" ]
permissive
vanncho/DatabasesAdvancedHibernate
99cdd0f548a50b3c7bd7ca83383cdf0fe60398c2
b282cf92f7442e231479302577c806dd89ff23a1
refs/heads/master
2020-06-28T18:34:18.502130
2016-12-16T16:57:40
2016-12-16T16:57:40
74,484,456
0
0
null
null
null
null
UTF-8
Java
false
false
2,928
java
package app.servicesImpl; import app.domains.dtos.ProductDto; import app.domains.dtos.ProductJsonDtoExport; import app.domains.dtos.UserDto; import app.domains.entities.Product; import app.domains.entities.User; import app.repositories.ProductRepository; import app.repositories.UserRepository; import app.services.ProductService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.List; import java.util.Random; @Service public class ProductServiceImpl implements ProductService { @Autowired private ProductRepository productRepository; @Autowired private UserRepository userRepository; @Override public void create(ProductDto productDto) { Product product = this.convertDtoToEntity(productDto); this.productRepository.saveAndFlush(product); } @Override public List<ProductDto> allProducts() { List<Product> products = this.productRepository.findAll(); List<ProductDto> productDtos = new ArrayList<>(); for (Product product : products) { ProductDto currProd = this.convertEntityToDto(product); productDtos.add(currProd); } return productDtos; } @Override public void updateProductsWithBuyerAndSeller(UserDto buyer, UserDto seller, long id) { User ub = this.userRepository.findById(buyer.getId()); User us = this.userRepository.findById(seller.getId()); Random random = new Random(); int n = random.nextInt(10); if (n == 2) { ub = null; } this.productRepository.updateProductsWithBuyerAndSeller(ub, us, id); } @Override public List<ProductJsonDtoExport> productsInRange() { List<Product> products = this.productRepository.productsInRange(); List<ProductJsonDtoExport> productJsonDtos = new ArrayList<>(); for (Product product : products) { ProductJsonDtoExport currProd = new ProductJsonDtoExport(); currProd.setName(product.getName()); currProd.setPrice(product.getPrice()); currProd.setSeller(product.getSeller().getFirstName() + " " + product.getSeller().getLastName()); productJsonDtos.add(currProd); } return productJsonDtos; } private ProductDto convertEntityToDto(Product product) { ProductDto productDto = new ProductDto(); productDto.setId(product.getId()); productDto.setName(product.getName()); productDto.setPrice(product.getPrice()); return productDto; } private Product convertDtoToEntity(ProductDto productDto) { Product product = new Product(); product.setId(productDto.getId()); product.setName(productDto.getName()); product.setPrice(productDto.getPrice()); return product; } }
[ "van_cho@abv.bg" ]
van_cho@abv.bg
7e8d7f297bc4ad990071d450ad69ef32e77741d7
e8fe69a3cc0ee78733eefbd0bd9221f71a3072dd
/Leapyear.java
b0e090d1ea97767ab79bd419ab88df85df5f68d1
[]
no_license
MuthurathinamECE/Don
54c80cb29f5000c6f6ca194ed177a09aca01cc6b
b52e878925993991d13f5eae9f8edae393565500
refs/heads/master
2020-03-22T21:09:40.832640
2018-07-31T10:17:15
2018-07-31T10:17:15
140,662,020
0
1
null
null
null
null
UTF-8
Java
false
false
461
java
package day20; import java.util.Scanner; public class Leapyear { public static void main(String[] args) { int a; Scanner sc=new Scanner(System.in); a=sc.nextInt(); if(a%100==0){ if(a%400==0){ System.out.println("leap year"); } else{ System.out.println("not leap year"); } }else if(a%4==0){ System.out.println("leap year"); } else{ System.out.println("not leap year"); } } }
[ "noreply@github.com" ]
noreply@github.com
e36c74d4f782d389eaf081e5315fb9c7054b3564
858c1eab055cc3afa8c060603601144b1b27db8d
/app/src/androidTest/java/com/pakoandrade/fuelcalculator/ExampleInstrumentedTest.java
2acc4c6c7b78178e9d565f9ca24222486382ad0e
[]
no_license
pako10/FuelCalculator
64a8036b4a7a43b57c0db6fcd0ec3938ceb0ad23
a791e84e33a159c9904051a788b449f90f1205c4
refs/heads/master
2021-01-21T11:56:51.316944
2017-05-19T04:53:05
2017-05-19T04:53:05
91,766,817
0
0
null
null
null
null
UTF-8
Java
false
false
764
java
package com.pakoandrade.fuelcalculator; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumentation test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() throws Exception { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.pakoandrade.fuelcalculator", appContext.getPackageName()); } }
[ "pakoandrade10@gmail.com" ]
pakoandrade10@gmail.com
c13f8fe9b32eb033906ea8f8f7f87f99e11e1b83
a6e99ee44ee7f8232669f4541c0e5bcd71a2c9cb
/Music School - Server/src/thread/ThreadServer.java
1609bc12056c4e1a6e3b0f22db3284dff3c5128c
[]
no_license
ivansard/Music-School-Desktop
07bb906ca712df962158558dcf3dad682a6cb031
e24eadebc774fdf5f57262f3fb431d1948310891
refs/heads/master
2020-03-24T23:52:43.322158
2018-08-01T13:15:47
2018-08-01T13:15:47
143,151,768
0
0
null
null
null
null
UTF-8
Java
false
false
2,975
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package thread; import java.io.BufferedReader; import java.io.IOException; import java.net.ServerSocket; import java.net.Socket; import java.util.ArrayList; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; import util.User; /** * * @author Ivan */ public class ThreadServer extends Thread { ServerSocket serverSocket; List<ThreadClient> clients; boolean stopped = false; public ThreadServer(int port) { try { serverSocket = new ServerSocket(port); clients = new ArrayList<>(); } catch (IOException ex) { System.out.println(ex.getMessage()); ex.printStackTrace(); } } @Override public void run() { while (!isInterrupted()) { try { if (stopped) { interrupt(); } System.out.println("Server up and running and waiting for new clients!"); Socket clientCommunicationSocket = serverSocket.accept(); System.out.println("A new client has connected!"); ThreadClient client = new ThreadClient(clientCommunicationSocket); client.start(); clients.add(client); } catch (IOException ex) { ex.printStackTrace(); } } System.out.println("Server stopped!"); } public void notifyClients() { for (Thread user : clients) { ThreadClient clientThread = (ThreadClient) user; clientThread.notifyShutdown(); } } public void removeUsers() throws InterruptedException { for (ThreadClient user : clients) { user.interrupt(); // client.join(); } clients.clear(); stopped = true; } public void removeUser(User userToRemove) { for (ThreadClient user : clients) { if (userToRemove.getUserThread().equals(user)) { user.interrupt(); } } clients.remove(userToRemove.getUserThread()); } public ServerSocket getServerSocket() { return serverSocket; } public void setServerSocket(ServerSocket serverSocket) { this.serverSocket = serverSocket; } public void removeClients() { for (ThreadClient client : clients) { client.interrupt(); // client.join(); } clients.clear(); stopped = true; } public void removeClient(User userToRemove) { for (ThreadClient client : clients) { if (userToRemove.getUserThread().equals(client)) { client.interrupt(); } } clients.remove(userToRemove.getUserThread()); } }
[ "ivan.ssardelic@gmail.com" ]
ivan.ssardelic@gmail.com
14464284908a3867fc88d807e0dceb67ab181ec1
5807a7ad9ed73344e585da522d087864f20dccec
/backSpring/domain/model/src/main/java/co/com/sofka/model/factura/Factura.java
9ce2ee3ab5d001515090fc8dc63b61c4e63ad64d
[]
no_license
jdan2/RetoRepaso
0cd60adf62b695bf754a588005ecf00c2675b92d
8b0f91fe5e937ee9587d0da12a6204fc83424a0d
refs/heads/master
2023-07-03T10:46:02.725266
2021-08-02T05:30:34
2021-08-02T05:30:34
390,024,597
0
0
null
2021-08-02T06:37:29
2021-07-27T14:58:17
JavaScript
UTF-8
Java
false
false
830
java
package co.com.sofka.model.factura; import co.com.sofka.model.factura.values.*; import lombok.Builder; import lombok.Data; @Data @Builder(toBuilder = true) public class Factura { private String facturaId; private TiqueteId tiqueteId; private EmpleadoId empleadoId; private HoraSalida horaSalida; private CanitdadMinutos canitdadMinutos; private ValorTotal valorTotal; public Factura(String facturaId, TiqueteId tiqueteId, EmpleadoId empleadoId, HoraSalida horaSalida, CanitdadMinutos canitdadMinutos, ValorTotal valorTotal) { this.facturaId = facturaId; this.tiqueteId = tiqueteId; this.empleadoId = empleadoId; this.horaSalida = horaSalida; this.canitdadMinutos = canitdadMinutos; this.valorTotal = valorTotal; } public Factura() { } }
[ "juandortiz.15@gmail.com" ]
juandortiz.15@gmail.com
783325ed22c049213b5273a1aaddb563a296b2cd
ffd5cceaedfafe48c771f3d8f8841be9773ae605
/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/circle/KeyPointsCircleRegularGrid.java
7ba3e4154e846e3a3ac091dc2a68a5a0ae24ea9a
[ "LicenseRef-scancode-takuya-ooura", "Apache-2.0" ]
permissive
Pandinosaurus/BoofCV
7ea1db317570b2900349e2b44cc780efc9bf1269
fc75d510eecf7afd55383b6aae8f01a92b1a47d3
refs/heads/SNAPSHOT
2023-08-31T07:29:59.845934
2019-11-03T17:46:24
2019-11-03T17:46:24
191,161,726
0
0
Apache-2.0
2019-11-03T23:57:13
2019-06-10T12:13:55
Java
UTF-8
Java
false
false
6,382
java
/* * Copyright (c) 2011-2017, Peter Abeles. All Rights Reserved. * * This file is part of BoofCV (http://boofcv.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 boofcv.alg.fiducial.calib.circle; import boofcv.alg.fiducial.calib.circle.EllipseClustersIntoGrid.Grid; import georegression.geometry.algs.TangentLinesTwoEllipses_F64; import georegression.misc.GrlConstants; import georegression.struct.curve.EllipseRotated_F64; import georegression.struct.point.Point2D_F64; import org.ddogleg.struct.FastQueue; /** * <p>Computes key points from an observed regular circular grid. Each circle has 4 key points at the grid aligned * top, bottom, left, and right side of the circle. These key points are found using tangent points between * adjacent circles. Tangent points are the same under perspective * distortion and the same can be said for the intersection of their lines. When more than one intersection * is at the same location the average is found</p> * * <center> * <img src="doc-files/regcircle_tangent_intersections.png"/> * </center> * * @author Peter Abeles */ public class KeyPointsCircleRegularGrid { // tangent points on each ellipse FastQueue<Tangents> tangents = new FastQueue<>(Tangents.class,true); // detected location FastQueue<Point2D_F64> keypoints = new FastQueue<>(Point2D_F64.class,true); // used to compute tangent lines between two ellipses private TangentLinesTwoEllipses_F64 tangentFinder = new TangentLinesTwoEllipses_F64(GrlConstants.TEST_F64,10); // storage for tangent points on ellipses private Point2D_F64 A0 = new Point2D_F64(); private Point2D_F64 A1 = new Point2D_F64(); private Point2D_F64 A2 = new Point2D_F64(); private Point2D_F64 A3 = new Point2D_F64(); private Point2D_F64 B0 = new Point2D_F64(); private Point2D_F64 B1 = new Point2D_F64(); private Point2D_F64 B2 = new Point2D_F64(); private Point2D_F64 B3 = new Point2D_F64(); /** * Computes key points from the grid of ellipses * @param grid Grid of ellipses * @return true if successful or false if it failed */ public boolean process(Grid grid ) { // reset and initialize data structures init(grid); // add tangent points from adjacent ellipses if( !horizontal(grid) ) return false; if( !vertical(grid) ) return false; keypoints.reset(); for (int i = 0; i < tangents.size(); i++) { tangents.get(i).getTop(keypoints.grow()); tangents.get(i).getRight(keypoints.grow()); tangents.get(i).getBottom(keypoints.grow()); tangents.get(i).getLeft(keypoints.grow()); } return true; } void init(Grid grid) { tangents.resize(grid.ellipses.size()); for (int i = 0; i < tangents.size(); i++) { tangents.get(i).reset(); } } boolean horizontal(Grid grid) { for (int i = 0; i < grid.rows; i++) { for (int j = 0; j < grid.columns-1; j++) { if (!addTangents(grid, i, j, i, j+1)) return false; } } return true; } boolean vertical(Grid grid) { for (int i = 0; i < grid.rows-1; i++) { for (int j = 0; j < grid.columns; j++) { if (!addTangents(grid, i, j, i+1, j)) return false; } } return true; } /** * Computes tangent points to the two ellipses specified by the grid coordinates */ private boolean addTangents(Grid grid, int rowA, int colA, int rowB, int colB) { EllipseRotated_F64 a = grid.get(rowA,colA); EllipseRotated_F64 b = grid.get(rowB,colB); if( !tangentFinder.process(a,b, A0, A1, A2, A3, B0, B1, B2, B3) ) { return false; } Tangents ta = tangents.get(grid.getIndexOfRegEllipse(rowA,colA)); Tangents tb = tangents.get(grid.getIndexOfRegEllipse(rowB,colB)); // Which point is 0 or 3 is not defined and can swap arbitrarily. To fix this problem // 0 will be defined as on the 'positive side' of the line connecting the ellipse centers double slopeX = b.center.x-a.center.x; double slopeY = b.center.y-a.center.y; double dx0 = A0.x-a.center.x; double dy0 = A0.y-a.center.y; double z = slopeX*dy0 - slopeY*dx0; if( z < 0 == (rowA == rowB)) { Point2D_F64 tmp = A0; A0 = A3; A3 = tmp; tmp = B0; B0 = B3; B3 = tmp; } // add tangent points from the two lines which do not cross the center line if( rowA == rowB ) { ta.t[ta.countT++].set(A0); ta.b[ta.countB++].set(A3); tb.t[tb.countT++].set(B0); tb.b[tb.countB++].set(B3); } else { ta.r[ta.countL++].set(A0); ta.l[ta.countR++].set(A3); tb.r[tb.countL++].set(B0); tb.l[tb.countR++].set(B3); } return true; } /** * Returns the location of each key point in the image from the most recently processed grid. * @return detected image location */ public FastQueue<Point2D_F64> getKeyPoints() { return keypoints; } public FastQueue<Tangents> getTangents() { return tangents; } public static class Tangents { // top bottom left right public Point2D_F64 t[] = new Point2D_F64[2]; public Point2D_F64 b[] = new Point2D_F64[2]; public Point2D_F64 l[] = new Point2D_F64[2]; public Point2D_F64 r[] = new Point2D_F64[2]; int countT = 0; int countB = 0; int countL = 0; int countR = 0; public Tangents() { for (int i = 0; i < 2; i++) { t[i] = new Point2D_F64(); b[i] = new Point2D_F64(); l[i] = new Point2D_F64(); r[i] = new Point2D_F64(); } } public void reset() { countT = countB = countL = countR = 0; } public void getTop( Point2D_F64 top ) {assign(t,countT,top);} public void getBottom( Point2D_F64 p ) { assign(b,countB,p); } public void getLeft( Point2D_F64 p ) { assign(l,countL,p); } public void getRight( Point2D_F64 p ) { assign(r,countR,p); } private void assign( Point2D_F64 array[] , int length , Point2D_F64 output ) { if( length == 1 ) { output.set(array[0]); } else { output.x = (array[0].x + array[1].x)/2.0; output.y = (array[0].y + array[1].y)/2.0; } } } }
[ "peter.abeles@gmail.com" ]
peter.abeles@gmail.com
1f5140195d95df09f763ec99a917f3921f54ffe7
868a1e6567d0498d32f03228bfc856abfc06f041
/Foundation1/src/lesson03/Task02.java
72c7d65e63eb85a869a5c1c1cd7ae895101a6d81
[]
no_license
lMysticl/Base_Java
9a881b47ef3774cc35c689d9fb7c24181d8a7988
0b5cec5ccb64747f19d5f6add5d5445e08352467
refs/heads/master
2020-12-30T22:31:41.421418
2016-09-18T23:46:10
2016-09-18T23:46:10
68,553,524
0
0
null
null
null
null
WINDOWS-1251
Java
false
false
942
java
package lesson03; import java.util.Scanner; public class Task02 { public static void main(String[] args) { int comp = (int) (Math.random() * 10) + 1;// Загадали число Scanner scan = new Scanner(System.in); int choise = 0; int c = 0; do { System.out.println("Угадайте число (Ваш выбор :"); while (!scan.hasNextInt()) { // Пока не число , ошибка System.out.println("\nОшибка вы ввели не число :" + scan.next() + "не число"); System.out.println("\nУгадай число(Ваш выш):"); } choise = scan.nextInt(); if (choise < comp) { System.out.println("Ведите число больше"); } else if (choise > comp) { System.out.println("Ведите число меньше"); } c++; } while (choise != comp); System.out.println("Угадал с = " + c + " Попытки"); scan.close(); } }
[ "putrenkov99@gmail.com" ]
putrenkov99@gmail.com
6cb061127bfb28ef4efb1032ea30cbc959dd5507
1f5929291139e0668bce32d317d0b13aa738412a
/gdsfm-server/src/main/java/gdsfm/telegrambot/model/airtime/liveinfov2/station/Station.java
5c851ed1cfb172280e6029da520272a48c110a38
[]
no_license
ideadapt/gdsfm-bot
177a14a5a4719556b2b54f620e46e7893665d3fc
669ed61e56b66166633a6ca338a69aeb26961e61
refs/heads/master
2021-01-13T04:21:35.826664
2016-12-30T21:25:25
2016-12-30T21:25:54
77,456,111
1
0
null
null
null
null
UTF-8
Java
false
false
2,281
java
package gdsfm.telegrambot.model.airtime.liveinfov2.station; import java.util.HashMap; import java.util.Map; import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonInclude(JsonInclude.Include.NON_NULL) @JsonPropertyOrder({ "env", "schedulerTime", "source_enabled", "timezone", "AIRTIME_API_VERSION" }) public class Station { @JsonProperty("env") private String env; @JsonProperty("schedulerTime") private String schedulerTime; @JsonProperty("source_enabled") private String sourceEnabled; @JsonProperty("timezone") private String timezone; @JsonProperty("AIRTIME_API_VERSION") private String aIRTIMEAPIVERSION; @JsonIgnore private Map<String, Object> additionalProperties = new HashMap<String, Object>(); @JsonProperty("env") public String getEnv() { return env; } @JsonProperty("env") public void setEnv(String env) { this.env = env; } @JsonProperty("schedulerTime") public String getSchedulerTime() { return schedulerTime; } @JsonProperty("schedulerTime") public void setSchedulerTime(String schedulerTime) { this.schedulerTime = schedulerTime; } @JsonProperty("source_enabled") public String getSourceEnabled() { return sourceEnabled; } @JsonProperty("source_enabled") public void setSourceEnabled(String sourceEnabled) { this.sourceEnabled = sourceEnabled; } @JsonProperty("timezone") public String getTimezone() { return timezone; } @JsonProperty("timezone") public void setTimezone(String timezone) { this.timezone = timezone; } @JsonProperty("AIRTIME_API_VERSION") public String getAIRTIMEAPIVERSION() { return aIRTIMEAPIVERSION; } @JsonProperty("AIRTIME_API_VERSION") public void setAIRTIMEAPIVERSION(String aIRTIMEAPIVERSION) { this.aIRTIMEAPIVERSION = aIRTIMEAPIVERSION; } @JsonAnyGetter public Map<String, Object> getAdditionalProperties() { return this.additionalProperties; } @JsonAnySetter public void setAdditionalProperty(String name, Object value) { this.additionalProperties.put(name, value); } }
[ "michischmuki@gmail.com" ]
michischmuki@gmail.com
1396ade639c8c07d7ab2434c5b001090fe3db947
72f7686d2fae875c1f5f021b4a0ad17d125af770
/displayjokeslibrary/src/main/java/com/example/displayjokeslibrary/JokeActivityFragment.java
b99d3316707ee52fbcbb9c50eb705b32efeb0139
[]
no_license
RehamShehada/BuildItBigger
8f4fe3159264699d9264a090e02494d2496cf481
2bb9816ca354d8f691185e6ee442a2af927f39eb
refs/heads/master
2021-01-07T12:10:10.294905
2020-02-19T18:02:44
2020-02-19T18:02:44
241,687,723
0
0
null
null
null
null
UTF-8
Java
false
false
940
java
package com.example.displayjokeslibrary; import android.content.Context; import android.net.Uri; import android.os.Bundle; import androidx.fragment.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; public class JokeActivityFragment extends Fragment { public JokeActivityFragment() { // Required empty public constructor } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View rootView = inflater.inflate(R.layout.fragment_joke_activity, container, false); String joke = getActivity().getIntent().getStringExtra(JokeActivity.JOKE_KEY); TextView textView = rootView.findViewById(R.id.jokeTV); textView.setText(joke); return rootView; } }
[ "rehamshehadeh97@gmail.com" ]
rehamshehadeh97@gmail.com
4734b390e2e626d37341c24b39bfae522d4c1c36
4e75e0a11cf3e69db7cf88cf0ae5953cb5abe9d0
/src/cc/easyandroid/easyui/fragment/EasyFragmentTabs.java
16d426045e967b248d75f613c489ef4eb42db8c1
[]
no_license
cgpllx/easyAndroid_ec
2331d722d6a1b85c3958e47130a6c2060c2db31d
e3709a8ebfb728f52ee11379ba2c34b276f82bc1
refs/heads/master
2020-12-06T17:21:52.643738
2015-12-23T06:25:44
2015-12-23T06:25:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,692
java
package cc.easyandroid.easyui.fragment; import android.os.Bundle; import android.support.v4.app.FragmentTabHost; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import cc.easyandroid.easyui.EasyR; import cc.easyandroid.easyui.config.TabConfig; import cc.easyandroid.easyui.pojo.EasyTab; import cc.easyandroid.easyui.utils.ViewFactory; /** * Tab+Fragment * * @author 耳东 * */ public abstract class EasyFragmentTabs extends EasyTabBaseFragment { protected FragmentTabHost mFragmentTabHost; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { TabConfig tabConfig = onCreatTabConfig(); if (tabConfig == null) { tabConfig = TabConfig.getSimpleInstance(); } View view = ViewFactory.getFragmentTabHostView(inflater.getContext(), tabConfig.getTabGravity()); mFragmentTabHost = (FragmentTabHost) view.findViewById(android.R.id.tabhost); mFragmentTabHost.setup(view.getContext(), getChildFragmentManager(), EasyR.id.realtabcontent); creatTab(); int tabcount = mFragmentTabHost.getTabWidget().getChildCount(); if (tabcount == 0) { throw new IllegalArgumentException("Please in the onCreatTab() method to addTab "); } mFragmentTabHost.getTabWidget().setBackgroundResource(tabConfig.getWidgetBackgroundResource()); return view; } /** * eg:EATab eaTab=new EATab(tabSpec, tabView, yourFragment.class, bundle); */ void addTab(EasyTab eaTab) { mFragmentTabHost.addTab(mFragmentTabHost.newTabSpec(eaTab.getTabSpec())// .setIndicator(eaTab.getTabView()), eaTab.getClass(), eaTab.getBundle()); } }
[ "Administrator@PC-20150408YMYE" ]
Administrator@PC-20150408YMYE
55f05eb048e29a1d322b929a70cd545d02e810a8
991cce588e65ddcc891a3d9672dbe7e0b33add62
/app/src/main/java/tourism/fighter/code/tourism/mainFrame.java
cc945b2f6a6c8b8854255a4d7880a5fd520c7da4
[]
no_license
Dreizehn133/Tourism
78d78545bb1b294b79c7e3562115c350f97cbffa
024dd2dce4371476f08e131712964905d01f7475
refs/heads/master
2020-03-12T00:45:53.161662
2018-04-20T12:26:54
2018-04-20T12:26:54
130,357,796
0
0
null
null
null
null
UTF-8
Java
false
false
5,149
java
package tourism.fighter.code.tourism; import android.content.Intent; import android.support.annotation.NonNull; import android.support.design.widget.NavigationView; import android.support.design.widget.Snackbar; import android.support.v4.view.GravityCompat; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.ActionBarDrawerToggle; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.DefaultItemAnimator; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.MenuItem; import android.view.View; import android.widget.ImageView; import android.widget.TextView; import java.util.ArrayList; import java.util.List; import butterknife.BindView; import butterknife.ButterKnife; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; import tourism.fighter.code.tourism.model.Tourism.Datum; import tourism.fighter.code.tourism.model.Tourism.Status; import tourism.fighter.code.tourism.util.ApiConnection; import tourism.fighter.code.tourism.util.ApiHelper; import tourism.fighter.code.tourism.adapter.RecyclerAdapter; import tourism.fighter.code.tourism.util.Session; import tourism.fighter.code.tourism.util.Transaksi; import tourism.fighter.code.tourism.util.detailClick; public class mainFrame extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener,detailClick { @BindView(R.id.parentDrawer) DrawerLayout drawerLayout; @BindView(R.id.nav)NavigationView nv; @BindView(R.id.recycler)RecyclerView recyclerView; TextView tNama; TextView tEmail; ImageView imgProfil; ActionBarDrawerToggle drawerToggle; Session session; Transaksi tr; List<Datum> isi ; RecyclerAdapter adapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main_frame); ButterKnife.bind(this); session=new Session(this); tr=new Transaksi(this); indentify(); recyclerSetting(); } void indentify(){ drawerToggle=new ActionBarDrawerToggle(this,drawerLayout,R.string.open,R.string.close); drawerLayout.addDrawerListener(drawerToggle); drawerToggle.syncState(); getSupportActionBar().setDisplayHomeAsUpEnabled(true); View header = nv.getHeaderView(0); tNama=(TextView)header.findViewById(R.id.profilNama); tEmail=(TextView)header.findViewById(R.id.profilEmail); imgProfil=(ImageView)header.findViewById(R.id.profilImg); tNama.setText(session.getNama()); tEmail.setText(session.getEmail()); imgProfil.setImageResource(R.drawable.image); nv.setNavigationItemSelectedListener(this); } void recyclerSetting(){ RecyclerView.LayoutManager layout=new LinearLayoutManager(this); recyclerView.setLayoutManager(layout); recyclerView.setItemAnimator(new DefaultItemAnimator()); LoadDataTourism(); } void LoadDataTourism(){ Log.e("api","masukk"); ApiConnection api = ApiHelper.retroBuilder(ApiHelper.ALAMAT(ApiHelper.IP)).create(ApiConnection.class); Call<Status> call = api.fetchData(); call.enqueue(new Callback<Status>() { @Override public void onResponse(Call<Status> call, Response<Status> response) { if(response.isSuccessful()){ isi=new ArrayList<>(); isi=response.body().getData(); adapter=new RecyclerAdapter(getApplicationContext(),isi,mainFrame.this::Click); recyclerView.setAdapter(adapter); adapter.notifyDataSetChanged(); } } @Override public void onFailure(Call<Status> call, Throwable t) { Log.e("er",t.toString()); } }); } @Override public boolean onOptionsItemSelected(MenuItem item) { if(drawerToggle.onOptionsItemSelected(item)){ return true; } return super.onOptionsItemSelected(item); } @Override public boolean onNavigationItemSelected(@NonNull MenuItem item) { int id = item.getItemId(); if(id==R.id.menu1){ Log.e("menu1","KLIK GANNN"); }else if (id==R.id.logout){ session.clear(); Intent in = new Intent(this,MainActivity.class); startActivity(in); finish(); }else if (id==R.id.trans){ if(tr.inTrans()){ }else { Snackbar.make(recyclerView,"Tidak ada Transaksi",Snackbar.LENGTH_LONG).show(); } }else if (id==R.id.topT){ } drawerLayout.closeDrawer(GravityCompat.START); return true; } @Override public void Click(int position) { Datum d = isi.get(position); Intent in = new Intent(this,Detail.class); in.putExtra("detail",d); startActivity(in); } }
[ "6lullaby9@gmail.com" ]
6lullaby9@gmail.com
5e708997181d48217a4508a8c6d9e025b9b9219c
acc3b27e282619f517fa6f584546c938384095ba
/Mixit2014/src/main/java/com/ehret/mixit/fragment/CalendarFragmentJ1.java
217312f248d3d53aa36b1b2dc3e16d17b7bb2507
[ "Apache-2.0" ]
permissive
javamind/Mixit2014
5cf0ecb791762b8351c5850b417781b5a570c882
b4ac6b592e91565909491e599cbfc64ecd8f1f90
refs/heads/master
2016-09-06T06:16:14.620075
2014-04-11T06:33:15
2014-04-11T06:33:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,476
java
/* * Copyright 2014 Guillaume EHRET * * 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.ehret.mixit.fragment; import android.app.Fragment; import android.os.Bundle; import android.util.TypedValue; import android.view.*; import android.widget.Button; import android.widget.GridLayout; import android.widget.LinearLayout; import android.widget.TextView; import com.ehret.mixit.R; import com.ehret.mixit.ui.AbstractPlanningActivity; import com.ehret.mixit.utils.ButtonGridBuilder; import com.ehret.mixit.utils.TextViewGridBuilder; import com.ehret.mixit.utils.UIUtils; import java.math.BigDecimal; import java.util.Date; /** * Planning de la première journée */ public class CalendarFragmentJ1 extends AbstractCalendarFragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { setConteneur((LinearLayout) inflater.inflate(R.layout.fragment_calendar2, container, false)); return getConteneur(); } protected void dessinerCalendrier() { addViewHeure(); addViewQuartHeure(); addViewEventCommun(0,6," ", null,R.drawable.button_empty_background); addViewEventCommun(6, 6, getResources().getString(R.string.calendrier_accueil), UIUtils.createPlageHoraire(29, 8, 30),R.drawable.button_pause_background); addViewEventCommun(12,3,getResources().getString(R.string.calendrier_orga), UIUtils.createPlageHoraire(29, 9, 0),R.drawable.button_pause_background); addViewEventCommun(15, 5, getResources().getString(R.string.calendrier_keynote), UIUtils.createPlageHoraire(29, 9, 15),R.drawable.button_ligtalk_background); addViewEventCommun(20, 4, getResources().getString(R.string.calendrier_pause), UIUtils.createPlageHoraire(29, 9, 40), R.drawable.button_pause_background); addViewTalk(24, 10, getResources().getString(R.string.calendrier_conf_small), false, R.drawable.button_talk_background, UIUtils.createPlageHoraire(29, 10, 0)); addViewTalk(34, 4, getResources().getString(R.string.calendrier_pause), false, R.drawable.button_pause_background, UIUtils.createPlageHoraire(29, 10, 50)); addViewTalk(38, 10, getResources().getString(R.string.calendrier_conf_small), false, R.drawable.button_talk_background, UIUtils.createPlageHoraire(29, 11, 10)); addViewWorkshop(24, 24, getResources().getString(R.string.calendrier_atelier), false, UIUtils.createPlageHoraire(29, 10, 0)); addViewTalk(48, 12,getResources().getString(R.string.calendrier_repas), false, R.drawable.button_pause_background, UIUtils.createPlageHoraire(29, 12, 0)); addViewWorkshop(48, 6, getResources().getString(R.string.calendrier_repas), false, R.drawable.button_pause_background, UIUtils.createPlageHoraire(29, 12, 0)); addViewWorkshop(54, 24, getResources().getString(R.string.calendrier_atelier), false, UIUtils.createPlageHoraire(29, 12, 30)); addViewTalk(60, 6, getString(R.string.calendrier_ligthning_small), false, R.drawable.button_ligtalk_background, UIUtils.createPlageHoraire(29, 13, 0)); addViewTalk(66, 2, getString(R.string.calendrier_presses), false, R.drawable.button_pause_background, UIUtils.createPlageHoraire(29, 13, 30)); addViewTalk(68, 10, getResources().getString(R.string.calendrier_conf_small), false, R.drawable.button_talk_background, UIUtils.createPlageHoraire(29, 13, 40)); addViewEventCommun(78, 4, getResources().getString(R.string.calendrier_pause), UIUtils.createPlageHoraire(29, 14, 30),R.drawable.button_pause_background); addViewWorkshop(82 , 24, getResources().getString(R.string.calendrier_atelier), false, UIUtils.createPlageHoraire(29, 14, 50)); addViewTalk(82, 10, getResources().getString(R.string.calendrier_conf_small), false, R.drawable.button_talk_background, UIUtils.createPlageHoraire(29, 14, 50)); addViewTalk(92, 4, getString(R.string.calendrier_pause), false, R.drawable.button_pause_background, UIUtils.createPlageHoraire(29, 15, 40)); addViewTalk(96, 10, getResources().getString(R.string.calendrier_conf_small), false, R.drawable.button_talk_background, UIUtils.createPlageHoraire(29, 16, 0)); addViewEventCommun(106, 4, getResources().getString(R.string.calendrier_pause), UIUtils.createPlageHoraire(29, 16, 50),R.drawable.button_pause_background); addViewEventCommun(110, 5, getResources().getString(R.string.calendrier_keynote), UIUtils.createPlageHoraire(29, 17, 10),R.drawable.button_ligtalk_background); addViewEventCommun(115, 5, getResources().getString(R.string.calendrier_keynote), UIUtils.createPlageHoraire(29, 17, 35),R.drawable.button_ligtalk_background); addViewEventCommun(120,12," ", null,R.drawable.button_empty_background); addViewEventCommun(132, 12, getResources().getString(R.string.calendrier_partie), UIUtils.createPlageHoraire(29, 19, 0),R.drawable.button_ligtalk_background); } }
[ "guillaume.ehret@gmail.com" ]
guillaume.ehret@gmail.com
7ed20ebbd31ac41e19b5fe9ad5be18e793f578cb
bf2966abae57885c29e70852243a22abc8ba8eb0
/aws-java-sdk-managedblockchain/src/main/java/com/amazonaws/services/managedblockchain/model/MemberStatus.java
af8c90e2da1fb2723611567a2de63c69d5559e50
[ "Apache-2.0" ]
permissive
kmbotts/aws-sdk-java
ae20b3244131d52b9687eb026b9c620da8b49935
388f6427e00fb1c2f211abda5bad3a75d29eef62
refs/heads/master
2021-12-23T14:39:26.369661
2021-07-26T20:09:07
2021-07-26T20:09:07
246,296,939
0
0
Apache-2.0
2020-03-10T12:37:34
2020-03-10T12:37:33
null
UTF-8
Java
false
false
1,957
java
/* * Copyright 2016-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.managedblockchain.model; import javax.annotation.Generated; /** * */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public enum MemberStatus { CREATING("CREATING"), AVAILABLE("AVAILABLE"), CREATE_FAILED("CREATE_FAILED"), UPDATING("UPDATING"), DELETING("DELETING"), DELETED("DELETED"), INACCESSIBLE_ENCRYPTION_KEY("INACCESSIBLE_ENCRYPTION_KEY"); private String value; private MemberStatus(String value) { this.value = value; } @Override public String toString() { return this.value; } /** * Use this in place of valueOf. * * @param value * real value * @return MemberStatus corresponding to the value * * @throws IllegalArgumentException * If the specified value does not map to one of the known values in this enum. */ public static MemberStatus fromValue(String value) { if (value == null || "".equals(value)) { throw new IllegalArgumentException("Value cannot be null or empty!"); } for (MemberStatus enumEntry : MemberStatus.values()) { if (enumEntry.toString().equals(value)) { return enumEntry; } } throw new IllegalArgumentException("Cannot create enum from " + value + " value!"); } }
[ "" ]
c6d332e578b820c029a676b9cf0f8bb74674ec93
ad2a9f7d8b9e47b5896f512bbd794465f0775bcf
/_08_Metotlar/src/com/zeynel_recursion_ozyinelemeli_metodlar/Asinifi.java
ed958585bfd81f835fc1039373b83ee79816d018
[]
no_license
ZeynelAkin/Java-SE-Calismalarim
dc5cee32af145a2555195fba63c44abb51cc1f56
3e17ac7f475d89b1b7c2d55cd8b7d45ed3404243
refs/heads/main
2022-12-30T06:00:16.909405
2020-10-16T18:19:56
2020-10-16T18:19:56
304,706,578
1
0
null
null
null
null
UTF-8
Java
false
false
259
java
package com.zeynel_recursion_ozyinelemeli_metodlar; public class Asinifi { int faktoriyelAl(int n) { int sonuc; if ((n == 1)||(n==0)) { return 1; } sonuc=faktoriyelAl(n-1)*n; return sonuc; } }
[ "kepsod123@gmail.com" ]
kepsod123@gmail.com
0bafd73abcffee14cffadc82a937d704faddd6e5
c633c88cb23b526ef837b7ed1beda400058f8020
/Taco_Chess/view/Dialog.java
1ff50f6508cafd6d355e5fb60a2b5f41436fe181
[]
no_license
sakuv3/Taco_Chess
cdd77c16eb89157058528b5ef29f38d29473a4ad
1897f580e999d1b97f12a744bedbc74d40303500
refs/heads/master
2023-01-10T07:14:48.105763
2020-11-12T12:22:05
2020-11-12T12:22:05
283,471,520
0
0
null
null
null
null
UTF-8
Java
false
false
8,236
java
package Taco_Chess.view; import Taco_Chess.Figures.*; import Taco_Chess.Main; import Taco_Chess.controller.BoardController; import Taco_Chess.model.Board; import javafx.application.Platform; import javafx.event.ActionEvent; import javafx.geometry.Insets; import javafx.scene.Scene; import javafx.scene.control.Label; import javafx.scene.layout.*; import javafx.scene.paint.Color; import javafx.scene.shape.Rectangle; import javafx.geometry.Pos; import javafx.scene.control.Button; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.text.Font; import javafx.scene.text.FontPosture; import javafx.scene.text.FontWeight; import javafx.stage.Modality; import javafx.stage.Stage; import javafx.stage.StageStyle; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; public class Dialog { private Main main; static final String URL = "src/Taco_Chess/images/"; static String BEFORE1, BEFORE2; static final String type[] = {"queen.png", "horse.png", "rook.png", "bishop.png"}; static private BoardController controller; static Board board; static View view; public Dialog( Board board, View view, BoardController controller ) { main = new Main(); this.controller = controller; this.board = board; this.view = view; } public void GAMEOVER( boolean isBlack, boolean isCheckmate ) throws FileNotFoundException { Stage window = new Stage(); GridPane grid = new GridPane(); StackPane stack = new StackPane(); FileInputStream fis = new FileInputStream("src/Taco_Chess/images/background/gameover.jpg"); Image img = new Image(fis); ImageView bg = new ImageView(img); bg.setFitWidth(300); bg.setFitHeight(200); Button close = new Button("Quit"); Button newGame = new Button("New Game"); close.setAlignment( Pos.BOTTOM_LEFT); close.setPrefHeight(25); close.setPrefWidth(100); close.setOnMouseEntered( e -> { BEFORE2 = close.getStyle(); close.setStyle("-fx-background-color: linear-gradient(darkred,lightskyblue );"); }); close.setOnMouseExited( e -> { close.setStyle(BEFORE2); }); close.setOnMouseClicked( e -> Platform.exit() ); close.setStyle("-fx-background-color: linear-gradient(indianred, darksalmon)"); newGame.setPrefWidth(100); newGame.setPrefHeight(25); newGame.setStyle("-fx-background-color: linear-gradient( cadetblue, lightgreen)"); newGame.setAlignment( Pos.BOTTOM_RIGHT); newGame.setOnMouseEntered( e -> { BEFORE1 = newGame.getStyle(); newGame.setStyle("-fx-background-color: linear-gradient(lightskyblue, greenyellow);"); }); newGame.setOnMouseExited( e -> { newGame.setStyle(BEFORE1); }); newGame.setOnAction( (ActionEvent e) -> { try { window.close(); main.restart(); } catch (Exception ioException) { ioException.printStackTrace(); } }); grid.add( close, 0, 0); grid.add( newGame, 1, 0); grid.setAlignment( Pos.BOTTOM_CENTER ); grid.setPadding( new Insets(130,0,0,0)); VBox v = new VBox(); String x; if( !isCheckmate ) x = "S T A L E M A T E"; else if( isBlack ) x = "B L A C K is the Winner"; else x = "W H I T E is the Winner"; Label text = new Label(x); text.setAlignment(Pos.CENTER); text.setPadding( new Insets(10,0,0,40)); text.setFont( Font.font("verdana", FontWeight.EXTRA_BOLD, FontPosture.REGULAR, 20)); text.setTextFill(Color.WHITESMOKE); text.setDisable(true); v.getChildren().addAll(text, grid); stack.getChildren().addAll( bg, v ); Scene scene = new Scene (stack, 300, 200 ); window.initModality( Modality.APPLICATION_MODAL ); window.initStyle(StageStyle.TRANSPARENT); window.setTitle("CHECKMATE"); window.centerOnScreen(); window.setScene(scene); window.show(); } public static void spawn_new_figure(Abstract_Figure activePlayer, Button btn, boolean isBlack) throws FileNotFoundException { String PATH; board.getChessBoard().setDisable( true ); String figs[] = new String[4]; Button btns[] = new Button[4]; GridPane grid = new GridPane(); ColumnConstraints column = new ColumnConstraints(100); RowConstraints row = new RowConstraints(100); // gibt den auswählbaren figuren ne abgerundete Form Rectangle rect = new Rectangle(100, 100); rect.setArcHeight(10); rect.setArcWidth(10); grid.getColumnConstraints().add(column); grid.getColumnConstraints().add(column); grid.getRowConstraints().add(row); grid.getRowConstraints().add(row); grid.setAlignment(Pos.CENTER); grid.setMaxHeight(200); grid.setMaxWidth(200); if( isBlack ) PATH = URL +"black/"; else PATH = URL +"white/"; for(int i =0; i<4 ; i++) { final int j =i; final String URL = PATH +type[i]; btns[i] = new Button(); btns[i].setMaxHeight(100); btns[i].setMaxWidth(100); btns[i].setStyle(" -fx-background-color: linear-gradient(lightgreen, cadetblue); "); btns[i].setGraphic( new ImageView(new Image(new FileInputStream( URL ))) ); btns[i].setShape(rect); btns[i].setOnMouseEntered( e -> { btns[j].setStyle( "-fx-border-color: gold; " + "-fx-background-color: linear-gradient(cadetblue, lightgreen);" ); }); btns[i].setOnMouseExited( e -> { btns[j].setStyle( "-fx-border-color: #A39300;" + "-fx-background-color: linear-gradient(lightgreen, cadetblue);" ); }); btns[i].setOnMouseClicked( e -> { // SPAWN NEW CHOSEN FIGURE FileInputStream FIS = null; try { FIS = new FileInputStream( URL ); Image IMAGE = new Image(FIS); ImageView IMG = new ImageView( IMAGE ); Abstract_Figure newFig =null; if( j ==0 ) newFig = new Queen(); else if( j==1 ) newFig = new Horse(); else if( j==2 ) newFig = new Rook(); else if( j==3 ) newFig = new Bishop(); newFig.setImageView( IMG ); newFig.setBtn( btn ); view.update( newFig, btn, false ); int x = board.get_xCoord_btn( btn ); int y = board.get_yCoord_btn( btn ); board.set_figure( newFig, x, y, isBlack); view.update_score( null ); controller.collect_next_moves( newFig.isBlack(), false, true );// falls der neue Zug den Gegner in Schach setzt if( controller.isCheck() ) // ja hat er { controller.setIsCheck(true); System.out.println("CHECK"); } // remove the chosable 4 figures view.getStackPane().getChildren().remove( grid ); board.getChessBoard().setDisable( false ); } catch (FileNotFoundException fileNotFoundException) { System.out.println("mayday"); } }); } grid.add(btns[0], 0, 0); grid.add(btns[1], 1, 0); grid.add(btns[2], 0, 1); grid.add(btns[3], 1, 1); // Shows the 4 figures to choose from view.getStackPane().getChildren().addAll( grid ); } }
[ "jm-191091@hs-weingarten.de" ]
jm-191091@hs-weingarten.de
d3961bdffa496e51e50d23d77306aa7451a07e56
72c0c7843ed33e615d3be48706cb08cff858675d
/src/com/geokewpie/drawer/models/ActionNavigationItemModel.java
b69b59764cc965a5c3de055d02615e25575a8e4e
[]
no_license
bgdsrn/GeoKewpie-Android
74964b05d6542a1a17be562783e4b15b25d61c9d
44d294b4f09a27f2ad6ac4d3f7d1436d85462614
refs/heads/master
2016-09-05T17:56:40.831099
2015-04-16T13:11:15
2015-04-16T13:11:15
29,132,449
0
1
null
2015-04-30T13:36:05
2015-01-12T11:29:58
Java
UTF-8
Java
false
false
1,081
java
package com.geokewpie.drawer.models; import android.view.*; import android.widget.ImageView; import android.widget.TextView; import com.geokewpie.R; public class ActionNavigationItemModel implements INavigationItemModel { private String title; private int image; private Class activity; public ActionNavigationItemModel(String title, int image, Class activity) { this.title = title; this.image = image; this.activity = activity; } @Override public View constructView(LayoutInflater inflater, ViewGroup parent) { View rowView = inflater.inflate(R.layout.drawer_action_item, parent, false); TextView titleView = (TextView) rowView.findViewById(R.id.drawer_action_title); ImageView imageView = (ImageView) rowView.findViewById(R.id.drawer_action_img); titleView.setText(title); imageView.setImageResource(image); return rowView; } @Override public boolean isEnabled() { return true; } public Class getActivity() { return activity; } }
[ "vfydtk_27" ]
vfydtk_27
6a8cd144f83fff21805d145b1c3a3c1f49da8516
cc40e207ad0bf12f27614efdc6b6917bdbd2745c
/src/rogueshadow/combat2/AbstractEntity.java
76d2a0d45dc8d5521fa17d7276f123ed73908c83
[]
no_license
RogueShadow/AsteroidCombat
dbe2fc4abbd96216d4277532d05e23e559433f8f
a1ac5a0f42de6ca2d166de85376655eab2194ff7
refs/heads/master
2021-01-13T01:41:35.650392
2011-05-29T04:03:41
2011-05-29T04:03:41
1,774,723
0
0
null
null
null
null
UTF-8
Java
false
false
2,547
java
/** * */ package rogueshadow.combat2; import org.newdawn.slick.geom.Vector2f; /** * @author Adam * */ public abstract class AbstractEntity implements Entity { protected final int WIDTH = Combat2.WORLD_WIDTH; protected final int HEIGHT = Combat2.WORLD_HEIGHT; protected Vector2f position = new Vector2f(0,0); protected Vector2f velocity = new Vector2f(0,0); protected float size = 0; protected boolean destroyed = false; protected Camera cam = new Camera(); public boolean isDestroyed() { return destroyed; } public boolean isVisible(){ boolean visible = true; if (getX() + getSize() < cam.getX())visible = false; if (getY() + getSize() < cam.getY())visible = false; if (getX() > cam.getX() + Combat2.WIDTH)visible = false; if (getY() > cam.getY() + Combat2.HEIGHT)visible = false; return visible; } public void setDestroyed(boolean destroyed) { this.destroyed = destroyed; } public CollisionInfo collides(Entity other){ float distance = getPosition().distanceSquared(other.getPosition()); float range = getSize()/2f + other.getSize()/2f; range *= range; if (distance < range){ return new CollisionInfo(this, other, true, distance); }else{ return new CollisionInfo(this, other, false, distance); } } public void update(int delta){ position.add(velocity.copy().scale((delta/1000f))); if (position.getX() < -size/2)position.x = WIDTH + size/2; if (position.getX() > WIDTH + size/2)position.x = -size/2; if (position.getY() < -size/2)position.y = HEIGHT +size/2; if (position.getY() > HEIGHT + size/2)position.y = -size/2; } public float getX(){ return position.getX(); } public float getY(){ return position.getY(); } public float getCenterX(){ return position.getX()+getSize()/2f; } public float getCenterY(){ return position.getY()+getSize()/2f; } public float getSize(){ return size; } public Vector2f getPosition() { return position; } public void setPosition(Vector2f position) { this.position = position; } public Vector2f getVelocity() { return velocity; } public void setVelocity(Vector2f velocity) { this.velocity = velocity; } public AbstractEntity(Vector2f position, Vector2f velocity) { super(); this.position = position; this.velocity = velocity; this.size = 0; } public void setSize(float size){ this.size = size; } public void setCam(Camera cam) { this.cam = cam; } }
[ "adamstcn@gmail.com" ]
adamstcn@gmail.com
04f89a2434ce04768d4eb1a888c98127a02326b6
d5f09c7b0e954cd20dd613af600afd91b039c48a
/sources/com/coolapk/market/service/action/CheckForUpgradeAction$checkForAll$upgradeInfoList$2.java
776325172dc59c3d63066e728f059435c943d48b
[]
no_license
t0HiiBwn/CoolapkRelease
af5e00c701bf82c4e90b1033f5c5f9dc8526f4b3
a6a2b03e32cde0e5163016e0078391271a8d33ab
refs/heads/main
2022-07-29T23:28:35.867734
2021-03-26T11:41:18
2021-03-26T11:41:18
345,290,891
5
2
null
null
null
null
UTF-8
Java
false
false
1,849
java
package com.coolapk.market.service.action; import com.coolapk.market.model.PatchInfo; import com.coolapk.market.model.UpgradeInfo; import kotlin.Metadata; import kotlin.jvm.internal.Intrinsics; import rx.functions.Func1; @Metadata(bv = {1, 0, 3}, d1 = {"\u0000\u0010\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\u0010\u0000\u001a\n \u0002*\u0004\u0018\u00010\u00010\u00012\u000e\u0010\u0003\u001a\n \u0002*\u0004\u0018\u00010\u00040\u0004H\n¢\u0006\u0002\b\u0005"}, d2 = {"<anonymous>", "Lcom/coolapk/market/model/UpgradeInfo;", "kotlin.jvm.PlatformType", "patchInfo", "Lcom/coolapk/market/model/PatchInfo;", "call"}, k = 3, mv = {1, 4, 2}) /* compiled from: CheckForUpgradeAction.kt */ final class CheckForUpgradeAction$checkForAll$upgradeInfoList$2<T, R> implements Func1<PatchInfo, UpgradeInfo> { public static final CheckForUpgradeAction$checkForAll$upgradeInfoList$2 INSTANCE = new CheckForUpgradeAction$checkForAll$upgradeInfoList$2(); CheckForUpgradeAction$checkForAll$upgradeInfoList$2() { } public final UpgradeInfo call(PatchInfo patchInfo) { UpgradeInfo.Builder newBuilder = UpgradeInfo.newBuilder(); Intrinsics.checkNotNullExpressionValue(patchInfo, "patchInfo"); return newBuilder.packageName(patchInfo.getPackageName()).apkId(patchInfo.getApkId()).displayVersionName(patchInfo.getDisplayVersionName()).versionName(patchInfo.getVersionName()).versionCode(patchInfo.getVersionCode()).apkSize(patchInfo.getApkSize()).lastUpdate(patchInfo.getLastUpdate()).changeLog(patchInfo.getChangeLog()).logo(patchInfo.getLogo()).patchKey(patchInfo.getPatchKey()).patchSize(patchInfo.getPatchSize()).patchLength(patchInfo.getPatchLength()).patchMd5(patchInfo.getPatchMd5()).extraAnalysisData(patchInfo.getExtraAnalysisData()).extraFlag(patchInfo.getExtraFlag()).build(); } }
[ "test@gmail.com" ]
test@gmail.com
54d3cec23ddcc5a307ace860add0513a6cb0473a
e08314b8c22df72cf3aa9e089624fc511ff0d808
/src/selfdefine/com/ces/component/tzjyxxxx/action/TzjyxxxxController.java
e8c90a0c72eeeff232d55467e820a2e814cb0f27
[]
no_license
quxiongwei/qhzyc
46acd4f6ba41ab3b39968071aa114b24212cd375
4b44839639c033ea77685b98e65813bfb269b89d
refs/heads/master
2020-12-02T06:38:21.581621
2017-07-12T02:06:10
2017-07-12T02:06:10
96,864,946
0
3
null
null
null
null
UTF-8
Java
false
false
883
java
package com.ces.component.tzjyxxxx.action; import com.ces.component.trace.dao.TraceShowModuleDao; import com.ces.component.tzjyxxxx.service.TzjyxxxxService; import com.ces.component.trace.action.base.TraceShowModuleDefineServiceDaoController; import com.ces.xarch.core.entity.StringIDEntity; public class TzjyxxxxController extends TraceShowModuleDefineServiceDaoController<StringIDEntity, TzjyxxxxService, TraceShowModuleDao> { private static final long serialVersionUID = 1L; /* * (非 Javadoc) * <p>标题: initModel</p> * <p>描述: </p> * @see com.ces.xarch.core.web.struts2.BaseController#initModel() */ @Override protected void initModel() { setModel(new StringIDEntity()); } public void getXgdate(){ String id=getParameter("id"); setReturnData(getService().getXgdate(id)); } }
[ "qu.xiongwei@cesgroup.com.cn" ]
qu.xiongwei@cesgroup.com.cn
ace4e9be9ec7b1dc47a48887f029b975bee253f6
ce8f07266d052048b9043119848012233da08ffc
/app/src/main/java/fan/mytwospinner/adapter/DataModel.java
c94a4bc558a090ed91c3e73366bd590590a5bff7
[ "Apache-2.0" ]
permissive
aa215166671/Ywg
95a316a27f488d93cc350e27d69d5c7749ca0225
5d7661ce6d228f4b05be77cce8c4aafb6ec86f34
refs/heads/master
2022-04-17T04:29:50.200575
2020-04-10T04:34:15
2020-04-10T04:34:15
254,537,341
0
0
null
null
null
null
UTF-8
Java
false
false
3,594
java
package fan.mytwospinner.adapter; /** * created anumbrella * * 2015 7 27 数据常量类 * */ public class DataModel { // 第一个listView的图片资源数组(12张图片) // public static int[] LISTVIEWIMG = new int[] { }; // 第一个listView的文本数据数组(12个数据文本) public static String[] LISTVIEWTXT = new String[] { "热门分类", "美食", "购物", "休闲娱乐", "运动健身", "丽人", "结婚", "酒店", "爱车", "亲子", "生活服务", "家装" }; // 第二个listView文本数据数组(12,..) public static String[][] MORELISTVIEWTXT = new String[][] { { "全部分类", "小吃快餐", "咖啡厅", "电影院", "KTV", "茶馆", "足疗按摩", "超市/便利店", "银行", "经济型酒店", "景点/郊游", "公园", "美发" }, { "全部美食", "小吃快餐", "西餐", "火锅", "北京菜", "川菜", "日本", "面包甜点", "粤菜", "韩国料理", "自助餐", "浙江菜", "云南菜", "湘菜", "东南亚菜", "西北菜", "鲁菜", "东北菜", "素菜", "新疆菜", "海鲜", "清真菜", "贵州菜", "湖北菜", "其他" }, { "全部购物", "综合商场", "服饰鞋包", "超市/便利店", "特色集市", "品牌折扣店", "眼镜店", "珠宝饰品", "化妆品", "运动户外", "食品茶酒", "书店", "数码产品", "药店", "京味儿购物", "亲子购物", "花店", "家具建材", "更多购物场所" }, { "全部休闲娱乐", "咖啡厅", "KTV", "景点/郊游", "电影院", "酒吧", "公园", "温泉", "文化艺术", "足疗按摩", "洗浴", "茶馆", "游乐游艺", "密室", "采摘/农家乐", "桌面游戏", "台球馆", "DIY手工坊", "休闲网吧", "真人CS", "棋牌室", "轰趴馆", "私人影院", "更多休闲娱乐" }, { "全部运动健身", "健身中心", "游泳馆", "瑜伽", "羽毛球馆", "台球馆", "舞蹈", "体育场馆", "高尔夫场", "网球场", "武术场馆", "篮球场", "保龄球馆", "足球场", "乒乓球馆", "更多体育运动" }, { "全部丽人", "美发", "美容/SPA", "齿科", "美甲", "化妆品", "瑜伽", "瘦身纤体", "舞蹈", "个性写真", "整形" }, { "全部结婚", "婚纱摄影", "婚宴酒店", "婚纱礼服", "婚庆公司", "婚戒首饰", "个性写真", "彩妆造型", "婚礼小礼品", "婚礼跟拍", "婚车租赁", "司仪主持", "婚房装修", "更多婚礼服务" }, { "全部酒店", "经济型酒店", "五星级酒店", "度假村", "四星级酒店", "三星级酒店", "农家院", "公寓式酒店", "青年旅社", "精品酒店", "更多酒店住宿" }, { "全部爱车", "维修保养", "驾校", "停车场", "4S店/汽车销售", "加油站", "配件/车饰", "汽车租赁", "汽车保险" }, { "全部亲子", "亲子摄影", "幼儿教育", "亲子游乐", "孕产护理", "亲子购物", "更多亲子服务" }, { "全部生活服务", "医院", "银行", "齿科", "宠物", "培训", "快照/冲印", "学校", "旅行社", "购物网站", "干洗店", "家政", "奢侈品护理", "商务楼", "小区", "更多生活服务" }, { "全部家装", "家具家装", "家用电器", "建材", "家装卖场", "装修设计" } }; }
[ "215166671@qq.com" ]
215166671@qq.com
12c6fdcb79e9dd0f96dc7d211e2ef6ba92cead41
8fc2045e4a9b3991de8f6eb7b643f290df3fe607
/src/vlab/server_java/calculate/CalculateProcessorImpl.java
bff460a39eec71ba89c28568c192f98875fc6012
[]
no_license
thejerome/LabDiffractus
b4f37c9151b9bdc488b6d16b1b8db057adafe448
15c401fe899471486e1a544c591f7d987c527e87
refs/heads/master
2021-01-12T11:36:52.263390
2016-11-16T13:04:19
2016-11-16T13:04:19
72,227,996
0
0
null
null
null
null
UTF-8
Java
false
false
1,722
java
package vlab.server_java.calculate; import com.fasterxml.jackson.databind.ObjectMapper; import rlcp.calculate.CalculatingResult; import rlcp.generate.GeneratingResult; import rlcp.server.processor.calculate.CalculateProcessor; import vlab.server_java.model.*; import vlab.server_java.model.tool.ToolModel; import static vlab.server_java.model.util.Util.escapeParam; import static vlab.server_java.model.util.Util.prepareInputJsonString; /** * Simple CalculateProcessor implementation. Supposed to be changed as needed to provide necessary Calculate method support. */ public class CalculateProcessorImpl implements CalculateProcessor { @Override public CalculatingResult calculate(String condition, String instructions, GeneratingResult generatingResult) { //do calculate logic here String text = "text"; String code = "code"; instructions = prepareInputJsonString(instructions); generatingResult = new GeneratingResult( generatingResult.getText(), prepareInputJsonString(generatingResult.getCode()), prepareInputJsonString(generatingResult.getInstructions()) ); ObjectMapper objectMapper = new ObjectMapper(); try { ToolState toolState = objectMapper.readValue(instructions, ToolState.class); Variant varCode = objectMapper.readValue(generatingResult.getCode(), Variant.class); return new CalculatingResult("ok", escapeParam(escapeParam(objectMapper.writeValueAsString(ToolModel.buildPlot(toolState))))); } catch (Exception e) { e.printStackTrace(); return new CalculatingResult("error", e.getMessage()); } } }
[ "thejerome@mail.ru" ]
thejerome@mail.ru
1def9fbcf1d6c1c99e33d1d675720cfda3b51083
9a6ea6087367965359d644665b8d244982d1b8b6
/src/main/java/X/C50512Uz.java
ebd609279e635a928c68552a4a50df106847f301
[]
no_license
technocode/com.wa_2.21.2
a3dd842758ff54f207f1640531374d3da132b1d2
3c4b6f3c7bdef7c1523c06d5bd9a90b83acc80f9
refs/heads/master
2023-02-12T11:20:28.666116
2021-01-14T10:22:21
2021-01-14T10:22:21
329,578,591
2
1
null
null
null
null
UTF-8
Java
false
false
4,222
java
package X; import com.facebook.simplejni.NativeHolder; import com.whatsapp.wamsys.JniBridge; /* renamed from: X.2Uz reason: invalid class name and case insensitive filesystem */ public class C50512Uz { public final C001000o A00; public final C50492Ux A01; public final AnonymousClass1XJ A02; public C50512Uz(AnonymousClass1XJ r1, C001000o r2, C50492Ux r3) { this.A02 = r1; this.A00 = r2; this.A01 = r3; } public AnonymousClass1UF A00(AnonymousClass0E6 r62, AnonymousClass02P r63, C44281zn r64, boolean z) { int i; AnonymousClass1UE r9; C50492Ux r1 = this.A01; AnonymousClass1XJ r11 = this.A02; if (r1 != null) { AnonymousClass02P r2 = r11.A08; if (r2 != null) { i = r2.A01; } else { AnonymousClass02P r22 = r11.A07; i = r22 != null ? r22.A01 : 0; } if (i == 1) { if (z) { r64.A07 = 1L; r9 = new C57812ku(r1.A0G, r11); } else { throw new IllegalStateException("receipt sending has been disabled for a v1 encrypted message"); } } else if (i == 2) { r64.A07 = 2L; r9 = new C57822kv(r1.A01, r1.A00, r1.A03, r1.A0B, r1.A0U, r1.A0F, r1.A0E, r1.A0K, r1.A06, r1.A05, r1.A07, r1.A09, r1.A04, r1.A0C, r1.A0R, r1.A0Q, r1.A0A, r1.A0G, r1.A02, r1.A0D, r1.A0M, r1.A0I, r1.A0J, r1.A0P, r1.A0L, r1.A08, r1.A0T, r1.A0H, r1.A0N, r1.A0O, r1.A0S, r62, r11, r64, z); } else { r9 = new C57802kt(i, z, r1.A05, r11, r64, r1.A0J); } if (r63 == null) { return null; } int i2 = r63.A00; if (i2 == 0) { r64.A02 = 0; return this.A00.A04(r62, r63.A02, r9); } else if (i2 == 1) { r64.A02 = 1; return this.A00.A05(r62, r63.A02, r9); } else if (i2 == 2) { r64.A02 = 2; String A0D = AnonymousClass1VY.A0D(AnonymousClass1VY.A09(r11.A0Y)); AnonymousClass02N A09 = AnonymousClass1VY.A09(r11.A06); String A0D2 = AnonymousClass1VY.A0D(A09); if (AnonymousClass1VY.A0T(A09)) { A0D = A0D2; } AnonymousClass0OE r6 = new AnonymousClass0OE(A0D, r62); C001000o r3 = this.A00; byte[] bArr = r63.A02; r3.A0H.A00(); if (r3.A0I.A0E(188)) { JniBridge jniBridge = r3.A01.A03; String str = r6.A01; AnonymousClass0E6 r0 = r6.A00; C21030xz r02 = new C21030xz((NativeHolder) JniBridge.jvidispatchOIOOOOO(0, (long) r0.A00, str, r0.A01, r9, jniBridge.getWajContext(), bArr)); byte[] A002 = r02.A00(); JniBridge.getInstance(); return new AnonymousClass1UF(A002, (int) JniBridge.jvidispatchIIO(1, (long) 38, r02.A00)); } try { return AnonymousClass05B.A00(new AnonymousClass1Yr(r3.A00.A00.A02, C002001d.A2L(r6)).A01(bArr, new C43431yM(r9)), 0, null); } catch (C29401Yi e) { return AnonymousClass05B.A00(null, -1007, e); } catch (C29381Yg e2) { return AnonymousClass05B.A00(null, -1005, e2); } catch (C29341Yb e3) { return AnonymousClass05B.A00(null, -1001, e3); } catch (C29411Yj e4) { return AnonymousClass05B.A00(null, -1008, e4); } } else { StringBuilder A0S = AnonymousClass008.A0S("decryptmessagerunnable/axolotl unrecognized ciphertext type; message.key="); A0S.append(r11.A04()); A0S.append(" type="); AnonymousClass008.A1M(A0S, i2); r64.A00 = Boolean.FALSE; r64.A04 = 8; return null; } } else { throw null; } } }
[ "madeinborneo@gmail.com" ]
madeinborneo@gmail.com
8243b5962fc6bfc272d7aca4875ec6e0a605cf2a
04a89f6a77485e4ff70d6602a8c5b2e4d878aab7
/src/com/github/technus/avrClone/memory/SramMemory.java
452df60878f0d8abf220c7a31560348e857631bf
[]
no_license
Technus/AVRcore
cdb8e0be14a2bfde07e09707d350a6b6b59d64d6
27bf45ba7b08a0e3751b3e119e73441430bda49f
refs/heads/master
2021-12-30T05:54:37.591723
2020-04-07T22:24:34
2020-04-07T22:24:34
133,194,606
0
1
null
2021-12-17T12:22:10
2018-05-13T00:53:02
Java
UTF-8
Java
false
false
426
java
package com.github.technus.avrClone.memory; public class SramMemory implements IDataMemoryDefinition { private final int size; public SramMemory(int ramSize){ size=ramSize; } @Override public int[] getDataDefault() { return new int[size]; } @Override public int getOffset() { return 8192; } @Override public int getSize() { return size; } }
[ "daniel112092@gmail.com" ]
daniel112092@gmail.com
15a7cf233f9f820e7ebecb40ed0c7704c1352170
d60e287543a95a20350c2caeabafbec517cabe75
/NLPCCd/Hadoop/150_2.java
75b66eaf9268962a32dd1438760c1960adc7e478
[ "MIT" ]
permissive
sgholamian/log-aware-clone-detection
242067df2db6fd056f8d917cfbc143615c558b2c
9993cb081c420413c231d1807bfff342c39aa69a
refs/heads/main
2023-07-20T09:32:19.757643
2021-08-27T15:02:50
2021-08-27T15:02:50
337,837,827
0
0
null
null
null
null
UTF-8
Java
false
false
296
java
//,temp,sample_3207.java,2,11,temp,sample_7167.java,2,9 //,3 public class xxx { protected void removeRMDTMasterKeyState(DelegationKey masterKey) throws IOException { String dbKey = getRMDTMasterKeyNodeKey(masterKey); if (LOG.isDebugEnabled()) { log.info("removing token master key at"); } } };
[ "sgholami@uwaterloo.ca" ]
sgholami@uwaterloo.ca
372cccf28e404a8d486b4bc3f19828e3cfad2492
990dda93f869f40745f8761629a73b83fee1f2d7
/app/src/main/java/com/example/prototype/HuntAR/ARActivity.java
544088761ff22931452ace16d4d9676019876478
[]
no_license
gursesq/huntar
c6de49f040f987dc963759411640dba2a0e72bd8
8aea85302e8fdaf674abcee22a38596c99631d79
refs/heads/master
2020-05-21T17:23:54.436396
2019-05-11T11:00:38
2019-05-11T11:00:38
186,122,596
2
0
null
null
null
null
UTF-8
Java
false
false
5,674
java
package com.example.prototype.HuntAR; /* * Copyright 2018 Google LLC. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import android.app.Activity; import android.app.ActivityManager; import android.content.Context; import android.os.Build; import android.os.Build.VERSION_CODES; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.view.Gravity; import android.view.MotionEvent; import android.widget.Toast; import com.example.prototype.R; import com.example.prototype.helpers.CameraPermissionHelper; import com.google.ar.core.Anchor; import com.google.ar.core.HitResult; import com.google.ar.core.Plane; import com.google.ar.sceneform.AnchorNode; import com.google.ar.sceneform.rendering.ModelRenderable; import com.google.ar.sceneform.ux.ArFragment; import com.google.ar.sceneform.ux.TransformableNode; /** * This is an example activity that uses the Sceneform UX package to make common AR tasks easier. */ public class ARActivity extends AppCompatActivity { private static final String TAG = ARActivity.class.getSimpleName(); private static final double MIN_OPENGL_VERSION = 3.0; private ArFragment arFragment; private ModelRenderable andyRenderable; @Override @SuppressWarnings({"AndroidApiChecker", "FutureReturnValueIgnored"}) // CompletableFuture requires api level 24 // FutureReturnValueIgnored is not valid protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d(TAG, "onCreate: STARTED"); if (!checkIsSupportedDeviceOrFinish(this)) { return; } Log.d(TAG, "onCreate: CHECK DONE"); setContentView(R.layout.activity_ux); arFragment = (ArFragment) getSupportFragmentManager().findFragmentById(R.id.ux_fragment); // When you build a Renderable, Sceneform loads its resources in the background while returning // a CompletableFuture. Call thenAccept(), handle(), or check isDone() before calling get(). ModelRenderable.builder() .setSource(this, R.raw.andy) .build() .thenAccept(renderable -> andyRenderable = renderable) .exceptionally( throwable -> { Toast toast = Toast.makeText(this, "Unable to load andy renderable", Toast.LENGTH_LONG); toast.setGravity(Gravity.CENTER, 0, 0); toast.show(); return null; }); Log.d(TAG, "onCreate: RENDERABLE BUILT"); arFragment.setOnTapArPlaneListener( (HitResult hitResult, Plane plane, MotionEvent motionEvent) -> { if (andyRenderable == null) { return; } // Create the Anchor. Anchor anchor = hitResult.createAnchor(); AnchorNode anchorNode = new AnchorNode(anchor); anchorNode.setParent(arFragment.getArSceneView().getScene()); // Create the transformable andy and add it to the anchor. TransformableNode andy = new TransformableNode(arFragment.getTransformationSystem()); andy.setParent(anchorNode); andy.setRenderable(andyRenderable); andy.select(); }); Log.d(TAG, "onCreate: CLASSEND"); } @Override protected void onResume() { super.onResume(); // ARCore requires camera permission to operate. if (!CameraPermissionHelper.hasCameraPermission(this)) { CameraPermissionHelper.requestCameraPermission(this); return; } } /** * Returns false and displays an error message if Sceneform can not run, true if Sceneform can run * on this device. * * <p>Sceneform requires Android N on the device as well as OpenGL 3.0 capabilities. * * <p>Finishes the activity if Sceneform can not run */ public static boolean checkIsSupportedDeviceOrFinish(final Activity activity) { if (Build.VERSION.SDK_INT < VERSION_CODES.N) { Log.e(TAG, "Sceneform requires Android N or later"); Toast.makeText(activity, "Sceneform requires Android N or later", Toast.LENGTH_LONG).show(); activity.finish(); return false; } String openGlVersionString = ((ActivityManager) activity.getSystemService(Context.ACTIVITY_SERVICE)) .getDeviceConfigurationInfo() .getGlEsVersion(); if (Double.parseDouble(openGlVersionString) < MIN_OPENGL_VERSION) { Log.e(TAG, "Sceneform requires OpenGL ES 3.0 later"); Toast.makeText(activity, "Sceneform requires OpenGL ES 3.0 or later", Toast.LENGTH_LONG) .show(); activity.finish(); return false; } return true; } }
[ "gursesyigit99@gmail.com" ]
gursesyigit99@gmail.com
7a3450c19c6018f01833c92b836d7f32d52b4956
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/9/9_65b56a8e24e560437e90b2645fa5cf2dbc5547dd/ShortestPath/9_65b56a8e24e560437e90b2645fa5cf2dbc5547dd_ShortestPath_s.java
7dfa78725a54763b4181585168290d734f072845
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
3,063
java
package com.jadekler.app; import java.util.PriorityQueue; public class ShortestPath { int[][] adjancecyList; int[][] edges; int[] vertexDistances; int[] previous; boolean[] visited; public static void main(String args[]) { int[][] adjancecyList = {{1,2,5},{0,2,3},{0,1,3,5},{1,2,4},{3,5},{0,4}}; int[][] edges = {{7,9,14},{7,10,15},{9,10,11,2},{15,11,6},{6,9},{14,9}}; ShortestPath sp = new ShortestPath(); sp.djikstrasAlgorithm(adjancecyList, edges, 0, 4); } public void init(int[][] adjancecyList, int[][] edges) { if (this.checkConsistency(adjancecyList, edges)) { this.visited = new boolean[adjancecyList.length]; this.previous = new int[adjancecyList.length]; this.vertexDistances = new int[adjancecyList.length]; for (int i = 0; i < adjancecyList.length; i++) { this.visited[i] = false; this.vertexDistances[i] = Integer.MAX_VALUE; } this.adjancecyList = adjancecyList; this.edges = edges; } else { System.out.println("Vertices and edges don't match"); System.exit(0); } } public boolean checkConsistency(int[][] arr1, int[][] arr2) { if (arr1.length != arr2.length) { return false; } for (int i = 0; i < arr1.length; i++) { if (arr1[i].length != arr2[i].length) { return false; } } return true; } public void djikstrasAlgorithm(int[][] vertices, int[][] edges, int start, int end) { this.init(vertices, edges); this.djikstrasAlgorithm(start, end); } public void djikstrasAlgorithm(int start, int target) { this.visited[start] = true; this.vertexDistances[start] = 0; PriorityQueue<Integer> queue = new PriorityQueue<Integer>(); queue.offer(start); while (!queue.isEmpty()) { int curItem = queue.poll(); this.visited[curItem] = true; // Go through adjacent items for (int i = 0; i < this.adjancecyList[curItem].length; i++) { int adjancentItem = this.adjancecyList[curItem][i]; int distance = this.vertexDistances[curItem] + this.edges[curItem][adjancentItem]; if (distance < this.vertexDistances[adjancentItem]) { this.vertexDistances[adjancentItem] = distance; this.previous[adjancentItem] = curItem; if (!this.visited[adjancentItem]) { this.visited[adjancentItem] = true; queue.offer(adjancentItem); } } } } int curItem = target; do { System.out.println(curItem); curItem = this.previous[curItem]; } while (curItem != start); } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
8fe4565eddc2238c5d87c656bef9033789606d60
ee1994308702aa38e062e75b8fbea3b5036b9e08
/src/test/java/testScripts/BaseTest.java
78398b95e58f58ee1901c9ea86da524fd7c20a36
[]
no_license
SaiKumarKotha/openWeatherApiAutomation
0975084d0666fde3f3ed045b5d97a4455fc23db8
56945978bf9bffefec848da0152f513506c559f5
refs/heads/master
2020-09-15T08:47:32.777114
2016-09-05T13:01:05
2016-09-05T13:01:05
67,421,488
0
0
null
null
null
null
UTF-8
Java
false
false
2,454
java
package testScripts; import PojoUtil.CityPojoUtil; import utils.CityBean; import utils.EnvironmentVariables; import utils.ExcelReader; import utils.MyReporter; import utils.MySoftAssertion; import org.testng.annotations.BeforeMethod; import org.testng.annotations.DataProvider; import java.io.File; import org.junit.BeforeClass; import org.testng.annotations.AfterMethod; /** * This class is base test for test cases. it contains all common objects for test scripts * @author Sai Kotha * */ public class BaseTest { protected CityPojoUtil cityUtil; protected MyReporter reporter; protected MySoftAssertion softAssertion; /********************************* TestNG Annotations START***********************************************************/ @BeforeMethod public void beforeMethod() { cityUtil = new CityPojoUtil(); reporter = new MyReporter(); softAssertion = new MySoftAssertion(reporter); EnvironmentVariables.currentTestLogMessages = ""; } @AfterMethod public void afterMethod() { reporter.LogToReporter(null); MyReporter.stepCount = 1; } @BeforeClass public void beforeClass(){ } /********************************* TestNG Annotations END***********************************************************/ /********************************* Data Providers Start***********************************************************/ @DataProvider(name = "cityDataProvider", parallel = true) public static Object[][] cityDataProvider() { return new Object[][] { { 2643743, "London" }, { 5391959, "San Francisco" }, { 1269843, "Hyderabad" }, { 4887398, "Chicago" } }; } @DataProvider(name = "cityBeanDataProvider", parallel = true) public static CityBean[][] cityBeanDataProvider() { return new CityBean[][] { { new CityBean(2643743, "London") }, { new CityBean(5391959, "San Francisco") }, { new CityBean(1269843, "Hyderabad") }, { new CityBean(4887398, "Chicago") } }; } @DataProvider(name = "cityExcelDataProvider", parallel = true) public static String[][] cityExcelDataProvider() { File currDir = new File("."); String path = currDir.getAbsolutePath(); path = path.substring(0, path.length() - 1); String fileName = path + "src\\test\\java\\utils\\CityDetailsOne.xls"; String sheetName = "CityDetails"; return new ExcelReader(fileName, sheetName).getData(); } /********************************* Data Providers End***********************************************************/ }
[ "saikumar.kotha@gmail.com" ]
saikumar.kotha@gmail.com
6810f25e5ca367ca18a4dc0a82cebd11b22cd130
9a65e74b653454f0d3f6b592e881669b2ef519d4
/starter/cloudstorage/src/main/java/com/udacity/jwdnd/course1/cloudstorage/models/NoteRequestDto.java
e1a671b76299b014e62227eda5ed38fa4181245a
[]
no_license
refka-farid/nd035-c1-spring-boot-basics-project-starter
b4f5a84bbbe2d40eb56f8a0daa12da93cdb57d88
a5e8b31bbd38b4dd5edbb80cbac71ae0ab84ea16
refs/heads/master
2023-06-03T11:10:27.404010
2021-06-16T00:58:26
2021-06-18T16:44:32
365,479,848
0
1
null
2021-06-01T17:08:51
2021-05-08T10:01:38
Java
UTF-8
Java
false
false
1,892
java
package com.udacity.jwdnd.course1.cloudstorage.models; import com.udacity.jwdnd.course1.cloudstorage.entities.Note; import java.util.Objects; public class NoteRequestDto { private Integer noteId; private String noteTitle; private String noteDescription; public NoteRequestDto() { } public NoteRequestDto(Integer noteId, String noteTitle, String noteDescription) { this.noteId = noteId; this.noteTitle = noteTitle.trim(); this.noteDescription = noteDescription.trim(); } public String getNoteTitle() { return noteTitle; } public void setNoteTitle(String noteTitle) { this.noteTitle = noteTitle; } public String getNoteDescription() { return noteDescription; } public void setNoteDescription(String noteDescription) { this.noteDescription = noteDescription; } public Integer getNoteId() { return noteId; } public void setNoteId(Integer noteId) { this.noteId = noteId; } public Note toNote(Integer userId) { return new Note(noteId, noteTitle, noteDescription, userId); } public Note toNote() { return new Note(noteId, noteTitle.trim(), noteDescription.trim(), null); } public static NoteRequestDto fromNote(Note note) { return new NoteRequestDto(note.getNoteId(), note.getNoteTitle().trim(), note.getNoteDescription().trim()); } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; NoteRequestDto that = (NoteRequestDto) o; return noteId.equals(that.noteId) && noteTitle.equals(that.noteTitle) && noteDescription.equals(that.noteDescription); } @Override public int hashCode() { return Objects.hash(noteId, noteTitle, noteDescription); } }
[ "refka.farid@gmail.com" ]
refka.farid@gmail.com
b74fcfc266481cb1a67283cc04fe498902d2a4b3
01f3c8804721557fc89cc4781814824a0d9c7245
/AndroidInstragramClone/app/src/main/java/com/example/shakil/androidinstragramclone/CommentsActivity.java
986a48c5b649cf359edd7572850e967b9017500e
[]
no_license
shakil1994/AndroidApp-TestInstragram
d2b2e7426847efe603adcfca8e4999700615e256
0fc2ca350474ae6fe5ad13d0f85c05e000f93991
refs/heads/master
2020-09-07T04:22:36.150713
2019-11-22T17:31:57
2019-11-22T17:31:57
220,653,899
0
0
null
null
null
null
UTF-8
Java
false
false
5,829
java
package com.example.shakil.androidinstragramclone; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.Toolbar; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import android.content.Intent; import android.os.Bundle; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; import com.bumptech.glide.Glide; import com.example.shakil.androidinstragramclone.Adapter.CommentsAdapter; import com.example.shakil.androidinstragramclone.Common.Common; import com.example.shakil.androidinstragramclone.Model.CommentsModel; import com.example.shakil.androidinstragramclone.Model.Notification; import com.example.shakil.androidinstragramclone.Model.UserModel; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseUser; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.ValueEventListener; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import butterknife.BindView; import butterknife.ButterKnife; import de.hdodenhof.circleimageview.CircleImageView; public class CommentsActivity extends AppCompatActivity { @BindView(R.id.toolbar) Toolbar toolbar; @BindView(R.id.img_profile) CircleImageView img_profile; @BindView(R.id.recycler_comments_list) RecyclerView recycler_comments_list; @BindView(R.id.edt_add_comment) EditText edt_add_comment; @BindView(R.id.txt_post) TextView txt_post; String postId, publisherId; FirebaseUser firebaseUser; CommentsAdapter adapter; List<CommentsModel> commentsModelList; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_comments); ButterKnife.bind(this); recycler_comments_list.setHasFixedSize(true); LinearLayoutManager layoutManager = new LinearLayoutManager(this); recycler_comments_list.setLayoutManager(layoutManager); commentsModelList = new ArrayList<>(); adapter = new CommentsAdapter(this, commentsModelList); recycler_comments_list.setAdapter(adapter); setSupportActionBar(toolbar); getSupportActionBar().setTitle("Comments"); getSupportActionBar().setDisplayHomeAsUpEnabled(true); toolbar.setNavigationOnClickListener(view -> { finish(); }); firebaseUser = FirebaseAuth.getInstance().getCurrentUser(); Intent intent = getIntent(); postId = intent.getStringExtra("POSTID"); publisherId = intent.getStringExtra("PUBLISHERID"); txt_post.setOnClickListener(view -> { if (edt_add_comment.getText().equals("")) { Toast.makeText(this, "You can't send empty comment", Toast.LENGTH_SHORT).show(); } else { addComment(); } }); getImage(); readComments(); } private void addComment() { DatabaseReference reference = FirebaseDatabase.getInstance().getReference("Comments").child(postId); CommentsModel commentsModel = new CommentsModel(); commentsModel.setComment(edt_add_comment.getText().toString()); commentsModel.setPublisher(firebaseUser.getUid()); reference.push().setValue(commentsModel).addOnCompleteListener(task -> { if (task.isSuccessful()) { addNotifications(); Toast.makeText(this, "Your comment send !", Toast.LENGTH_SHORT).show(); edt_add_comment.setText(""); } }); } private void getImage(){ DatabaseReference reference = FirebaseDatabase.getInstance().getReference(Common.USER_REFERENCE).child(firebaseUser.getUid()); reference.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { UserModel userModel = dataSnapshot.getValue(UserModel.class); Glide.with(getApplicationContext()).load(userModel.getImageLink()).into(img_profile); } @Override public void onCancelled(@NonNull DatabaseError databaseError) { } }); } private void readComments(){ DatabaseReference reference = FirebaseDatabase.getInstance().getReference("Comments").child(postId); reference.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { commentsModelList.clear(); for (DataSnapshot commentSnapshot : dataSnapshot.getChildren()){ CommentsModel commentsModel = commentSnapshot.getValue(CommentsModel.class); commentsModelList.add(commentsModel); } adapter.notifyDataSetChanged(); } @Override public void onCancelled(@NonNull DatabaseError databaseError) { } }); } private void addNotifications(){ DatabaseReference reference = FirebaseDatabase.getInstance().getReference("Notifications").child(publisherId); Notification notification = new Notification(); notification.setUserId(firebaseUser.getUid()); notification.setText("commented: " + edt_add_comment.getText().toString()); notification.setPostId(postId); notification.setPost(true); reference.push().setValue(notification); } }
[ "shakhawathossen53@gmail.com" ]
shakhawathossen53@gmail.com
e49b4552a64d01383ce32b75507a4209299f70cc
435f7665601540dd96a1c36d11bf7a852a6ba965
/android/src/com/itc/e1/AndroidLauncher.java
1168cf82e980d5b52626a0c0214834cdc6101155
[]
no_license
apexJCL/Graficacion
b15d69061c913a40cb4ceb740700f003c013ad7e
bfee101fc572dff38a89758c2d11ead7017ffc6f
refs/heads/master
2021-01-22T19:04:24.044522
2016-05-16T14:22:43
2016-05-16T14:22:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
501
java
package com.itc.e1; import android.os.Bundle; import com.badlogic.gdx.backends.android.AndroidApplication; import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration; import com.itc.e1.MainClass; public class AndroidLauncher extends AndroidApplication { @Override protected void onCreate (Bundle savedInstanceState) { super.onCreate(savedInstanceState); AndroidApplicationConfiguration config = new AndroidApplicationConfiguration(); initialize(new MainClass(), config); } }
[ "12030800@itcelaya.edu.mx" ]
12030800@itcelaya.edu.mx
822f710aeb747aa13262220530107bf014f922b0
6daf5277c88d4a9df9bec694c23f72e424838bae
/src/main/java/com/raphydaphy/rocksolid/world/WorldGenMagnesium.java
882d187a182e19d700a9d389508aa1a70808c530
[ "MIT" ]
permissive
raphydaphy/RockSolid
ce2bdb04e454c422031c0934ca8104c989fb28c7
d30a6944bf8b59ba8c9ecc3021e0afa23b20759a
refs/heads/master
2021-06-17T16:01:44.934032
2017-10-14T02:25:53
2017-10-14T02:25:53
96,505,218
57
5
null
2017-07-25T04:01:25
2017-07-07T06:12:24
Java
UTF-8
Java
false
false
740
java
package com.raphydaphy.rocksolid.world; import com.raphydaphy.rocksolid.api.content.RockSolidContent; import de.ellpeck.rockbottom.api.tile.state.TileState; import de.ellpeck.rockbottom.api.world.gen.WorldGenOre; public class WorldGenMagnesium extends WorldGenOre { @Override public int getPriority() { return 210; } @Override public int getHighestGridPos() { return -8; } @Override public int getLowestGridPos() { return -20; } @Override public int getMaxAmount() { return 2; } @Override public int getClusterRadiusX() { return 3; } @Override public int getClusterRadiusY() { return 2; } @Override public TileState getOreState() { return RockSolidContent.oreMagnesium.getDefState(); } }
[ "raph.hennessy@gmail.com" ]
raph.hennessy@gmail.com
3f6f595554dbd8d0dc97613e9dffb53c63d42437
cc1241b768c255088c557f8aebbf874db777e275
/open-metadata-implementation/common-services/generic-handlers/src/main/java/org/odpi/openmetadata/commonservices/generichandlers/ExternalIdentifierHandler.java
f31067b42d0adc3928072d6373ac02b90f40e2c4
[ "CC-BY-4.0", "Apache-2.0" ]
permissive
dariusatruvia/egeria
c9e246083213db6cff3660b0f83c8b5fdfecd741
c2d0df869dc2e9fdf9f6d6ac786bb1b132f687ae
refs/heads/master
2023-09-04T13:59:31.293773
2021-11-23T09:58:58
2021-11-23T09:58:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
98,619
java
/* SPDX-License-Identifier: Apache 2.0 */ /* Copyright Contributors to the ODPi Egeria project. */ package org.odpi.openmetadata.commonservices.generichandlers; import org.odpi.openmetadata.commonservices.ffdc.InvalidParameterHandler; import org.odpi.openmetadata.commonservices.generichandlers.ffdc.GenericHandlersAuditCode; import org.odpi.openmetadata.commonservices.generichandlers.ffdc.GenericHandlersErrorCode; import org.odpi.openmetadata.commonservices.repositoryhandler.RepositoryHandler; import org.odpi.openmetadata.commonservices.repositoryhandler.RepositoryIteratorForEntities; import org.odpi.openmetadata.commonservices.repositoryhandler.RepositoryRelatedEntitiesIterator; import org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException; import org.odpi.openmetadata.frameworks.connectors.ffdc.PropertyServerException; import org.odpi.openmetadata.frameworks.connectors.ffdc.UserNotAuthorizedException; import org.odpi.openmetadata.metadatasecurity.server.OpenMetadataServerSecurityVerifier; import org.odpi.openmetadata.frameworks.auditlog.AuditLog; import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.EntityDetail; import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.InstanceProperties; import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.Relationship; import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.repositoryconnector.OMRSRepositoryHelper; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Map; /** * ExternalIdentifierHandler manages ExternalIdentifier objects. These entities represent the identifiers used for metadata * in third party technology. It runs server-side in the OMAG Server Platform and manages ExternalId entities through the OMRSRepositoryConnector * via the repository handler. * * The ExternalIdentifier is linked to the SoftwareServerCapability that represents the third party technology * that generated the external identifier. This is referred to as the scope. It is also linked to the element * (or elements) in open metadata that are equivalent to the metadata element(s) in the third party technology. * The correlation may be many-to-many. * * @param <EXTERNAL_ID> bean that returns an external identifier * @param <OPEN_METADATA_ELEMENT_HEADER> bean that returns the elements tied to this external identifier */ public class ExternalIdentifierHandler<EXTERNAL_ID, OPEN_METADATA_ELEMENT_HEADER> extends ReferenceableHandler<EXTERNAL_ID> { private OpenMetadataAPIGenericConverter<OPEN_METADATA_ELEMENT_HEADER> elementConverter; private Class<OPEN_METADATA_ELEMENT_HEADER> elementBeanClass; /** * Construct the handler information needed to interact with the repository services * * @param converter specific converter for the EXTERNAL_ID bean class * @param beanClass name of bean class that is represented by the generic class EXTERNAL_ID * @param elementConverter specific converter for the OPEN_METADATA_ELEMENT_HEADER bean class * @param elementBeanClass name of bean class that is represented by the generic class OPEN_METADATA_ELEMENT_HEADER * @param serviceName name of this service * @param serverName name of the local server * @param invalidParameterHandler handler for managing parameter errors * @param repositoryHandler manages calls to the repository services * @param repositoryHelper provides utilities for manipulating the repository services objects * @param localServerUserId userId for this server * @param securityVerifier open metadata security services verifier * @param supportedZones list of zones that the access service is allowed to serve Asset instances from. * @param defaultZones list of zones that the access service should set in all new Asset instances. * @param publishZones list of zones that the access service sets up in published Asset instances. * @param auditLog destination for audit log events. */ public ExternalIdentifierHandler(OpenMetadataAPIGenericConverter<EXTERNAL_ID> converter, Class<EXTERNAL_ID> beanClass, OpenMetadataAPIGenericConverter<OPEN_METADATA_ELEMENT_HEADER> elementConverter, Class<OPEN_METADATA_ELEMENT_HEADER> elementBeanClass, String serviceName, String serverName, InvalidParameterHandler invalidParameterHandler, RepositoryHandler repositoryHandler, OMRSRepositoryHelper repositoryHelper, String localServerUserId, OpenMetadataServerSecurityVerifier securityVerifier, List<String> supportedZones, List<String> defaultZones, List<String> publishZones, AuditLog auditLog) { super(converter, beanClass, serviceName, serverName, invalidParameterHandler, repositoryHandler, repositoryHelper, localServerUserId, securityVerifier, supportedZones, defaultZones, publishZones, auditLog); this.elementConverter = elementConverter; this.elementBeanClass = elementBeanClass; } /** * Set up the ExternalIdentifier for the supplied element. This external identifier may already exist for the requested * scope if multiple open metadata entities are needed to represent the metadata element(s) in the third party metadata source * that is identified by this ExternalIdentifier. * * @param userId calling userId * @param elementGUID unique identifier of the open metadata element to link to the external identifier * @param elementGUIDParameterName parameter supplying elementGUID * @param elementTypeName type of the element * @param identifier identifier from the third party technology (scope) * @param identifierParameterName name of parameter supplying identifier * @param identifierKeyPattern type of key pattern used in the third party technology (typically local key) * @param identifierDescription name of the identifier in the third party technology * @param identifierUsage usage information from the connector/client supplying the identifier * @param identifierSource name of the connector/client supplying the identifier * @param identifierMappingProperties additional properties to help with the synchronization * @param scopeGUID unique identifier of the software server capability that represents the third metadata source * @param scopeGUIDParameterName parameter supplying scopeGUID * @param scopeQualifiedName qualified name from the entity that * @param scopeTypeName specific type name of the software server capability that represents the third party metadata source * @param permittedSynchronization direction of synchronization * @param synchronizationDescription optional description of the synchronization in progress (augments the description in the * permitted synchronization enum) * @param effectiveTime the time that the retrieved elements must be effective for (null for any time, new Date() for now) * @param methodName calling method * * @throws InvalidParameterException one of the parameters is invalid * @throws UserNotAuthorizedException the user is not authorized to issue this request * @throws PropertyServerException there is a problem reported in the open metadata server(s) */ public void setUpExternalIdentifier(String userId, String elementGUID, String elementGUIDParameterName, String elementTypeName, String identifier, String identifierParameterName, int identifierKeyPattern, String identifierDescription, String identifierUsage, String identifierSource, Map<String, String> identifierMappingProperties, String scopeGUID, String scopeGUIDParameterName, String scopeQualifiedName, String scopeTypeName, int permittedSynchronization, String synchronizationDescription, Date effectiveTime, String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException { final String externalIdGUIDParameterName = "externalIdGUID"; EntityDetail externalIdEntity = this.getExternalIdEntity(userId, identifier, identifierParameterName, scopeGUID, scopeGUIDParameterName, scopeQualifiedName, scopeTypeName, effectiveTime, methodName); String externalIdGUID; if (externalIdEntity == null) { /* * There is no external identifier and so it needs to be created and connected to the * scope and the element. */ externalIdGUID = createExternalIdentifier(userId, identifier, identifierKeyPattern, scopeGUID, scopeGUIDParameterName, scopeTypeName, permittedSynchronization, synchronizationDescription, methodName); auditLog.logMessage(methodName, GenericHandlersAuditCode.SETTING_UP_EXTERNAL_ID.getMessageDefinition(serviceName, elementTypeName, elementGUID, identifier, scopeQualifiedName, scopeGUID, methodName)); } else { externalIdGUID = externalIdEntity.getGUID(); updateExternalIdentifier(userId, externalIdGUID, externalIdGUIDParameterName, identifier, identifierKeyPattern, methodName); } /* * Now check if the relationship currently exists between the element and the external id entity. */ Relationship resourceLink = this.getResourceLinkRelationship(userId, elementGUID, elementGUIDParameterName, elementTypeName, externalIdGUID, effectiveTime, methodName); if (resourceLink == null) { /* * At this point the link between the element and the external id entity is missing and needs to be created */ createExternalIdLink(userId, elementGUID, elementGUIDParameterName, elementTypeName, externalIdGUID, externalIdGUIDParameterName, identifierDescription, identifierUsage, identifierSource, identifierMappingProperties, methodName); } else { updateExternalIdLink(userId, resourceLink, identifierDescription, identifierUsage, identifierSource, identifierMappingProperties, methodName); } } /** * Create an audit log record to document that an external metadata source has created a relationship. * * @param scopeGUID unique identifier of the element representing the scope * @param scopeQualifiedName unique name of the element representing the scope * @param relationshipType type of relationship * @param end1GUID unique identifier for the entity at end 1 of the relationship * @param end1TypeName type of the entity at end 1 of the relationship * @param end2GUID unique identifier for the entity at end 2 of the relationship * @param end2TypeName type of the entity at end 2 of the relationship * @param methodName calling method */ public void logRelationshipCreation(String scopeGUID, String scopeQualifiedName, String relationshipType, String end1GUID, String end1TypeName, String end2GUID, String end2TypeName, String methodName) { if (scopeGUID != null) { auditLog.logMessage(methodName, GenericHandlersAuditCode.NEW_EXTERNAL_RELATIONSHIP.getMessageDefinition(serviceName, relationshipType, end1TypeName, end1GUID, end2TypeName, end2GUID, methodName, scopeGUID, scopeQualifiedName)); } } /** * Create an audit log record to document that an external metadata source has created a relationship. * * @param scopeGUID unique identifier of the element representing the scope * @param scopeQualifiedName unique name of the element representing the scope * @param relationshipType type of relationship * @param end1GUID unique identifier for the entity at end 1 of the relationship * @param end1TypeName type of the entity at end 1 of the relationship * @param end2GUID unique identifier for the entity at end 2 of the relationship * @param end2TypeName type of the entity at end 2 of the relationship * @param methodName calling method */ public void logRelationshipRemoval(String scopeGUID, String scopeQualifiedName, String relationshipType, String end1GUID, String end1TypeName, String end2GUID, String end2TypeName, String methodName) { if (scopeGUID != null) { auditLog.logMessage(methodName, GenericHandlersAuditCode.EXTERNAL_RELATIONSHIP_REMOVED.getMessageDefinition(serviceName, relationshipType, end1TypeName, end1GUID, end2TypeName, end2GUID, methodName, scopeGUID, scopeQualifiedName)); } } /** * Remove the ExternalIdentifier for the supplied element. The open metadata element is not affected. * * @param userId calling userId * @param elementGUID unique identifier of the open metadata element to link to the external identifier * @param elementGUIDParameterName parameter supplying elementGUID * @param elementTypeName type of the element * @param identifier identifier from the third party technology (scope) * @param identifierParameterName name of parameter supplying identifier * @param identifierKeyPattern type of key pattern used in the third party technology (typically local key) * @param identifierDescription name of the identifier in the third party technology * @param identifierUsage usage information from the connector/client supplying the identifier * @param identifierSource name of the connector/client supplying the identifier * @param identifierMappingProperties additional properties to help with the synchronization * @param scopeGUID unique identifier of the software server capability that represents the third metadata source * @param scopeGUIDParameterName parameter supplying scopeGUID * @param scopeQualifiedName qualified name from the entity that * @param scopeTypeName specific type name of the software server capability that represents the third party metadata source * @param permittedSynchronization direction of synchronization * @param synchronizationDescription optional description of the synchronization in progress (augments the description in the * permitted synchronization enum) * @param methodName calling method * @throws InvalidParameterException one of the parameters is invalid * @throws UserNotAuthorizedException the user is not authorized to issue this request * @throws PropertyServerException there is a problem reported in the open metadata server(s) */ public void removeExternalIdentifier(String userId, String elementGUID, String elementGUIDParameterName, String elementTypeName, String identifier, String identifierParameterName, int identifierKeyPattern, String identifierDescription, String identifierUsage, String identifierSource, Map<String, String> identifierMappingProperties, String scopeGUID, String scopeGUIDParameterName, String scopeQualifiedName, String scopeTypeName, int permittedSynchronization, String synchronizationDescription, String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException { // todo } /** * Confirm that the values of a particular metadata element have been synchronized. This is important * from an audit points of view, and to allow bidirectional updates of metadata using optimistic locking. * * @param userId calling user * @param elementGUID unique identifier (GUID) of this element in open metadata * @param elementGUIDParameterName parameter supplying elementGUID * @param elementTypeName type of element being mapped * @param identifier unique identifier of this element in the external asset manager * @param identifierParameterName parameter supplying identifier * @param scopeGUID unique identifier of software server capability representing the caller * @param scopeGUIDParameterName parameter name supplying scopeGUID * @param scopeQualifiedName unique name of the scope * @param scopeTypeName specific type name of the software server capability that represents the third party metadata source * @param effectiveTime the time that the retrieved elements must be effective for (null for any time, new Date() for now) * @param methodName calling method * * @return the identifier's entity * * @throws InvalidParameterException one of the parameters is invalid * @throws UserNotAuthorizedException user not authorized to issue this request * @throws PropertyServerException problem accessing the property server */ public EntityDetail confirmSynchronization(String userId, String elementGUID, String elementGUIDParameterName, String elementTypeName, String identifier, String identifierParameterName, String scopeGUID, String scopeGUIDParameterName, String scopeQualifiedName, String scopeTypeName, Date effectiveTime, String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException { invalidParameterHandler.validateGUID(elementGUID, elementGUIDParameterName, methodName); invalidParameterHandler.validateGUID(scopeGUID, scopeGUIDParameterName, methodName); invalidParameterHandler.validateName(identifier, identifierParameterName, methodName); EntityDetail externalIdEntity = this.getExternalIdEntity(userId, identifier, identifierParameterName, scopeGUID, scopeGUIDParameterName, scopeQualifiedName, scopeTypeName, effectiveTime, methodName); if (externalIdEntity == null) { throw new InvalidParameterException(GenericHandlersErrorCode.UNKNOWN_EXTERNAL_IDENTITY.getMessageDefinition(serviceName, identifier, scopeQualifiedName, scopeGUID, elementTypeName, elementGUID), this.getClass().getName(), methodName, identifierParameterName); } /* * Now check if the relationship currently exists between the element and the external id entity. */ Relationship resourceLink = this.getResourceLinkRelationship(userId, elementGUID, elementGUIDParameterName, elementTypeName, externalIdEntity.getGUID(), effectiveTime, methodName); if (resourceLink == null) { throw new InvalidParameterException(GenericHandlersErrorCode.UNKNOWN_RESOURCE_LINK.getMessageDefinition(serviceName, identifier, scopeQualifiedName, scopeGUID, elementTypeName, elementGUID), this.getClass().getName(), methodName, identifierParameterName); } else { InstanceProperties newProperties; if (resourceLink.getProperties() == null) { newProperties = repositoryHelper.addDatePropertyToInstance(serviceName, null, OpenMetadataAPIMapper.LAST_SYNCHRONIZED_PROPERTY_NAME, new Date(), methodName); } else { newProperties = repositoryHelper.addDatePropertyToInstance(serviceName, new InstanceProperties(resourceLink.getProperties()), OpenMetadataAPIMapper.LAST_SYNCHRONIZED_PROPERTY_NAME, new Date(), methodName); } repositoryHandler.updateRelationshipProperties(userId, null, null, resourceLink, newProperties, methodName); } return externalIdEntity; } /** * Retrieve the ExternalIdentifier for the supplied element. This external identifier needs to cone form the correct scope. * * @param userId calling userId * @param identifier identifier from the third party technology (scope) * @param identifierParameterName name of parameter supplying the identifier * @param scopeGUID unique identifier of the software server capability that represents the third metadata source * @param scopeGUIDParameterName parameter supplying scopeGUID * @param scopeQualifiedName unique name of the software server capability that represents the third metadata source * @param scopeTypeName specific type name of the software server capability that represents the third party metadata source * @param effectiveTime the time that the retrieved elements must be effective for * @param methodName calling method * * @return ExternalId entity for the supplied identifier and scope * * @throws InvalidParameterException one of the parameters is invalid * @throws UserNotAuthorizedException user not authorized to issue this request * @throws PropertyServerException problem accessing the property server */ private EntityDetail getExternalIdEntity(String userId, String identifier, String identifierParameterName, String scopeGUID, String scopeGUIDParameterName, String scopeQualifiedName, String scopeTypeName, Date effectiveTime, String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException { invalidParameterHandler.validateGUID(scopeGUID, scopeGUIDParameterName, methodName); invalidParameterHandler.validateName(identifier, identifierParameterName, methodName); /* * Since the external identifier is not necessarily unique and is linked many-to-many, begin with * retrieving all of the ExternalId entities with the same identifier. */ List<String> propertyNames = new ArrayList<>(); propertyNames.add(OpenMetadataAPIMapper.IDENTIFIER_PROPERTY_NAME); int queryPageSize = invalidParameterHandler.getMaxPagingSize(); RepositoryIteratorForEntities identifierIterator = getEntitySearchIterator(userId, identifier, OpenMetadataAPIMapper.EXTERNAL_IDENTIFIER_TYPE_GUID, OpenMetadataAPIMapper.EXTERNAL_IDENTIFIER_TYPE_NAME, propertyNames, true, null, false, false, 0, queryPageSize, effectiveTime, methodName); while (identifierIterator.moreToReceive()) { /* * For each of the matching external identifiers validate the scope */ EntityDetail externalIdEntity = identifierIterator.getNext(); if (this.validateExternalIdentifierScope(userId, identifier, externalIdEntity, scopeGUID, scopeQualifiedName, scopeTypeName, effectiveTime, methodName)) { return externalIdEntity; } } return null; } /** * Retrieve the ExternalIdLink relationship between the open metadata element and the external identifier. * * @param userId calling user * @param elementGUID unique identifier of the open metadata element to link to the external identifier * @param elementGUIDParameterName parameter supplying elementGUID * @param elementTypeName type of the element * @param externalIdGUID unique identifier of the ExternalId entity * @param effectiveTime the time that the retrieved elements must be effective for (null for any time, new Date() for now) * @param methodName calling method * * @return ExternalIdLink relationship between the requested elements - or null * * @throws InvalidParameterException one of the parameters is invalid * @throws UserNotAuthorizedException user not authorized to issue this request * @throws PropertyServerException problem accessing the property server */ private Relationship getResourceLinkRelationship(String userId, String elementGUID, String elementGUIDParameterName, String elementTypeName, String externalIdGUID, Date effectiveTime, String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException { invalidParameterHandler.validateGUID(elementGUID, elementGUIDParameterName, methodName); /* * Now check if the relationship currently exists between the element and the external id entity. */ List<Relationship> resourceLinks = this.getAttachmentLinks(userId, elementGUID, elementGUIDParameterName, elementTypeName, OpenMetadataAPIMapper.REFERENCEABLE_TO_EXTERNAL_ID_TYPE_GUID, OpenMetadataAPIMapper.REFERENCEABLE_TO_EXTERNAL_ID_TYPE_NAME, externalIdGUID, OpenMetadataAPIMapper.EXTERNAL_IDENTIFIER_TYPE_NAME, 0, invalidParameterHandler.getMaxPagingSize(), effectiveTime, methodName); if (resourceLinks != null) { for (Relationship relationship : resourceLinks) { if ((relationship != null) && (relationship.getEntityOneProxy() != null)) { if (elementGUID.equals(relationship.getEntityOneProxy().getGUID())) { return relationship; } } } } return null; } /** * Determine if the scope of an external identifier matches the requester's scope. This test is needed * because it is possible that different third party technologies are using the same external identifier * for completely different elements. This is why the external identifiers are always tied to a scope * to show where it is valid. * * @param userId calling userId * @param identifier identifier from the third party technology (scope) * @param externalIdEntity entity for the external identifier * @param scopeGUID unique identifier of the software server capability that represents the third metadata source * @param scopeQualifiedName unique name of the software server capability that represents the third metadata source * @param scopeTypeName specific type name of the software server capability that represents the third party metadata source * @param effectiveTime the time that the retrieved elements must be effective for (null for any time, new Date() for now) * @param methodName calling method * * @throws InvalidParameterException one of the parameters is invalid * @throws UserNotAuthorizedException user not authorized to issue this request * @throws PropertyServerException problem accessing the property server */ private boolean validateExternalIdentifierScope(String userId, String identifier, EntityDetail externalIdEntity, String scopeGUID, String scopeQualifiedName, String scopeTypeName, Date effectiveTime, String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException { final String externalIdGUIDParameterName = "externalIdEntity.getGUID()"; if ((externalIdEntity != null) && (externalIdEntity.getType() != null)) { /* * An entity with the same identifier already exists - retrieve its relationships * to determine if connected to the same scope. An ordinary retrieve, rather than using an iterator, * is used because this number is expected to be small (number of external systems exchanging * metadata in the open metadata ecosystem that happens to use the same external identifier). */ List<Relationship> externalIdScopes = this.getAttachmentLinks(userId, externalIdEntity.getGUID(), externalIdGUIDParameterName, OpenMetadataAPIMapper.EXTERNAL_IDENTIFIER_TYPE_NAME, OpenMetadataAPIMapper.EXTERNAL_ID_SCOPE_TYPE_GUID, OpenMetadataAPIMapper.EXTERNAL_ID_SCOPE_TYPE_NAME, scopeGUID, scopeTypeName, 0, invalidParameterHandler.getMaxPagingSize(), effectiveTime, methodName); if (externalIdScopes != null) { return true; } else { return false; } } else { /* * Throw logic error exception */ throw new PropertyServerException(GenericHandlersErrorCode.NULL_EXTERNAL_ID_ENTITY.getMessageDefinition(identifier, scopeTypeName, scopeQualifiedName, scopeGUID), this.getClass().getName(), methodName); } } /** * Create a new external Identifier and attach it to its valid scope. * * @param userId calling user * @param identifier identifier from the third party technology * @param identifierKeyPattern key pattern that defines the logic used to maintain the identifier * @param scopeGUID unique identifier of the software server capability that represents the third metadata source * @param scopeGUIDParameterName parameter supplying scopeGUID * @param scopeTypeName specific type name of the software server capability that represents the third party metadata source * @param permittedSynchronization direction of synchronization * @param synchronizationDescription optional description of the synchronization in progress (augments the description in the * permitted synchronization enum) * @param methodName calling method * * @return unique identifier of the new external id entity * * @throws InvalidParameterException one of the parameters is invalid * @throws UserNotAuthorizedException user not authorized to issue this request * @throws PropertyServerException problem accessing the property server */ private String createExternalIdentifier(String userId, String identifier, int identifierKeyPattern, String scopeGUID, String scopeGUIDParameterName, String scopeTypeName, int permittedSynchronization, String synchronizationDescription, String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException { final String externalIdGUIDParameterName = "externalIdentifierGUID"; ExternalIdentifierBuilder builder = new ExternalIdentifierBuilder(identifier, identifierKeyPattern, repositoryHelper, serviceName, serverName); builder.setAnchors(userId, scopeGUID, methodName); String externalIdGUID = this.createBeanInRepository(userId, null, null, OpenMetadataAPIMapper.EXTERNAL_IDENTIFIER_TYPE_GUID, OpenMetadataAPIMapper.EXTERNAL_IDENTIFIER_TYPE_NAME, null, null, builder, methodName); if (externalIdGUID != null) { InstanceProperties scopeProperties = builder.getExternalIdScopeProperties(synchronizationDescription, permittedSynchronization, methodName); this.linkElementToElement(userId, null, null, scopeGUID, scopeGUIDParameterName, scopeTypeName, externalIdGUID, externalIdGUIDParameterName, OpenMetadataAPIMapper.EXTERNAL_IDENTIFIER_TYPE_NAME, false, false, supportedZones, OpenMetadataAPIMapper.EXTERNAL_ID_SCOPE_TYPE_GUID, OpenMetadataAPIMapper.EXTERNAL_ID_SCOPE_TYPE_NAME, scopeProperties, methodName); } return externalIdGUID; } /** * Create a new external Identifier and attach it to its valid scope. * * @param userId calling user * @param externalIdGUID unique identifier of the * @param identifier identifier from the third party technology * @param identifierKeyPattern key pattern that defines the logic used to maintain the identifier * @param methodName calling method * * @throws InvalidParameterException one of the parameters is invalid * @throws UserNotAuthorizedException user not authorized to issue this request * @throws PropertyServerException problem accessing the property server */ private void updateExternalIdentifier(String userId, String externalIdGUID, String externalIdGUIDParameterName, String identifier, int identifierKeyPattern, String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException { ExternalIdentifierBuilder builder = new ExternalIdentifierBuilder(identifier, identifierKeyPattern, repositoryHelper, serviceName, serverName); this.updateBeanInRepository(userId, null, null, externalIdGUID, externalIdGUIDParameterName, OpenMetadataAPIMapper.EXTERNAL_IDENTIFIER_TYPE_GUID, OpenMetadataAPIMapper.EXTERNAL_IDENTIFIER_TYPE_NAME, false, false, supportedZones, builder.getInstanceProperties(methodName), true, new Date(), methodName); } /** * Create the relationship between an open metadata element and an external id. * * @param userId calling user * @param elementGUID unique identifier of the open metadata element to link to the external identifier * @param elementGUIDParameterName parameter supplying elementGUID * @param elementTypeName type of the element * @param identifierDescription name of the identifier in the third party technology * @param identifierUsage usage information from the connector/client supplying the identifier * @param identifierSource name of the connector/client supplying the identifier * @param externalIdGUID unique identifier of the external id entity * @param externalIdGUIDParameterName parameter supplying externalIdGUID * @param identifierMappingProperties additional properties used to manage the mapping to the elements in the third party technology * @param methodName calling method * * @throws InvalidParameterException one of the parameters is invalid * @throws UserNotAuthorizedException user not authorized to issue this request * @throws PropertyServerException problem accessing the property server */ private void createExternalIdLink(String userId, String elementGUID, String elementGUIDParameterName, String elementTypeName, String externalIdGUID, String externalIdGUIDParameterName, String identifierDescription, String identifierUsage, String identifierSource, Map<String, String> identifierMappingProperties, String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException { ExternalIdentifierBuilder builder = new ExternalIdentifierBuilder(repositoryHelper, serviceName, serverName); InstanceProperties resourceLinkProperties = builder.getExternalIdResourceLinkProperties(identifierDescription, identifierUsage, identifierSource, identifierMappingProperties, methodName); this.linkElementToElement(userId, null, null, elementGUID, elementGUIDParameterName, elementTypeName, externalIdGUID, externalIdGUIDParameterName, OpenMetadataAPIMapper.EXTERNAL_IDENTIFIER_TYPE_NAME, false, false, supportedZones, OpenMetadataAPIMapper.REFERENCEABLE_TO_EXTERNAL_ID_TYPE_GUID, OpenMetadataAPIMapper.REFERENCEABLE_TO_EXTERNAL_ID_TYPE_NAME, resourceLinkProperties, methodName); } /** * Create the relationship between an open metadata element and an external id. * * @param userId calling user * @param externalIdLink existing relationship * @param identifierDescription name of the identifier in the third party technology * @param identifierUsage usage information from the connector/client supplying the identifier * @param identifierSource name of the connector/client supplying the identifier * @param identifierMappingProperties additional properties used to manage the mapping to the elements in the third party technology * @param methodName calling method * * @throws UserNotAuthorizedException user not authorized to issue this request * @throws PropertyServerException problem accessing the property server */ private void updateExternalIdLink(String userId, Relationship externalIdLink, String identifierDescription, String identifierUsage, String identifierSource, Map<String, String> identifierMappingProperties, String methodName) throws UserNotAuthorizedException, PropertyServerException { ExternalIdentifierBuilder builder = new ExternalIdentifierBuilder(repositoryHelper, serviceName, serverName); if (externalIdLink != null) { /* * Only update the relationship if things have changed (this rarely happens). */ InstanceProperties existingProperties = externalIdLink.getProperties(); if ((propertyUpdateNeeded(identifierDescription, OpenMetadataAPIMapper.DESCRIPTION_PROPERTY_NAME, existingProperties, methodName)) || (propertyUpdateNeeded(identifierUsage, OpenMetadataAPIMapper.USAGE_PROPERTY_NAME, existingProperties, methodName)) || (propertyUpdateNeeded(identifierSource, OpenMetadataAPIMapper.SOURCE_PROPERTY_NAME, existingProperties, methodName))) { InstanceProperties properties = builder.getExternalIdResourceLinkProperties(identifierDescription, identifierUsage, identifierSource, identifierMappingProperties, methodName); repositoryHandler.updateRelationshipProperties(userId, null, null, externalIdLink, properties, methodName); } } } /** * Test if a string property needs updating. * * @param newValue new value * @param propertyName name of the property * @param existingProperties properties currently stored * @param methodName calling method * * @return boolean flag - true if the property needs updating */ private boolean propertyUpdateNeeded(String newValue, String propertyName, InstanceProperties existingProperties, String methodName) { String existingValue = repositoryHelper.getStringProperty(serviceName, propertyName, existingProperties, methodName); if ((existingValue == null) && (newValue == null)) { return false; } if (existingValue == null) { return true; } return (! existingValue.equals(newValue)); } /** * Update and validate the properties associated with the ExternalIdScope relationship. * * @param userId calling userId * @param externalIdScope scope relationship * @param permittedSynchronization direction of synchronization * @param synchronizationDescription optional description of the synchronization in progress (augments the description in the permitted synchronization enum) * @param methodName calling method * * @throws InvalidParameterException one of the parameters is invalid * @throws UserNotAuthorizedException user not authorized to issue this request * @throws PropertyServerException problem accessing the property server */ private void updateScopeProperties(String userId, Relationship externalIdScope, int permittedSynchronization, String synchronizationDescription, String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException { ExternalIdentifierBuilder builder = new ExternalIdentifierBuilder(repositoryHelper, serviceName, serverName); /* * The properties for this synchronization are not set up - make the changes */ InstanceProperties properties = builder.getExternalIdScopeProperties(synchronizationDescription, permittedSynchronization, methodName); repositoryHandler.updateRelationshipProperties(userId, null, null, externalIdScope, properties, methodName); } /** * Count the number of external identifiers attached to an anchor entity. * * @param userId calling user * @param elementGUID identifier for the entity that the object is attached to * @param effectiveTime the time that the retrieved elements must be effective for * @param methodName calling method * @return count of attached objects * @throws InvalidParameterException the parameters are invalid * @throws UserNotAuthorizedException user not authorized to issue this request * @throws PropertyServerException problem detected in the repository services */ public int countExternalIdentifiers(String userId, String elementGUID, Date effectiveTime, String methodName) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException { return super.countAttachments(userId, elementGUID, OpenMetadataAPIMapper.REFERENCEABLE_TYPE_NAME, OpenMetadataAPIMapper.REFERENCEABLE_TO_EXTERNAL_ID_TYPE_GUID, OpenMetadataAPIMapper.REFERENCEABLE_TO_EXTERNAL_ID_TYPE_NAME, effectiveTime, methodName); } /** * Return the external identifiers attached to a referenceable by the ExternalIdLink. * * @param userId calling user * @param elementGUID identifier for the entity that the identifier is attached to * @param elementGUIDParameterName name of parameter supplying the GUID * @param elementTypeName name of the type of object being attached to * @param serviceSupportedZones supported zones for calling service * @param startingFrom where to start from in the list * @param pageSize maximum number of results that can be returned * @param effectiveTime the time that the retrieved elements must be effective for * @param methodName calling method * * @return list of retrieved objects or null if none found * * @throws InvalidParameterException the input properties are invalid * @throws UserNotAuthorizedException user not authorized to issue this request * @throws PropertyServerException problem accessing the property server */ public List<EXTERNAL_ID> getExternalIdentifiersForElement(String userId, String elementGUID, String elementGUIDParameterName, String elementTypeName, List<String> serviceSupportedZones, int startingFrom, int pageSize, Date effectiveTime, String methodName) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException { return this.getExternalIdentifiersForScope(userId, elementGUID, elementGUIDParameterName, elementTypeName, serviceSupportedZones, null, OpenMetadataAPIMapper.REFERENCEABLE_TYPE_NAME, null, startingFrom, pageSize, effectiveTime, methodName); } /** * Return the external identifiers attached to a referenceable by the ExternalIdLink. * * @param userId calling user * @param elementGUID identifier for the entity that the identifier is attached to * @param elementGUIDParameterName name of parameter supplying the GUID * @param elementTypeName name of the type of object being attached to * @param scopeGUID unique identifier of the software server capability that represents the third metadata source * @param scopeTypeName specific type name of the software server capability that represents the third party metadata source * @param scopeQualifiedName unique name of the software server capability that represents the third metadata source * @param startingFrom where to start from in the list * @param pageSize maximum number of results that can be returned * @param effectiveTime the time that the retrieved elements must be effective for * @param methodName calling method * * @return list of retrieved objects or null if none found * * @throws InvalidParameterException the input properties are invalid * @throws UserNotAuthorizedException user not authorized to issue this request * @throws PropertyServerException problem accessing the property server */ public List<EXTERNAL_ID> getExternalIdentifiersForScope(String userId, String elementGUID, String elementGUIDParameterName, String elementTypeName, String scopeGUID, String scopeTypeName, String scopeQualifiedName, int startingFrom, int pageSize, Date effectiveTime, String methodName) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException { return getExternalIdentifiersForScope(userId, elementGUID, elementGUIDParameterName, elementTypeName, supportedZones, scopeGUID, scopeTypeName, scopeQualifiedName, startingFrom, pageSize, effectiveTime, methodName); } /** * Return the external identifiers attached to a referenceable by the ExternalIdLink. * * @param userId calling user * @param elementGUID identifier for the entity that the identifier is attached to * @param elementGUIDParameterName name of parameter supplying the GUID * @param elementTypeName name of the type of object being attached to * @param serviceSupportedZones supported zones for calling service * @param scopeGUID unique identifier of the software server capability that represents the third metadata source * @param scopeTypeName specific type name of the software server capability that represents the third party metadata source * @param scopeQualifiedName unique name name of the software server capability that represents the third party metadata source * @param startingFrom where to start from in the list * @param pageSize maximum number of results that can be returned * @param effectiveTime the time that the retrieved elements must be effective for * @param methodName calling method * * @return list of retrieved objects or null if none found * * @throws InvalidParameterException the input properties are invalid * @throws UserNotAuthorizedException user not authorized to issue this request * @throws PropertyServerException problem accessing the property server */ public List<EXTERNAL_ID> getExternalIdentifiersForScope(String userId, String elementGUID, String elementGUIDParameterName, String elementTypeName, List<String> serviceSupportedZones, String scopeGUID, String scopeTypeName, String scopeQualifiedName, int startingFrom, int pageSize, Date effectiveTime, String methodName) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException { invalidParameterHandler.validateGUID(elementGUID, elementGUIDParameterName, methodName); List<EXTERNAL_ID> results = new ArrayList<>(); List<Relationship> externalIdLinks = this.getAttachmentLinks(userId, elementGUID, elementGUIDParameterName, elementTypeName, OpenMetadataAPIMapper.REFERENCEABLE_TO_EXTERNAL_ID_TYPE_GUID, OpenMetadataAPIMapper.REFERENCEABLE_TO_EXTERNAL_ID_TYPE_NAME, null, OpenMetadataAPIMapper.EXTERNAL_IDENTIFIER_TYPE_NAME, 0, false, startingFrom, pageSize, effectiveTime, methodName); if (externalIdLinks != null) { for (Relationship externalIdLink : externalIdLinks) { if ((externalIdLink != null) && (externalIdLink.getEntityTwoProxy()!= null)) { final String externalIdGUIDParameterName = "externalIdLink.getEntityTwoProxy().getGUID()"; String externalIdGUID = externalIdLink.getEntityTwoProxy().getGUID(); EntityDetail externalIdEntity = this.getEntityFromRepository(userId, externalIdGUID, externalIdGUIDParameterName, OpenMetadataAPIMapper.EXTERNAL_IDENTIFIER_TYPE_NAME, null, null, false, false, serviceSupportedZones, effectiveTime, methodName); if ((externalIdEntity != null) && (externalIdEntity.getType() != null)) { List<Relationship> externalIdScopes = this.getAttachmentLinks(userId, externalIdGUID, externalIdGUIDParameterName, OpenMetadataAPIMapper.EXTERNAL_IDENTIFIER_TYPE_NAME, OpenMetadataAPIMapper.EXTERNAL_ID_SCOPE_TYPE_GUID, OpenMetadataAPIMapper.EXTERNAL_ID_SCOPE_TYPE_NAME, null, scopeTypeName, 0, false, startingFrom, pageSize, effectiveTime, methodName); if (externalIdScopes != null) { for (Relationship externalIdScope : externalIdScopes) { if ((externalIdScope != null) && (externalIdScope.getEntityOneProxy() != null)) { if ((scopeGUID == null) || (scopeGUID.equals(externalIdScope.getEntityOneProxy().getGUID()))) { List<Relationship> externalIdRelationships = new ArrayList<>(); externalIdRelationships.add(externalIdLink); externalIdRelationships.add(externalIdScope); EXTERNAL_ID bean = converter.getNewComplexBean(beanClass, externalIdEntity, externalIdRelationships, methodName); if (bean != null) { results.add(bean); } } } } } } } } } if (results.isEmpty()) { return null; } return results; } /** * Return the list of entities for open metadata elements of an open metadata type that are associated with an * external identifier in a particular scope. * * @param userId calling user * @param scopeGUID unique identifier of software server capability representing the caller * @param scopeParameterName unique name of software server capability representing the caller * @param scopeTypeName specific type name of the software server capability that represents the third party metadata source * @param requestedTypeName unique type name of the elements in the external asset manager * @param startingFrom where to start from in the list * @param pageSize maximum number of results that can be returned * @param effectiveTime the time that the retrieved elements must be effective for * @param methodName calling method * * @return list of element headers * * @throws InvalidParameterException one of the parameters is invalid * @throws UserNotAuthorizedException user not authorized to issue this request * @throws PropertyServerException problem accessing the property server */ public List<EntityDetail> getElementEntitiesForScope(String userId, String scopeGUID, String scopeParameterName, String scopeTypeName, String requestedTypeName, int startingFrom, int pageSize, Date effectiveTime, String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException { final String requestedTypeNameParameterName = "requestedTypeName"; invalidParameterHandler.validateGUID(scopeGUID, scopeParameterName, methodName); invalidParameterHandler.validateName(requestedTypeName, requestedTypeNameParameterName, methodName); int queryPageSize = invalidParameterHandler.validatePaging(startingFrom, pageSize, methodName); RepositoryRelatedEntitiesIterator externalIdIterator = new RepositoryRelatedEntitiesIterator(repositoryHandler, userId, scopeGUID, scopeTypeName, OpenMetadataAPIMapper.EXTERNAL_ID_SCOPE_TYPE_GUID, OpenMetadataAPIMapper.EXTERNAL_ID_SCOPE_TYPE_NAME, null, false, false, 0, 0, effectiveTime, methodName); int skippedResults = 0; List<EntityDetail> results = new ArrayList<>(); while ((externalIdIterator.moreToReceive()) && ((queryPageSize == 0) || results.size() < queryPageSize)) { EntityDetail externalIdEntity = externalIdIterator.getNext(); if (externalIdEntity != null) { RepositoryRelatedEntitiesIterator elementIterator = new RepositoryRelatedEntitiesIterator(repositoryHandler, userId, externalIdEntity.getGUID(), OpenMetadataAPIMapper.EXTERNAL_IDENTIFIER_TYPE_NAME, OpenMetadataAPIMapper.REFERENCEABLE_TO_EXTERNAL_ID_TYPE_GUID, OpenMetadataAPIMapper.REFERENCEABLE_TO_EXTERNAL_ID_TYPE_NAME, null, false, false, 0, 0, effectiveTime, methodName); while ((externalIdIterator.moreToReceive()) && ((queryPageSize == 0) || results.size() < queryPageSize)) { EntityDetail elementEntity = elementIterator.getNext(); if ((elementEntity != null) && (elementEntity.getType() != null)) { if (repositoryHelper.isTypeOf(serviceName, elementEntity.getType().getTypeDefName(), requestedTypeName)) { if (skippedResults < startingFrom) { skippedResults ++; } else { results.add(elementEntity); } } } } } } if (results.isEmpty()) { return null; } else { return results; } } /** * Return the list of headers for open metadata elements that are associated with a particular * external identifier. It is necessary to navigate to the externalIdentifier from the scope. * * @param userId calling user * @param scopeGUID unique identifier of software server capability representing the caller * @param scopeParameterName unique name of software server capability representing the caller * @param scopeTypeName specific type name of the software server capability that represents the third party metadata source * @param scopeQualifiedName unique name name of the software server capability that represents the third party metadata source * @param externalIdentifier unique identifier of this element in the external asset manager * @param startingFrom where to start from in the list * @param pageSize maximum number of results that can be returned * @param effectiveTime the time that the retrieved elements must be effective for * @param methodName calling method * * @return list of element headers * * @throws InvalidParameterException one of the parameters is invalid * @throws UserNotAuthorizedException user not authorized to issue this request * @throws PropertyServerException problem accessing the property server */ public List<OPEN_METADATA_ELEMENT_HEADER> getElementsForExternalIdentifier(String userId, String scopeGUID, String scopeParameterName, String scopeTypeName, String scopeQualifiedName, String externalIdentifier, int startingFrom, int pageSize, Date effectiveTime, String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException { final String externalIdentifierParameterName = "externalIdentifier"; invalidParameterHandler.validateGUID(scopeGUID, scopeParameterName, methodName); invalidParameterHandler.validateName(externalIdentifier, externalIdentifierParameterName, methodName); List<String> propertyNames = new ArrayList<>(); propertyNames.add(OpenMetadataAPIMapper.IDENTIFIER_PROPERTY_NAME); List<EntityDetail> matchingExternalIds = this.getEntitiesByValue(userId, externalIdentifier, externalIdentifierParameterName, OpenMetadataAPIMapper.EXTERNAL_IDENTIFIER_TYPE_GUID, OpenMetadataAPIMapper.EXTERNAL_IDENTIFIER_TYPE_NAME, propertyNames, true, null, null, false, false, supportedZones, null, 0, invalidParameterHandler.getMaxPagingSize(), effectiveTime, methodName); if (matchingExternalIds != null) { final String matchingEntityGUIDParameterName = "matchingEntity.getGUID()"; for (EntityDetail matchingEntity : matchingExternalIds) { if (matchingEntity != null) { List<Relationship> externalIdRelationships = this.getAttachmentLinks(userId, scopeGUID, scopeParameterName, scopeTypeName, OpenMetadataAPIMapper.EXTERNAL_ID_SCOPE_TYPE_GUID, OpenMetadataAPIMapper.EXTERNAL_ID_SCOPE_TYPE_NAME, scopeGUID, OpenMetadataAPIMapper.EXTERNAL_IDENTIFIER_TYPE_NAME, 0, invalidParameterHandler.getMaxPagingSize(), effectiveTime, methodName); if ((externalIdRelationships != null) && (externalIdRelationships.isEmpty())) { return this.getElementHeaders(userId, matchingEntity.getGUID(), matchingEntityGUIDParameterName, startingFrom, pageSize, effectiveTime, methodName); } } } } return null; } /** * Return the list of headers for open metadata elements that are associated with a particular * external identifier. It is necessary to navigate to the externalIdentifier fro * * @param userId calling user * @param externalIdGUID unique identifier of software server capability representing the caller * @param externalIdGUIDParameterName unique name of software server capability representing the caller * @param startingFrom where to start from in the list * @param pageSize maximum number of results that can be returned * @param effectiveTime the time that the retrieved elements must be effective for * @param methodName calling method * * @return list of element headers * * @throws InvalidParameterException one of the parameters is invalid * @throws UserNotAuthorizedException user not authorized to issue this request * @throws PropertyServerException problem accessing the property server */ private List<OPEN_METADATA_ELEMENT_HEADER> getElementHeaders(String userId, String externalIdGUID, String externalIdGUIDParameterName, int startingFrom, int pageSize, Date effectiveTime, String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException { invalidParameterHandler.validateGUID(externalIdGUID, externalIdGUIDParameterName, methodName); invalidParameterHandler.validateName(externalIdGUID, externalIdGUIDParameterName, methodName); List<EntityDetail> elementEntities = this.getAttachedEntities(userId, externalIdGUID, externalIdGUIDParameterName, OpenMetadataAPIMapper.EXTERNAL_IDENTIFIER_TYPE_NAME, OpenMetadataAPIMapper.REFERENCEABLE_TO_EXTERNAL_ID_TYPE_GUID, OpenMetadataAPIMapper.REFERENCEABLE_TO_EXTERNAL_ID_TYPE_NAME, OpenMetadataAPIMapper.REFERENCEABLE_TYPE_NAME, null, null, false, false, supportedZones, startingFrom, pageSize, effectiveTime, methodName); List<OPEN_METADATA_ELEMENT_HEADER> results = new ArrayList<>(); if (elementEntities != null) { for (EntityDetail elementEntity : elementEntities) { if (elementEntity != null) { OPEN_METADATA_ELEMENT_HEADER bean = elementConverter.getNewBean(elementBeanClass, elementEntity, methodName); if (bean != null) { results.add(bean); } } } } if (results.isEmpty()) { return null; } return results; } }
[ "mandy_chessell@uk.ibm.com" ]
mandy_chessell@uk.ibm.com
0e0d794d750c145e422501232017d83a5fda809b
620644fd52a3c7827fa47b5add48e5cd95f7222a
/src/main/java/com/tweet/hashtags/twitter/TwitterModel.java
8174430e7f8cd2e2aa405112c26c95442016cb36
[]
no_license
Mritunjaya/Tweet_HashTag_Backend
bf7c04593af6bd7e1ef9be57dc72383f00f5d0c7
01ed91e6f1a7d9e903b2d4ffaa16bd76d57d1714
refs/heads/master
2020-03-31T05:40:50.315449
2018-10-15T09:09:21
2018-10-15T09:09:21
151,955,186
0
0
null
null
null
null
UTF-8
Java
false
false
284
java
package com.tweet.hashtags.twitter; import java.util.List; public class TwitterModel { private List<TweetModel> tweet; public List<TweetModel> getTweet() { return tweet; } public void setTweet(List<TweetModel> tweet) { this.tweet = tweet; } }
[ "mritunjay.chaurasia22@gmail.com" ]
mritunjay.chaurasia22@gmail.com
eecb2d8503e9aa1c71dd2661f40f2bf85e0d7b66
58c0a94985b1676e1d8f3c17aeb96b31fc307226
/src/main/java/com/erhsh/prj/distrmgmtsys/service/TestServiceImpl.java
1b150ad47b213b6c7dac3653e0dfce98938c44a9
[]
no_license
erhsh/spring-mvc
f9562113500ab22059526ed7e087542cca3dc575
291fd0f7361d2c0a0d8bf50e712666ab7734ab70
refs/heads/master
2021-01-23T04:10:12.759422
2015-08-02T12:03:39
2015-08-02T12:03:39
40,077,412
0
0
null
null
null
null
UTF-8
Java
false
false
853
java
package com.erhsh.prj.distrmgmtsys.service; import java.util.ArrayList; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.erhsh.prj.distrmgmtsys.dao.TestDao; import com.erhsh.prj.distrmgmtsys.model.User; import com.erhsh.prj.distrmgmtsys.pojo.UserVO; @Service public class TestServiceImpl implements TestService { @Autowired private TestDao dao; @Override public String sayHello(String name) { dao.test(); return "hello, " + name; } @Override public List<UserVO> list() { List<UserVO> ret = new ArrayList<UserVO>(); List<User> users = dao.list(); for (User user : users) { UserVO userVO = new UserVO(); userVO.setId(String.valueOf(user.getId())); userVO.setName(user.getName()); ret.add(userVO); } return ret; } }
[ "erhsh_165@126.com" ]
erhsh_165@126.com
3db4a451c1321bcd00e7c5a5c1f4d09d9c3f28b6
a70cda04817c065281702c3f2652517fea80df1e
/ClinicsAndDoctors/app/src/main/java/com/clinicsanddoctors/data/remote/requests/LoginRequest.java
f9e60c0e94515299dd1aaba82115ed94a4e472a7
[]
no_license
kcmkcm1234/ClinicsAndDoctors-Android
34829bc77027ffe64c76767b46aeb71d98f16a83
f094fd75a9e26892a738ef3756a1bdd21e126ffe
refs/heads/master
2020-04-14T08:50:03.249636
2018-02-14T19:39:57
2018-02-14T19:39:57
null
0
0
null
null
null
null
UTF-8
Java
false
false
485
java
package com.clinicsanddoctors.data.remote.requests; import com.google.gson.annotations.Expose; /** * Created by Daro on 01/08/2017. */ public class LoginRequest { @Expose String phone_number; @Expose String password; public LoginRequest setMobile(String phone_number) { this.phone_number = phone_number; return this; } public LoginRequest setPassword(String password) { this.password = password; return this; } }
[ "dario@infinixsoft.com" ]
dario@infinixsoft.com
400c4784d3b32164bc5d7177ebaa3aae917d5099
ab618e598da85b8554a79fbf07d936977ca4495a
/AttendanceMonitoringSystem/backend-transacting/CBGFXDatabase/src/com/bpi/impl/T0220DAOImpl.java
390f0b4923b309f6f1f1da08549f053447460588
[]
no_license
chrisjeriel/AttendanceMonitoringSystem
1108c55f71dbbb31e09191e47c8035d3f01da467
7ce4ee398c091435eefcf4311bc25b0bdc96d22e
refs/heads/master
2021-01-20T07:09:56.217032
2017-05-19T11:46:17
2017-05-19T11:46:17
89,969,174
0
0
null
null
null
null
UTF-8
Java
false
false
208
java
package com.bpi.impl; import com.bpi.dao.T0220DAO; import com.bpi.model.T0220; public class T0220DAOImpl extends GenericDAOImpl<T0220> implements T0220DAO{ public T0220DAOImpl() { super (T0220.class); } }
[ "Christopher Jeriel Sarsonas" ]
Christopher Jeriel Sarsonas
b591760599c103173ead035da5003e2768c726d8
28d2037d9515a7edd361bc7bb6f9e36ac0226139
/BOJ_경로찾기.java
f1d77a703f6ef926d61a30f6ec49eecdf7eec97c
[]
no_license
wkarhfo/BOJ
37b396eb57be675a76829348e0a67d17f0b08b92
44ff7d60d892d13782e4ef6dd34b3eaeb8f6248e
refs/heads/master
2021-03-11T11:11:31.454128
2020-07-10T15:12:34
2020-07-10T15:12:34
246,525,322
0
0
null
null
null
null
UTF-8
Java
false
false
1,086
java
import java.util.LinkedList; import java.util.Queue; import java.util.Scanner; public class BOJ_경로찾기 { static int[][] arr; static boolean[][] visit; public static void main(String[] args) { Scanner sc = new Scanner(System.in); int size = sc.nextInt(); arr = new int[size][size]; for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { arr[i][j] = sc.nextInt(); } } for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { visit = new boolean[size][size]; bfs(i, j); System.out.print(" "); } System.out.println(); } } static void bfs(int i, int j) { Queue<Integer> q = new LinkedList<>(); q.add(i); boolean flag = false; while (!q.isEmpty()) { int tmp = q.poll(); if (flag) { if (tmp == j) { System.out.print(1); return; } } for (int m = 0; m < arr.length; m++) { if (arr[tmp][m] == 1 && visit[tmp][m] == false) { q.add(m); visit[tmp][m] = true; } } flag = true; } System.out.print(0); } }
[ "noreply@github.com" ]
noreply@github.com
047abb61ed97aa602e90312ceec23124f581f560
39dbc123d8338e3ae8856db428de7e770d9ff3ca
/src/main/java/models/Move.java
849a91ff55e0e97a4167fe1fd4e59a55086f95ee
[]
no_license
tiludropdancer/OrderAndChaos
c645794b5d22ff3ecb5774339c2fd995ce5575e4
a3cd5034e4c941d56a2e74790d31b2bf2eb6afde
refs/heads/master
2021-01-18T21:56:38.023859
2016-09-27T19:18:35
2016-09-27T19:18:35
69,312,755
0
0
null
null
null
null
UTF-8
Java
false
false
516
java
package models; /** * Player's move on the board. * * @author Anastasia Radchenko */ public class Move { private final String player; private final int x; private final int y; private final Mark mark; public Move(String player, int x, int y, Mark mark) { this.player = player; this.x = x; this.y = y; this.mark = mark; } public String getPlayer() { return player; } public int getX() { return x; } public int getY() { return y; } public Mark getMark() { return mark; } }
[ "anastasia.radchenko@gmail.com" ]
anastasia.radchenko@gmail.com
bc54deb17a72b3ba3d4dc68c574d0fa62f2f1cb6
5dc43887bbb1b202d1b3f6bb7e453a4567dc4de9
/src/com/sun/corba/se/spi/activation/_ServerManagerImplBase.java
67b3a513103e35074f5a3f570566b75944b360eb
[]
no_license
xlwh/study-jdk
f83bcec2cc63d412f49792073f83ac85b493cdc9
82700fb35ece6d883018058342ce71df364d2bab
refs/heads/master
2021-04-12T11:24:24.951635
2017-06-16T13:19:30
2017-06-16T13:19:30
94,541,754
0
0
null
null
null
null
UTF-8
Java
false
false
12,599
java
package com.sun.corba.se.spi.activation; /** * com/sun/corba/se/spi/activation/_ServerManagerImplBase.java . * Generated by the IDL-to-Java compiler (portable), version "3.2" * from /HUDSON/workspace/8-2-build-linux-i586/jdk8u131/8869/corba/src/share/classes/com/sun/corba/se/spi/activation/activation.idl * Wednesday, March 15, 2017 1:31:18 AM PDT */ public abstract class _ServerManagerImplBase extends org.omg.CORBA.portable.ObjectImpl implements com.sun.corba.se.spi.activation.ServerManager, org.omg.CORBA.portable.InvokeHandler { // Constructors public _ServerManagerImplBase () { } private static java.util.Hashtable _methods = new java.util.Hashtable (); static { _methods.put ("active", new java.lang.Integer (0)); _methods.put ("registerEndpoints", new java.lang.Integer (1)); _methods.put ("getActiveServers", new java.lang.Integer (2)); _methods.put ("activate", new java.lang.Integer (3)); _methods.put ("shutdown", new java.lang.Integer (4)); _methods.put ("install", new java.lang.Integer (5)); _methods.put ("getORBNames", new java.lang.Integer (6)); _methods.put ("uninstall", new java.lang.Integer (7)); _methods.put ("locateServer", new java.lang.Integer (8)); _methods.put ("locateServerForORB", new java.lang.Integer (9)); _methods.put ("getEndpoint", new java.lang.Integer (10)); _methods.put ("getServerPortForType", new java.lang.Integer (11)); } public org.omg.CORBA.portable.OutputStream _invoke (String $method, org.omg.CORBA.portable.InputStream in, org.omg.CORBA.portable.ResponseHandler $rh) { org.omg.CORBA.portable.OutputStream out = null; java.lang.Integer __method = (java.lang.Integer)_methods.get ($method); if (__method == null) throw new org.omg.CORBA.BAD_OPERATION (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE); switch (__method.intValue ()) { // A new ORB started server registers itself with the Activator case 0: // activation/Activator/active { try { int serverId = com.sun.corba.se.spi.activation.ServerIdHelper.read (in); com.sun.corba.se.spi.activation.Server serverObj = com.sun.corba.se.spi.activation.ServerHelper.read (in); this.active (serverId, serverObj); out = $rh.createReply(); } catch (com.sun.corba.se.spi.activation.ServerNotRegistered $ex) { out = $rh.createExceptionReply (); com.sun.corba.se.spi.activation.ServerNotRegisteredHelper.write (out, $ex); } break; } // Install a particular kind of endpoint case 1: // activation/Activator/registerEndpoints { try { int serverId = com.sun.corba.se.spi.activation.ServerIdHelper.read (in); String orbId = com.sun.corba.se.spi.activation.ORBidHelper.read (in); com.sun.corba.se.spi.activation.EndPointInfo endPointInfo[] = com.sun.corba.se.spi.activation.EndpointInfoListHelper.read (in); this.registerEndpoints (serverId, orbId, endPointInfo); out = $rh.createReply(); } catch (com.sun.corba.se.spi.activation.ServerNotRegistered $ex) { out = $rh.createExceptionReply (); com.sun.corba.se.spi.activation.ServerNotRegisteredHelper.write (out, $ex); } catch (com.sun.corba.se.spi.activation.NoSuchEndPoint $ex) { out = $rh.createExceptionReply (); com.sun.corba.se.spi.activation.NoSuchEndPointHelper.write (out, $ex); } catch (com.sun.corba.se.spi.activation.ORBAlreadyRegistered $ex) { out = $rh.createExceptionReply (); com.sun.corba.se.spi.activation.ORBAlreadyRegisteredHelper.write (out, $ex); } break; } // list active servers case 2: // activation/Activator/getActiveServers { int $result[] = null; $result = this.getActiveServers (); out = $rh.createReply(); com.sun.corba.se.spi.activation.ServerIdsHelper.write (out, $result); break; } // If the server is not running, start it up. case 3: // activation/Activator/activate { try { int serverId = com.sun.corba.se.spi.activation.ServerIdHelper.read (in); this.activate (serverId); out = $rh.createReply(); } catch (com.sun.corba.se.spi.activation.ServerAlreadyActive $ex) { out = $rh.createExceptionReply (); com.sun.corba.se.spi.activation.ServerAlreadyActiveHelper.write (out, $ex); } catch (com.sun.corba.se.spi.activation.ServerNotRegistered $ex) { out = $rh.createExceptionReply (); com.sun.corba.se.spi.activation.ServerNotRegisteredHelper.write (out, $ex); } catch (com.sun.corba.se.spi.activation.ServerHeldDown $ex) { out = $rh.createExceptionReply (); com.sun.corba.se.spi.activation.ServerHeldDownHelper.write (out, $ex); } break; } // If the server is running, shut it down case 4: // activation/Activator/shutdown { try { int serverId = com.sun.corba.se.spi.activation.ServerIdHelper.read (in); this.shutdown (serverId); out = $rh.createReply(); } catch (com.sun.corba.se.spi.activation.ServerNotActive $ex) { out = $rh.createExceptionReply (); com.sun.corba.se.spi.activation.ServerNotActiveHelper.write (out, $ex); } catch (com.sun.corba.se.spi.activation.ServerNotRegistered $ex) { out = $rh.createExceptionReply (); com.sun.corba.se.spi.activation.ServerNotRegisteredHelper.write (out, $ex); } break; } // currently running, this method will activate it. case 5: // activation/Activator/install { try { int serverId = com.sun.corba.se.spi.activation.ServerIdHelper.read (in); this.install (serverId); out = $rh.createReply(); } catch (com.sun.corba.se.spi.activation.ServerNotRegistered $ex) { out = $rh.createExceptionReply (); com.sun.corba.se.spi.activation.ServerNotRegisteredHelper.write (out, $ex); } catch (com.sun.corba.se.spi.activation.ServerHeldDown $ex) { out = $rh.createExceptionReply (); com.sun.corba.se.spi.activation.ServerHeldDownHelper.write (out, $ex); } catch (com.sun.corba.se.spi.activation.ServerAlreadyInstalled $ex) { out = $rh.createExceptionReply (); com.sun.corba.se.spi.activation.ServerAlreadyInstalledHelper.write (out, $ex); } break; } // list all registered ORBs for a server case 6: // activation/Activator/getORBNames { try { int serverId = com.sun.corba.se.spi.activation.ServerIdHelper.read (in); String $result[] = null; $result = this.getORBNames (serverId); out = $rh.createReply(); com.sun.corba.se.spi.activation.ORBidListHelper.write (out, $result); } catch (com.sun.corba.se.spi.activation.ServerNotRegistered $ex) { out = $rh.createExceptionReply (); com.sun.corba.se.spi.activation.ServerNotRegisteredHelper.write (out, $ex); } break; } // After this hook completes, the server may still be running. case 7: // activation/Activator/uninstall { try { int serverId = com.sun.corba.se.spi.activation.ServerIdHelper.read (in); this.uninstall (serverId); out = $rh.createReply(); } catch (com.sun.corba.se.spi.activation.ServerNotRegistered $ex) { out = $rh.createExceptionReply (); com.sun.corba.se.spi.activation.ServerNotRegisteredHelper.write (out, $ex); } catch (com.sun.corba.se.spi.activation.ServerHeldDown $ex) { out = $rh.createExceptionReply (); com.sun.corba.se.spi.activation.ServerHeldDownHelper.write (out, $ex); } catch (com.sun.corba.se.spi.activation.ServerAlreadyUninstalled $ex) { out = $rh.createExceptionReply (); com.sun.corba.se.spi.activation.ServerAlreadyUninstalledHelper.write (out, $ex); } break; } // Starts the server if it is not already running. case 8: // activation/Locator/locateServer { try { int serverId = com.sun.corba.se.spi.activation.ServerIdHelper.read (in); String endPoint = in.read_string (); com.sun.corba.se.spi.activation.LocatorPackage.ServerLocation $result = null; $result = this.locateServer (serverId, endPoint); out = $rh.createReply(); com.sun.corba.se.spi.activation.LocatorPackage.ServerLocationHelper.write (out, $result); } catch (com.sun.corba.se.spi.activation.NoSuchEndPoint $ex) { out = $rh.createExceptionReply (); com.sun.corba.se.spi.activation.NoSuchEndPointHelper.write (out, $ex); } catch (com.sun.corba.se.spi.activation.ServerNotRegistered $ex) { out = $rh.createExceptionReply (); com.sun.corba.se.spi.activation.ServerNotRegisteredHelper.write (out, $ex); } catch (com.sun.corba.se.spi.activation.ServerHeldDown $ex) { out = $rh.createExceptionReply (); com.sun.corba.se.spi.activation.ServerHeldDownHelper.write (out, $ex); } break; } // Starts the server if it is not already running. case 9: // activation/Locator/locateServerForORB { try { int serverId = com.sun.corba.se.spi.activation.ServerIdHelper.read (in); String orbId = com.sun.corba.se.spi.activation.ORBidHelper.read (in); com.sun.corba.se.spi.activation.LocatorPackage.ServerLocationPerORB $result = null; $result = this.locateServerForORB (serverId, orbId); out = $rh.createReply(); com.sun.corba.se.spi.activation.LocatorPackage.ServerLocationPerORBHelper.write (out, $result); } catch (com.sun.corba.se.spi.activation.InvalidORBid $ex) { out = $rh.createExceptionReply (); com.sun.corba.se.spi.activation.InvalidORBidHelper.write (out, $ex); } catch (com.sun.corba.se.spi.activation.ServerNotRegistered $ex) { out = $rh.createExceptionReply (); com.sun.corba.se.spi.activation.ServerNotRegisteredHelper.write (out, $ex); } catch (com.sun.corba.se.spi.activation.ServerHeldDown $ex) { out = $rh.createExceptionReply (); com.sun.corba.se.spi.activation.ServerHeldDownHelper.write (out, $ex); } break; } // get the port for the endpoint of the locator case 10: // activation/Locator/getEndpoint { try { String endPointType = in.read_string (); int $result = (int)0; $result = this.getEndpoint (endPointType); out = $rh.createReply(); out.write_long ($result); } catch (com.sun.corba.se.spi.activation.NoSuchEndPoint $ex) { out = $rh.createExceptionReply (); com.sun.corba.se.spi.activation.NoSuchEndPointHelper.write (out, $ex); } break; } // to pick a particular port type. case 11: // activation/Locator/getServerPortForType { try { com.sun.corba.se.spi.activation.LocatorPackage.ServerLocationPerORB location = com.sun.corba.se.spi.activation.LocatorPackage.ServerLocationPerORBHelper.read (in); String endPointType = in.read_string (); int $result = (int)0; $result = this.getServerPortForType (location, endPointType); out = $rh.createReply(); out.write_long ($result); } catch (com.sun.corba.se.spi.activation.NoSuchEndPoint $ex) { out = $rh.createExceptionReply (); com.sun.corba.se.spi.activation.NoSuchEndPointHelper.write (out, $ex); } break; } default: throw new org.omg.CORBA.BAD_OPERATION (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE); } return out; } // _invoke // Type-specific CORBA::Object operations private static String[] __ids = { "IDL:activation/ServerManager:1.0", "IDL:activation/Activator:1.0", "IDL:activation/Locator:1.0"}; public String[] _ids () { return (String[])__ids.clone (); } } // class _ServerManagerImplBase
[ "zhanghongbin01@baidu.com" ]
zhanghongbin01@baidu.com
ce66ae2c38350c523cce96ee3c86848b960f8893
8c7b35a391857c6ea12f45886a3758297ddf4388
/src/main/java/com/larkinds/aikamtest/model/Purchase.java
ca47487ea51e8c69c783331fa647350c514b0f5f
[]
no_license
LarkinRepositories/aikamtest
6ac97eb0b798b6591ebec8f176a539aa5acf8451
8c5f2177bc4872d115d9a39fe8a0d6f4e63614b1
refs/heads/master
2022-11-22T23:13:49.441907
2020-03-31T13:03:10
2020-03-31T13:03:10
250,576,155
0
0
null
null
null
null
UTF-8
Java
false
false
642
java
package com.larkinds.aikamtest.model; import lombok.Data; import lombok.EqualsAndHashCode; import org.springframework.data.annotation.CreatedDate; import javax.persistence.*; import java.time.LocalDate; import java.time.LocalDateTime; @EqualsAndHashCode(callSuper = true) @Data @Entity @Table(name = "purchases") public class Purchase extends BaseEntity { @CreatedDate @Column(name = "created") private LocalDate created; @OneToOne(cascade = CascadeType.ALL) @JoinColumn(name = "customer_id" ) Customer customer; @OneToOne(cascade = CascadeType.ALL) @JoinColumn(name = "product_id") Product product; }
[ "larkindsx@gmail.com" ]
larkindsx@gmail.com
630ae5f3f04957f258798f179918c5f136e874fc
6e966225b3b05b07dc6208abc2cf27c4041db38a
/src/main/java/me/vilsol/nmswrapper/wraps/unparsed/NMSBlockWallSign.java
67796ab321641b37b1346ba0e90d3c42d5cbbbe0
[ "Apache-2.0" ]
permissive
Vilsol/NMSWrapper
a73a2c88fe43384139fefe4ce2b0586ac6421539
4736cca94f5a668e219a78ef9ae4746137358e6e
refs/heads/master
2021-01-10T14:34:41.673024
2016-04-11T13:02:21
2016-04-11T13:02:22
51,975,408
1
0
null
null
null
null
UTF-8
Java
false
false
2,360
java
package me.vilsol.nmswrapper.wraps.unparsed; import me.vilsol.nmswrapper.NMSWrapper; import me.vilsol.nmswrapper.reflections.ReflectiveClass; import me.vilsol.nmswrapper.reflections.ReflectiveMethod; @ReflectiveClass(name = "BlockWallSign") public class NMSBlockWallSign extends NMSBlockSign { public NMSBlockWallSign(Object nmsObject){ super(nmsObject); } /** * @see net.minecraft.server.v1_9_R1.BlockWallSign#doPhysics(net.minecraft.server.v1_9_R1.World, net.minecraft.server.v1_9_R1.BlockPosition, net.minecraft.server.v1_9_R1.IBlockData, net.minecraft.server.v1_9_R1.Block) */ @ReflectiveMethod(name = "doPhysics", types = {NMSWorld.class, NMSBlockPosition.class, NMSIBlockData.class, NMSBlock.class}) public void doPhysics(NMSWorld world, NMSBlockPosition blockPosition, NMSIBlockData iBlockData, NMSBlock block){ NMSWrapper.getInstance().exec(nmsObject, world, blockPosition, iBlockData, block); } /** * @see net.minecraft.server.v1_9_R1.BlockWallSign#fromLegacyData(int) */ @ReflectiveMethod(name = "fromLegacyData", types = {int.class}) public NMSIBlockData fromLegacyData(int i){ return (NMSIBlockData) NMSWrapper.getInstance().createApplicableObject(NMSWrapper.getInstance().exec(nmsObject, i)); } /** * @see net.minecraft.server.v1_9_R1.BlockWallSign#getStateList() */ @ReflectiveMethod(name = "getStateList", types = {}) public NMSBlockStateList getStateList(){ return new NMSBlockStateList(NMSWrapper.getInstance().exec(nmsObject)); } /** * @see net.minecraft.server.v1_9_R1.BlockWallSign#toLegacyData(net.minecraft.server.v1_9_R1.IBlockData) */ @ReflectiveMethod(name = "toLegacyData", types = {NMSIBlockData.class}) public int toLegacyData(NMSIBlockData iBlockData){ return (int) NMSWrapper.getInstance().exec(nmsObject, iBlockData); } /** * @see net.minecraft.server.v1_9_R1.BlockWallSign#updateShape(net.minecraft.server.v1_9_R1.IBlockAccess, net.minecraft.server.v1_9_R1.BlockPosition) */ @ReflectiveMethod(name = "updateShape", types = {NMSIBlockAccess.class, NMSBlockPosition.class}) public void updateShape(NMSIBlockAccess iBlockAccess, NMSBlockPosition blockPosition){ NMSWrapper.getInstance().exec(nmsObject, iBlockAccess, blockPosition); } }
[ "vilsol2000@gmail.com" ]
vilsol2000@gmail.com
3c2e9aac360cac7649ef8116dc603b7747833f1e
cc0439b02147d47b2694d7c2e5ce771849ced874
/Tareas/Clase01/acamayo/PagoApp/src/pe/egcc/pagoapp/view/PagoView.java
7a29947f8cbcbc95a480f221cb8a9d884c59f208
[]
no_license
albjoa/ISIL-EMP-JAVA-EE-001
3bf9de310fab3796d23ed3ede7701af2fe343b4d
d9c408ecbd65210be866911c184cfb0eb0ef94e9
refs/heads/master
2020-09-14T02:51:29.693491
2018-07-18T02:49:56
2018-07-18T02:49:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
15,230
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package pe.egcc.pagoapp.view; import javax.swing.JOptionPane; import pe.egcc.pagoapp.dto.PagoDto; import pe.egcc.pagoapp.service.PagoService; /** * * @author Alumno-CT */ public class PagoView extends javax.swing.JFrame { /** * Creates new form PagoView */ public PagoView() { initComponents(); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); txtHoras = new javax.swing.JTextField(); txtDias = new javax.swing.JTextField(); txtPagoHora = new javax.swing.JTextField(); jButton1 = new javax.swing.JButton(); jSeparator1 = new javax.swing.JSeparator(); jLabel4 = new javax.swing.JLabel(); txtIngresos = new javax.swing.JTextField(); txtRenta = new javax.swing.JTextField(); jLabel5 = new javax.swing.JLabel(); txtNeto = new javax.swing.JTextField(); jLabel6 = new javax.swing.JLabel(); jButton2 = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("PAGO APP"); jLabel1.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N jLabel1.setText("Horas Trabajadas"); jLabel2.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N jLabel2.setText("Dias Trabajados"); jLabel3.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N jLabel3.setText("Pago por Hora"); txtHoras.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N txtHoras.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { txtHorasActionPerformed(evt); } }); txtDias.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N txtDias.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { txtDiasActionPerformed(evt); } }); txtPagoHora.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N jButton1.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N jButton1.setText("Calcular"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); jLabel4.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N jLabel4.setText("Ingresos"); txtIngresos.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N txtIngresos.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { txtIngresosActionPerformed(evt); } }); txtRenta.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N txtRenta.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { txtRentaActionPerformed(evt); } }); jLabel5.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N jLabel5.setText("Renta"); txtNeto.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N jLabel6.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N jLabel6.setText("Neto"); jButton2.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N jButton2.setText("Salir"); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(layout.createSequentialGroup() .addGap(61, 61, 61) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel4) .addComponent(jLabel5) .addComponent(jLabel6)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(txtNeto) .addComponent(txtIngresos, javax.swing.GroupLayout.Alignment.LEADING) .addComponent(txtRenta, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jButton2) .addGap(15, 15, 15)) .addGroup(layout.createSequentialGroup() .addContainerGap(51, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel1) .addComponent(jLabel2)) .addComponent(jLabel3)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(txtPagoHora) .addComponent(txtHoras, javax.swing.GroupLayout.Alignment.LEADING) .addComponent(txtDias, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 80, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 225, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton1)) .addComponent(jSeparator1)))) .addGap(32, 32, 32)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel1) .addComponent(txtHoras, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2) .addComponent(txtDias, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel3) .addComponent(txtPagoHora, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jButton1) .addGap(18, 18, 18) .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel4) .addComponent(txtIngresos, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel5) .addComponent(txtRenta, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(txtNeto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel6) .addComponent(jButton2)) .addContainerGap(21, Short.MAX_VALUE)) ); pack(); }// </editor-fold>//GEN-END:initComponents private void txtHorasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtHorasActionPerformed // TODO add your handling code here: }//GEN-LAST:event_txtHorasActionPerformed private void txtDiasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtDiasActionPerformed // TODO add your handling code here: }//GEN-LAST:event_txtDiasActionPerformed private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed // TODO add your handling code here: //datos ingreso int horas = Integer.parseInt(txtHoras.getText()); int dias = Integer.parseInt(txtDias.getText()); double pagohora = Double.parseDouble(txtPagoHora.getText()); //proceso PagoDto dto = new PagoDto(horas, dias, pagohora); PagoService pagoService = new PagoService(); dto = pagoService.calcularPago(dto); txtIngresos.setText(Double.toString(dto.getIngresos())); txtRenta.setText(Double.toString(dto.getRenta())); txtNeto.setText(Double.toString(dto.getNeto())); // reporte /* String repo = ""; repo += "Ingresos: " + dto.getIngresos() + "\n"; repo += "Renta: " + dto.getRenta() + "\n"; repo += "Neto: " + dto.getNeto() + "\n"; JOptionPane.showMessageDialog(rootPane, repo, "REPORTE", JOptionPane.INFORMATION_MESSAGE); */ }//GEN-LAST:event_jButton1ActionPerformed private void txtIngresosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtIngresosActionPerformed // TODO add your handling code here: }//GEN-LAST:event_txtIngresosActionPerformed private void txtRentaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtRentaActionPerformed // TODO add your handling code here: }//GEN-LAST:event_txtRentaActionPerformed private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed // TODO add your handling code here: dispose(); }//GEN-LAST:event_jButton2ActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(PagoView.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(PagoView.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(PagoView.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(PagoView.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new PagoView().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton jButton1; private javax.swing.JButton jButton2; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JSeparator jSeparator1; private javax.swing.JTextField txtDias; private javax.swing.JTextField txtHoras; private javax.swing.JTextField txtIngresos; private javax.swing.JTextField txtNeto; private javax.swing.JTextField txtPagoHora; private javax.swing.JTextField txtRenta; // End of variables declaration//GEN-END:variables }
[ "gcoronelc@gmail.com" ]
gcoronelc@gmail.com
d55f3302589bbaa60833f49b34a9ca49879dbebf
e57083ea584d69bc9fb1b32f5ec86bdd4fca61c0
/sample-components-500/src/main/java/com/example/service/sample500/sample3/Component3_22.java
dd25222f4a1c6ca92b57d70c3ce47bbe68b2cf3b
[]
no_license
snicoll-scratches/test-spring-components-index
77e0ad58c8646c7eb1d1563bf31f51aa42a0636e
aa48681414a11bb704bdbc8acabe45fa5ef2fd2d
refs/heads/main
2021-06-13T08:46:58.532850
2019-12-09T15:11:10
2019-12-09T15:11:10
65,806,297
5
3
null
null
null
null
UTF-8
Java
false
false
142
java
package com.example.service.sample500.sample3; import org.springframework.stereotype.Component; @Component public class Component3_22 { }
[ "snicoll@pivotal.io" ]
snicoll@pivotal.io
8e7730a87793fec0446ce36dbce667a2b328a9e6
fe38940042f1b368b5c874f933278594099ead45
/Duyibang/app/src/main/java/com/pengdu/example/SygActivity.java
85e473772813bbedb199cd060fda9fbfa9aa802b
[ "Apache-2.0" ]
permissive
anz130/khService
5e1c8ef1203fbebdd28ff9fcfda9fcd517efcf46
515d180419f796aee08e210d0399b60f78f37115
refs/heads/master
2020-12-02T18:11:31.461017
2017-07-07T04:57:43
2017-07-07T04:57:43
96,492,045
0
1
null
2017-07-07T04:57:44
2017-07-07T02:43:43
Java
UTF-8
Java
false
false
935
java
package com.pengdu.example; import android.content.Intent; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v7.app.AppCompatActivity; import android.widget.ImageView; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnClick; /** * Created by Administrator on 2017/7/1. */ public class SygActivity extends AppCompatActivity { @BindView(R.id.image_back) ImageView imageBack; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.syg_activity); ButterKnife.bind(this); } @OnClick(R.id.image_back) public void onViewClicked() { startActivity(MainActivity.class); } private void startActivity(Class<?> targtClass) { Intent intent=new Intent(this,targtClass); startActivity(intent); } }
[ "1159647587@qq.com" ]
1159647587@qq.com
de571003f0eb50aebfacc6b53e77d258ae60d777
34b6187f6e8fbb24029f61ec9d53d7c2b2363b0d
/catalogue/src/main/java/org/giavacms/catalogue/model/Product.java
b2c0352c5e111a94991263688debaeb3d3bfd324
[]
no_license
fiorenzino/giavacms
4d250ffc78af676f46d6e81b31ea4db29df2ab18
47018589a8c113cb1b7c6c5b568117df0b9acdcf
refs/heads/master
2021-01-20T23:03:32.759199
2013-03-02T09:18:07
2013-03-02T09:18:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,758
java
package org.giavacms.catalogue.model; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.JoinTable; import javax.persistence.Lob; import javax.persistence.ManyToOne; import javax.persistence.OneToMany; import javax.persistence.Transient; import org.giavacms.base.model.attachment.Document; import org.giavacms.base.model.attachment.Image; @Entity public class Product implements Serializable { private static final long serialVersionUID = 1L; private Long id; private String name; private String preview; private String description; private Category category; private String dimensions; private String code; List<Document> documents; List<Image> images; private boolean active = true; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } @Lob @Column(length = 1024) public String getPreview() { return preview; } public void setPreview(String preview) { this.preview = preview; } @Lob @Column(length = 1024) public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } @ManyToOne public Category getCategory() { if (this.category == null) this.category = new Category(); return category; } public void setCategory(Category category) { this.category = category; } @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL) @JoinTable(name = "Product_Document", joinColumns = @JoinColumn(name = "Product_id"), inverseJoinColumns = @JoinColumn(name = "documents_id")) public List<Document> getDocuments() { if (this.documents == null) this.documents = new ArrayList<Document>(); return documents; } public void setDocuments(List<Document> documents) { this.documents = documents; } public void addDocument(Document document) { getDocuments().add(document); } @Transient public int getDocSize() { return getDocuments().size(); } @Transient public Image getImage() { if (getImages() != null && getImages().size() > 0) return getImages().get(0); return null; } @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL) @JoinTable(name = "Product_Image", joinColumns = @JoinColumn(name = "Product_id"), inverseJoinColumns = @JoinColumn(name = "images_id")) public List<Image> getImages() { if (this.images == null) this.images = new ArrayList<Image>(); return images; } public void setImages(List<Image> images) { this.images = images; } public void addImage(Image image) { getImages().add(image); } @Transient public int getImgSize() { return getImages().size(); } public String getCode() { return code; } public void setCode(String code) { this.code = code; } public String getDimensions() { return dimensions; } public void setDimensions(String dimensions) { this.dimensions = dimensions; } public boolean isActive() { return active; } public void setActive(boolean active) { this.active = active; } @Override public String toString() { return "Product [id=" + id + ", name=" + name + ", preview=" + preview + ", description=" + description + ", category=" + category.getName() + ", dimensions=" + dimensions + ", code=" + code + ", active=" + active + "]"; } }
[ "fiorenzino@gmail.com" ]
fiorenzino@gmail.com
0c897582a5d2ec2d6f8562640a3c9983f0f3be4c
699847bb135ad212943628d3e01e22bc57431797
/src/main/java/sample3/StockFetcher.java
d942cbc536b6c94f04a08aaea66855a399eab028
[]
no_license
mariuszpawlowski/dynatrace-lazy-evaluation
5f1bc7f7ef77a2f5ba1520250e9c0041659f95b4
6382a7628d31de5ca7a8114f1f53092c4779fbc3
refs/heads/master
2021-01-10T07:13:27.573475
2015-10-07T09:45:48
2015-10-07T09:45:48
43,059,124
0
0
null
null
null
null
UTF-8
Java
false
false
454
java
package sample3; import java.util.*; import java.util.stream.Stream; public class StockFetcher { public static List<StockInfo> fetchStockPrices(List<String> symbols) { List<StockInfo> stocks = new ArrayList<>(); for (String symbol : symbols) { stocks.add(StockUtil.getPrice(symbol)); } return stocks; } public static Stream<StockInfo> fetchStockPricesLazy(List<String> symbols) { return symbols.stream().map(StockUtil::getPrice); } }
[ "mariusz.pawlowski@dynatrace.com" ]
mariusz.pawlowski@dynatrace.com
c0591fc858ec2612dec914496a6b487922ab8cf9
1fd921c5e35d5442bbe0876c50df1e2d51734124
/src/corvscmd/Validator.java
03659248f43f2488dc4491a5082e6c8b6503a834
[]
no_license
yergalem/Design-Patterns
c8c7d306054af70767eb89f0995581124c7d9936
ce5278a0819d249732c12cd1ef356d5d34226e02
refs/heads/master
2021-01-10T23:39:41.782030
2016-10-09T21:59:45
2016-10-09T21:59:45
70,432,957
0
0
null
null
null
null
UTF-8
Java
false
false
701
java
package corvscmd; /** * Handles Call Records requests and forwards them to DataWasher * Displays invalid requests whose attributes are empty * * @author Yergalem * */ public class Validator extends DataProcessor { @Override public void handleRequest(CallRecord rec) { if( isValid( rec.getCustomer() ) ) { rec.setValid(true); successor.handleRequest(rec); return; } System.out.println("Invalid Requests"); System.out.println( rec ); } private boolean isValid(Customer customer) { if( customer.getEmail() != "" && customer.getAddress() != null && customer.getPhone() != "" ) return true; return false; } }
[ "alexofeth@gmail.com" ]
alexofeth@gmail.com
9999b5e05af3862a92110b5223ff2eef5dbe032f
dffc0f9256d25ab77a18ead3f48906105e55ae22
/src/main/java/ac/at/tuwien/ifs/sepses/helper/Utility.java
753cd29e47ea05097e9a02c4e07628b9acb82114
[ "MIT" ]
permissive
fekaputra/sepses-converter
d6d7769936ec85758154cddd921a4dd3e7ff7a57
11092ac0acf263069cfc597a973d96d5f58d6282
refs/heads/master
2020-05-04T10:34:50.081946
2019-04-15T14:46:37
2019-04-15T14:46:37
179,090,718
0
0
null
null
null
null
UTF-8
Java
false
false
8,319
java
package ac.at.tuwien.ifs.sepses.helper; import ac.at.tuwien.ifs.sepses.storage.Storage; import ac.at.tuwien.ifs.sepses.storage.impl.FusekiStorage; import ac.at.tuwien.ifs.sepses.vocab.*; import org.apache.jena.query.*; import org.apache.jena.rdf.model.*; import org.apache.jena.vocabulary.DCTerms; import org.apache.jena.vocabulary.OWL; import org.eclipse.rdf4j.model.vocabulary.RDF; import org.eclipse.rdf4j.model.vocabulary.RDFS; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.util.HashMap; import java.util.Map; import java.util.Properties; public class Utility { private static final Logger log = LoggerFactory.getLogger(Utility.class); /** * check if a graph needs update (based on the catalog iD) * * @param metaModel * @param endpoint * @param graph * @param catalogResource * @return true if existing catalog id the same with the new catalog id * @throws IOException */ public static boolean checkIsUpToDate(Model metaModel, String endpoint, String graph, Resource catalogResource) throws IOException { ParameterizedSparqlString queryString1 = new ParameterizedSparqlString("select ?s from ?graph where { ?s a ?catalog }"); Resource graphResource = ResourceFactory.createResource(graph); queryString1.setParam("graph", graphResource); queryString1.setParam("catalog", catalogResource); QueryExecution qeQuery1 = QueryExecutionFactory.sparqlService(endpoint, queryString1.asQuery()); ParameterizedSparqlString stringQuery2 = new ParameterizedSparqlString("select ?s where { ?s a ?catalog }"); stringQuery2.setParam("catalog", catalogResource); QueryExecution qeQuery2 = QueryExecutionFactory.create(stringQuery2.asQuery(), metaModel); return checkResultContainTheSameValue(qeQuery1, qeQuery2, "?s"); } public static boolean checkIsEqualModifedDate(String tempRML, String xmlFile, String endpoint, String graph, Property property) throws IOException { ParameterizedSparqlString queryString1 = new ParameterizedSparqlString("select ?date from ?graph where { ?s ?property ?date }"); Resource graphResource = ResourceFactory.createResource(graph); queryString1.setParam("graph", graphResource); queryString1.setParam("property", property); QueryExecution qeQuery1 = QueryExecutionFactory.sparqlService(endpoint, queryString1.asQuery()); Model TempModel = XMLParser.Parse(xmlFile, tempRML); ParameterizedSparqlString stringQuery2 = new ParameterizedSparqlString("select ?date where { ?s ?property ?date }"); stringQuery2.setParam("property", property); QueryExecution qeQuery2 = QueryExecutionFactory.create(stringQuery2.asQuery(), TempModel); return checkResultContainTheSameValue(qeQuery1, qeQuery2, "?date"); } public static boolean checkResultContainTheSameValue(QueryExecution qeQuery1, QueryExecution qeQuery2, String var) { ResultSet rs1 = qeQuery1.execSelect(); String s1 = ""; while (rs1.hasNext()) { QuerySolution qsQuery1 = rs1.nextSolution(); RDFNode cat = qsQuery1.get(var); s1 = cat.toString(); } ResultSet rs2 = qeQuery2.execSelect(); String s2 = ""; while (rs2.hasNext()) { QuerySolution qsQuery2 = rs2.nextSolution(); RDFNode cat2 = qsQuery2.get(var); s2 = cat2.toString(); } return (s1.equals(s2)); } /** * check whether a graph contains instance of a certain class * * @param endpoint * @param CPEGraphName * @param cls * @return */ public static boolean checkIsGraphNotEmpty(String endpoint, String CPEGraphName, Resource cls) { //select if resource is not empty ParameterizedSparqlString queryString = new ParameterizedSparqlString("ASK FROM ?graph where { ?a a ?cls }"); Resource graphResource = ResourceFactory.createResource(CPEGraphName); queryString.setParam("graph", graphResource); queryString.setParam("cls", cls); QueryExecution qeQuery1 = QueryExecutionFactory.sparqlService(endpoint, queryString.asQuery()); return qeQuery1.execAsk(); } /** * Counts how many instances are contained within the downloaded file * * @param model * @param cls * @return string of instance count */ public static Integer countInstance(Model model, Resource cls) { Integer count = 0; ParameterizedSparqlString queryString = new ParameterizedSparqlString("select (str(count(?s)) as ?c) where { ?s a ?cls }"); queryString.setParam("cls", cls); QueryExecution queryExecution = QueryExecutionFactory.create(queryString.asQuery(), model); ResultSet resultSet = queryExecution.execSelect(); while (resultSet.hasNext()) { QuerySolution querySolution = resultSet.nextSolution(); RDFNode queryNode = querySolution.get("c"); count = queryNode.asLiteral().getInt(); } return count; } /** * Counts how many instances are contained within a named graph in a sparql endpoint * * @param endpoint * @param cls * @return string of instance count */ public static Integer countInstance(String endpoint, String graph, Resource cls) { Integer count = 0; ParameterizedSparqlString queryString = new ParameterizedSparqlString("select (str(count(?s)) as ?c) FROM ?graph where { ?s a ?cls }"); Resource graphResource = ResourceFactory.createResource(graph); queryString.setParam("cls", cls); queryString.setParam("graph", graphResource); QueryExecution queryExecution = QueryExecutionFactory.sparqlService(endpoint, queryString.asQuery()); ResultSet resultSet = queryExecution.execSelect(); while (resultSet.hasNext()) { QuerySolution querySolution = resultSet.nextSolution(); RDFNode queryNode = querySolution.get("c"); count = queryNode.asLiteral().getInt(); } return count; } public static String saveToFile(Model model, String outputDir, String xmlURL) { String fileName = xmlURL.substring(xmlURL.lastIndexOf("/") + 1); if (fileName.indexOf("\\") >= 0) { fileName = xmlURL.substring(xmlURL.lastIndexOf("\\") + 1); } String outputFileName = outputDir + "/" + fileName + "-output.ttl"; File outputFile = new File(outputFileName); outputFile.getParentFile().mkdirs(); try { FileWriter out = new FileWriter(outputFile); model.write(out, "TURTLE"); } catch (IOException e) { log.error(e.getMessage(), e); } return outputFileName; } public static Storage getStorage(Properties properties) { String triplestore = properties.getProperty("Triplestore"); if (triplestore.equalsIgnoreCase("fuseki")) { log.info("Fuseki triplestore is selected"); return FusekiStorage.getInstance(); } else { log.error("Triplestore type is not supported !!!"); return null; } } public static Map<String, String> getPrefixes() { Map<String, String> prefixes = new HashMap<>(); // General prefixes.put("rdf", RDF.NAMESPACE); prefixes.put("rdfs", RDFS.NAMESPACE); prefixes.put("owl", OWL.NS); prefixes.put("dct", DCTerms.NS); // SEPSES classes prefixes.put("cpe", CPE.NS); prefixes.put("cve", CVE.NS); prefixes.put("cvss", CVSS.NS); prefixes.put("capec", CAPEC.NS); prefixes.put("cwe", CWE.NS); // SEPSES resources prefixes.put("cpe-res", CPE.NS_INSTANCE); prefixes.put("cve-res", CVE.NS_INSTANCE); prefixes.put("cvss-res", CVSS.NS_INSTANCE); prefixes.put("capec-res", CAPEC.NS_INSTANCE); prefixes.put("cwe-res", CWE.NS_INSTANCE); return prefixes; } }
[ "fajar.ekaputra@tuwien.ac.at" ]
fajar.ekaputra@tuwien.ac.at
42ca3c08f89c4a081b84ee9512ed9a836c6d5e1b
2c606f9f71c2aa29be5b4542156c60240c207911
/app/src/main/java/com/jamie/devonrocksandstones/adapters/CluesAdapter.java
70ce2ba910708d0d69a980b4e5b61322e20d47b4
[]
no_license
Dr-Bond/DevonRocksAndStones
9316f1b9fc37ff7a2bbeba2035995b5f23202446
acf4e9f80c655167b1f9b2e93f0a55f9fe9ff2b0
refs/heads/master
2020-09-22T23:27:08.963836
2020-01-26T09:36:59
2020-01-26T09:36:59
225,343,749
0
0
null
null
null
null
UTF-8
Java
false
false
5,226
java
package com.jamie.devonrocksandstones.adapters; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; import com.bumptech.glide.Glide; import com.jamie.devonrocksandstones.R; import com.jamie.devonrocksandstones.activities.ClueActivity; import com.jamie.devonrocksandstones.activities.ProfileActivity; import com.jamie.devonrocksandstones.api.RetrofitClient; import com.jamie.devonrocksandstones.models.Clue; import com.jamie.devonrocksandstones.models.DefaultResponse; import com.jamie.devonrocksandstones.models.User; import com.jamie.devonrocksandstones.storage.SharedPrefManager; import java.util.List; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; public class CluesAdapter extends RecyclerView.Adapter<CluesAdapter.CluesViewHolder> { private Context mCtx; private List<Clue> clueList; private int stone; private int location; public CluesAdapter(Context mCtx, List<Clue> clueList) { this.mCtx = mCtx; this.clueList = clueList; } @NonNull @Override public CluesViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { //Create view View view = LayoutInflater.from(mCtx).inflate(R.layout.recyclerview_clues, parent, false); return new CluesViewHolder(view); } @Override public void onBindViewHolder(@NonNull CluesViewHolder holder,final int position) { //Get extras passed to intent Intent intent = ((Activity) mCtx).getIntent(); Bundle extras = intent.getExtras(); stone = extras.getInt("stone"); location = extras.getInt("location"); Clue clue = clueList.get(position); holder.textViewAddedBy.setText(clue.getAddedBy()); holder.textViewContent.setText(clue.getContent()); //Check if image is null, if not null, download image and add to holder, if null, hide the holder if(clue.getImage() != null) { Glide.with(mCtx).load(Uri.parse(clue.getImage())) .thumbnail(0.5f) .into(holder.imageViewStone); } else { holder.imageViewStone.setVisibility(View.GONE); } //Hide delete button if clue does not belong to user if(!clue.isDeletable()) { holder.buttonDeleteClue.setVisibility(View.GONE); } //Listen for delete button to be clicked holder.buttonDeleteClue.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { //Get stored user User user = SharedPrefManager.getInstance(mCtx).getUser(); //Make API call with the stored users access token and post ID relating to the clicked on button Call<DefaultResponse> call = RetrofitClient.getInstance().getApi().deleteClue(user.getAccessToken(),clueList.get(position).getId()); //Call back response to see what the API returns call.enqueue(new Callback<DefaultResponse>() { @Override public void onResponse(Call<DefaultResponse> call, Response<DefaultResponse> response) { //On error, return error message if (response.body().isError()) { Toast.makeText(mCtx, response.body().getMessage(), Toast.LENGTH_LONG).show(); } else { //On success, return message Toast.makeText(mCtx, response.body().getMessage(), Toast.LENGTH_LONG).show(); //Reload intent Intent intent = new Intent(mCtx, ClueActivity.class); intent.putExtra("stone",stone); intent.putExtra("location",location); mCtx.startActivity(intent); } } @Override public void onFailure(Call<DefaultResponse> call, Throwable t) { } }); } }); } @Override public int getItemCount() { return clueList.size(); } class CluesViewHolder extends RecyclerView.ViewHolder { //Create items for rows TextView textViewAddedBy; TextView textViewContent; ImageView imageViewStone; Button buttonDeleteClue; public CluesViewHolder(View itemView) { super(itemView); textViewAddedBy = itemView.findViewById(R.id.textViewAddedBy); textViewContent = itemView.findViewById(R.id.textViewContent); imageViewStone = itemView.findViewById(R.id.imageViewStone); buttonDeleteClue = itemView.findViewById(R.id.buttonDeleteClue); } } }
[ "mrjamiebond@gmail.com" ]
mrjamiebond@gmail.com
c8938dd1ad9bea7ae23cf86b858f98251ba31a7b
2832d3301338e5dbbbc8b96090c745c33ccf31b9
/000Java11/src/javacore/colecoes/test/SortProdustoTest.java
53e42355b91715d8fa831d2470666c11fb9788c4
[ "MIT" ]
permissive
ForeverFloripa/cursomaratonajava
e402e34a7e53a510a2d6eccfc3a10e90d3a4ef54
a69abff26cc4e4087eecda981be7672f125eea1d
refs/heads/master
2022-10-04T05:09:40.813583
2020-06-08T17:41:40
2020-06-08T17:41:40
270,762,495
0
0
null
null
null
null
UTF-8
Java
false
false
1,922
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package javacore.colecoes.test; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.List; import javacore.colecoes.classes.Produto; class ProdutoNomeComparator implements Comparator<Produto>{ @Override public int compare(Produto o1, Produto o2) { return o1.getNome().compareTo(o2.getNome()); } } public class SortProdustoTest { public static void main(String[] args) { List<Produto> produtos = new ArrayList<>(); Produto[] produtosArray= new Produto[4]; Produto produto3 = new Produto("789", "Picanha", 2400.0); Produto produto4 = new Produto("987", "Erva", 1122.0); Produto produto1 = new Produto("123", "LAPTOP LeNovo", 2000.0); Produto produto2 = new Produto("456", "TV Toshiba", 1000.0); produtos.add(produto1); produtos.add(produto2); produtos.add(produto3); produtos.add(produto4); produtosArray[0]=produto1; produtosArray[1]=produto2; produtosArray[2]=produto3; produtosArray[3]=produto4; Collections.sort(produtos,new ProdutoNomeComparator()); // produtos.forEach((prod) -> { // System.out.println(prod); // }); for(Produto prod : produtos){ System.out.println(prod); } System.out.println("_______________"); Arrays.sort(produtosArray, new ProdutoNomeComparator()); //System.out.println(Arrays.toString(produtosArray)); for(Produto prod : produtosArray){ System.out.println(prod); } } }
[ "34176505+ForeverFloripa@users.noreply.github.com" ]
34176505+ForeverFloripa@users.noreply.github.com
41a9ed97341d569e79f57c34957a220b9142d1a4
7cad67b18f36fac872b56557eea2f6b8334ed8e8
/app/src/main/java/com/jiakaiyang/onekey2doanything/utils/ShortcutUtils.java
11b09ae960ea31f3cc6316aee8fec3083b64918a
[]
no_license
kaiyangjia/OneKey2DoAnything
52509e19e2716d72c267358468feadb8427a6b03
d78e95300e40914152e9bc30957e5f2da2d5de91
refs/heads/master
2021-05-04T11:38:17.613313
2016-08-23T01:45:16
2016-08-23T01:45:16
53,123,994
1
0
null
null
null
null
UTF-8
Java
false
false
1,327
java
package com.jiakaiyang.onekey2doanything.utils; import android.content.Context; import android.content.Intent; import android.graphics.Bitmap; /** * 操作快捷方式的工具集 */ public class ShortcutUtils { public static void createShortcut(Context context, int iconId, String name, Intent shortcutIntent){ Intent addIntent = new Intent(); addIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, name); addIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent); addIntent.putExtra("duplicate", false); addIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, Intent.ShortcutIconResource.fromContext(context, iconId)); addIntent.setAction("com.android.launcher.action.INSTALL_SHORTCUT"); context.sendBroadcast(addIntent); } public static void createShortcut(Context context, Bitmap iconBitmap, String name, Intent shortcutIntent){ Intent addIntent = new Intent(); addIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, name); addIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent); addIntent.putExtra("duplicate", false); addIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON, iconBitmap); addIntent.setAction("com.android.launcher.action.INSTALL_SHORTCUT"); context.sendBroadcast(addIntent); } }
[ "fendou.1314" ]
fendou.1314
b6b10e2d4a03c71d05acbc4acb524e2cfeb682d7
7215434e352e43fd84179f9e754fa504748da5e6
/BankAccount/src/nvcc/edu/view/PanelTest.java
8031a32d96cb504cba9e9cdfb3e836f1e70433fb
[]
no_license
csc130/BankAccount
80d3947fa888730060ea6c02f536c6af21648584
89d785a5ee4f9c01918f9255a1e861b1afaebb6a
refs/heads/master
2021-01-01T20:05:45.223625
2013-04-23T20:35:00
2013-04-23T20:35:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
668
java
package nvcc.edu.view; import java.awt.BorderLayout; import javax.swing.JFrame; public class PanelTest extends JFrame { public static void createAndShowGUI() { //Create and set up the window. JFrame frame = new JFrame("TabbedPaneDemo"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //Add content to the window. frame.add(new BPanels(), BorderLayout.CENTER); //Display the window. frame.pack(); frame.setVisible(true); } public static void main(String[] args) { // TODO Auto-generated method stub createAndShowGUI(); } }
[ "fstkanchanawanchai@an098046.nvstu.edu" ]
fstkanchanawanchai@an098046.nvstu.edu
ef4f20f78d605085e76ff2d9a0e38e0d3f53454a
19f7e40c448029530d191a262e5215571382bf9f
/decompiled/instagram/sources/p000X/C43631un.java
62faa277b7d3f67d2142a7ca256f86f86fbc76f8
[]
no_license
stanvanrooy/decompiled-instagram
c1fb553c52e98fd82784a3a8a17abab43b0f52eb
3091a40af7accf6c0a80b9dda608471d503c4d78
refs/heads/master
2022-12-07T22:31:43.155086
2020-08-26T03:42:04
2020-08-26T03:42:04
283,347,288
18
1
null
null
null
null
UTF-8
Java
false
false
5,196
java
package p000X; import android.app.Activity; import android.content.Context; import android.content.res.Resources; import android.os.Handler; import android.os.Looper; import android.view.View; import com.facebook.C0003R; import com.instagram.profile.intf.UserDetailEntryInfo; import com.instagram.user.follow.FollowButton; /* renamed from: X.1un reason: invalid class name and case insensitive filesystem */ public final class C43631un implements View.OnAttachStateChangeListener { public View.OnClickListener A00; public UserDetailEntryInfo A01; public FollowButton A02; public String A03; public String A04; public String A05; public final C43641uo A06 = new C43641uo(); public final void A00(AnonymousClass0C1 r2, C13300iJ r3) { A01(r2, r3, (C467220p) null); } public final void A01(AnonymousClass0C1 r8, C13300iJ r9, C467220p r10) { A02(r8, r9, r10, (AnonymousClass1NJ) null, (C06270Ok) null, (AnonymousClass1I6) null); } public final void A02(AnonymousClass0C1 r9, C13300iJ r10, C467220p r11, AnonymousClass1NJ r12, C06270Ok r13, AnonymousClass1I6 r14) { A04(r9, r10, r11, r12, r13, r14, (String) null); } public final void A04(AnonymousClass0C1 r12, C13300iJ r13, C467220p r14, AnonymousClass1NJ r15, C06270Ok r16, AnonymousClass1I6 r17, String str) { C13300iJ r3 = r13; if (r13 != null) { AnonymousClass0C1 r4 = r12; C13390iS A0J = C26661Ek.A00(r12).A0J(r13); this.A02.A00(A0J); if (C14090jk.A05(r12, r13)) { this.A02.setVisibility(8); return; } this.A02.setVisibility(0); this.A02.A01(r13, A0J); FollowButton followButton = this.A02; View.OnClickListener onClickListener = this.A00; if (onClickListener == null) { onClickListener = new C467320q(this, r3, r4, r14, A0J, r15, r16, r17, str); } followButton.setOnClickListener(onClickListener); } } public final void A05(AnonymousClass0C1 r9, C13300iJ r10, C467220p r11, String str) { A04(r9, r10, r11, (AnonymousClass1NJ) null, (C06270Ok) null, (AnonymousClass1I6) null, str); } public final void A03(AnonymousClass0C1 r24, C13300iJ r25, C467220p r26, AnonymousClass1NJ r27, C06270Ok r28, AnonymousClass1I6 r29, String str) { Resources resources; int i; String string; AnonymousClass0C1 r12 = r24; C13300iJ r13 = r25; C13390iS A0J = C26661Ek.A00(r12).A0J(r13); C43641uo r7 = this.A06; FollowButton followButton = this.A02; Context context = followButton.getContext(); if (!AnonymousClass0NT.A07(context) && !C16180oA.A00(r12).A00.getBoolean("seen_offline_follow_nux", false) && (A0J == C13390iS.FollowStatusFollowing || A0J == C13390iS.FollowStatusNotFollowing)) { if (r7.A02 == null) { r7.A02 = new C105754hN(r7, r12); } AnonymousClass1RF r8 = r7.A02; if (A0J != C13390iS.FollowStatusNotFollowing) { resources = context.getResources(); i = C0003R.string.offline_unfollow_nux_title; string = resources.getString(i, new Object[]{r13.A0B()}); } else if (r13.A1o == Constants.A0C) { string = context.getResources().getString(C0003R.string.offline_follow_request_nux_title); } else { resources = context.getResources(); i = C0003R.string.offline_follow_nux_title; string = resources.getString(i, new Object[]{r13.A0B()}); } Object A012 = AnonymousClass0PK.A01(context, Activity.class); AnonymousClass0a4.A06(A012); C56142c0 r1 = new C56142c0((Activity) A012, new AnonymousClass95U((CharSequence) string)); r1.A05 = C56162c2.BELOW_ANCHOR; r1.A09 = false; r1.A04 = r8; r1.A0B = false; r1.A02(followButton); r7.A01 = r1.A00(); if (r7.A00 == null) { r7.A00 = new Handler(Looper.getMainLooper()); } Runnable runnable = r7.A03; if (runnable == null) { r7.A03 = new C105764hO(r7); } else { AnonymousClass0ZA.A08(r7.A00, runnable); } AnonymousClass0ZA.A09(r7.A00, r7.A03, 500, -1035528114); } this.A02.A00(A0J); Context context2 = this.A02.getContext(); String str2 = this.A03; String str3 = this.A05; C467220p r14 = r26; String str4 = this.A04; UserDetailEntryInfo userDetailEntryInfo = this.A01; String str5 = str3; AnonymousClass5GK.A00(context2, r12, r13, r14, str2, str5, str4, userDetailEntryInfo, r27, r28, r29, str); } public final void onViewAttachedToWindow(View view) { this.A06.A00(true); } public final void onViewDetachedFromWindow(View view) { this.A06.A00(false); } public C43631un(FollowButton followButton) { this.A02 = followButton; } }
[ "stan@rooy.works" ]
stan@rooy.works
9465f730c7939a8b4572044ac799b195e7f88677
50ad2981bc11f106850afa2ccba94955a5b67247
/app/src/main/java/akrupych/doomcameraview/MainFragment.java
c073e4f12d83f95f100c0436230092b390a342b9
[]
no_license
akrupych/DoomCameraView
2a3f6721fda2e54e84620bb67e040a5a42bd99a8
16afbd61041e14d569e33799c05a78acbea2ac01
refs/heads/master
2016-09-16T15:29:15.624886
2015-06-11T01:43:01
2015-06-11T01:43:01
37,098,525
0
0
null
null
null
null
UTF-8
Java
false
false
3,948
java
package akrupych.doomcameraview; import android.app.Activity; import android.app.Fragment; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.os.Environment; import android.provider.MediaStore; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.ImageView; import android.widget.TextView; import java.io.File; public class MainFragment extends Fragment { private static final String TAG = MainFragment.class.getSimpleName(); private static final int REQUEST_IMAGE_CAPTURE = 1; private MovementController mController = new MovementController(); private CompassAnimator mCompassAnimator = new CompassAnimator(); private PhotoView mPhotoView; private ImageView mCompassView; private Button mTakePhotoButton; private TextView mTextView; @Override public void onCreate(Bundle savedInstanceState) { Log.d(TAG, "onCreate"); super.onCreate(savedInstanceState); setRetainInstance(true); // don't recreate fragment after rotation } @Nullable @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Log.d(TAG, "onCreateView"); return inflater.inflate(R.layout.fragment_main, container, false); } @Override public void onViewCreated(View view, Bundle savedInstanceState) { Log.d(TAG, "onViewCreated"); mPhotoView = (PhotoView) view.findViewById(R.id.photo); mCompassView = (ImageView) view.findViewById(R.id.compass); mCompassAnimator.setup(mCompassView, mController); mTextView = (TextView) view.findViewById(R.id.location); mTakePhotoButton = (Button) view.findViewById(R.id.take_photo); mTakePhotoButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { takePhoto(); } }); view.setOnTouchListener(new OnSwipeTouchListener(getActivity()) { @Override public void onSwipe(SwipeDirection direction) { Log.d(TAG, "onSwipe " + direction); switch (direction) { case BOTTOM: mController.goForward(); break; case TOP: mController.goBackward(); break; case LEFT: mController.turnRight(); mCompassAnimator.rotateRight(mCompassView); break; case RIGHT: mController.turnLeft(); mCompassAnimator.rotateLeft(mCompassView); break; } updateView(); } }); updateView(); } private void takePhoto() { Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(getPhotoFile())); startActivityForResult(takePictureIntent, REQUEST_IMAGE_CAPTURE); } @NonNull private File getPhotoFile() { return new File(getActivity().getExternalFilesDir(Environment.DIRECTORY_PICTURES), mController.toString()); } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == REQUEST_IMAGE_CAPTURE && resultCode == Activity.RESULT_OK) updateView(); } private void updateView() { File photoFile = getPhotoFile(); boolean photoAvailable = photoFile.exists(); mPhotoView.setImageFile(photoFile); mTakePhotoButton.setVisibility(photoAvailable ? View.GONE : View.VISIBLE); mTextView.setText(mController.getLocationString()); } }
[ "andriy.krupych@gmail.com" ]
andriy.krupych@gmail.com
3f0a441e40196c58a0e96ffc67381bc8540e406a
0cf148173de99d4d96f40942424da152ea9f947d
/src/words/Country.java
caf84b45ec0b81ec9405ba39e636216aefa6c967
[]
no_license
SevadaIskandaryan/hangman
4dcfe541af8b7e22550a0e1c8cbf683ac30e9f0a
4fc1d544ebfdd66cbf752e41e57f89f6b87a8152
refs/heads/main
2023-04-23T05:31:41.920867
2021-05-04T11:34:36
2021-05-04T11:34:36
358,342,810
0
0
null
null
null
null
UTF-8
Java
false
false
495
java
package words; public class Country extends Word{ private Type type; public Country() { this.type = Type.COUNTRY; } public Country(String name, Level level,Type type) { super(name, level); this.type = type; } @Override public Type getClassType() { return getType(); } public Type getType() { return type; } public void setType(Type type) { this.type = type; } }
[ "noreply@github.com" ]
noreply@github.com
cbcc8bd06f3442cdb304dcfc5fc4f3208afb865b
47bd020f5688323f88814539eed0e44400a25c0b
/src/BinarySearchTest.java
923c4f9488eb3abe7e40be5afda34f7f3f4eda85
[]
no_license
victoria-miltcheva/binary-search
4294fb4228961040ce63cf3eb5653529a0c1ab9f
989198beb5ecd01b9db6163cb673c2fe1683018a
refs/heads/master
2020-06-07T10:14:53.330838
2019-06-20T23:03:15
2019-06-20T23:03:15
192,996,838
0
0
null
null
null
null
UTF-8
Java
false
false
1,407
java
import static org.junit.jupiter.api.Assertions.assertEquals; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; public class BinarySearchTest { private int[] numbers; @BeforeEach public void init() { numbers = new int[]{22, 48, 69, 90, 150, 168, 182, 199, 201, 240}; } @Test public void test_givenASortedArray_correctIndexIsFound() { assertEquals(2, BinarySearch.findIndex(numbers, 69), "The index of 69 should be 3"); assertEquals(5, BinarySearch.findIndex(numbers, 168), "The index of 168 should be 5"); assertEquals(7, BinarySearch.findIndex(numbers, 199), "The index of 240 should be 9"); } @Test public void test_givenEmptyArray_noIndexIsFound() { numbers = new int[0]; assertEquals(-1, BinarySearch.findIndex(numbers, 0), "The index of 0 should be -1 since array is empty"); } @Test public void test_givenNumberHasMiddleIndex_correctIndexIsFound() { assertEquals(4, BinarySearch.findIndex(numbers, 150), "The index of 150 should be 4"); } @Test public void test_givenNumberHasLowestIndex_correctIndexIsFound() { assertEquals(0, BinarySearch.findIndex(numbers, 22), "The index of 2 should be 0"); } @Test public void test_givenNumberHasHighestIndex_correctIndexIsFound() { assertEquals(9, BinarySearch.findIndex(numbers, 240), "The index of 240 should be 9"); } }
[ "victoria-m@users.noreply.github.com" ]
victoria-m@users.noreply.github.com