blob_id
stringlengths 40
40
| __id__
int64 225
39,780B
| directory_id
stringlengths 40
40
| path
stringlengths 6
313
| content_id
stringlengths 40
40
| detected_licenses
sequence | license_type
stringclasses 2
values | repo_name
stringlengths 6
132
| repo_url
stringlengths 25
151
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
70
| visit_date
timestamp[ns] | revision_date
timestamp[ns] | committer_date
timestamp[ns] | github_id
int64 7.28k
689M
โ | star_events_count
int64 0
131k
| fork_events_count
int64 0
48k
| gha_license_id
stringclasses 23
values | gha_fork
bool 2
classes | gha_event_created_at
timestamp[ns] | gha_created_at
timestamp[ns] | gha_updated_at
timestamp[ns] | gha_pushed_at
timestamp[ns] | gha_size
int64 0
40.4M
โ | gha_stargazers_count
int32 0
112k
โ | gha_forks_count
int32 0
39.4k
โ | gha_open_issues_count
int32 0
11k
โ | gha_language
stringlengths 1
21
โ | gha_archived
bool 2
classes | gha_disabled
bool 1
class | content
stringlengths 7
4.37M
| src_encoding
stringlengths 3
16
| language
stringclasses 1
value | length_bytes
int64 7
4.37M
| extension
stringclasses 24
values | filename
stringlengths 4
174
| language_id
stringclasses 1
value | entities
list | contaminating_dataset
stringclasses 0
values | malware_signatures
sequence | redacted_content
stringlengths 7
4.37M
| redacted_length_bytes
int64 7
4.37M
| alphanum_fraction
float32 0.25
0.94
| alpha_fraction
float32 0.25
0.94
| num_lines
int32 1
84k
| avg_line_length
float32 0.76
99.9
| std_line_length
float32 0
220
| max_line_length
int32 5
998
| is_vendor
bool 2
classes | is_generated
bool 1
class | max_hex_length
int32 0
319
| hex_fraction
float32 0
0.38
| max_unicode_length
int32 0
408
| unicode_fraction
float32 0
0.36
| max_base64_length
int32 0
506
| base64_fraction
float32 0
0.5
| avg_csv_sep_count
float32 0
4
| is_autogen_header
bool 1
class | is_empty_html
bool 1
class | shard
stringclasses 16
values |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
8526b5c52c3a60ca7e5ed21450ee48eeb0120019 | 6,992,206,758,090 | ac70f18abf73ee119ad9c0423478059b825af0a9 | /app/src/main/java/com/example/jelelight/clinicqueuing/MyProfileActivity.java | 1f9bbff2b64f07c1e454060518150e9689f674da | [] | no_license | jeletwilight/clinicQueue | https://github.com/jeletwilight/clinicQueue | 1e6d417ede4451bf6cf79c8ad6b84aa0c600046b | 5a9bd062c63bc03267ccd9ca31071294925ff369 | refs/heads/master | 2020-05-26T12:57:52.357000 | 2019-05-23T13:27:48 | 2019-05-23T13:27:48 | 188,237,948 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.jelelight.clinicqueuing;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.TextView;
import android.widget.Toast;
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;
public class MyProfileActivity extends AppCompatActivity {
private FirebaseDatabase mDatabasae;
private DatabaseReference mReferenceProfile;
private FirebaseAuth mAuth;
private FirebaseUser mUser;
private TextView uidView,statusView,nameView;
private Button editBtn,backBtn;
private ImageButton copyBtn;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getSupportActionBar().hide();
setContentView(R.layout.activity_my_profile);
bind();
}
@Override
protected void onStart() {
super.onStart();
mAuth = FirebaseAuth.getInstance();
mUser = mAuth.getCurrentUser();
if(mUser == null){
startActivity(new Intent(getApplicationContext(),MainActivity.class));
finish();
}
pageManage();
}
private final View.OnClickListener onClickListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.editProfile_Btn:
startActivity(new Intent(MyProfileActivity.this,EditProfileActivity.class));
break;
case R.id.backProfile_Btn:
onBackPressed();
finish();
break;
case R.id.copy_profile:
ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText("UserID", uidView.getText());
clipboard.setPrimaryClip(clip);
Toast.makeText(MyProfileActivity.this, "Copied to Clipboard.",
Toast.LENGTH_SHORT).show();
break;
}
}
};
private void bind(){
nameView = findViewById(R.id.name_profile);
statusView = findViewById(R.id.status_profile);
uidView = findViewById(R.id.uid_profile);
copyBtn = findViewById(R.id.copy_profile);
editBtn = findViewById(R.id.editProfile_Btn);
backBtn = findViewById(R.id.backProfile_Btn);
copyBtn.setOnClickListener(onClickListener);
editBtn.setOnClickListener(onClickListener);
backBtn.setOnClickListener(onClickListener);
}
private void pageManage(){
mDatabasae = FirebaseDatabase.getInstance();
mReferenceProfile = mDatabasae.getReference("Officers");
uidView.setText(mUser.getUid());
readProfiles();
}
private void readProfiles(){
mReferenceProfile.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
for(DataSnapshot node : dataSnapshot.getChildren()){
if(node.getKey().toString().equals(mUser.getUid().toString())){
if(node.child("name").exists()) {
nameView.setText(node.child("name").getValue().toString());
}else{
nameView.setText(mUser.getDisplayName());
mReferenceProfile.child(node.getKey()).child("name").setValue(mUser.getDisplayName());
}
if(node.child("status").exists()) {
statusView.setText(node.child("status").getValue().toString());
}else{
statusView.setText("Idle");
mReferenceProfile.child(node.getKey()).child("status").setValue("idle");
}
}
}
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
}
}
| UTF-8 | Java | 4,710 | java | MyProfileActivity.java | Java | [
{
"context": "package com.example.jelelight.clinicqueuing;\n\nimport android.content.ClipData;\n",
"end": 29,
"score": 0.8342735767364502,
"start": 20,
"tag": "USERNAME",
"value": "jelelight"
}
] | null | [] | package com.example.jelelight.clinicqueuing;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.TextView;
import android.widget.Toast;
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;
public class MyProfileActivity extends AppCompatActivity {
private FirebaseDatabase mDatabasae;
private DatabaseReference mReferenceProfile;
private FirebaseAuth mAuth;
private FirebaseUser mUser;
private TextView uidView,statusView,nameView;
private Button editBtn,backBtn;
private ImageButton copyBtn;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getSupportActionBar().hide();
setContentView(R.layout.activity_my_profile);
bind();
}
@Override
protected void onStart() {
super.onStart();
mAuth = FirebaseAuth.getInstance();
mUser = mAuth.getCurrentUser();
if(mUser == null){
startActivity(new Intent(getApplicationContext(),MainActivity.class));
finish();
}
pageManage();
}
private final View.OnClickListener onClickListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.editProfile_Btn:
startActivity(new Intent(MyProfileActivity.this,EditProfileActivity.class));
break;
case R.id.backProfile_Btn:
onBackPressed();
finish();
break;
case R.id.copy_profile:
ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText("UserID", uidView.getText());
clipboard.setPrimaryClip(clip);
Toast.makeText(MyProfileActivity.this, "Copied to Clipboard.",
Toast.LENGTH_SHORT).show();
break;
}
}
};
private void bind(){
nameView = findViewById(R.id.name_profile);
statusView = findViewById(R.id.status_profile);
uidView = findViewById(R.id.uid_profile);
copyBtn = findViewById(R.id.copy_profile);
editBtn = findViewById(R.id.editProfile_Btn);
backBtn = findViewById(R.id.backProfile_Btn);
copyBtn.setOnClickListener(onClickListener);
editBtn.setOnClickListener(onClickListener);
backBtn.setOnClickListener(onClickListener);
}
private void pageManage(){
mDatabasae = FirebaseDatabase.getInstance();
mReferenceProfile = mDatabasae.getReference("Officers");
uidView.setText(mUser.getUid());
readProfiles();
}
private void readProfiles(){
mReferenceProfile.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
for(DataSnapshot node : dataSnapshot.getChildren()){
if(node.getKey().toString().equals(mUser.getUid().toString())){
if(node.child("name").exists()) {
nameView.setText(node.child("name").getValue().toString());
}else{
nameView.setText(mUser.getDisplayName());
mReferenceProfile.child(node.getKey()).child("name").setValue(mUser.getDisplayName());
}
if(node.child("status").exists()) {
statusView.setText(node.child("status").getValue().toString());
}else{
statusView.setText("Idle");
mReferenceProfile.child(node.getKey()).child("status").setValue("idle");
}
}
}
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
}
}
| 4,710 | 0.612951 | 0.612739 | 132 | 34.68182 | 26.77836 | 114 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.575758 | false | false | 7 |
3ba256f9108ad7ab64e64e3189fad1ee5b65b377 | 27,719,718,995,715 | 6906f3d0fb42c7523f31f72ef860b9fd029f5f8b | /src/main/java/com/kiselev/enemy/network/instagram/api/internal2/responses/media/MediaPermalinkResponse.java | 0b598ab6f82a2aaa94b15d4193673ef649aaa1c0 | [
"MIT"
] | permissive | vadim8kiselev/public-enemy | https://github.com/vadim8kiselev/public-enemy | e8e8b429cc3420c99c74908cbfbceec4f0eee8f5 | e1a9fe8008228249858c258a001e79c908bb65c0 | refs/heads/master | 2023-04-10T09:49:32.664000 | 2021-04-14T17:40:38 | 2021-04-14T17:40:38 | 274,445,031 | 1 | 0 | MIT | false | 2021-04-26T20:42:34 | 2020-06-23T15:41:55 | 2021-04-14T17:40:48 | 2021-04-26T20:42:33 | 782 | 0 | 0 | 1 | Java | false | false | package com.kiselev.enemy.network.instagram.api.internal2.responses.media;
import com.kiselev.enemy.network.instagram.api.internal2.responses.IGResponse;
import lombok.Data;
@Data
public class MediaPermalinkResponse extends IGResponse {
private String permalink;
}
| UTF-8 | Java | 271 | java | MediaPermalinkResponse.java | Java | [] | null | [] | package com.kiselev.enemy.network.instagram.api.internal2.responses.media;
import com.kiselev.enemy.network.instagram.api.internal2.responses.IGResponse;
import lombok.Data;
@Data
public class MediaPermalinkResponse extends IGResponse {
private String permalink;
}
| 271 | 0.826568 | 0.819188 | 9 | 29.111111 | 30.362419 | 78 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.444444 | false | false | 7 |
e305454d1840df3c69079e5592f6ee4fed6aaae4 | 28,759,101,015,176 | 304654fb43068bae86e5708c885df19d9d27e7d4 | /test/org/itstep/CircleTest.java | d51f39606e3d8c7d826e2a153121f83bbca99380 | [] | no_license | Cattallia/TEST | https://github.com/Cattallia/TEST | a9a3bba11ee76ce8056849df5089b8f16ad32118 | 86ce1b32155ce79c8158845b74fcfd1102be9a20 | refs/heads/master | 2021-05-14T17:52:46.905000 | 2018-01-02T21:03:10 | 2018-01-02T21:03:10 | 116,056,833 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.itstep;
import static org.junit.Assert.*;
import org.junit.Test;
public class CircleTest {
@Test
public void testPrintArea() {
Circle circle = new Circle();
circle.setRadius(15);
//circle.printArea();
String testArea = circle.getArea();
assertEquals("706.8583470577034", testArea);
}
}
| UTF-8 | Java | 315 | java | CircleTest.java | Java | [] | null | [] | package org.itstep;
import static org.junit.Assert.*;
import org.junit.Test;
public class CircleTest {
@Test
public void testPrintArea() {
Circle circle = new Circle();
circle.setRadius(15);
//circle.printArea();
String testArea = circle.getArea();
assertEquals("706.8583470577034", testArea);
}
}
| 315 | 0.711111 | 0.653968 | 17 | 17.529411 | 14.911967 | 46 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.294118 | false | false | 7 |
8249f45aba3705aa7b5103bdff79e029b42bc0ae | 3,118,146,261,135 | 04b8bec734331f6a820123ed219b3390cd0936ca | /app/src/main/java/com/aashreys/walls/di/modules/ServiceModule.java | 940443bf81d0d6594d3b5e7a03606502f098f23a | [
"Apache-2.0"
] | permissive | YSC168/sublime-stills | https://github.com/YSC168/sublime-stills | 07c2ff950e52b1c23ec96f999d6af56739223d9c | 617204bf2412aa6bdad068ff86a061c662512970 | refs/heads/master | 2021-01-20T00:11:09.708000 | 2017-04-21T18:26:03 | 2017-04-21T18:26:03 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* Copyright {2017} {Aashrey Kamal Sharma}
*
* 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.aashreys.walls.di.modules;
import com.aashreys.walls.domain.display.collections.search.CollectionSearchService;
import com.aashreys.walls.domain.display.collections.search.CollectionSearchServiceImpl;
import com.aashreys.walls.domain.display.collections.search.FlickrTagSearchService;
import com.aashreys.walls.domain.display.collections.search.UnsplashCollectionSearchService;
import com.aashreys.walls.domain.display.images.ImageInfoService;
import com.aashreys.walls.domain.display.images.ImageInfoServiceImpl;
import com.aashreys.walls.network.UrlShortener;
import com.aashreys.walls.network.UrlShortenerImpl;
import com.aashreys.walls.network.apis.FlickrApi;
import com.aashreys.walls.network.apis.UnsplashApi;
import com.aashreys.walls.network.apis.UrlShortenerApi;
import com.aashreys.walls.network.parsers.FlickrExifParser;
import com.aashreys.walls.network.parsers.UnsplashPhotoInfoParser;
import com.aashreys.walls.network.parsers.UnsplashPhotoResponseParser;
import com.aashreys.walls.persistence.shorturl.ShortUrlRepository;
import com.aashreys.walls.ui.tasks.CollectionSearchTaskFactory;
import com.aashreys.walls.ui.tasks.FeaturedCollectionsTaskFactory;
import javax.inject.Provider;
import dagger.Module;
import dagger.Provides;
/**
* Created by aashreys on 18/02/17.
*/
@Module
public class ServiceModule {
public ServiceModule() {}
@Provides
public UnsplashPhotoResponseParser providesUnsplashImageResponseParser() {
return new UnsplashPhotoResponseParser();
}
@Provides
public CollectionSearchTaskFactory providesCollectionSearchTaskFactory
(Provider<CollectionSearchService> collectionSearchServiceProvider) {
return new CollectionSearchTaskFactory(collectionSearchServiceProvider);
}
@Provides
public FeaturedCollectionsTaskFactory providesFeaturedCollectionsTaskFactory
(Provider<CollectionSearchService> collectionSearchServiceProvider) {
return new FeaturedCollectionsTaskFactory(collectionSearchServiceProvider);
}
@Provides
public UrlShortener providesUrlShortener(
ShortUrlRepository shortUrlRepository,
UrlShortenerApi urlShortenerApi
) {
return new UrlShortenerImpl(shortUrlRepository, urlShortenerApi);
}
@Provides
public ImageInfoService providesImagePropertiesService(
UnsplashApi unsplashApi,
FlickrApi flickrApi,
UnsplashPhotoInfoParser unsplashPhotoInfoParser,
FlickrExifParser flickrExifParser
) {
return new ImageInfoServiceImpl(
unsplashApi,
flickrApi,
unsplashPhotoInfoParser,
flickrExifParser
);
}
@Provides
public CollectionSearchService providesCollectionSearchService(
UnsplashCollectionSearchService unsplashCollectionSearchService,
FlickrTagSearchService flickrTagSearchService
) {
return new CollectionSearchServiceImpl(
unsplashCollectionSearchService,
flickrTagSearchService
);
}
}
| UTF-8 | Java | 3,760 | java | ServiceModule.java | Java | [
{
"context": "/*\n * Copyright {2017} {Aashrey Kamal Sharma}\n *\n * Licensed under the Apache License, Vers",
"end": 44,
"score": 0.9998713731765747,
"start": 24,
"tag": "NAME",
"value": "Aashrey Kamal Sharma"
},
{
"context": "Module;\nimport dagger.Provides;\n\n/**\n * Created by aashreys on 18/02/17.\n */\n\n@Module\npublic class ServiceMod",
"end": 1922,
"score": 0.9996917843818665,
"start": 1914,
"tag": "USERNAME",
"value": "aashreys"
}
] | null | [] | /*
* Copyright {2017} {<NAME>}
*
* 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.aashreys.walls.di.modules;
import com.aashreys.walls.domain.display.collections.search.CollectionSearchService;
import com.aashreys.walls.domain.display.collections.search.CollectionSearchServiceImpl;
import com.aashreys.walls.domain.display.collections.search.FlickrTagSearchService;
import com.aashreys.walls.domain.display.collections.search.UnsplashCollectionSearchService;
import com.aashreys.walls.domain.display.images.ImageInfoService;
import com.aashreys.walls.domain.display.images.ImageInfoServiceImpl;
import com.aashreys.walls.network.UrlShortener;
import com.aashreys.walls.network.UrlShortenerImpl;
import com.aashreys.walls.network.apis.FlickrApi;
import com.aashreys.walls.network.apis.UnsplashApi;
import com.aashreys.walls.network.apis.UrlShortenerApi;
import com.aashreys.walls.network.parsers.FlickrExifParser;
import com.aashreys.walls.network.parsers.UnsplashPhotoInfoParser;
import com.aashreys.walls.network.parsers.UnsplashPhotoResponseParser;
import com.aashreys.walls.persistence.shorturl.ShortUrlRepository;
import com.aashreys.walls.ui.tasks.CollectionSearchTaskFactory;
import com.aashreys.walls.ui.tasks.FeaturedCollectionsTaskFactory;
import javax.inject.Provider;
import dagger.Module;
import dagger.Provides;
/**
* Created by aashreys on 18/02/17.
*/
@Module
public class ServiceModule {
public ServiceModule() {}
@Provides
public UnsplashPhotoResponseParser providesUnsplashImageResponseParser() {
return new UnsplashPhotoResponseParser();
}
@Provides
public CollectionSearchTaskFactory providesCollectionSearchTaskFactory
(Provider<CollectionSearchService> collectionSearchServiceProvider) {
return new CollectionSearchTaskFactory(collectionSearchServiceProvider);
}
@Provides
public FeaturedCollectionsTaskFactory providesFeaturedCollectionsTaskFactory
(Provider<CollectionSearchService> collectionSearchServiceProvider) {
return new FeaturedCollectionsTaskFactory(collectionSearchServiceProvider);
}
@Provides
public UrlShortener providesUrlShortener(
ShortUrlRepository shortUrlRepository,
UrlShortenerApi urlShortenerApi
) {
return new UrlShortenerImpl(shortUrlRepository, urlShortenerApi);
}
@Provides
public ImageInfoService providesImagePropertiesService(
UnsplashApi unsplashApi,
FlickrApi flickrApi,
UnsplashPhotoInfoParser unsplashPhotoInfoParser,
FlickrExifParser flickrExifParser
) {
return new ImageInfoServiceImpl(
unsplashApi,
flickrApi,
unsplashPhotoInfoParser,
flickrExifParser
);
}
@Provides
public CollectionSearchService providesCollectionSearchService(
UnsplashCollectionSearchService unsplashCollectionSearchService,
FlickrTagSearchService flickrTagSearchService
) {
return new CollectionSearchServiceImpl(
unsplashCollectionSearchService,
flickrTagSearchService
);
}
}
| 3,746 | 0.756117 | 0.752394 | 102 | 35.862743 | 29.406895 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.411765 | false | false | 7 |
94e4a3d38c1d617c67a0fd55a788cf28cab4de28 | 22,943,715,360,332 | 1586d808f4677a3398c6b4e042099c9124beab5f | /NPCSim/src/ui/map/SkipDialog.java | b66db0c311bd0dc42e58b0ccc29e0e80a09721f7 | [] | no_license | ThereGoesMySanity/NPCSim | https://github.com/ThereGoesMySanity/NPCSim | 02e07ceaa7a8b17685bc0f56a4797dc0fd49a291 | 09a342404ea6c2aa950a28219ea6aba9552ac58c | refs/heads/master | 2020-04-07T02:07:40.575000 | 2018-11-18T05:46:28 | 2018-11-18T05:46:28 | 157,964,795 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ui.map;
import ui.MainWindow;
import util.Time;
import javax.swing.*;
import javax.swing.border.EmptyBorder;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class SkipDialog extends JDialog implements ChangeListener, ActionListener {
private final int WIDTH = 256, HEIGHT = 128;
private final JLabel lblTime;
private final JSlider slider;
private final Time time;
private int value;
private final MainWindow mw;
/**
* Create the dialog.
*/
public SkipDialog(Time t, MainWindow mw) {
super(mw, true);
time = t;
this.mw = mw;
setBounds(0, 0, WIDTH, HEIGHT);
getContentPane().setLayout(new BorderLayout());
JPanel contentPanel = new JPanel();
contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
getContentPane().add(contentPanel, BorderLayout.CENTER);
contentPanel.setLayout(new BoxLayout(contentPanel, BoxLayout.Y_AXIS));
slider = new JSlider(0, 120, 0);
slider.addChangeListener(this);
contentPanel.add(slider);
lblTime = new JLabel(t.toString());
lblTime.setAlignmentY(Component.TOP_ALIGNMENT);
lblTime.setAlignmentX(Component.CENTER_ALIGNMENT);
contentPanel.add(lblTime);
JPanel buttonPane = new JPanel();
buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
getContentPane().add(buttonPane, BorderLayout.SOUTH);
JButton okButton = new JButton("OK");
okButton.setActionCommand("OK");
okButton.addActionListener(this);
buttonPane.add(okButton);
getRootPane().setDefaultButton(okButton);
JButton cancelButton = new JButton("Cancel");
cancelButton.setActionCommand("Cancel");
cancelButton.addActionListener(this);
buttonPane.add(cancelButton);
}
public int getResult() {
slider.setValue(0);
setLocation(mw.getX() + (mw.getWidth() - WIDTH) / 2, mw.getY() + (mw.getHeight() - HEIGHT) / 2);
setVisible(true);
return value;
}
@Override
public void stateChanged(ChangeEvent e) {
lblTime.setText(time.plus(slider.getValue()).toString());
}
@Override
public void actionPerformed(ActionEvent e) {
if (e.getActionCommand().equals("OK")) {
value = slider.getValue();
} else {
value = 0;
}
this.setVisible(false);
}
}
| UTF-8 | Java | 2,552 | java | SkipDialog.java | Java | [] | null | [] | package ui.map;
import ui.MainWindow;
import util.Time;
import javax.swing.*;
import javax.swing.border.EmptyBorder;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class SkipDialog extends JDialog implements ChangeListener, ActionListener {
private final int WIDTH = 256, HEIGHT = 128;
private final JLabel lblTime;
private final JSlider slider;
private final Time time;
private int value;
private final MainWindow mw;
/**
* Create the dialog.
*/
public SkipDialog(Time t, MainWindow mw) {
super(mw, true);
time = t;
this.mw = mw;
setBounds(0, 0, WIDTH, HEIGHT);
getContentPane().setLayout(new BorderLayout());
JPanel contentPanel = new JPanel();
contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
getContentPane().add(contentPanel, BorderLayout.CENTER);
contentPanel.setLayout(new BoxLayout(contentPanel, BoxLayout.Y_AXIS));
slider = new JSlider(0, 120, 0);
slider.addChangeListener(this);
contentPanel.add(slider);
lblTime = new JLabel(t.toString());
lblTime.setAlignmentY(Component.TOP_ALIGNMENT);
lblTime.setAlignmentX(Component.CENTER_ALIGNMENT);
contentPanel.add(lblTime);
JPanel buttonPane = new JPanel();
buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
getContentPane().add(buttonPane, BorderLayout.SOUTH);
JButton okButton = new JButton("OK");
okButton.setActionCommand("OK");
okButton.addActionListener(this);
buttonPane.add(okButton);
getRootPane().setDefaultButton(okButton);
JButton cancelButton = new JButton("Cancel");
cancelButton.setActionCommand("Cancel");
cancelButton.addActionListener(this);
buttonPane.add(cancelButton);
}
public int getResult() {
slider.setValue(0);
setLocation(mw.getX() + (mw.getWidth() - WIDTH) / 2, mw.getY() + (mw.getHeight() - HEIGHT) / 2);
setVisible(true);
return value;
}
@Override
public void stateChanged(ChangeEvent e) {
lblTime.setText(time.plus(slider.getValue()).toString());
}
@Override
public void actionPerformed(ActionEvent e) {
if (e.getActionCommand().equals("OK")) {
value = slider.getValue();
} else {
value = 0;
}
this.setVisible(false);
}
}
| 2,552 | 0.648511 | 0.640282 | 77 | 32.142857 | 21.406221 | 104 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.883117 | false | false | 7 |
d9060a417c61358a487ce37f9d94f217dfbe147b | 22,943,715,361,630 | 9afae432d18c2301ea2bb0acbabf7265d8943196 | /gwt4jvm/src/test/java/com/mind/gwt/jclient/test/client/ServiceAsync.java | 31f3b262c89f6fb95d469b50941a3a42a43b3d0d | [] | no_license | andrey-vorobiev/gwt4jvm | https://github.com/andrey-vorobiev/gwt4jvm | 208e810cae6f5c0e21ac516a608249dac9447a91 | ddc7321814fb98948a82506fed5ac9fd95fa5016 | refs/heads/master | 2016-09-05T21:18:46.899000 | 2015-08-11T16:06:46 | 2015-08-11T20:39:47 | 40,550,293 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* Copyright 2011 Mind Ltd.
*
* 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.mind.gwt.jclient.test.client;
import java.util.LinkedList;
import java.util.List;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.mind.gwt.jclient.test.dto.Cookie;
import com.mind.gwt.jclient.test.dto.ExtendedCollection;
import com.mind.gwt.jclient.test.dto.ExtendedPrimitives;
import com.mind.gwt.jclient.test.dto.Primitives;
import com.mind.gwt.jclient.test.dto.PrimitiveWrappers;
import com.mind.gwt.jclient.test.dto.AggregatedEnumeration;
import com.mind.gwt.jclient.test.dto.WithStaticNestedClass;
public interface ServiceAsync
{
void putAndGetPrimitiveWrappers(PrimitiveWrappers primitiveWrappers, String reference, AsyncCallback<PrimitiveWrappers> callback);
void putAndGetPrimitives(Primitives primitives, String reference, AsyncCallback<Primitives> callback);
void putAndGetExtendedPrimitives(ExtendedPrimitives extendedPrimitives, String reference, AsyncCallback<ExtendedPrimitives> callback);
void putAndGetWithStaticNestedClass(WithStaticNestedClass withStaticNestedClass, String reference, AsyncCallback<WithStaticNestedClass> callback);
void putAndGetExtendedCollection(ExtendedCollection extendedCollection, String reference, AsyncCallback<ExtendedCollection> callback);
void putAndGetAggregatedEnumeration(AggregatedEnumeration aggregatedEnumeration, String reference, AsyncCallback<AggregatedEnumeration> callback);
void putAndGetList(List<?> list, String reference, AsyncCallback<List<?>> callback);
void putAndGetArray(String[] array, String reference, AsyncCallback<String[]> callback);
void throwCheckedException(String message, AsyncCallback<Void> callback);
void getCookies(AsyncCallback<String> callback);
void setCookies(LinkedList<Cookie> cookies, AsyncCallback<Void> callback);
} | UTF-8 | Java | 2,388 | java | ServiceAsync.java | Java | [] | null | [] | /*
* Copyright 2011 Mind Ltd.
*
* 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.mind.gwt.jclient.test.client;
import java.util.LinkedList;
import java.util.List;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.mind.gwt.jclient.test.dto.Cookie;
import com.mind.gwt.jclient.test.dto.ExtendedCollection;
import com.mind.gwt.jclient.test.dto.ExtendedPrimitives;
import com.mind.gwt.jclient.test.dto.Primitives;
import com.mind.gwt.jclient.test.dto.PrimitiveWrappers;
import com.mind.gwt.jclient.test.dto.AggregatedEnumeration;
import com.mind.gwt.jclient.test.dto.WithStaticNestedClass;
public interface ServiceAsync
{
void putAndGetPrimitiveWrappers(PrimitiveWrappers primitiveWrappers, String reference, AsyncCallback<PrimitiveWrappers> callback);
void putAndGetPrimitives(Primitives primitives, String reference, AsyncCallback<Primitives> callback);
void putAndGetExtendedPrimitives(ExtendedPrimitives extendedPrimitives, String reference, AsyncCallback<ExtendedPrimitives> callback);
void putAndGetWithStaticNestedClass(WithStaticNestedClass withStaticNestedClass, String reference, AsyncCallback<WithStaticNestedClass> callback);
void putAndGetExtendedCollection(ExtendedCollection extendedCollection, String reference, AsyncCallback<ExtendedCollection> callback);
void putAndGetAggregatedEnumeration(AggregatedEnumeration aggregatedEnumeration, String reference, AsyncCallback<AggregatedEnumeration> callback);
void putAndGetList(List<?> list, String reference, AsyncCallback<List<?>> callback);
void putAndGetArray(String[] array, String reference, AsyncCallback<String[]> callback);
void throwCheckedException(String message, AsyncCallback<Void> callback);
void getCookies(AsyncCallback<String> callback);
void setCookies(LinkedList<Cookie> cookies, AsyncCallback<Void> callback);
} | 2,388 | 0.80402 | 0.80067 | 54 | 43.240742 | 44.748653 | 150 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.833333 | false | false | 7 |
c9dd8a87f1a8198718702e1e747f1e451a2018b8 | 1,348,619,762,179 | ad8797fda60ff082c166e7caa5c9f202dec8bee4 | /src/main/java/com/xfhy/common/dto/Filterable.java | 922af1349ea3d2ccdd240446f189ea9fcda9ccec | [] | no_license | xfxiaq/XFDemo | https://github.com/xfxiaq/XFDemo | 11fe0933342ec6331493db63e9b5cf6c01b886b2 | a9e555ebd92530dbd9258dc8ee1af870bf6bcb83 | refs/heads/master | 2020-06-12T11:49:27.898000 | 2016-12-05T02:39:45 | 2016-12-05T02:39:45 | 75,582,416 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.xfhy.common.dto;
import org.springframework.data.domain.Sort;
/**
* ๆฅ่ฏข่ฟๆปคๆกไปถๆฅๅฃใ
*
* @author liuyg
* @version 1.0
*/
public interface Filterable {
/**
* ๅๅพๆฅ่ฏข่ฟๆปคๆกไปถใ
*
* @return ๆฅ่ฏข่ฟๆปคๆกไปถ
*/
public Filter getFilter();
/**
* ๅๅพๆๅบๆกไปถใ
*
* @return ๆๅบๆกไปถ
*/
public Sort getSort();
/**
* ๅๅพๅ็ปๆกไปถใ
*
* @return ๅ็ปๆกไปถ
*/
public GroupUnit[] getGroup();
}
| UTF-8 | Java | 587 | java | Filterable.java | Java | [
{
"context": ".Sort;\r\n\r\n\r\n\r\n\r\n/**\r\n * ๆฅ่ฏข่ฟๆปคๆกไปถๆฅๅฃใ\r\n * \r\n * @author liuyg\r\n * @version 1.0\r\n */\r\npublic interface Filterabl",
"end": 126,
"score": 0.9996169209480286,
"start": 121,
"tag": "USERNAME",
"value": "liuyg"
}
] | null | [] | package com.xfhy.common.dto;
import org.springframework.data.domain.Sort;
/**
* ๆฅ่ฏข่ฟๆปคๆกไปถๆฅๅฃใ
*
* @author liuyg
* @version 1.0
*/
public interface Filterable {
/**
* ๅๅพๆฅ่ฏข่ฟๆปคๆกไปถใ
*
* @return ๆฅ่ฏข่ฟๆปคๆกไปถ
*/
public Filter getFilter();
/**
* ๅๅพๆๅบๆกไปถใ
*
* @return ๆๅบๆกไปถ
*/
public Sort getSort();
/**
* ๅๅพๅ็ปๆกไปถใ
*
* @return ๅ็ปๆกไปถ
*/
public GroupUnit[] getGroup();
}
| 587 | 0.458586 | 0.454545 | 36 | 11.75 | 10.973136 | 44 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.138889 | false | false | 7 |
bab15c6fc5113b242db9e9db3543355bd107a009 | 29,025,388,999,479 | 2399b994f7ca92544de7a8757375902c626f75cf | /app/src/main/java/com/example/mdsuhelrana/helloandroid/AdapterClasses/CmpAdapter.java | b20749e7f209768836ebb9cde70d43cdb3482581 | [] | no_license | mdsuhelrana/crimemanagementsystem | https://github.com/mdsuhelrana/crimemanagementsystem | f518fb53df9a3d32e429cc4279369a156d69ab08 | 44bd18f511a44f5379d1238e6d12da835097a92c | refs/heads/master | 2020-04-06T07:13:50.084000 | 2018-11-27T16:55:55 | 2018-11-27T16:55:55 | 157,264,509 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.mdsuhelrana.helloandroid.AdapterClasses;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import com.example.mdsuhelrana.helloandroid.ModelClasses.CrimeModel;
import com.example.mdsuhelrana.helloandroid.R;
import java.util.ArrayList;
public class CmpAdapter extends BaseAdapter {
private Context context;
private ArrayList<CrimeModel>models;
public CmpAdapter(Context context, ArrayList<CrimeModel> models) {
this.context = context;
this.models = models;
}
@Override
public int getCount() {
return models.size();
}
@Override
public Object getItem(int i) {
return models.get(i);
}
@Override
public long getItemId(int i) {
return i;
}
public class CustomViewHolder{
TextView tvLocation;
TextView tvPostalcode;
TextView tvcity;
TextView tvSubject;
TextView tvComplain;
TextView tvComplainstatus;
TextView tvDate;
}
@Override
public View getView(int i, View view, ViewGroup viewGroup) {
CustomViewHolder viewHolder;
if (view==null){
viewHolder=new CustomViewHolder();
LayoutInflater inflater= (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
view=inflater.inflate(R.layout.complain_single_row,viewGroup,false);
viewHolder.tvLocation=view.findViewById(R.id.tv_location_Id);
viewHolder.tvPostalcode=view.findViewById(R.id.tv_postalcode_Id);
viewHolder.tvcity=view.findViewById(R.id.tv_city_Id);
viewHolder.tvDate=view.findViewById(R.id.tv_date_Id);
viewHolder.tvSubject=view.findViewById(R.id.tv_subject_Id);
viewHolder.tvComplain=view.findViewById(R.id.tv_complain_Id);
viewHolder.tvComplainstatus=view.findViewById(R.id.tvComplainstaust_Id);
view.setTag(viewHolder);
}else {
viewHolder= (CustomViewHolder) view.getTag();
}
viewHolder.tvLocation.setText(models.get(i).getLocation());
viewHolder.tvPostalcode.setText(models.get(i).getPostalcode());
viewHolder.tvcity.setText(models.get(i).getCity());
viewHolder.tvDate.setText(models.get(i).getDate());
viewHolder.tvSubject.setText(models.get(i).getSubject());
viewHolder.tvComplain.setText(models.get(i).getComplain());
viewHolder.tvComplainstatus.setText(models.get(i).getComplainstaus());
return view;
}
public void aupdateAdaper(ArrayList<CrimeModel> models){
this.models=models;
notifyDataSetChanged();
}
}
| UTF-8 | Java | 2,787 | java | CmpAdapter.java | Java | [
{
"context": "package com.example.mdsuhelrana.helloandroid.AdapterClasses;\n\nimport android.cont",
"end": 31,
"score": 0.6732971668243408,
"start": 20,
"tag": "USERNAME",
"value": "mdsuhelrana"
},
{
"context": "port android.widget.TextView;\n\nimport com.example.mdsuhelrana.helloandroid.ModelClasses.CrimeModel;\nimport com.",
"end": 285,
"score": 0.8214465379714966,
"start": 274,
"tag": "USERNAME",
"value": "mdsuhelrana"
},
{
"context": "droid.ModelClasses.CrimeModel;\nimport com.example.mdsuhelrana.helloandroid.R;\nimport java.util.ArrayList;\n\n\npub",
"end": 354,
"score": 0.7978190183639526,
"start": 343,
"tag": "USERNAME",
"value": "mdsuhelrana"
}
] | null | [] | package com.example.mdsuhelrana.helloandroid.AdapterClasses;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import com.example.mdsuhelrana.helloandroid.ModelClasses.CrimeModel;
import com.example.mdsuhelrana.helloandroid.R;
import java.util.ArrayList;
public class CmpAdapter extends BaseAdapter {
private Context context;
private ArrayList<CrimeModel>models;
public CmpAdapter(Context context, ArrayList<CrimeModel> models) {
this.context = context;
this.models = models;
}
@Override
public int getCount() {
return models.size();
}
@Override
public Object getItem(int i) {
return models.get(i);
}
@Override
public long getItemId(int i) {
return i;
}
public class CustomViewHolder{
TextView tvLocation;
TextView tvPostalcode;
TextView tvcity;
TextView tvSubject;
TextView tvComplain;
TextView tvComplainstatus;
TextView tvDate;
}
@Override
public View getView(int i, View view, ViewGroup viewGroup) {
CustomViewHolder viewHolder;
if (view==null){
viewHolder=new CustomViewHolder();
LayoutInflater inflater= (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
view=inflater.inflate(R.layout.complain_single_row,viewGroup,false);
viewHolder.tvLocation=view.findViewById(R.id.tv_location_Id);
viewHolder.tvPostalcode=view.findViewById(R.id.tv_postalcode_Id);
viewHolder.tvcity=view.findViewById(R.id.tv_city_Id);
viewHolder.tvDate=view.findViewById(R.id.tv_date_Id);
viewHolder.tvSubject=view.findViewById(R.id.tv_subject_Id);
viewHolder.tvComplain=view.findViewById(R.id.tv_complain_Id);
viewHolder.tvComplainstatus=view.findViewById(R.id.tvComplainstaust_Id);
view.setTag(viewHolder);
}else {
viewHolder= (CustomViewHolder) view.getTag();
}
viewHolder.tvLocation.setText(models.get(i).getLocation());
viewHolder.tvPostalcode.setText(models.get(i).getPostalcode());
viewHolder.tvcity.setText(models.get(i).getCity());
viewHolder.tvDate.setText(models.get(i).getDate());
viewHolder.tvSubject.setText(models.get(i).getSubject());
viewHolder.tvComplain.setText(models.get(i).getComplain());
viewHolder.tvComplainstatus.setText(models.get(i).getComplainstaus());
return view;
}
public void aupdateAdaper(ArrayList<CrimeModel> models){
this.models=models;
notifyDataSetChanged();
}
}
| 2,787 | 0.683531 | 0.683531 | 80 | 33.837502 | 26.186087 | 112 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.65 | false | false | 7 |
e7cab0ed19a2d5756ba2f68b6edde4f4d5c189b8 | 28,406,913,729,161 | b9ef1a9649c125cdaacbe8e6b900c5ddbf7bbe4e | /src/main/java/characters/CharacterType.java | bedfe0ac2beb955cd8052d43081bf6cd9fe8a71c | [] | no_license | stephensanchez/familiar | https://github.com/stephensanchez/familiar | db6acf6a3146b2a9cad73aaf51e0e742a0d59d22 | efdc8f1dbfb04bee787db214924bd7920fba7f92 | refs/heads/master | 2021-01-20T10:37:10.525000 | 2017-08-03T17:16:54 | 2017-08-03T17:16:54 | 9,731,749 | 0 | 0 | null | false | 2015-04-01T01:45:31 | 2013-04-28T15:23:39 | 2015-04-01T01:45:31 | 2015-04-01T01:45:31 | 1,056 | 0 | 0 | 0 | Java | null | null | package characters;
/**
* Every {@link Character} is associated with a CharacterType, which defines the attributes of the Character. For
* example, is this a 5th Edition Character, or a 4th Edition? Is it an NPC, monster, or Player? A CharacterType is
* much like a Character Sheet, outlining all the information needed, or expected, to use this character.
*/
public interface CharacterType {
}
| UTF-8 | Java | 400 | java | CharacterType.java | Java | [] | null | [] | package characters;
/**
* Every {@link Character} is associated with a CharacterType, which defines the attributes of the Character. For
* example, is this a 5th Edition Character, or a 4th Edition? Is it an NPC, monster, or Player? A CharacterType is
* much like a Character Sheet, outlining all the information needed, or expected, to use this character.
*/
public interface CharacterType {
}
| 400 | 0.76 | 0.755 | 9 | 43.444443 | 48.803715 | 115 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1 | false | false | 7 |
42160585f5ffccfece497b7bb5b06402e5992bc5 | 19,602,230,783,321 | b92b885bdbf4ac3e2a869ce34da548f4f922046a | /helloworld/src/main/java/com/threadpool/ThreadPoolTest.java | 6965bedc3a6278303c361a60c2ee3d8df69708a2 | [] | no_license | taoqianxi/spring-cloud | https://github.com/taoqianxi/spring-cloud | 3dac9219d020fbbb3fa1e38489038a8f7e443d7a | 44130722c6d8441e8f8a089f68ff2dc0da9a9fc1 | refs/heads/master | 2020-11-26T17:55:24.065000 | 2020-07-27T06:40:22 | 2020-07-27T06:40:22 | 229,165,810 | 0 | 0 | null | false | 2020-06-10T06:49:14 | 2019-12-20T01:17:01 | 2020-06-10T06:48:53 | 2020-06-10T06:49:13 | 65 | 0 | 0 | 1 | Java | false | false | package com.threadpool;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;
public class ThreadPoolTest {
public static void main(String[] args) throws InterruptedException {
long startTime = System.currentTimeMillis();
ExecutorService executor = Executors.newFixedThreadPool(5);
CountDownLatch countDownLatch = new CountDownLatch(5);
for (int i = 0; i < 5; i++) {
int finalI = i;
executor.execute(()->{
for (int j = 0; j < 100000; j++) {
System.err.println(finalI);
System.err.println(Thread.currentThread().getName());
}
countDownLatch.countDown();
});
}
System.err.println("็บฟ็จ็กไบ=============");
countDownLatch.await();
long endTime = System.currentTimeMillis(); //่ทๅ็ปๆๆถ้ด
System.out.println("็จๅบ่ฟ่กๆถ้ด๏ผ" + (endTime - startTime) + "ms"); //่พๅบ็จๅบ่ฟ่กๆถ้ด
}
}
| UTF-8 | Java | 1,139 | java | ThreadPoolTest.java | Java | [] | null | [] | package com.threadpool;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;
public class ThreadPoolTest {
public static void main(String[] args) throws InterruptedException {
long startTime = System.currentTimeMillis();
ExecutorService executor = Executors.newFixedThreadPool(5);
CountDownLatch countDownLatch = new CountDownLatch(5);
for (int i = 0; i < 5; i++) {
int finalI = i;
executor.execute(()->{
for (int j = 0; j < 100000; j++) {
System.err.println(finalI);
System.err.println(Thread.currentThread().getName());
}
countDownLatch.countDown();
});
}
System.err.println("็บฟ็จ็กไบ=============");
countDownLatch.await();
long endTime = System.currentTimeMillis(); //่ทๅ็ปๆๆถ้ด
System.out.println("็จๅบ่ฟ่กๆถ้ด๏ผ" + (endTime - startTime) + "ms"); //่พๅบ็จๅบ่ฟ่กๆถ้ด
}
}
| 1,139 | 0.598714 | 0.588613 | 30 | 35.299999 | 24.087549 | 83 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.7 | false | false | 7 |
372b16a9f397e612b6f42bfe13a0e5fe23e5e87f | 24,266,565,269,860 | 7da2a6e21cf22a1f158ec47af2a7e163bf14f708 | /app/src/main/java/ru/ovod/carinspection/adapters/CarInspectionAdapter.java | 82f526779876fb96374175d555c2bd9eff5a8b1a | [] | no_license | gh0st820/CarInspection | https://github.com/gh0st820/CarInspection | 7a58e533923828909447191b46c1dd34a7878496 | caf0753c9f26bc7167adbb5dba0889ebf40d6f65 | refs/heads/master | 2020-04-10T00:20:46.958000 | 2018-12-24T10:07:39 | 2018-12-24T10:07:39 | 160,682,822 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ru.ovod.carinspection.adapters;
import android.content.Context;
import android.net.Uri;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.design.widget.FloatingActionButton;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.TextView;
import com.squareup.picasso.Picasso;
import java.io.File;
import java.text.SimpleDateFormat;
import ru.ovod.carinspection.CarInspectionsActivity;
import ru.ovod.carinspection.R;
import ru.ovod.carinspection.helpers.PhotoHelper;
import ru.ovod.carinspection.helpers.SysHelper;
import ru.ovod.carinspection.pojo.Inspection;
public class CarInspectionAdapter extends ArrayAdapter<Inspection> {
private Context context;
private boolean isDelVisible;
static class ViewHolderItem {
private TextView photoCo;
private TextView number;
private TextView date;
private TextView model;
private TextView vin;
private CheckBox isSynced;
private ImageView img;
private FloatingActionButton fab;
}
public CarInspectionAdapter(Context context) {
super(context, R.layout.activity_carinspections_item);
this.context = context;
isDelVisible = false;
}
@NonNull
@Override
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
ViewHolderItem viewHolder;
final Inspection item = getItem(position);
if(convertView==null){
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE );
convertView = inflater.inflate(R.layout.activity_carinspections_item, parent, false);
// well set up the ViewHolder
viewHolder = new ViewHolderItem();
viewHolder.photoCo = (TextView) convertView.findViewById(R.id.viewPhotoCo);
viewHolder.number = (TextView) convertView.findViewById(R.id.viewNumber);
viewHolder.date = (TextView) convertView.findViewById(R.id.viewDate);
viewHolder.model = (TextView) convertView.findViewById(R.id.viewModel);
viewHolder.vin = (TextView) convertView.findViewById(R.id.viewVIN);
viewHolder.isSynced = (CheckBox) convertView.findViewById(R.id.chbIsSynced);
viewHolder.img = (ImageView) convertView.findViewById(R.id.img);
viewHolder.fab = (FloatingActionButton) convertView.findViewById(R.id.fab);
viewHolder.fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
try {
((CarInspectionsActivity) context).delInspection(item);
CarInspectionAdapter.this.remove(item);
notifyDataSetChanged();
} catch (Exception e) {
}
}
});
// store the holder with the view.
convertView.setTag(viewHolder);
}else{
viewHolder = (ViewHolderItem) convertView.getTag();
}
if(item != null) {
if (item.getPhotoCo() > 0) {
viewHolder.photoCo.setText(String.valueOf(item.getPhotoCo()));
} else {
viewHolder.photoCo.setText("");
}
viewHolder.number.setText(String.valueOf(item.getNumber()));
if (item.getDate().getTime() == 0) {
viewHolder.date.setText("");
}else {
SimpleDateFormat dateFormat = new SimpleDateFormat("dd.mm.yyyy");
viewHolder.date.setText(dateFormat.format(item.getDate()));
}
viewHolder.model.setText(item.getModel());
viewHolder.vin.setText(item.getVin());
viewHolder.isSynced.setChecked(item.getIssync() == 1);
if (item.getPath() != null) {
float angle = new PhotoHelper().getRotateAngle(item.getPath());
File file = new File(item.getPath());
Uri photoURI = SysHelper.getInstance(null).getUri(file);
Picasso.get()
.load(photoURI)
.resize(100, 100)
.rotate(angle)
.into(viewHolder.img);
}
if (isDelVisible) {
viewHolder.fab.show();
} else {
viewHolder.fab.hide();
}
convertView.setTag(viewHolder);
}
return convertView;
}
public void showDelBtn(boolean isVisible){
isDelVisible = isVisible;
notifyDataSetChanged();
}
}
| UTF-8 | Java | 4,874 | java | CarInspectionAdapter.java | Java | [] | null | [] | package ru.ovod.carinspection.adapters;
import android.content.Context;
import android.net.Uri;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.design.widget.FloatingActionButton;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.TextView;
import com.squareup.picasso.Picasso;
import java.io.File;
import java.text.SimpleDateFormat;
import ru.ovod.carinspection.CarInspectionsActivity;
import ru.ovod.carinspection.R;
import ru.ovod.carinspection.helpers.PhotoHelper;
import ru.ovod.carinspection.helpers.SysHelper;
import ru.ovod.carinspection.pojo.Inspection;
public class CarInspectionAdapter extends ArrayAdapter<Inspection> {
private Context context;
private boolean isDelVisible;
static class ViewHolderItem {
private TextView photoCo;
private TextView number;
private TextView date;
private TextView model;
private TextView vin;
private CheckBox isSynced;
private ImageView img;
private FloatingActionButton fab;
}
public CarInspectionAdapter(Context context) {
super(context, R.layout.activity_carinspections_item);
this.context = context;
isDelVisible = false;
}
@NonNull
@Override
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
ViewHolderItem viewHolder;
final Inspection item = getItem(position);
if(convertView==null){
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE );
convertView = inflater.inflate(R.layout.activity_carinspections_item, parent, false);
// well set up the ViewHolder
viewHolder = new ViewHolderItem();
viewHolder.photoCo = (TextView) convertView.findViewById(R.id.viewPhotoCo);
viewHolder.number = (TextView) convertView.findViewById(R.id.viewNumber);
viewHolder.date = (TextView) convertView.findViewById(R.id.viewDate);
viewHolder.model = (TextView) convertView.findViewById(R.id.viewModel);
viewHolder.vin = (TextView) convertView.findViewById(R.id.viewVIN);
viewHolder.isSynced = (CheckBox) convertView.findViewById(R.id.chbIsSynced);
viewHolder.img = (ImageView) convertView.findViewById(R.id.img);
viewHolder.fab = (FloatingActionButton) convertView.findViewById(R.id.fab);
viewHolder.fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
try {
((CarInspectionsActivity) context).delInspection(item);
CarInspectionAdapter.this.remove(item);
notifyDataSetChanged();
} catch (Exception e) {
}
}
});
// store the holder with the view.
convertView.setTag(viewHolder);
}else{
viewHolder = (ViewHolderItem) convertView.getTag();
}
if(item != null) {
if (item.getPhotoCo() > 0) {
viewHolder.photoCo.setText(String.valueOf(item.getPhotoCo()));
} else {
viewHolder.photoCo.setText("");
}
viewHolder.number.setText(String.valueOf(item.getNumber()));
if (item.getDate().getTime() == 0) {
viewHolder.date.setText("");
}else {
SimpleDateFormat dateFormat = new SimpleDateFormat("dd.mm.yyyy");
viewHolder.date.setText(dateFormat.format(item.getDate()));
}
viewHolder.model.setText(item.getModel());
viewHolder.vin.setText(item.getVin());
viewHolder.isSynced.setChecked(item.getIssync() == 1);
if (item.getPath() != null) {
float angle = new PhotoHelper().getRotateAngle(item.getPath());
File file = new File(item.getPath());
Uri photoURI = SysHelper.getInstance(null).getUri(file);
Picasso.get()
.load(photoURI)
.resize(100, 100)
.rotate(angle)
.into(viewHolder.img);
}
if (isDelVisible) {
viewHolder.fab.show();
} else {
viewHolder.fab.hide();
}
convertView.setTag(viewHolder);
}
return convertView;
}
public void showDelBtn(boolean isVisible){
isDelVisible = isVisible;
notifyDataSetChanged();
}
}
| 4,874 | 0.617152 | 0.615306 | 138 | 34.31884 | 26.588377 | 114 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.565217 | false | false | 7 |
b58d824a0708b9a2a918f805f915a0d70f0495d8 | 21,878,563,417,356 | 5330a6d121116ed2b4b0ca915338222865a1918a | /java/varargs/DisplayContents.java | 029b494da56e4e6efc681f3c0dfa2b684c607c5a | [] | no_license | ionnich/code-dump | https://github.com/ionnich/code-dump | e8a6b6a96b8cf1d73f5db2f321dd63bfdeb486b1 | aa557f7581669c36b61dfa1a03c703284367a0d5 | refs/heads/master | 2023-03-12T18:59:45.327000 | 2021-02-17T11:43:27 | 2021-02-17T11:43:27 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package varargs;
import java.util.stream.IntStream;
public class DisplayContents {
public static void displayContents(double... x) {
for (double num : x) {
System.out.println(
num + " at index: " + IntStream.range(0, x.length).filter(i -> x[i] == num).findFirst().orElse(-1));
}
}
public static void displayContents(int... x) {
for (int i = 0; i < x.length; i++) {
System.out.println(x[i] + "at index: " + i);
}
}
public static void displayContents(float... x) {
for (int i = 0; i < x.length; i++) {
System.out.println(x[i]);
}
}
}
| UTF-8 | Java | 665 | java | DisplayContents.java | Java | [] | null | [] | package varargs;
import java.util.stream.IntStream;
public class DisplayContents {
public static void displayContents(double... x) {
for (double num : x) {
System.out.println(
num + " at index: " + IntStream.range(0, x.length).filter(i -> x[i] == num).findFirst().orElse(-1));
}
}
public static void displayContents(int... x) {
for (int i = 0; i < x.length; i++) {
System.out.println(x[i] + "at index: " + i);
}
}
public static void displayContents(float... x) {
for (int i = 0; i < x.length; i++) {
System.out.println(x[i]);
}
}
}
| 665 | 0.520301 | 0.514286 | 25 | 25.6 | 27.493999 | 120 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.4 | false | false | 7 |
1650e5ff49d859d0d97f80c76963c407b066897b | 31,061,203,495,963 | 72f1cf66be6ec3ae55a77420a0916f6838c09b26 | /notice/src/main/java/com/huhushengdai/notice/widget/MyTextView.java | b70515105e203c5d4a1601121cb1020bd378184c | [] | no_license | huhushengdai/ViewTest | https://github.com/huhushengdai/ViewTest | c377efa8bbb5352c644ddabe4a50f9416113ac89 | 07c2d3397b31d9f7a519b091b8dad5f05208de0d | refs/heads/master | 2020-04-05T11:21:26.848000 | 2017-08-22T11:50:27 | 2017-08-22T11:50:27 | 81,414,895 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.huhushengdai.notice.widget;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.TextView;
/**
* Date๏ผ 2017/4/6
* Description:
*
* @author WangLizhi
* @version 1.0
*/
public class MyTextView extends TextView{
public MyTextView(Context context) {
super(context);
}
public MyTextView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public MyTextView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
}
| UTF-8 | Java | 569 | java | MyTextView.java | Java | [
{
"context": "**\n * Date๏ผ 2017/4/6\n * Description:\n *\n * @author WangLizhi\n * @version 1.0\n */\npublic class MyTextView exten",
"end": 201,
"score": 0.9954301714897156,
"start": 192,
"tag": "NAME",
"value": "WangLizhi"
}
] | null | [] | package com.huhushengdai.notice.widget;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.TextView;
/**
* Date๏ผ 2017/4/6
* Description:
*
* @author WangLizhi
* @version 1.0
*/
public class MyTextView extends TextView{
public MyTextView(Context context) {
super(context);
}
public MyTextView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public MyTextView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
}
| 569 | 0.696649 | 0.68254 | 26 | 20.807692 | 20.420614 | 78 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false | 7 |
3c6872b8ff0358cd802a5ef7ad6a53f4c200636a | 10,969,346,518,498 | 148765243706b56fe6aee326834a4d0494a7666b | /data-structures-and-algorithms/insertion-sort/src/main/java/playground/dsa/insertionSort/Main.java | de33a67130c2a3a365b158daa01dfa2cff49de42 | [
"Apache-2.0"
] | permissive | NovaOrdis/playground | https://github.com/NovaOrdis/playground | 3607c0cabc57fc0f1884ee62ee975c6799cc0dcd | 6a63a87f2e78c24bd70a11ded635f27c22f876a4 | refs/heads/master | 2020-04-15T15:22:06.983000 | 2020-04-06T22:55:02 | 2020-04-06T22:55:02 | 49,339,629 | 5 | 10 | null | null | null | null | null | null | null | null | null | null | null | null | null | package playground.dsa.insertionSort;
import playground.dsa.common.DSA;
public class Main {
public static void main(String[] args) {
// int[] a = DSA.unsortedArray(20, 10);
//
// DSA.printArray(a);
//
// new InsertionSort().sort(a);
//
// DSA.printArray(a);
DSA.test(100000, 400, 20, new InsertionSort(), false);
}
}
| UTF-8 | Java | 368 | java | Main.java | Java | [] | null | [] | package playground.dsa.insertionSort;
import playground.dsa.common.DSA;
public class Main {
public static void main(String[] args) {
// int[] a = DSA.unsortedArray(20, 10);
//
// DSA.printArray(a);
//
// new InsertionSort().sort(a);
//
// DSA.printArray(a);
DSA.test(100000, 400, 20, new InsertionSort(), false);
}
}
| 368 | 0.592391 | 0.55163 | 21 | 16.523809 | 19.55607 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.571429 | false | false | 7 |
7eadb585b62be13c2822f7a0cf5cf7c2ff0f0d0e | 6,090,263,643,692 | dc1c1df3f1b08b2da0776b899e2edf96b29531a0 | /app/src/main/java/com/socialpresencenetwork/phodo/FriendsActivity.java | 0d6b8f17bd948537406e506340699fea64f3a3bc | [] | no_license | RekhaNarwal/AndroidLoginAndRegistration | https://github.com/RekhaNarwal/AndroidLoginAndRegistration | 13da0b0087db99176f540d48ae77f23525742c08 | cfb5a4b9609f6752b12bb6c4efc579dd2f8f47b9 | refs/heads/master | 2020-05-17T00:42:28.492000 | 2015-08-05T12:49:44 | 2015-08-05T12:49:44 | 32,401,422 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.socialpresencenetwork.phodo;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.ContextMenu;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
public class FriendsActivity extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View v=inflater.inflate(R.layout.activity_friends,container,false);
return v;
}
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo)
{
super.onCreateContextMenu(menu, v, menuInfo);
MenuInflater inflater = getActivity().getMenuInflater();
inflater.inflate(R.menu.menu_friends, menu);
}
}
| UTF-8 | Java | 1,004 | java | FriendsActivity.java | Java | [] | null | [] | package com.socialpresencenetwork.phodo;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.ContextMenu;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
public class FriendsActivity extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View v=inflater.inflate(R.layout.activity_friends,container,false);
return v;
}
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo)
{
super.onCreateContextMenu(menu, v, menuInfo);
MenuInflater inflater = getActivity().getMenuInflater();
inflater.inflate(R.menu.menu_friends, menu);
}
}
| 1,004 | 0.770916 | 0.768924 | 31 | 31.387096 | 29.163254 | 123 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.83871 | false | false | 7 |
062218550f8c9d47e9b4c8dec43ad7e1e741ede8 | 31,714,038,567,592 | b08197d677db0b62347c2042097b362b1fcc3c10 | /src/main/java/chess/model/gameCreator/NormalBoardCreatingStrategy.java | 71598600db898134119982bb2a1ad3ae3189097a | [] | no_license | gch01410/java-chess | https://github.com/gch01410/java-chess | 73e36d928960564192b81032e677ede2c0b268a6 | dbd930197a18d3fa23eea78681a26411ce38f72e | refs/heads/master | 2020-06-04T19:00:55.162000 | 2019-06-27T15:06:19 | 2019-06-27T15:06:19 | 192,155,453 | 0 | 0 | null | true | 2019-06-16T05:53:20 | 2019-06-16T05:53:19 | 2019-06-15T01:02:32 | 2019-06-15T06:51:08 | 53 | 0 | 0 | 0 | null | false | false | package chess.model.gameCreator;
import chess.model.board.BoardDTO;
import chess.model.board.Tile;
import chess.model.piece.*;
import java.util.*;
import java.util.function.Function;
import static chess.model.board.Board.*;
public class NormalBoardCreatingStrategy implements BoardCreatingStrategy {
private static Map<String, Function<String, Tile>> pieces = new HashMap<>();
private static final String MOVED_PAWN = "moved";
private static final String MOVED_BLACK_PAWN = "movedP";
private static final String MOVED_WHITE_PAWN = "movedp";
private BoardDTO dto;
static {
pieces.put(BLACK_KING, (coordinate) -> new Tile(coordinate, new King(BLACK_TEAM)));
pieces.put(BLACK_QUEEN, (coordinate) -> new Tile(coordinate, new Queen(BLACK_TEAM)));
pieces.put(BLACK_BISHOP, (coordinate) -> new Tile(coordinate, new Bishop(BLACK_TEAM)));
pieces.put(BLACK_ROOK, (coordinate) -> new Tile(coordinate, new Rook(BLACK_TEAM)));
pieces.put(BLACK_KNIGHT, (coordinate) -> new Tile(coordinate, new Knight(BLACK_TEAM)));
pieces.put(BLACK_PAWN, (coordinate) -> new Tile(coordinate, new Pawn(true, BLACK_TEAM)));
pieces.put(MOVED_BLACK_PAWN, (coordinate) -> new Tile(coordinate, new Pawn(false, BLACK_TEAM)));
pieces.put(WHITE_KING, (coordinate) -> new Tile(coordinate, new King(WHITE_TEAM)));
pieces.put(WHITE_QUEEN, (coordinate) -> new Tile(coordinate, new Queen(WHITE_TEAM)));
pieces.put(WHITE_BISHOP, (coordinate) -> new Tile(coordinate, new Bishop(WHITE_TEAM)));
pieces.put(WHITE_ROOK, (coordinate) -> new Tile(coordinate, new Rook(WHITE_TEAM)));
pieces.put(WHITE_KNIGHT, (coordinate) -> new Tile(coordinate, new Knight(WHITE_TEAM)));
pieces.put(WHITE_PAWN, (coordinate) -> new Tile(coordinate, new Pawn(true, WHITE_TEAM)));
pieces.put(MOVED_WHITE_PAWN, (coordinate) -> new Tile(coordinate, new Pawn(false, WHITE_TEAM)));
pieces.put(EMPTY, (coordinate) -> new Tile(coordinate, null));
}
public NormalBoardCreatingStrategy(BoardDTO dto) {
this.dto = dto;
}
@Override
public Map<String, Tile> create() {
Map<String, Tile> tiles = new HashMap<>();
List<String> pieces = dto.getPieces();
Collections.reverse(pieces);
for (int row = ROW_SIZE - INITIAL_ROW; row >= 0; row--) {
String piecesByRow = pieces.get(row);
registerTile(tiles, row, piecesByRow);
}
return tiles;
}
private void registerTile(Map<String, Tile> tiles, int row, String piecesByRow) {
for (int column = INITIAL_COLUMN; column <= COLUMN_SIZE; column++) {
String piece = piecesByRow.substring(column - 1, column);
String coordinate = String.valueOf(column) + (INITIAL_ROW + row);
if (BLACK_PAWN.equals(piece) && (INITIAL_ROW + row) == BLACK_PAWN_ROW) {
piece = MOVED_PAWN.concat(piece);
}
if (WHITE_PAWN.equals(piece) && (INITIAL_ROW + row) == WHITE_PAWN_ROW) {
piece = MOVED_PAWN.concat(piece);
}
tiles.put(coordinate, NormalBoardCreatingStrategy.pieces.get(piece).apply(coordinate));
}
}
}
| UTF-8 | Java | 3,241 | java | NormalBoardCreatingStrategy.java | Java | [] | null | [] | package chess.model.gameCreator;
import chess.model.board.BoardDTO;
import chess.model.board.Tile;
import chess.model.piece.*;
import java.util.*;
import java.util.function.Function;
import static chess.model.board.Board.*;
public class NormalBoardCreatingStrategy implements BoardCreatingStrategy {
private static Map<String, Function<String, Tile>> pieces = new HashMap<>();
private static final String MOVED_PAWN = "moved";
private static final String MOVED_BLACK_PAWN = "movedP";
private static final String MOVED_WHITE_PAWN = "movedp";
private BoardDTO dto;
static {
pieces.put(BLACK_KING, (coordinate) -> new Tile(coordinate, new King(BLACK_TEAM)));
pieces.put(BLACK_QUEEN, (coordinate) -> new Tile(coordinate, new Queen(BLACK_TEAM)));
pieces.put(BLACK_BISHOP, (coordinate) -> new Tile(coordinate, new Bishop(BLACK_TEAM)));
pieces.put(BLACK_ROOK, (coordinate) -> new Tile(coordinate, new Rook(BLACK_TEAM)));
pieces.put(BLACK_KNIGHT, (coordinate) -> new Tile(coordinate, new Knight(BLACK_TEAM)));
pieces.put(BLACK_PAWN, (coordinate) -> new Tile(coordinate, new Pawn(true, BLACK_TEAM)));
pieces.put(MOVED_BLACK_PAWN, (coordinate) -> new Tile(coordinate, new Pawn(false, BLACK_TEAM)));
pieces.put(WHITE_KING, (coordinate) -> new Tile(coordinate, new King(WHITE_TEAM)));
pieces.put(WHITE_QUEEN, (coordinate) -> new Tile(coordinate, new Queen(WHITE_TEAM)));
pieces.put(WHITE_BISHOP, (coordinate) -> new Tile(coordinate, new Bishop(WHITE_TEAM)));
pieces.put(WHITE_ROOK, (coordinate) -> new Tile(coordinate, new Rook(WHITE_TEAM)));
pieces.put(WHITE_KNIGHT, (coordinate) -> new Tile(coordinate, new Knight(WHITE_TEAM)));
pieces.put(WHITE_PAWN, (coordinate) -> new Tile(coordinate, new Pawn(true, WHITE_TEAM)));
pieces.put(MOVED_WHITE_PAWN, (coordinate) -> new Tile(coordinate, new Pawn(false, WHITE_TEAM)));
pieces.put(EMPTY, (coordinate) -> new Tile(coordinate, null));
}
public NormalBoardCreatingStrategy(BoardDTO dto) {
this.dto = dto;
}
@Override
public Map<String, Tile> create() {
Map<String, Tile> tiles = new HashMap<>();
List<String> pieces = dto.getPieces();
Collections.reverse(pieces);
for (int row = ROW_SIZE - INITIAL_ROW; row >= 0; row--) {
String piecesByRow = pieces.get(row);
registerTile(tiles, row, piecesByRow);
}
return tiles;
}
private void registerTile(Map<String, Tile> tiles, int row, String piecesByRow) {
for (int column = INITIAL_COLUMN; column <= COLUMN_SIZE; column++) {
String piece = piecesByRow.substring(column - 1, column);
String coordinate = String.valueOf(column) + (INITIAL_ROW + row);
if (BLACK_PAWN.equals(piece) && (INITIAL_ROW + row) == BLACK_PAWN_ROW) {
piece = MOVED_PAWN.concat(piece);
}
if (WHITE_PAWN.equals(piece) && (INITIAL_ROW + row) == WHITE_PAWN_ROW) {
piece = MOVED_PAWN.concat(piece);
}
tiles.put(coordinate, NormalBoardCreatingStrategy.pieces.get(piece).apply(coordinate));
}
}
}
| 3,241 | 0.645788 | 0.645171 | 74 | 42.797298 | 36.715111 | 104 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.189189 | false | false | 7 |
83ea255b8d27e168cb3ccd2a51e82eea8b33f8b0 | 25,280,177,549,096 | 10eec5ba9e6dc59478cdc0d7522ff7fc6c94cd94 | /maind/src/main/java/com/vvt/qq/internal/ForwardExtra.java | e7fb4eacee90119d53b65d3e74cdab99a82fe9b6 | [] | no_license | EchoAGI/Flexispy.re | https://github.com/EchoAGI/Flexispy.re | a2f5fec409db083ee3fe0d664dc2cca7f9a4f234 | ba65a5b8b033b92c5867759f2727c5141b7e92fc | refs/heads/master | 2023-04-26T02:52:18.732000 | 2018-07-16T07:46:56 | 2018-07-16T07:46:56 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.vvt.qq.internal;
import com.vvt.qq.internal.pb.MessageMicro;
import com.vvt.qq.internal.pb.MessageMicro.FieldMap;
import com.vvt.qq.internal.pb.PBField;
import com.vvt.qq.internal.pb.PBInt32Field;
import com.vvt.qq.internal.pb.PBStringField;
import com.vvt.qq.internal.pb.PBUInt64Field;
public final class ForwardExtra
extends MessageMicro
{
static final MessageMicro.FieldMap __fieldMap__;
public final PBInt32Field foward_orgFileSizeType;
public final PBUInt64Field foward_orgId;
public final PBStringField foward_orgUin;
public final PBInt32Field foward_orgUinType;
public final PBStringField foward_orgUrl;
public final PBStringField foward_thumbPath;
static
{
int i = 2;
int j = 1;
long l = 489L;
int k = 6;
int[] arrayOfInt = new int[k];
int[] tmp20_18 = arrayOfInt;
int[] tmp21_20 = tmp20_18;
int[] tmp21_20 = tmp20_18;
tmp21_20[0] = 8;
tmp21_20[1] = 18;
int[] tmp30_21 = tmp21_20;
int[] tmp30_21 = tmp21_20;
tmp30_21[2] = 24;
tmp30_21[3] = 34;
tmp30_21[4] = 42;
tmp30_21[5] = 48;
String[] arrayOfString = new String[k];
arrayOfString[0] = "foward_orgId";
arrayOfString[j] = "foward_orgUin";
arrayOfString[i] = "foward_orgUinType";
arrayOfString[3] = "foward_orgUrl";
arrayOfString[4] = "foward_thumbPath";
arrayOfString[5] = "foward_orgFileSizeType";
Object[] arrayOfObject = new Object[k];
Object localObject1 = Long.valueOf(0L);
arrayOfObject[0] = localObject1;
localObject1 = Long.valueOf(l);
arrayOfObject[j] = localObject1;
localObject1 = Integer.valueOf(0);
arrayOfObject[i] = localObject1;
Object localObject2 = Long.valueOf(l);
arrayOfObject[3] = localObject2;
localObject2 = Long.valueOf(l);
arrayOfObject[4] = localObject2;
localObject2 = Integer.valueOf(0);
arrayOfObject[5] = localObject2;
__fieldMap__ = MessageMicro.initFieldMap(arrayOfInt, arrayOfString, arrayOfObject, ForwardExtra.class);
}
public ForwardExtra()
{
Object localObject = PBField.initUInt64(0L);
this.foward_orgId = ((PBUInt64Field)localObject);
localObject = PBField.initString("foward_orgUin");
this.foward_orgUin = ((PBStringField)localObject);
localObject = PBField.initInt32(0);
this.foward_orgUinType = ((PBInt32Field)localObject);
localObject = PBField.initString("foward_orgUrl");
this.foward_orgUrl = ((PBStringField)localObject);
localObject = PBField.initString("foward_thumbPath");
this.foward_thumbPath = ((PBStringField)localObject);
localObject = PBField.initInt32(0);
this.foward_orgFileSizeType = ((PBInt32Field)localObject);
}
}
/* Location: /Volumes/D1/codebase/android/POC/assets/product/maind/classes-enjarify.jar!/com/vvt/qq/internal/ForwardExtra.class
* Java compiler version: 5 (49.0)
* JD-Core Version: 0.7.1
*/ | UTF-8 | Java | 2,893 | java | ForwardExtra.java | Java | [] | null | [] | package com.vvt.qq.internal;
import com.vvt.qq.internal.pb.MessageMicro;
import com.vvt.qq.internal.pb.MessageMicro.FieldMap;
import com.vvt.qq.internal.pb.PBField;
import com.vvt.qq.internal.pb.PBInt32Field;
import com.vvt.qq.internal.pb.PBStringField;
import com.vvt.qq.internal.pb.PBUInt64Field;
public final class ForwardExtra
extends MessageMicro
{
static final MessageMicro.FieldMap __fieldMap__;
public final PBInt32Field foward_orgFileSizeType;
public final PBUInt64Field foward_orgId;
public final PBStringField foward_orgUin;
public final PBInt32Field foward_orgUinType;
public final PBStringField foward_orgUrl;
public final PBStringField foward_thumbPath;
static
{
int i = 2;
int j = 1;
long l = 489L;
int k = 6;
int[] arrayOfInt = new int[k];
int[] tmp20_18 = arrayOfInt;
int[] tmp21_20 = tmp20_18;
int[] tmp21_20 = tmp20_18;
tmp21_20[0] = 8;
tmp21_20[1] = 18;
int[] tmp30_21 = tmp21_20;
int[] tmp30_21 = tmp21_20;
tmp30_21[2] = 24;
tmp30_21[3] = 34;
tmp30_21[4] = 42;
tmp30_21[5] = 48;
String[] arrayOfString = new String[k];
arrayOfString[0] = "foward_orgId";
arrayOfString[j] = "foward_orgUin";
arrayOfString[i] = "foward_orgUinType";
arrayOfString[3] = "foward_orgUrl";
arrayOfString[4] = "foward_thumbPath";
arrayOfString[5] = "foward_orgFileSizeType";
Object[] arrayOfObject = new Object[k];
Object localObject1 = Long.valueOf(0L);
arrayOfObject[0] = localObject1;
localObject1 = Long.valueOf(l);
arrayOfObject[j] = localObject1;
localObject1 = Integer.valueOf(0);
arrayOfObject[i] = localObject1;
Object localObject2 = Long.valueOf(l);
arrayOfObject[3] = localObject2;
localObject2 = Long.valueOf(l);
arrayOfObject[4] = localObject2;
localObject2 = Integer.valueOf(0);
arrayOfObject[5] = localObject2;
__fieldMap__ = MessageMicro.initFieldMap(arrayOfInt, arrayOfString, arrayOfObject, ForwardExtra.class);
}
public ForwardExtra()
{
Object localObject = PBField.initUInt64(0L);
this.foward_orgId = ((PBUInt64Field)localObject);
localObject = PBField.initString("foward_orgUin");
this.foward_orgUin = ((PBStringField)localObject);
localObject = PBField.initInt32(0);
this.foward_orgUinType = ((PBInt32Field)localObject);
localObject = PBField.initString("foward_orgUrl");
this.foward_orgUrl = ((PBStringField)localObject);
localObject = PBField.initString("foward_thumbPath");
this.foward_thumbPath = ((PBStringField)localObject);
localObject = PBField.initInt32(0);
this.foward_orgFileSizeType = ((PBInt32Field)localObject);
}
}
/* Location: /Volumes/D1/codebase/android/POC/assets/product/maind/classes-enjarify.jar!/com/vvt/qq/internal/ForwardExtra.class
* Java compiler version: 5 (49.0)
* JD-Core Version: 0.7.1
*/ | 2,893 | 0.697546 | 0.649499 | 83 | 33.86747 | 22.19561 | 140 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.795181 | false | false | 7 |
37f8c4dbac4099a4e9dfb6ed9c2329021bc795d9 | 30,253,749,681,839 | f277d15f7bb45d696f2967153ad05a984e48ea32 | /compare-service-jar/src/main/java/com/vw/compare/domain/PhotoGalleryInfo.java | 3033fdf8c9f6e43a02084ce7453998bd4903062b | [] | no_license | rhullathy/compare | https://github.com/rhullathy/compare | 27c5ea921fd4e348b194d8c4ef078bccae4f3d1d | 2dc95d6f8a4183369b6f554d839d9722a85efda9 | refs/heads/master | 2021-01-25T10:16:24.836000 | 2014-03-17T19:02:28 | 2014-03-17T19:02:28 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.vw.compare.domain;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = { "substituteTrimID", "substituteTrimName", "substituteUsed" })
public class PhotoGalleryInfo {
@XmlAttribute(name = "SubstituteUsed")
private String substituteUsed;
@XmlAttribute(name = "SubstituteTrimName")
private String substituteTrimName;
@XmlAttribute(name = "SubstituteTrimID")
private String substituteTrimID;
public String getSubstituteUsed() {
return substituteUsed;
}
public void setSubstituteUsed(String substituteUsed) {
this.substituteUsed = substituteUsed;
}
public String getSubstituteTrimName() {
return substituteTrimName;
}
public void setSubstituteTrimName(String substituteTrimName) {
this.substituteTrimName = substituteTrimName;
}
public String getSubstituteTrimID() {
return substituteTrimID;
}
public void setSubstituteTrimID(String substituteTrimID) {
this.substituteTrimID = substituteTrimID;
}
@Override
public String toString() {
return "PhotoGalleryInfo [substituteUsed=" + substituteUsed + ", substituteTrimName=" + substituteTrimName
+ ", substituteTrimID=" + substituteTrimID + "]";
}
}
| UTF-8 | Java | 1,523 | java | PhotoGalleryInfo.java | Java | [] | null | [] | package com.vw.compare.domain;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = { "substituteTrimID", "substituteTrimName", "substituteUsed" })
public class PhotoGalleryInfo {
@XmlAttribute(name = "SubstituteUsed")
private String substituteUsed;
@XmlAttribute(name = "SubstituteTrimName")
private String substituteTrimName;
@XmlAttribute(name = "SubstituteTrimID")
private String substituteTrimID;
public String getSubstituteUsed() {
return substituteUsed;
}
public void setSubstituteUsed(String substituteUsed) {
this.substituteUsed = substituteUsed;
}
public String getSubstituteTrimName() {
return substituteTrimName;
}
public void setSubstituteTrimName(String substituteTrimName) {
this.substituteTrimName = substituteTrimName;
}
public String getSubstituteTrimID() {
return substituteTrimID;
}
public void setSubstituteTrimID(String substituteTrimID) {
this.substituteTrimID = substituteTrimID;
}
@Override
public String toString() {
return "PhotoGalleryInfo [substituteUsed=" + substituteUsed + ", substituteTrimName=" + substituteTrimName
+ ", substituteTrimID=" + substituteTrimID + "]";
}
}
| 1,523 | 0.696651 | 0.696651 | 48 | 29.729166 | 26.432886 | 114 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.416667 | false | false | 7 |
f77deabf11365a62e85bacb852d9c19d67af8267 | 2,430,951,523,360 | 647ec12ce50f06e7380fdbfb5b71e9e2d1ac03b4 | /com.tencent.minihd.qq/assets/exlibs.1.jar/classes.jar/cooperation/photoplus/PhotoPlusBridgeActivity.java | 318e9ec6764b7c3c70aa1719ba0da7bc6829908a | [] | no_license | tsuzcx/qq_apk | https://github.com/tsuzcx/qq_apk | 0d5e792c3c7351ab781957bac465c55c505caf61 | afe46ef5640d0ba6850cdefd3c11badbd725a3f6 | refs/heads/main | 2022-07-02T10:32:11.651000 | 2022-02-01T12:41:38 | 2022-02-01T12:41:38 | 453,860,108 | 36 | 9 | null | false | 2022-01-31T09:46:26 | 2022-01-31T02:43:22 | 2022-01-31T06:56:43 | 2022-01-31T09:46:26 | 167,304 | 0 | 1 | 1 | Java | false | false | package cooperation.photoplus;
import android.content.Intent;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler.Callback;
import android.os.Message;
import android.view.Window;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import com.tencent.mobileqq.app.IphoneTitleBarActivity;
import com.tencent.mobileqq.pluginsdk.PluginBaseInfo;
import com.tencent.mobileqq.pluginsdk.PluginManagerClient;
import com.tencent.mobileqq.pluginsdk.PluginManagerHelper;
import com.tencent.mobileqq.pluginsdk.PluginManagerHelper.OnPluginManagerLoadedListener;
import com.tencent.mobileqq.utils.NetworkUtil;
import com.tencent.qphone.base.util.QLog;
import com.tencent.util.WeakReferenceHandler;
import java.io.File;
import java.math.BigDecimal;
import lxc;
public class PhotoPlusBridgeActivity
extends IphoneTitleBarActivity
implements Handler.Callback, PluginManagerHelper.OnPluginManagerLoadedListener
{
public static final int a = 100003;
public static final String a = "photo_path";
private static final int b = 400;
public static final String b = "iswaitforsult";
private static final int c = 1000;
public static final String c = "type";
private static final int d = 1001;
public static final String d = "uin";
private static final int e = 1002;
public static final String e = "nick";
private static final int f = 1003;
public static final String f = "headDir";
private static final int jdField_g_of_type_Int = 1004;
private static final String jdField_g_of_type_JavaLangString = "Photoplus.apk";
private static final int jdField_h_of_type_Int = 90;
private static final String jdField_h_of_type_JavaLangString = "Photoplus.jpg";
private static final int jdField_i_of_type_Int = 99;
private static String m = "https://dldir1.qq.com/invc/zebra/imgs/photoplus_dowding_img.jpg";
private static final String n = Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + "tencent" + File.separator + "zebrasdk" + File.separator;
private long jdField_a_of_type_Long;
private Intent jdField_a_of_type_AndroidContentIntent;
private ImageView jdField_a_of_type_AndroidWidgetImageView;
private ProgressBar jdField_a_of_type_AndroidWidgetProgressBar;
private TextView jdField_a_of_type_AndroidWidgetTextView;
private PluginManagerClient jdField_a_of_type_ComTencentMobileqqPluginsdkPluginManagerClient;
private WeakReferenceHandler jdField_a_of_type_ComTencentUtilWeakReferenceHandler;
private boolean jdField_a_of_type_Boolean;
private String jdField_i_of_type_JavaLangString;
private int jdField_j_of_type_Int;
private String jdField_j_of_type_JavaLangString;
private String k;
private String l;
private String a(int paramInt)
{
Object localObject = "20็ง";
float f1;
if (paramInt != 0)
{
f1 = (float)((System.currentTimeMillis() - this.jdField_a_of_type_Long) / 1000L) / paramInt * (100 - paramInt);
if (f1 > 60.0F) {
localObject = "1ๅ้";
}
}
else
{
return localObject;
}
localObject = new BigDecimal(f1).setScale(1, 4);
return localObject + "็ง";
}
private void a(int paramInt)
{
if (QLog.isDevelopLevel()) {
QLog.d("IphoneTitleBarActivity", 4, "[PhotoPlusBridgeActivity] [finishAndResult] begin!");
}
setResult(paramInt, this.jdField_a_of_type_AndroidContentIntent);
finish();
}
private void b()
{
if (QLog.isDevelopLevel()) {
QLog.d("IphoneTitleBarActivity", 4, "[PhotoPlusBridgeActivity] [initUI] start!");
}
setTitle("ๅพ็็ผ่พ");
this.jdField_a_of_type_AndroidWidgetProgressBar = ((ProgressBar)findViewById(2131298129));
this.jdField_a_of_type_AndroidWidgetTextView = ((TextView)findViewById(2131298128));
this.jdField_a_of_type_AndroidWidgetImageView = ((ImageView)findViewById(2131298130));
File localFile = new File(n + "Photoplus.jpg");
if (localFile.exists())
{
if (QLog.isDevelopLevel()) {
QLog.d("IphoneTitleBarActivity", 4, "[PhotoPlusBridgeActivity] [initUI] intro pic exists!" + localFile.getAbsolutePath());
}
this.jdField_a_of_type_ComTencentUtilWeakReferenceHandler.obtainMessage(1004).sendToTarget();
}
for (;;)
{
if (QLog.isDevelopLevel()) {
QLog.d("IphoneTitleBarActivity", 4, "[PhotoPlusBridgeActivity] [initUI] end!");
}
return;
if (QLog.isDevelopLevel()) {
QLog.d("IphoneTitleBarActivity", 4, "[PhotoPlusBridgeActivity] [initUI] intro pic not exists!");
}
a();
}
}
public void a()
{
new Thread(new lxc(this)).start();
}
public void a(String paramString, PluginBaseInfo paramPluginBaseInfo)
{
if (paramPluginBaseInfo == null)
{
if (!this.jdField_a_of_type_ComTencentMobileqqPluginsdkPluginManagerClient.isReady()) {
this.jdField_a_of_type_ComTencentUtilWeakReferenceHandler.sendEmptyMessageDelayed(1001, 400L);
}
return;
}
switch (paramPluginBaseInfo.mState)
{
case -1:
default:
return;
case -2:
if (QLog.isDevelopLevel()) {
QLog.d("IphoneTitleBarActivity", 4, "[PhotoPlusBridgeActivity] [handlePluginInfo] PluginInfo.STATE_ERROR!");
}
this.jdField_a_of_type_ComTencentUtilWeakReferenceHandler.sendEmptyMessage(1003);
return;
case 0:
if (QLog.isDevelopLevel()) {
QLog.d("IphoneTitleBarActivity", 4, "[PhotoPlusBridgeActivity] [handlePluginInfo] PluginInfo.STATE_NODOWNLOAD!");
}
this.jdField_a_of_type_ComTencentMobileqqPluginsdkPluginManagerClient.installPlugin("Photoplus.apk");
case 1:
if (QLog.isDevelopLevel()) {
QLog.d("IphoneTitleBarActivity", 4, "[PhotoPlusBridgeActivity] [handlePluginInfo] PluginInfo.STATE_DOWNLOADING!");
}
case 2:
if (QLog.isDevelopLevel()) {
QLog.d("IphoneTitleBarActivity", 4, "[PhotoPlusBridgeActivity] [handlePluginInfo] PluginInfo.STATE_DOWNLOADED!");
}
int i1 = (int)(paramPluginBaseInfo.mDownloadProgress * 90.0F);
this.jdField_a_of_type_ComTencentUtilWeakReferenceHandler.obtainMessage(1000, i1, 0).sendToTarget();
this.jdField_a_of_type_ComTencentUtilWeakReferenceHandler.sendEmptyMessageDelayed(1001, 400L);
return;
case 3:
if (QLog.isDevelopLevel()) {
QLog.d("IphoneTitleBarActivity", 4, "[PhotoPlusBridgeActivity] [handlePluginInfo] PluginInfo.STATE_INSTALLING!");
}
this.jdField_a_of_type_ComTencentUtilWeakReferenceHandler.sendEmptyMessage(1002);
this.jdField_a_of_type_ComTencentUtilWeakReferenceHandler.sendEmptyMessageDelayed(1001, 400L);
return;
}
if (QLog.isDevelopLevel()) {
QLog.d("IphoneTitleBarActivity", 4, "[PhotoPlusBridgeActivity] [handlePluginInfo] PluginInfo.STATE_INSTALLED!");
}
a(-1);
}
public boolean handleMessage(Message paramMessage)
{
int i1 = 99;
switch (paramMessage.what)
{
}
for (;;)
{
return true;
if (QLog.isDevelopLevel()) {
QLog.d("IphoneTitleBarActivity", 4, "[PhotoPlusBridgeActivity] [handleMessage] ACTION_UPDATE_PROGRESS!");
}
i1 = paramMessage.arg1;
this.jdField_a_of_type_AndroidWidgetTextView.setText("ๆญฃๅจๅ ่ฝฝ(" + i1 + "%)๏ผๅคง็บฆ่ฟ้" + a(i1));
this.jdField_a_of_type_AndroidWidgetProgressBar.setProgress(i1);
continue;
if (QLog.isDevelopLevel()) {
QLog.d("IphoneTitleBarActivity", 4, "[PhotoPlusBridgeActivity] [handleMessage] ACTION_INCREMENT!");
}
int i2 = this.jdField_a_of_type_AndroidWidgetProgressBar.getProgress();
if (i2 < 99) {}
for (;;)
{
this.jdField_a_of_type_AndroidWidgetTextView.setText("ๆญฃๅจๅ ่ฝฝ(" + i1 + "%)๏ผๅคง็บฆ่ฟ้" + a(i1));
this.jdField_a_of_type_AndroidWidgetProgressBar.setProgress(i1);
break;
i1 = i2 + 1;
}
if (QLog.isDevelopLevel()) {
QLog.d("IphoneTitleBarActivity", 4, "[PhotoPlusBridgeActivity] [handleMessage] ACTION_QUERY!");
}
if (!isFinishing())
{
a("Photoplus.apk", this.jdField_a_of_type_ComTencentMobileqqPluginsdkPluginManagerClient.queryPlugin("Photoplus.apk"));
continue;
if (QLog.isDevelopLevel()) {
QLog.d("IphoneTitleBarActivity", 4, "[PhotoPlusBridgeActivity] [handleMessage] ACTION_ERROR!");
}
this.jdField_a_of_type_AndroidWidgetTextView.setText("ๅ ่ฝฝๅคฑ่ดฅ");
Toast.makeText(this, "็ฝ็ปๆ ่ฟๆฅ๏ผ่ฏทๆฃๆฅไฝ ็็ฝ็ป่ฟๆฅ", 0).show();
continue;
for (;;)
{
try
{
for (;;)
{
if (QLog.isDevelopLevel()) {
QLog.d("IphoneTitleBarActivity", 4, "[PhotoPlusBridgeActivity] [handleMessage] start decode image success!");
}
try
{
paramMessage = BitmapFactory.decodeFile(n + "Photoplus.jpg");
localMessage = paramMessage;
}
catch (OutOfMemoryError paramMessage)
{
for (;;)
{
try
{
if (QLog.isDevelopLevel())
{
QLog.d("IphoneTitleBarActivity", 4, "[PhotoPlusBridgeActivity] [handleMessage] decode image success!");
localMessage = paramMessage;
}
if (localMessage == null) {
continue;
}
this.jdField_a_of_type_AndroidWidgetImageView.setImageBitmap(localMessage);
this.jdField_a_of_type_AndroidWidgetImageView.setVisibility(0);
if (!QLog.isDevelopLevel()) {
break;
}
QLog.d("IphoneTitleBarActivity", 4, "[PhotoPlusBridgeActivity] [handleMessage] show image success!");
}
catch (Exception localException)
{
Message localMessage;
continue;
}
paramMessage = paramMessage;
paramMessage.printStackTrace();
paramMessage = null;
}
}
}
localMessage = paramMessage;
}
catch (Exception paramMessage)
{
paramMessage = null;
}
if (QLog.isDevelopLevel())
{
QLog.e("IphoneTitleBarActivity", 4, "[PhotoPlusBridgeActivity] [handleMessage] decode image failed!");
localMessage = paramMessage;
}
}
paramMessage = new File(n + "Photoplus.jpg");
if ((paramMessage != null) && (paramMessage.exists())) {
paramMessage.delete();
}
if (QLog.isDevelopLevel()) {
QLog.e("IphoneTitleBarActivity", 4, "[PhotoPlusBridgeActivity] [handleMessage] show image failed!");
}
}
}
}
protected boolean onBackEvent()
{
a(0);
return super.onBackEvent();
}
public void onCreate(Bundle paramBundle)
{
super.onCreate(paramBundle);
getWindow().setBackgroundDrawableResource(2131427375);
this.jdField_a_of_type_ComTencentUtilWeakReferenceHandler = new WeakReferenceHandler(this);
PluginManagerHelper.getPluginInterface(this, this);
this.jdField_a_of_type_Long = System.currentTimeMillis();
this.jdField_a_of_type_AndroidContentIntent = getIntent();
this.i = this.jdField_a_of_type_AndroidContentIntent.getStringExtra("photo_path");
this.jdField_a_of_type_Boolean = this.jdField_a_of_type_AndroidContentIntent.getBooleanExtra("iswaitforsult", false);
this.jdField_j_of_type_Int = this.jdField_a_of_type_AndroidContentIntent.getIntExtra("type", 0);
this.jdField_j_of_type_JavaLangString = this.jdField_a_of_type_AndroidContentIntent.getStringExtra("uin");
this.k = this.jdField_a_of_type_AndroidContentIntent.getStringExtra("nick");
this.l = this.jdField_a_of_type_AndroidContentIntent.getStringExtra("headDir");
}
public void onDestroy()
{
super.onDestroy();
}
public void onPluginManagerLoaded(PluginManagerClient paramPluginManagerClient)
{
this.jdField_a_of_type_ComTencentMobileqqPluginsdkPluginManagerClient = paramPluginManagerClient;
setContentView(2130903408);
b();
if (QLog.isDevelopLevel()) {
QLog.d("IphoneTitleBarActivity", 4, "[PhotoPlusBridgeActivity] [onPluginManagerLoaded] ");
}
if (QLog.isDevelopLevel()) {
QLog.d("IphoneTitleBarActivity", 4, "[PhotoPlusBridgeActivity] [onCreate] SUPPORT_NETWORKING = false ็ดๆฅๅฎ่ฃ
ๆฌๅฐๅ
!");
}
a(-1);
if (!NetworkUtil.f(getApplicationContext())) {
Toast.makeText(this, "็ฝ็ปๆ ่ฟๆฅ๏ผ่ฏทๆฃๆฅไฝ ็็ฝ็ป่ฟๆฅ", 0).show();
}
}
}
/* Location: L:\local\mybackup\temp\qq_apk\com.tencent.minihd.qq\assets\exlibs.1.jar\classes.jar
* Qualified Name: cooperation.photoplus.PhotoPlusBridgeActivity
* JD-Core Version: 0.7.0.1
*/ | UTF-8 | Java | 13,529 | java | PhotoPlusBridgeActivity.java | Java | [] | null | [] | package cooperation.photoplus;
import android.content.Intent;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler.Callback;
import android.os.Message;
import android.view.Window;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import com.tencent.mobileqq.app.IphoneTitleBarActivity;
import com.tencent.mobileqq.pluginsdk.PluginBaseInfo;
import com.tencent.mobileqq.pluginsdk.PluginManagerClient;
import com.tencent.mobileqq.pluginsdk.PluginManagerHelper;
import com.tencent.mobileqq.pluginsdk.PluginManagerHelper.OnPluginManagerLoadedListener;
import com.tencent.mobileqq.utils.NetworkUtil;
import com.tencent.qphone.base.util.QLog;
import com.tencent.util.WeakReferenceHandler;
import java.io.File;
import java.math.BigDecimal;
import lxc;
public class PhotoPlusBridgeActivity
extends IphoneTitleBarActivity
implements Handler.Callback, PluginManagerHelper.OnPluginManagerLoadedListener
{
public static final int a = 100003;
public static final String a = "photo_path";
private static final int b = 400;
public static final String b = "iswaitforsult";
private static final int c = 1000;
public static final String c = "type";
private static final int d = 1001;
public static final String d = "uin";
private static final int e = 1002;
public static final String e = "nick";
private static final int f = 1003;
public static final String f = "headDir";
private static final int jdField_g_of_type_Int = 1004;
private static final String jdField_g_of_type_JavaLangString = "Photoplus.apk";
private static final int jdField_h_of_type_Int = 90;
private static final String jdField_h_of_type_JavaLangString = "Photoplus.jpg";
private static final int jdField_i_of_type_Int = 99;
private static String m = "https://dldir1.qq.com/invc/zebra/imgs/photoplus_dowding_img.jpg";
private static final String n = Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + "tencent" + File.separator + "zebrasdk" + File.separator;
private long jdField_a_of_type_Long;
private Intent jdField_a_of_type_AndroidContentIntent;
private ImageView jdField_a_of_type_AndroidWidgetImageView;
private ProgressBar jdField_a_of_type_AndroidWidgetProgressBar;
private TextView jdField_a_of_type_AndroidWidgetTextView;
private PluginManagerClient jdField_a_of_type_ComTencentMobileqqPluginsdkPluginManagerClient;
private WeakReferenceHandler jdField_a_of_type_ComTencentUtilWeakReferenceHandler;
private boolean jdField_a_of_type_Boolean;
private String jdField_i_of_type_JavaLangString;
private int jdField_j_of_type_Int;
private String jdField_j_of_type_JavaLangString;
private String k;
private String l;
private String a(int paramInt)
{
Object localObject = "20็ง";
float f1;
if (paramInt != 0)
{
f1 = (float)((System.currentTimeMillis() - this.jdField_a_of_type_Long) / 1000L) / paramInt * (100 - paramInt);
if (f1 > 60.0F) {
localObject = "1ๅ้";
}
}
else
{
return localObject;
}
localObject = new BigDecimal(f1).setScale(1, 4);
return localObject + "็ง";
}
private void a(int paramInt)
{
if (QLog.isDevelopLevel()) {
QLog.d("IphoneTitleBarActivity", 4, "[PhotoPlusBridgeActivity] [finishAndResult] begin!");
}
setResult(paramInt, this.jdField_a_of_type_AndroidContentIntent);
finish();
}
private void b()
{
if (QLog.isDevelopLevel()) {
QLog.d("IphoneTitleBarActivity", 4, "[PhotoPlusBridgeActivity] [initUI] start!");
}
setTitle("ๅพ็็ผ่พ");
this.jdField_a_of_type_AndroidWidgetProgressBar = ((ProgressBar)findViewById(2131298129));
this.jdField_a_of_type_AndroidWidgetTextView = ((TextView)findViewById(2131298128));
this.jdField_a_of_type_AndroidWidgetImageView = ((ImageView)findViewById(2131298130));
File localFile = new File(n + "Photoplus.jpg");
if (localFile.exists())
{
if (QLog.isDevelopLevel()) {
QLog.d("IphoneTitleBarActivity", 4, "[PhotoPlusBridgeActivity] [initUI] intro pic exists!" + localFile.getAbsolutePath());
}
this.jdField_a_of_type_ComTencentUtilWeakReferenceHandler.obtainMessage(1004).sendToTarget();
}
for (;;)
{
if (QLog.isDevelopLevel()) {
QLog.d("IphoneTitleBarActivity", 4, "[PhotoPlusBridgeActivity] [initUI] end!");
}
return;
if (QLog.isDevelopLevel()) {
QLog.d("IphoneTitleBarActivity", 4, "[PhotoPlusBridgeActivity] [initUI] intro pic not exists!");
}
a();
}
}
public void a()
{
new Thread(new lxc(this)).start();
}
public void a(String paramString, PluginBaseInfo paramPluginBaseInfo)
{
if (paramPluginBaseInfo == null)
{
if (!this.jdField_a_of_type_ComTencentMobileqqPluginsdkPluginManagerClient.isReady()) {
this.jdField_a_of_type_ComTencentUtilWeakReferenceHandler.sendEmptyMessageDelayed(1001, 400L);
}
return;
}
switch (paramPluginBaseInfo.mState)
{
case -1:
default:
return;
case -2:
if (QLog.isDevelopLevel()) {
QLog.d("IphoneTitleBarActivity", 4, "[PhotoPlusBridgeActivity] [handlePluginInfo] PluginInfo.STATE_ERROR!");
}
this.jdField_a_of_type_ComTencentUtilWeakReferenceHandler.sendEmptyMessage(1003);
return;
case 0:
if (QLog.isDevelopLevel()) {
QLog.d("IphoneTitleBarActivity", 4, "[PhotoPlusBridgeActivity] [handlePluginInfo] PluginInfo.STATE_NODOWNLOAD!");
}
this.jdField_a_of_type_ComTencentMobileqqPluginsdkPluginManagerClient.installPlugin("Photoplus.apk");
case 1:
if (QLog.isDevelopLevel()) {
QLog.d("IphoneTitleBarActivity", 4, "[PhotoPlusBridgeActivity] [handlePluginInfo] PluginInfo.STATE_DOWNLOADING!");
}
case 2:
if (QLog.isDevelopLevel()) {
QLog.d("IphoneTitleBarActivity", 4, "[PhotoPlusBridgeActivity] [handlePluginInfo] PluginInfo.STATE_DOWNLOADED!");
}
int i1 = (int)(paramPluginBaseInfo.mDownloadProgress * 90.0F);
this.jdField_a_of_type_ComTencentUtilWeakReferenceHandler.obtainMessage(1000, i1, 0).sendToTarget();
this.jdField_a_of_type_ComTencentUtilWeakReferenceHandler.sendEmptyMessageDelayed(1001, 400L);
return;
case 3:
if (QLog.isDevelopLevel()) {
QLog.d("IphoneTitleBarActivity", 4, "[PhotoPlusBridgeActivity] [handlePluginInfo] PluginInfo.STATE_INSTALLING!");
}
this.jdField_a_of_type_ComTencentUtilWeakReferenceHandler.sendEmptyMessage(1002);
this.jdField_a_of_type_ComTencentUtilWeakReferenceHandler.sendEmptyMessageDelayed(1001, 400L);
return;
}
if (QLog.isDevelopLevel()) {
QLog.d("IphoneTitleBarActivity", 4, "[PhotoPlusBridgeActivity] [handlePluginInfo] PluginInfo.STATE_INSTALLED!");
}
a(-1);
}
public boolean handleMessage(Message paramMessage)
{
int i1 = 99;
switch (paramMessage.what)
{
}
for (;;)
{
return true;
if (QLog.isDevelopLevel()) {
QLog.d("IphoneTitleBarActivity", 4, "[PhotoPlusBridgeActivity] [handleMessage] ACTION_UPDATE_PROGRESS!");
}
i1 = paramMessage.arg1;
this.jdField_a_of_type_AndroidWidgetTextView.setText("ๆญฃๅจๅ ่ฝฝ(" + i1 + "%)๏ผๅคง็บฆ่ฟ้" + a(i1));
this.jdField_a_of_type_AndroidWidgetProgressBar.setProgress(i1);
continue;
if (QLog.isDevelopLevel()) {
QLog.d("IphoneTitleBarActivity", 4, "[PhotoPlusBridgeActivity] [handleMessage] ACTION_INCREMENT!");
}
int i2 = this.jdField_a_of_type_AndroidWidgetProgressBar.getProgress();
if (i2 < 99) {}
for (;;)
{
this.jdField_a_of_type_AndroidWidgetTextView.setText("ๆญฃๅจๅ ่ฝฝ(" + i1 + "%)๏ผๅคง็บฆ่ฟ้" + a(i1));
this.jdField_a_of_type_AndroidWidgetProgressBar.setProgress(i1);
break;
i1 = i2 + 1;
}
if (QLog.isDevelopLevel()) {
QLog.d("IphoneTitleBarActivity", 4, "[PhotoPlusBridgeActivity] [handleMessage] ACTION_QUERY!");
}
if (!isFinishing())
{
a("Photoplus.apk", this.jdField_a_of_type_ComTencentMobileqqPluginsdkPluginManagerClient.queryPlugin("Photoplus.apk"));
continue;
if (QLog.isDevelopLevel()) {
QLog.d("IphoneTitleBarActivity", 4, "[PhotoPlusBridgeActivity] [handleMessage] ACTION_ERROR!");
}
this.jdField_a_of_type_AndroidWidgetTextView.setText("ๅ ่ฝฝๅคฑ่ดฅ");
Toast.makeText(this, "็ฝ็ปๆ ่ฟๆฅ๏ผ่ฏทๆฃๆฅไฝ ็็ฝ็ป่ฟๆฅ", 0).show();
continue;
for (;;)
{
try
{
for (;;)
{
if (QLog.isDevelopLevel()) {
QLog.d("IphoneTitleBarActivity", 4, "[PhotoPlusBridgeActivity] [handleMessage] start decode image success!");
}
try
{
paramMessage = BitmapFactory.decodeFile(n + "Photoplus.jpg");
localMessage = paramMessage;
}
catch (OutOfMemoryError paramMessage)
{
for (;;)
{
try
{
if (QLog.isDevelopLevel())
{
QLog.d("IphoneTitleBarActivity", 4, "[PhotoPlusBridgeActivity] [handleMessage] decode image success!");
localMessage = paramMessage;
}
if (localMessage == null) {
continue;
}
this.jdField_a_of_type_AndroidWidgetImageView.setImageBitmap(localMessage);
this.jdField_a_of_type_AndroidWidgetImageView.setVisibility(0);
if (!QLog.isDevelopLevel()) {
break;
}
QLog.d("IphoneTitleBarActivity", 4, "[PhotoPlusBridgeActivity] [handleMessage] show image success!");
}
catch (Exception localException)
{
Message localMessage;
continue;
}
paramMessage = paramMessage;
paramMessage.printStackTrace();
paramMessage = null;
}
}
}
localMessage = paramMessage;
}
catch (Exception paramMessage)
{
paramMessage = null;
}
if (QLog.isDevelopLevel())
{
QLog.e("IphoneTitleBarActivity", 4, "[PhotoPlusBridgeActivity] [handleMessage] decode image failed!");
localMessage = paramMessage;
}
}
paramMessage = new File(n + "Photoplus.jpg");
if ((paramMessage != null) && (paramMessage.exists())) {
paramMessage.delete();
}
if (QLog.isDevelopLevel()) {
QLog.e("IphoneTitleBarActivity", 4, "[PhotoPlusBridgeActivity] [handleMessage] show image failed!");
}
}
}
}
protected boolean onBackEvent()
{
a(0);
return super.onBackEvent();
}
public void onCreate(Bundle paramBundle)
{
super.onCreate(paramBundle);
getWindow().setBackgroundDrawableResource(2131427375);
this.jdField_a_of_type_ComTencentUtilWeakReferenceHandler = new WeakReferenceHandler(this);
PluginManagerHelper.getPluginInterface(this, this);
this.jdField_a_of_type_Long = System.currentTimeMillis();
this.jdField_a_of_type_AndroidContentIntent = getIntent();
this.i = this.jdField_a_of_type_AndroidContentIntent.getStringExtra("photo_path");
this.jdField_a_of_type_Boolean = this.jdField_a_of_type_AndroidContentIntent.getBooleanExtra("iswaitforsult", false);
this.jdField_j_of_type_Int = this.jdField_a_of_type_AndroidContentIntent.getIntExtra("type", 0);
this.jdField_j_of_type_JavaLangString = this.jdField_a_of_type_AndroidContentIntent.getStringExtra("uin");
this.k = this.jdField_a_of_type_AndroidContentIntent.getStringExtra("nick");
this.l = this.jdField_a_of_type_AndroidContentIntent.getStringExtra("headDir");
}
public void onDestroy()
{
super.onDestroy();
}
public void onPluginManagerLoaded(PluginManagerClient paramPluginManagerClient)
{
this.jdField_a_of_type_ComTencentMobileqqPluginsdkPluginManagerClient = paramPluginManagerClient;
setContentView(2130903408);
b();
if (QLog.isDevelopLevel()) {
QLog.d("IphoneTitleBarActivity", 4, "[PhotoPlusBridgeActivity] [onPluginManagerLoaded] ");
}
if (QLog.isDevelopLevel()) {
QLog.d("IphoneTitleBarActivity", 4, "[PhotoPlusBridgeActivity] [onCreate] SUPPORT_NETWORKING = false ็ดๆฅๅฎ่ฃ
ๆฌๅฐๅ
!");
}
a(-1);
if (!NetworkUtil.f(getApplicationContext())) {
Toast.makeText(this, "็ฝ็ปๆ ่ฟๆฅ๏ผ่ฏทๆฃๆฅไฝ ็็ฝ็ป่ฟๆฅ", 0).show();
}
}
}
/* Location: L:\local\mybackup\temp\qq_apk\com.tencent.minihd.qq\assets\exlibs.1.jar\classes.jar
* Qualified Name: cooperation.photoplus.PhotoPlusBridgeActivity
* JD-Core Version: 0.7.0.1
*/ | 13,529 | 0.641284 | 0.62598 | 340 | 37.414707 | 35.041679 | 170 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.691176 | false | false | 7 |
6435aab5b51e3c1d921ffce4e04f6f726bf3ba57 | 22,806,276,411,871 | 633d82948b783cfe89dee55173b920331fca2e90 | /Algorithms/src/strings/ZFunction.java | 4fc0cd424af4e1a4af86f69641a3de6907600ac0 | [] | no_license | ShmaxPPS/LitseyInnopolis | https://github.com/ShmaxPPS/LitseyInnopolis | 650c71bcdb4209378de27b0cc429d931808e784d | b1869d026e8317d68bd00e9781180d7908ac8cf0 | refs/heads/master | 2021-06-16T13:21:31.054000 | 2019-11-06T13:44:17 | 2019-11-06T13:44:17 | 138,393,645 | 1 | 1 | null | false | 2018-10-20T15:06:25 | 2018-06-23T10:51:57 | 2018-10-17T21:40:19 | 2018-10-20T15:04:42 | 34 | 1 | 0 | 1 | Java | false | null | package strings;
import java.io.*;
public class ZFunction {
int[] execute(String string) {
int[] z = new int[string.length()];
int left = 0;
int right = 0;
for (int i = 1; i < string.length(); ++i) {
z[i] = Math.max(Math.min(right - i, z[i - left]), 0);
while (i + z[i] < string.length() && string.charAt(z[i]) == string.charAt(i + z[i])) {
++z[i];
}
if (i + z[i] > right) {
left = i;
right = i + z[i];
}
}
return z;
}
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));
String string = reader.readLine();
ZFunction zFunction = new ZFunction();
int[] z = zFunction.execute(string);
for (int i = 1; i < z.length; ++i) {
writer.write(z[i] + " ");
}
writer.close();
}
}
| UTF-8 | Java | 1,085 | java | ZFunction.java | Java | [] | null | [] | package strings;
import java.io.*;
public class ZFunction {
int[] execute(String string) {
int[] z = new int[string.length()];
int left = 0;
int right = 0;
for (int i = 1; i < string.length(); ++i) {
z[i] = Math.max(Math.min(right - i, z[i - left]), 0);
while (i + z[i] < string.length() && string.charAt(z[i]) == string.charAt(i + z[i])) {
++z[i];
}
if (i + z[i] > right) {
left = i;
right = i + z[i];
}
}
return z;
}
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));
String string = reader.readLine();
ZFunction zFunction = new ZFunction();
int[] z = zFunction.execute(string);
for (int i = 1; i < z.length; ++i) {
writer.write(z[i] + " ");
}
writer.close();
}
}
| 1,085 | 0.498618 | 0.494009 | 35 | 30 | 25.468187 | 98 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.657143 | false | false | 7 |
32c2ff9a51a0e2be7c71ff09c26737dab32050af | 34,187,939,681,883 | 276ba791fb8c78fdc1ee49b769368aa6281d32f6 | /src/main/java/io/coastwatch/impl/ShipSightedServer.java | e17b01faea42618543c4f5dad237e39b8e7200c7 | [
"Apache-2.0"
] | permissive | noelo/grpctest | https://github.com/noelo/grpctest | cc313bf3b3d6d6adbdd3df78d546a15050103b47 | e55b10e280b1bdb49ba3bf88872ab6c18ebec0f9 | refs/heads/main | 2023-01-21T13:28:00.889000 | 2020-12-05T14:07:08 | 2020-12-05T14:07:08 | 318,769,673 | 0 | 0 | Apache-2.0 | false | 2020-12-05T11:27:11 | 2020-12-05T11:22:45 | 2020-12-05T11:22:50 | 2020-12-05T11:27:11 | 0 | 0 | 0 | 0 | null | false | false | package io.coastwatch.impl;
import io.coastwatch.grpc.Coastwatch.*;
import io.coastwatch.grpc.ShipSightedSVCGrpc;
import io.grpc.Server;
import io.grpc.ServerBuilder;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
public class ShipSightedServer extends ShipSightedSVCGrpc.ShipSightedSVCImplBase{
private Server server;
public ShipSightedServer(int port) {
ServerBuilder<?> serverBuilder = ServerBuilder.forPort(port);
server = serverBuilder.addService(new ShipSightedServer())
.build();
}
protected ShipSightedServer() {
}
/** Start serving requests. */
public void start() throws IOException {
server.start();
System.out.println("Server started, listening on 32000");
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
// Use stderr here since the logger may have been reset by its JVM shutdown hook.
System.err.println("*** shutting down gRPC server since JVM is shutting down");
try {
ShipSightedServer.this.stop();
} catch (InterruptedException e) {
e.printStackTrace(System.err);
}
System.err.println("*** server shut down");
}
});
}
/** Stop serving requests and shutdown resources. */
public void stop() throws InterruptedException {
if (server != null) {
server.shutdown().awaitTermination(30, TimeUnit.SECONDS);
}
}
/**
* Await termination on the main thread since the grpc library uses daemon threads.
*/
private void blockUntilShutdown() throws InterruptedException {
if (server != null) {
server.awaitTermination();
}
}
/**
* Main method. This comment makes the linter happy.
*/
public static void main(String[] args) throws Exception {
ShipSightedServer server = new ShipSightedServer(32000);
server.start();
server.blockUntilShutdown();
}
@Override
public void notify(io.coastwatch.grpc.Coastwatch.ShipSightedNotification request,
io.grpc.stub.StreamObserver<io.coastwatch.grpc.Coastwatch.AntiShipMunition> responseObserver){
System.out.println("Server : shipsighted "+request.toString());
responseObserver.onNext(buildMunition(request));
responseObserver.onCompleted();
}
private AntiShipMunition buildMunition(ShipSightedNotification shipSighted) {
//Do something here to build the antishipmunition and then send it back
AntiShipMunition resp = AntiShipMunition.newBuilder().setMunitionType("munition name").build();
return resp;
}
}
| UTF-8 | Java | 2,810 | java | ShipSightedServer.java | Java | [] | null | [] | package io.coastwatch.impl;
import io.coastwatch.grpc.Coastwatch.*;
import io.coastwatch.grpc.ShipSightedSVCGrpc;
import io.grpc.Server;
import io.grpc.ServerBuilder;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
public class ShipSightedServer extends ShipSightedSVCGrpc.ShipSightedSVCImplBase{
private Server server;
public ShipSightedServer(int port) {
ServerBuilder<?> serverBuilder = ServerBuilder.forPort(port);
server = serverBuilder.addService(new ShipSightedServer())
.build();
}
protected ShipSightedServer() {
}
/** Start serving requests. */
public void start() throws IOException {
server.start();
System.out.println("Server started, listening on 32000");
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
// Use stderr here since the logger may have been reset by its JVM shutdown hook.
System.err.println("*** shutting down gRPC server since JVM is shutting down");
try {
ShipSightedServer.this.stop();
} catch (InterruptedException e) {
e.printStackTrace(System.err);
}
System.err.println("*** server shut down");
}
});
}
/** Stop serving requests and shutdown resources. */
public void stop() throws InterruptedException {
if (server != null) {
server.shutdown().awaitTermination(30, TimeUnit.SECONDS);
}
}
/**
* Await termination on the main thread since the grpc library uses daemon threads.
*/
private void blockUntilShutdown() throws InterruptedException {
if (server != null) {
server.awaitTermination();
}
}
/**
* Main method. This comment makes the linter happy.
*/
public static void main(String[] args) throws Exception {
ShipSightedServer server = new ShipSightedServer(32000);
server.start();
server.blockUntilShutdown();
}
@Override
public void notify(io.coastwatch.grpc.Coastwatch.ShipSightedNotification request,
io.grpc.stub.StreamObserver<io.coastwatch.grpc.Coastwatch.AntiShipMunition> responseObserver){
System.out.println("Server : shipsighted "+request.toString());
responseObserver.onNext(buildMunition(request));
responseObserver.onCompleted();
}
private AntiShipMunition buildMunition(ShipSightedNotification shipSighted) {
//Do something here to build the antishipmunition and then send it back
AntiShipMunition resp = AntiShipMunition.newBuilder().setMunitionType("munition name").build();
return resp;
}
}
| 2,810 | 0.642705 | 0.638434 | 83 | 32.855423 | 30.039385 | 117 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.361446 | false | false | 7 |
137e6f8daca219db5cfc3b161a67dd30de6889ad | 11,630,771,479,733 | 681fe89bbbb6643746de7751d77ad4e14fe185a6 | /src/Stalls.java | 896644fcd02192d5be237a66d091be576fea99fe | [] | no_license | Pavanidesai/HCL-Training | https://github.com/Pavanidesai/HCL-Training | 999cf11c3a4f79ea12d0308ad7d38aaaeb988f69 | a189b2c665dbdfe17ab15c99e7d37a64838b4641 | refs/heads/main | 2023-02-10T22:45:07.641000 | 2021-01-07T09:53:07 | 2021-01-07T09:53:07 | 319,193,747 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
public class Stalls {
protected String name, detail, ownerName;
public Stalls(String name, String detail, String ownerName) {
super();
this.name = name;
this.detail = detail;
this.ownerName = ownerName;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDetail() {
return detail;
}
public void setDetail(String detail) {
this.detail = detail;
}
public String getOwnerName() {
return ownerName;
}
public void setOwnerName(String ownerName) {
this.ownerName = ownerName;
}
public Double computeCost(String stallType, Integer squareFeet) {
switch(stallType)
{
case "Platinum":
int value = 200;
return Double.valueOf(value * squareFeet);
case "Diamond":
int value1 = 150;
return Double.valueOf(value1 * squareFeet);
case "Gold":
int value2 = 100;
return Double.valueOf(value2 * squareFeet);
}
return null;
}
public Double computeCost(String stallType, Integer squareFeet, Integer numberOfTV) {
switch(stallType)
{
case "Platinum":
int value = 200;
return Double.valueOf((value * squareFeet) + (numberOfTV * 10000));
case "Diamond":
int value1 = 150;
return Double.valueOf((value1 * squareFeet) + (numberOfTV * 10000));
case "Gold":
int value2 = 100;
return Double.valueOf((value2 * squareFeet) + (numberOfTV * 10000));
}
return null;
}
}
| UTF-8 | Java | 1,491 | java | Stalls.java | Java | [] | null | [] |
public class Stalls {
protected String name, detail, ownerName;
public Stalls(String name, String detail, String ownerName) {
super();
this.name = name;
this.detail = detail;
this.ownerName = ownerName;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDetail() {
return detail;
}
public void setDetail(String detail) {
this.detail = detail;
}
public String getOwnerName() {
return ownerName;
}
public void setOwnerName(String ownerName) {
this.ownerName = ownerName;
}
public Double computeCost(String stallType, Integer squareFeet) {
switch(stallType)
{
case "Platinum":
int value = 200;
return Double.valueOf(value * squareFeet);
case "Diamond":
int value1 = 150;
return Double.valueOf(value1 * squareFeet);
case "Gold":
int value2 = 100;
return Double.valueOf(value2 * squareFeet);
}
return null;
}
public Double computeCost(String stallType, Integer squareFeet, Integer numberOfTV) {
switch(stallType)
{
case "Platinum":
int value = 200;
return Double.valueOf((value * squareFeet) + (numberOfTV * 10000));
case "Diamond":
int value1 = 150;
return Double.valueOf((value1 * squareFeet) + (numberOfTV * 10000));
case "Gold":
int value2 = 100;
return Double.valueOf((value2 * squareFeet) + (numberOfTV * 10000));
}
return null;
}
}
| 1,491 | 0.645875 | 0.618377 | 69 | 19.57971 | 20.626005 | 86 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.057971 | false | false | 7 |
3d8a4981b1db7d04c3ca969d5e7d5c9f91ef4aff | 34,961,033,798,006 | 37b25be46cfc6b86333b5d747bf0a487c4b3e3a8 | /FirstJavaWeb/src/org/jason/web/servlet/forward/BHttpServlet.java | ae81449248c6710705b13becef8610bf9641bb9f | [] | no_license | JieTrancender/JavaCode | https://github.com/JieTrancender/JavaCode | 6c88291f8cb39b802ffe3a8f8b97a6564e333b38 | 054f3d7dc4db0bd59a6cb8a325f876fccefe5573 | refs/heads/master | 2020-04-15T00:13:27.043000 | 2017-06-23T05:36:29 | 2017-06-23T05:36:29 | 83,433,702 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.jason.web.servlet.forward;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* Created by JTrancender on 2017/3/1.
*/
@WebServlet(name = "/BHttpServlet")
public class BHttpServlet extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
/**
* ๅจ่ทๅๅๆฐไนๅ๏ผ้่ฆๅ
่ฐ็จrequest.setCharacterEncoding("utf-8")
* ไฝฟ็จgetParameter่ทๅๅๆฐ
*/
// request.setCharacterEncoding("utf-8");
// String userName = request.getParameter("userName");
// System.out.println(userName);
/**
* jsp่ฎก็ฎๆดๆฐ้ไปท็ธๅ
*/
String s1 = request.getParameter("num1");
String s2 = request.getParameter("num2");
int num1 = Integer.parseInt(s1);
int num2 = Integer.parseInt(s2);
int sum = num1 + num2;
request.setAttribute("result", sum);
System.out.println("result = " + sum);
//่ฝฌๆขๅฐresult.jsp
request.getRequestDispatcher("/jsps/result.jsp").forward(request, response);
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("BHttpServlet");
System.out.println(request.getAttribute("userName"));
response.getWriter().print("hello BHttpServlet");
/**
* tomcat8ไนๅ็ๆฌ
* ๅ
่ทๅๆฅไฝฟ็จiso็้่ฏฏๅญ็ฌฆไธฒ
* ๅ้๏ผไฝฟ็จutf-8้็ผ
*/
// String name = request.getParameter("userName");
// byte[] b = name.getBytes("iso-8859-1");
// name = new String(b, "utf-8");
// System.out.println(name);
//ๆฐ็ๆฌ
System.out.println(request.getParameter("userName"));
}
}
| UTF-8 | Java | 2,046 | java | BHttpServlet.java | Java | [
{
"context": "se;\nimport java.io.IOException;\n\n/**\n * Created by JTrancender on 2017/3/1.\n */\n@WebServlet(name = \"/BHttpServle",
"end": 313,
"score": 0.9997286200523376,
"start": 302,
"tag": "USERNAME",
"value": "JTrancender"
}
] | null | [] | package org.jason.web.servlet.forward;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* Created by JTrancender on 2017/3/1.
*/
@WebServlet(name = "/BHttpServlet")
public class BHttpServlet extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
/**
* ๅจ่ทๅๅๆฐไนๅ๏ผ้่ฆๅ
่ฐ็จrequest.setCharacterEncoding("utf-8")
* ไฝฟ็จgetParameter่ทๅๅๆฐ
*/
// request.setCharacterEncoding("utf-8");
// String userName = request.getParameter("userName");
// System.out.println(userName);
/**
* jsp่ฎก็ฎๆดๆฐ้ไปท็ธๅ
*/
String s1 = request.getParameter("num1");
String s2 = request.getParameter("num2");
int num1 = Integer.parseInt(s1);
int num2 = Integer.parseInt(s2);
int sum = num1 + num2;
request.setAttribute("result", sum);
System.out.println("result = " + sum);
//่ฝฌๆขๅฐresult.jsp
request.getRequestDispatcher("/jsps/result.jsp").forward(request, response);
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("BHttpServlet");
System.out.println(request.getAttribute("userName"));
response.getWriter().print("hello BHttpServlet");
/**
* tomcat8ไนๅ็ๆฌ
* ๅ
่ทๅๆฅไฝฟ็จiso็้่ฏฏๅญ็ฌฆไธฒ
* ๅ้๏ผไฝฟ็จutf-8้็ผ
*/
// String name = request.getParameter("userName");
// byte[] b = name.getBytes("iso-8859-1");
// name = new String(b, "utf-8");
// System.out.println(name);
//ๆฐ็ๆฌ
System.out.println(request.getParameter("userName"));
}
}
| 2,046 | 0.648397 | 0.634953 | 61 | 30.704918 | 27.08296 | 122 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.540984 | false | false | 7 |
7532bae2b9eb8173637d25f8ae5a0592b0a53c7f | 12,017,318,543,979 | 671564080ba0d39db9b13f5fd8e777749505e6d7 | /src/main/java/com/chatapp/Controller/ChatController.java | 3898f80b31e8b7a6d526a8382950f358252f85e5 | [] | no_license | FreekiII/Chat | https://github.com/FreekiII/Chat | ae3a0e6bdc49626ac407c35845cc5ab7c811f39e | da2feedfe0b90d0f95ae754970806eb613887b26 | refs/heads/master | 2020-06-01T20:06:55.701000 | 2019-06-18T10:13:36 | 2019-06-18T10:13:36 | 190,911,721 | 0 | 0 | null | false | 2019-06-18T10:13:37 | 2019-06-08T16:41:48 | 2019-06-08T16:44:32 | 2019-06-18T10:13:36 | 37 | 0 | 0 | 0 | Java | false | false | package com.chatapp.Controller;
import com.chatapp.Data.Message;
import com.chatapp.Data.Room;
import com.chatapp.Data.User;
import com.chatapp.Repository.MessageRepository;
import com.chatapp.Repository.RoomRepository;
import com.chatapp.Service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import java.time.LocalDateTime;
@Controller
public class ChatController {
@Autowired
private MessageRepository msgRepo;
@Autowired
private RoomRepository roomRepo;
@Autowired
private UserService userService;
@GetMapping("/chat")
public String getChat(Model model,
@AuthenticationPrincipal User user_now) {
model.addAttribute("user_now", user_now);
model.addAttribute("rooms", roomRepo.findAll());
return "chat";
}
@PostMapping("/create_room")
public String createRoom(@RequestParam String room_name,
@RequestParam(required = false) boolean is_private,
@AuthenticationPrincipal User user) {
roomRepo.save(new Room(room_name, user, is_private));
return "redirect:/chat";
}
@GetMapping("/room/{id}")
public String getRoom(@PathVariable("id") Room room, Model model,
@AuthenticationPrincipal User user_now) {
model.addAttribute("room", room);
model.addAttribute("user_now", user_now);
model.addAttribute("messages", msgRepo.findByRoom(room));
model.addAttribute("CRUTCH", LocalDateTime.now());
model.addAttribute("user_list", room.getUser_list());
model.addAttribute("all_users", userService.findAll());
return "room";
}
@PostMapping("/room/{id}")
public String sendMessage(@AuthenticationPrincipal User user,
@RequestParam String userMsg,
@PathVariable("id") Room room) {
msgRepo.save(new Message(userMsg, user, room));
return "redirect:/room/{id}";
}
@PostMapping("/room/{id}/delete_msg")
public String deleteMessage(@RequestParam String msg_id,
@PathVariable("id") Room room) {
msgRepo.deleteById(Long.valueOf(msg_id));
return "redirect:/room/{id}";
}
@PostMapping("/room/{id}/add_user")
public String addUserToChat(@RequestParam String username,
@PathVariable("id") Room room) {
room.addUser(userService.findByUsername(username));
roomRepo.save(room);
return "redirect:/room/{id}";
}
@PostMapping("/room/{id}/delete_user")
public String deleteUserToChat(@RequestParam String username,
@PathVariable("id") Room room) {
room.deleteUser(userService.findByUsername(username));
roomRepo.save(room);
return "redirect:/room/{id}";
}
@PostMapping("/room/{id}/rename")
public String renameRoom(@RequestParam String new_name,
@PathVariable("id") Room room) {
room.setName(new_name);
roomRepo.save(room);
return "redirect:/room/{id}";
}
@PostMapping("/room/{id}/delete")
public String deleteRoom(@PathVariable("id") Room room) {
roomRepo.delete(room);
return "redirect:/chat";
}
}
| UTF-8 | Java | 3,568 | java | ChatController.java | Java | [] | null | [] | package com.chatapp.Controller;
import com.chatapp.Data.Message;
import com.chatapp.Data.Room;
import com.chatapp.Data.User;
import com.chatapp.Repository.MessageRepository;
import com.chatapp.Repository.RoomRepository;
import com.chatapp.Service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import java.time.LocalDateTime;
@Controller
public class ChatController {
@Autowired
private MessageRepository msgRepo;
@Autowired
private RoomRepository roomRepo;
@Autowired
private UserService userService;
@GetMapping("/chat")
public String getChat(Model model,
@AuthenticationPrincipal User user_now) {
model.addAttribute("user_now", user_now);
model.addAttribute("rooms", roomRepo.findAll());
return "chat";
}
@PostMapping("/create_room")
public String createRoom(@RequestParam String room_name,
@RequestParam(required = false) boolean is_private,
@AuthenticationPrincipal User user) {
roomRepo.save(new Room(room_name, user, is_private));
return "redirect:/chat";
}
@GetMapping("/room/{id}")
public String getRoom(@PathVariable("id") Room room, Model model,
@AuthenticationPrincipal User user_now) {
model.addAttribute("room", room);
model.addAttribute("user_now", user_now);
model.addAttribute("messages", msgRepo.findByRoom(room));
model.addAttribute("CRUTCH", LocalDateTime.now());
model.addAttribute("user_list", room.getUser_list());
model.addAttribute("all_users", userService.findAll());
return "room";
}
@PostMapping("/room/{id}")
public String sendMessage(@AuthenticationPrincipal User user,
@RequestParam String userMsg,
@PathVariable("id") Room room) {
msgRepo.save(new Message(userMsg, user, room));
return "redirect:/room/{id}";
}
@PostMapping("/room/{id}/delete_msg")
public String deleteMessage(@RequestParam String msg_id,
@PathVariable("id") Room room) {
msgRepo.deleteById(Long.valueOf(msg_id));
return "redirect:/room/{id}";
}
@PostMapping("/room/{id}/add_user")
public String addUserToChat(@RequestParam String username,
@PathVariable("id") Room room) {
room.addUser(userService.findByUsername(username));
roomRepo.save(room);
return "redirect:/room/{id}";
}
@PostMapping("/room/{id}/delete_user")
public String deleteUserToChat(@RequestParam String username,
@PathVariable("id") Room room) {
room.deleteUser(userService.findByUsername(username));
roomRepo.save(room);
return "redirect:/room/{id}";
}
@PostMapping("/room/{id}/rename")
public String renameRoom(@RequestParam String new_name,
@PathVariable("id") Room room) {
room.setName(new_name);
roomRepo.save(room);
return "redirect:/room/{id}";
}
@PostMapping("/room/{id}/delete")
public String deleteRoom(@PathVariable("id") Room room) {
roomRepo.delete(room);
return "redirect:/chat";
}
}
| 3,568 | 0.633688 | 0.633688 | 101 | 34.326733 | 23.514946 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.653465 | false | false | 7 |
97f580131f0d0e760228159748ae5732a9aa179a | 38,087,769,981,269 | 3e50d27e508f171689d8a292e8b08ec3be202b4b | /src/main/java/pl/lodz/p/acadart/models/VerificationToken.java | c2cad5c06ddede3e2d3d5acfddd62f252e6d3775 | [] | no_license | wcislo/acadart | https://github.com/wcislo/acadart | 18e7a78f903187eab27f96e7fd2a4bb9b2b84bec | 54583a0fe4f34bad8b51111fdceff5776ea74756 | refs/heads/master | 2016-12-04T14:32:58.471000 | 2016-06-17T15:34:28 | 2016-06-17T15:34:28 | 49,226,042 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package pl.lodz.p.acadart.models;
import org.springframework.security.core.userdetails.User;
import javax.persistence.*;
import java.sql.Timestamp;
import java.util.Calendar;
import java.util.Date;
/**
* Created by jacek on 21.03.2016.
*/
@Entity
public class VerificationToken {
/**
* The Id verification token.
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name="id_verification_token")
private Long idVerificationToken;
/**
* The Token.
*/
@Column(nullable=false)
private String token;
/**
* The Verified.
*/
@Column(nullable=false)
private Boolean verified;
/**
* The Account.
*/
@OneToOne(targetEntity = Account.class, fetch = FetchType.EAGER)
@JoinColumn(nullable = false, name = "id_account")
private Account account;
/**
* The Expiry date.
*/
@Column(nullable=false)
private Date expiryDate;
/**
* Gets id verification token.
*
* @return the id verification token
*/
public Long getIdVerificationToken() {
return idVerificationToken;
}
/**
* Sets id verification token.
*
* @param idVerificationToken the id verification token
*/
public void setIdVerificationToken(Long idVerificationToken) {
this.idVerificationToken = idVerificationToken;
}
/**
* Gets token.
*
* @return the token
*/
public String getToken() {
return token;
}
/**
* Sets token.
*
* @param token the token
*/
public void setToken(String token) {
this.token = token;
}
/**
* Gets verified.
*
* @return the verified
*/
public Boolean getVerified() {
return verified;
}
/**
* Sets verified.
*
* @param verified the verified
*/
public void setVerified(Boolean verified) {
this.verified = verified;
}
/**
* Gets account.
*
* @return the account
*/
public Account getAccount() {
return account;
}
/**
* Sets account.
*
* @param account the account
*/
public void setAccount(Account account) {
this.account = account;
}
/**
* Gets expiry date.
*
* @return the expiry date
*/
public Date getExpiryDate() {
return expiryDate;
}
/**
* Sets expiry date.
*
* @param expiryDate the expiry date
*/
public void setExpiryDate(Date expiryDate) {
this.expiryDate = expiryDate;
}
}
| UTF-8 | Java | 2,604 | java | VerificationToken.java | Java | [
{
"context": "alendar;\nimport java.util.Date;\n\n/**\n * Created by jacek on 21.03.2016.\n */\n@Entity\npublic class Verificat",
"end": 224,
"score": 0.999661386013031,
"start": 219,
"tag": "USERNAME",
"value": "jacek"
}
] | null | [] | package pl.lodz.p.acadart.models;
import org.springframework.security.core.userdetails.User;
import javax.persistence.*;
import java.sql.Timestamp;
import java.util.Calendar;
import java.util.Date;
/**
* Created by jacek on 21.03.2016.
*/
@Entity
public class VerificationToken {
/**
* The Id verification token.
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name="id_verification_token")
private Long idVerificationToken;
/**
* The Token.
*/
@Column(nullable=false)
private String token;
/**
* The Verified.
*/
@Column(nullable=false)
private Boolean verified;
/**
* The Account.
*/
@OneToOne(targetEntity = Account.class, fetch = FetchType.EAGER)
@JoinColumn(nullable = false, name = "id_account")
private Account account;
/**
* The Expiry date.
*/
@Column(nullable=false)
private Date expiryDate;
/**
* Gets id verification token.
*
* @return the id verification token
*/
public Long getIdVerificationToken() {
return idVerificationToken;
}
/**
* Sets id verification token.
*
* @param idVerificationToken the id verification token
*/
public void setIdVerificationToken(Long idVerificationToken) {
this.idVerificationToken = idVerificationToken;
}
/**
* Gets token.
*
* @return the token
*/
public String getToken() {
return token;
}
/**
* Sets token.
*
* @param token the token
*/
public void setToken(String token) {
this.token = token;
}
/**
* Gets verified.
*
* @return the verified
*/
public Boolean getVerified() {
return verified;
}
/**
* Sets verified.
*
* @param verified the verified
*/
public void setVerified(Boolean verified) {
this.verified = verified;
}
/**
* Gets account.
*
* @return the account
*/
public Account getAccount() {
return account;
}
/**
* Sets account.
*
* @param account the account
*/
public void setAccount(Account account) {
this.account = account;
}
/**
* Gets expiry date.
*
* @return the expiry date
*/
public Date getExpiryDate() {
return expiryDate;
}
/**
* Sets expiry date.
*
* @param expiryDate the expiry date
*/
public void setExpiryDate(Date expiryDate) {
this.expiryDate = expiryDate;
}
}
| 2,604 | 0.574117 | 0.571045 | 139 | 17.726618 | 16.280724 | 68 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.165468 | false | false | 7 |
061f98ca7bc39f3300730bf4601eadba5f1bcbe3 | 28,956,669,536,950 | 873523f6541c81f45bc7fd32857154bac54ecbf2 | /org.foxbpm.bpmn.designer.ui/src/org/foxbpm/bpmn/designer/ui/perspectives/FoxBPMPerspective.java | 540d046f03e225d08df016ef949d91e64b2937fe | [
"Apache-2.0"
] | permissive | FoxBPM/FoxBPM-Designer | https://github.com/FoxBPM/FoxBPM-Designer | 420c8571c939bd51ddb100ddad5446b68f510ac8 | 83a75acc213cdaa3df090ea74b0fbdbf565cf961 | refs/heads/master | 2021-01-23T02:28:51.461000 | 2014-04-17T01:44:20 | 2014-04-17T01:44:20 | 18,286,645 | 4 | 2 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.foxbpm.bpmn.designer.ui.perspectives;
import org.eclipse.ui.IFolderLayout;
import org.eclipse.ui.IPageLayout;
import org.eclipse.ui.IPerspectiveFactory;
import org.eclipse.ui.console.IConsoleConstants;
public class FoxBPMPerspective implements IPerspectiveFactory {
protected static final String ID_SERVERS_VIEW = "org.eclipse.wst.server.ui.ServersView";
protected static final String ID_SEARCH_VIEW = "org.eclipse.search.ui.views.SearchView";
protected static final String ID_HISTORY_VIEW = "org.eclipse.team.ui.GenericHistoryView";
protected static final String ID_FOXBPM_VIEW = "org.foxbpm.bpmn.designer.ui.foxbpmview";
@Override
public void createInitialLayout(IPageLayout layout) {
// ่ทๅ้ๆ่งๅพ็็ผ่พ็ฉบ้ดๆ ็คบ
String editerArea = layout.getEditorArea();
// ็ผ่พๅจๅทฆไธ้จ่งๅพ
IFolderLayout leftTop = layout.createFolder("leftTop", IPageLayout.LEFT, 0.25f, editerArea); // ็ธๅฏนไบโediterAreaโ็ผ่พๅจ็ไฝ็ฝฎleft
leftTop.addView(ID_FOXBPM_VIEW);//FOXBPM่งๅพ
leftTop.addView(IPageLayout.ID_PROJECT_EXPLORER); // ๅทฅ็จ่งๅพ
// ็ผ่พๅจๅทฆไธ่ง่งๅพ
IFolderLayout leftBottom = layout.createFolder("leftBottom", IPageLayout.BOTTOM, 0.5f, IPageLayout.ID_PROJECT_EXPLORER); // ็ธๅฏนไบไธ้ขโleftโ่งๅพ็ไฝ็ฝฎๅจๅบ้จ
leftBottom.addView(IPageLayout.ID_OUTLINE); // OUTLINE่งๅพ
// ็ผ่พๅจๅบ้จ่งๅพ
IFolderLayout bottom = layout.createFolder("bottom", IPageLayout.BOTTOM, 0.65f, editerArea); // ็ธๅฏนไบโediterAreaโ็ผ่พๅจ็ไฝ็ฝฎๅบ้จ
bottom.addView(IPageLayout.ID_PROP_SHEET); // ๅฑๆง่งๅพ
bottom.addView(ID_SERVERS_VIEW);// ๆๅกๅจ่งๅพ
bottom.addView(IPageLayout.ID_PROBLEM_VIEW); // ้ฎ้ข่งๅพ
bottom.addView(IConsoleConstants.ID_CONSOLE_VIEW);// ๆงๅถๅฐ่งๅพ
bottom.addView(ID_SEARCH_VIEW);// ๆ็ดข่งๅพ
bottom.addView(ID_HISTORY_VIEW);// ๅๅฒ่งๅพ
}
}
| UTF-8 | Java | 1,928 | java | FoxBPMPerspective.java | Java | [] | null | [] | package org.foxbpm.bpmn.designer.ui.perspectives;
import org.eclipse.ui.IFolderLayout;
import org.eclipse.ui.IPageLayout;
import org.eclipse.ui.IPerspectiveFactory;
import org.eclipse.ui.console.IConsoleConstants;
public class FoxBPMPerspective implements IPerspectiveFactory {
protected static final String ID_SERVERS_VIEW = "org.eclipse.wst.server.ui.ServersView";
protected static final String ID_SEARCH_VIEW = "org.eclipse.search.ui.views.SearchView";
protected static final String ID_HISTORY_VIEW = "org.eclipse.team.ui.GenericHistoryView";
protected static final String ID_FOXBPM_VIEW = "org.foxbpm.bpmn.designer.ui.foxbpmview";
@Override
public void createInitialLayout(IPageLayout layout) {
// ่ทๅ้ๆ่งๅพ็็ผ่พ็ฉบ้ดๆ ็คบ
String editerArea = layout.getEditorArea();
// ็ผ่พๅจๅทฆไธ้จ่งๅพ
IFolderLayout leftTop = layout.createFolder("leftTop", IPageLayout.LEFT, 0.25f, editerArea); // ็ธๅฏนไบโediterAreaโ็ผ่พๅจ็ไฝ็ฝฎleft
leftTop.addView(ID_FOXBPM_VIEW);//FOXBPM่งๅพ
leftTop.addView(IPageLayout.ID_PROJECT_EXPLORER); // ๅทฅ็จ่งๅพ
// ็ผ่พๅจๅทฆไธ่ง่งๅพ
IFolderLayout leftBottom = layout.createFolder("leftBottom", IPageLayout.BOTTOM, 0.5f, IPageLayout.ID_PROJECT_EXPLORER); // ็ธๅฏนไบไธ้ขโleftโ่งๅพ็ไฝ็ฝฎๅจๅบ้จ
leftBottom.addView(IPageLayout.ID_OUTLINE); // OUTLINE่งๅพ
// ็ผ่พๅจๅบ้จ่งๅพ
IFolderLayout bottom = layout.createFolder("bottom", IPageLayout.BOTTOM, 0.65f, editerArea); // ็ธๅฏนไบโediterAreaโ็ผ่พๅจ็ไฝ็ฝฎๅบ้จ
bottom.addView(IPageLayout.ID_PROP_SHEET); // ๅฑๆง่งๅพ
bottom.addView(ID_SERVERS_VIEW);// ๆๅกๅจ่งๅพ
bottom.addView(IPageLayout.ID_PROBLEM_VIEW); // ้ฎ้ข่งๅพ
bottom.addView(IConsoleConstants.ID_CONSOLE_VIEW);// ๆงๅถๅฐ่งๅพ
bottom.addView(ID_SEARCH_VIEW);// ๆ็ดข่งๅพ
bottom.addView(ID_HISTORY_VIEW);// ๅๅฒ่งๅพ
}
}
| 1,928 | 0.760819 | 0.75614 | 37 | 44.216217 | 37.527744 | 145 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.945946 | false | false | 7 |
a67284125a4eab45dacbe7bc8787a04a9a461c9a | 25,383,256,759,934 | a08ebbb590f8dc695c1cbc1bd581253556fb4442 | /WorkoutTimer/app/src/main/java/my/appcompany/workouttimer/MainActivity.java | 070743598f67e6fa541d430930c4954803d86ad8 | [] | no_license | akansh2000/Android_Work | https://github.com/akansh2000/Android_Work | f91346d208a598177c84f0664e2f42ad1717e988 | 2e7f7a9c246081304512e1ffc6d15b6312b0d4ae | refs/heads/master | 2023-06-19T03:09:19.877000 | 2021-07-15T11:40:03 | 2021-07-15T11:40:03 | 322,541,390 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package my.appcompany.workouttimer;
import androidx.appcompat.app.AppCompatActivity;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.view.View;
import android.widget.Button;
import android.widget.MediaController;
import android.widget.SeekBar;
import android.widget.TextView;
import android.widget.VideoView;
public class MainActivity extends AppCompatActivity {
SeekBar SeekBarTime;
TextView textView;
Button reset;
CountDownTimer countDownTimer;
Button pause;
Button cont;
int second_left;
boolean seekbar_enabled=false;
public void UpdateTime(int sec_left)
{
int minute;
int second;
second_left=sec_left;
minute=sec_left/60;
second=sec_left-(minute*60);
if(minute<10)
{
if(second<10)
textView.setText("0"+Integer.toString(minute)+":"+"0"+Integer.toString(second));
else
textView.setText("0"+Integer.toString(minute)+":"+Integer.toString(second));
}
else if(second<10)
{
textView.setText(Integer.toString(minute)+":"+"0"+Integer.toString(second));
}
else
textView.setText(Integer.toString(minute)+":"+Integer.toString(second));
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
reset=findViewById(R.id.button2);
reset.setVisibility(View.INVISIBLE);
pause=findViewById(R.id.button3);
pause.setVisibility(View.INVISIBLE);
cont=findViewById(R.id.button4);
cont.setVisibility(View.INVISIBLE);
SeekBarTime= findViewById(R.id.seekBar);
textView= findViewById(R.id.textView1);
SeekBarTime.setMax(600);
SeekBarTime.setProgress(30);
SeekBarTime.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int i, boolean b)
{
UpdateTime(i);
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
});
}
public void startTime(View view)
{
SeekBarTime.setEnabled(seekbar_enabled);
seekbar_enabled=true;
reset.setVisibility(View.VISIBLE);
pause.setVisibility(View.VISIBLE);
cont.setVisibility(View.VISIBLE);
countDownTimer= new CountDownTimer(SeekBarTime.getProgress()*1000, 1000){
@Override
public void onTick(long l) {
UpdateTime((int)l/1000);
}
@Override
public void onFinish() {
MediaPlayer mediaplayer= MediaPlayer.create(getApplicationContext(), R.raw.timeup);
mediaplayer.start();
SeekBarTime.setEnabled(true);
seekbar_enabled=false;
}
}.start();
}
public void Reset(View view)
{
seekbar_enabled=false;
SeekBarTime.setProgress(0);
SeekBarTime.setEnabled(true);
countDownTimer.cancel();
textView.setText("00:00");
pause.setVisibility(View.INVISIBLE);
cont.setVisibility(View.INVISIBLE);
reset.setVisibility(View.INVISIBLE);
}
public void Pause(View view)
{
cont=findViewById(R.id.button4);
cont.setVisibility(View.VISIBLE);
countDownTimer.cancel();
}
public void Cont(View view)
{
countDownTimer= new CountDownTimer(second_left*1000, 1000){
@Override
public void onTick(long l) {
UpdateTime((int)l/1000);
}
@Override
public void onFinish() {
MediaPlayer mediaplayer= MediaPlayer.create(getApplicationContext(), R.raw.timeup);
mediaplayer.start();
SeekBarTime.setEnabled(true);
}
}.start();
}
}
| UTF-8 | Java | 4,152 | java | MainActivity.java | Java | [] | null | [] | package my.appcompany.workouttimer;
import androidx.appcompat.app.AppCompatActivity;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.view.View;
import android.widget.Button;
import android.widget.MediaController;
import android.widget.SeekBar;
import android.widget.TextView;
import android.widget.VideoView;
public class MainActivity extends AppCompatActivity {
SeekBar SeekBarTime;
TextView textView;
Button reset;
CountDownTimer countDownTimer;
Button pause;
Button cont;
int second_left;
boolean seekbar_enabled=false;
public void UpdateTime(int sec_left)
{
int minute;
int second;
second_left=sec_left;
minute=sec_left/60;
second=sec_left-(minute*60);
if(minute<10)
{
if(second<10)
textView.setText("0"+Integer.toString(minute)+":"+"0"+Integer.toString(second));
else
textView.setText("0"+Integer.toString(minute)+":"+Integer.toString(second));
}
else if(second<10)
{
textView.setText(Integer.toString(minute)+":"+"0"+Integer.toString(second));
}
else
textView.setText(Integer.toString(minute)+":"+Integer.toString(second));
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
reset=findViewById(R.id.button2);
reset.setVisibility(View.INVISIBLE);
pause=findViewById(R.id.button3);
pause.setVisibility(View.INVISIBLE);
cont=findViewById(R.id.button4);
cont.setVisibility(View.INVISIBLE);
SeekBarTime= findViewById(R.id.seekBar);
textView= findViewById(R.id.textView1);
SeekBarTime.setMax(600);
SeekBarTime.setProgress(30);
SeekBarTime.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int i, boolean b)
{
UpdateTime(i);
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
});
}
public void startTime(View view)
{
SeekBarTime.setEnabled(seekbar_enabled);
seekbar_enabled=true;
reset.setVisibility(View.VISIBLE);
pause.setVisibility(View.VISIBLE);
cont.setVisibility(View.VISIBLE);
countDownTimer= new CountDownTimer(SeekBarTime.getProgress()*1000, 1000){
@Override
public void onTick(long l) {
UpdateTime((int)l/1000);
}
@Override
public void onFinish() {
MediaPlayer mediaplayer= MediaPlayer.create(getApplicationContext(), R.raw.timeup);
mediaplayer.start();
SeekBarTime.setEnabled(true);
seekbar_enabled=false;
}
}.start();
}
public void Reset(View view)
{
seekbar_enabled=false;
SeekBarTime.setProgress(0);
SeekBarTime.setEnabled(true);
countDownTimer.cancel();
textView.setText("00:00");
pause.setVisibility(View.INVISIBLE);
cont.setVisibility(View.INVISIBLE);
reset.setVisibility(View.INVISIBLE);
}
public void Pause(View view)
{
cont=findViewById(R.id.button4);
cont.setVisibility(View.VISIBLE);
countDownTimer.cancel();
}
public void Cont(View view)
{
countDownTimer= new CountDownTimer(second_left*1000, 1000){
@Override
public void onTick(long l) {
UpdateTime((int)l/1000);
}
@Override
public void onFinish() {
MediaPlayer mediaplayer= MediaPlayer.create(getApplicationContext(), R.raw.timeup);
mediaplayer.start();
SeekBarTime.setEnabled(true);
}
}.start();
}
}
| 4,152 | 0.608141 | 0.595376 | 166 | 24.006023 | 23.140873 | 99 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.451807 | false | false | 7 |
98aac27fd4170845a10f8758d14320889a4fa945 | 21,689,584,881,343 | 2bce3d7e26cb82b637bb8941cb9b0fa3a2d6b1dc | /src/main/java/com/iothings/service/SeniorityService.java | adcddbf19343f35f87a710994930da0c44d29c7d | [] | no_license | lixiaobaq/courseCenter | https://github.com/lixiaobaq/courseCenter | a1d973cb445f96565af0a86351c2d2f77a14b343 | 90dd206cd78033542fc73d6ec63e423864eafe38 | refs/heads/master | 2023-01-12T21:53:28.167000 | 2020-11-13T02:39:33 | 2020-11-13T02:39:33 | 308,563,754 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.iothings.service;
import com.iothings.entity.Business;
import com.iothings.entity.Seniority;
import com.iothings.form.BusinessForm;
import com.iothings.form.SeniorityForm;
import java.util.List;
/**
* @author: Alex
* @time:2020/11/7 14:58
* @Description
*/
public interface SeniorityService {
Seniority save(Seniority seniority);
Seniority edit(SeniorityForm seniorityForm);
public List<Seniority> getTree(Integer status);
public List<Seniority> getTreeAndCourseCounts(Integer status);
public void delete(Integer id);
public Seniority updataByid(Integer id,Integer pid,Integer sort);
public boolean existsById(Integer id);
}
| UTF-8 | Java | 679 | java | SeniorityService.java | Java | [
{
"context": "rityForm;\n\nimport java.util.List;\n\n/**\n * @author: Alex\n * @time:2020/11/7 14:58\n * @Description\n */\n\npub",
"end": 230,
"score": 0.9985840320587158,
"start": 226,
"tag": "NAME",
"value": "Alex"
}
] | null | [] | package com.iothings.service;
import com.iothings.entity.Business;
import com.iothings.entity.Seniority;
import com.iothings.form.BusinessForm;
import com.iothings.form.SeniorityForm;
import java.util.List;
/**
* @author: Alex
* @time:2020/11/7 14:58
* @Description
*/
public interface SeniorityService {
Seniority save(Seniority seniority);
Seniority edit(SeniorityForm seniorityForm);
public List<Seniority> getTree(Integer status);
public List<Seniority> getTreeAndCourseCounts(Integer status);
public void delete(Integer id);
public Seniority updataByid(Integer id,Integer pid,Integer sort);
public boolean existsById(Integer id);
}
| 679 | 0.758468 | 0.742268 | 30 | 21.633333 | 21.468555 | 69 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false | 7 |
019ab9bee29a49fe5244d46fc27eed44860c4e57 | 22,625,887,758,728 | ce84551d9a90e0666b05763846ea9c3f0b72a69d | /fr.centralesupelec.csd.ejava/src/fr/centralesupelec/csd/ejava/TryStmt.java | 895aedd92ef94523d3a64972cd91d7fc2be719c5 | [
"Apache-2.0"
] | permissive | marcadetd/javaparser.ecore | https://github.com/marcadetd/javaparser.ecore | 2ec0caed9fc2a85497fe2738f87bf9db23232866 | 1df87c42d81c82287a81b3f3332f809812aea85d | refs/heads/master | 2023-04-01T11:48:49.615000 | 2021-03-19T13:13:43 | 2021-03-19T13:13:43 | 342,150,597 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
* Copyright (c) 2021 CentraleSupรฉlec.
* This program and the accompanying materials are made
* available under the terms of the Apache License version 2.0
* which accompanies this distribution, and is available at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Contributors:
* Computer Science Department, CentraleSupรฉlec
* Contacts:
* dominique.marcadet@centralesupelec.fr
* Web site:
* https://github.com/marcadetd/javaparser.ecore
*
*/
package fr.centralesupelec.csd.ejava;
import org.eclipse.emf.common.util.EList;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Try Stmt</b></em>'.
* <!-- end-user-doc -->
*
* <p>
* The following features are supported:
* </p>
* <ul>
* <li>{@link fr.centralesupelec.csd.ejava.TryStmt#getResources <em>Resources</em>}</li>
* <li>{@link fr.centralesupelec.csd.ejava.TryStmt#getTryBlock <em>Try Block</em>}</li>
* <li>{@link fr.centralesupelec.csd.ejava.TryStmt#getCatchClauses <em>Catch Clauses</em>}</li>
* <li>{@link fr.centralesupelec.csd.ejava.TryStmt#getFinallyBlock <em>Finally Block</em>}</li>
* </ul>
*
* @see fr.centralesupelec.csd.ejava.EJavaPackage#getTryStmt()
* @model
* @generated
*/
public interface TryStmt extends Statement {
/**
* Returns the value of the '<em><b>Resources</b></em>' containment reference list.
* The list contents are of type {@link fr.centralesupelec.csd.ejava.Expression}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the value of the '<em>Resources</em>' containment reference list.
* @see fr.centralesupelec.csd.ejava.EJavaPackage#getTryStmt_Resources()
* @model containment="true"
* @generated
*/
EList< Expression > getResources();
/**
* Returns the value of the '<em><b>Try Block</b></em>' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the value of the '<em>Try Block</em>' containment reference.
* @see #setTryBlock(BlockStmt)
* @see fr.centralesupelec.csd.ejava.EJavaPackage#getTryStmt_TryBlock()
* @model containment="true"
* @generated
*/
BlockStmt getTryBlock();
/**
* Sets the value of the '{@link fr.centralesupelec.csd.ejava.TryStmt#getTryBlock <em>Try Block</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Try Block</em>' containment reference.
* @see #getTryBlock()
* @generated
*/
void setTryBlock( BlockStmt value );
/**
* Returns the value of the '<em><b>Catch Clauses</b></em>' containment reference list.
* The list contents are of type {@link fr.centralesupelec.csd.ejava.CatchClause}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the value of the '<em>Catch Clauses</em>' containment reference list.
* @see fr.centralesupelec.csd.ejava.EJavaPackage#getTryStmt_CatchClauses()
* @model containment="true"
* @generated
*/
EList< CatchClause > getCatchClauses();
/**
* Returns the value of the '<em><b>Finally Block</b></em>' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the value of the '<em>Finally Block</em>' containment reference.
* @see #setFinallyBlock(BlockStmt)
* @see fr.centralesupelec.csd.ejava.EJavaPackage#getTryStmt_FinallyBlock()
* @model containment="true"
* @generated
*/
BlockStmt getFinallyBlock();
/**
* Sets the value of the '{@link fr.centralesupelec.csd.ejava.TryStmt#getFinallyBlock <em>Finally Block</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Finally Block</em>' containment reference.
* @see #getFinallyBlock()
* @generated
*/
void setFinallyBlock( BlockStmt value );
} // TryStmt
| UTF-8 | Java | 3,965 | java | TryStmt.java | Java | [
{
"context": " Department, CentraleSupรฉlec\n * Contacts:\n * dominique.marcadet@centralesupelec.fr\n * Web site:\n * https://github.com/marcadet",
"end": 407,
"score": 0.9999133944511414,
"start": 370,
"tag": "EMAIL",
"value": "dominique.marcadet@centralesupelec.fr"
},
{
"context": "pelec.fr\n * Web site:\n * https://github.com/marcadetd/javaparser.ecore\n * \n */\npackage fr.centralesupel",
"end": 458,
"score": 0.999462902545929,
"start": 449,
"tag": "USERNAME",
"value": "marcadetd"
}
] | null | [] | /**
* Copyright (c) 2021 CentraleSupรฉlec.
* This program and the accompanying materials are made
* available under the terms of the Apache License version 2.0
* which accompanies this distribution, and is available at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Contributors:
* Computer Science Department, CentraleSupรฉlec
* Contacts:
* <EMAIL>
* Web site:
* https://github.com/marcadetd/javaparser.ecore
*
*/
package fr.centralesupelec.csd.ejava;
import org.eclipse.emf.common.util.EList;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Try Stmt</b></em>'.
* <!-- end-user-doc -->
*
* <p>
* The following features are supported:
* </p>
* <ul>
* <li>{@link fr.centralesupelec.csd.ejava.TryStmt#getResources <em>Resources</em>}</li>
* <li>{@link fr.centralesupelec.csd.ejava.TryStmt#getTryBlock <em>Try Block</em>}</li>
* <li>{@link fr.centralesupelec.csd.ejava.TryStmt#getCatchClauses <em>Catch Clauses</em>}</li>
* <li>{@link fr.centralesupelec.csd.ejava.TryStmt#getFinallyBlock <em>Finally Block</em>}</li>
* </ul>
*
* @see fr.centralesupelec.csd.ejava.EJavaPackage#getTryStmt()
* @model
* @generated
*/
public interface TryStmt extends Statement {
/**
* Returns the value of the '<em><b>Resources</b></em>' containment reference list.
* The list contents are of type {@link fr.centralesupelec.csd.ejava.Expression}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the value of the '<em>Resources</em>' containment reference list.
* @see fr.centralesupelec.csd.ejava.EJavaPackage#getTryStmt_Resources()
* @model containment="true"
* @generated
*/
EList< Expression > getResources();
/**
* Returns the value of the '<em><b>Try Block</b></em>' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the value of the '<em>Try Block</em>' containment reference.
* @see #setTryBlock(BlockStmt)
* @see fr.centralesupelec.csd.ejava.EJavaPackage#getTryStmt_TryBlock()
* @model containment="true"
* @generated
*/
BlockStmt getTryBlock();
/**
* Sets the value of the '{@link fr.centralesupelec.csd.ejava.TryStmt#getTryBlock <em>Try Block</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Try Block</em>' containment reference.
* @see #getTryBlock()
* @generated
*/
void setTryBlock( BlockStmt value );
/**
* Returns the value of the '<em><b>Catch Clauses</b></em>' containment reference list.
* The list contents are of type {@link fr.centralesupelec.csd.ejava.CatchClause}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the value of the '<em>Catch Clauses</em>' containment reference list.
* @see fr.centralesupelec.csd.ejava.EJavaPackage#getTryStmt_CatchClauses()
* @model containment="true"
* @generated
*/
EList< CatchClause > getCatchClauses();
/**
* Returns the value of the '<em><b>Finally Block</b></em>' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the value of the '<em>Finally Block</em>' containment reference.
* @see #setFinallyBlock(BlockStmt)
* @see fr.centralesupelec.csd.ejava.EJavaPackage#getTryStmt_FinallyBlock()
* @model containment="true"
* @generated
*/
BlockStmt getFinallyBlock();
/**
* Sets the value of the '{@link fr.centralesupelec.csd.ejava.TryStmt#getFinallyBlock <em>Finally Block</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Finally Block</em>' containment reference.
* @see #getFinallyBlock()
* @generated
*/
void setFinallyBlock( BlockStmt value );
} // TryStmt
| 3,935 | 0.642443 | 0.640424 | 108 | 35.694443 | 31.933512 | 137 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.092593 | false | false | 7 |
21f96152e54610e9fd973779ff561cb01abd0cf0 | 32,066,225,874,880 | 74b3ecfa814dc68edc24000f197b314903980dd7 | /src/main/java/com/moneysaver/service/MuserService.java | acbb13df0369f90d19c5e270f54d4f98d2bb9fd9 | [] | no_license | VioletBenin/MoneySaver | https://github.com/VioletBenin/MoneySaver | aad6ff10fbcc10fc6edf30c9ddd5b65af80fe32b | 0385c2282e92698c745b8544943c1cacd9faa9ef | refs/heads/master | 2023-06-15T19:18:45.878000 | 2021-07-13T08:03:30 | 2021-07-13T08:03:30 | 383,051,002 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.moneysaver.service;
import java.util.List;
import com.moneysaver.bean.User;
public interface MuserService {
//ๆฅ่ฏขๆๆ็จๆท
List<User> selectUser();
//ๅ ้ค็จๆท
int deleteuser(int id);
//ๆดๆฐๅฏ็
int updatepwd(int id);
//ๆดๆฐ็จๆท็ฑปๅ
int updatetype(User user);
//ๆทปๅ ็จๆท
int insertuser(User user);
//ๆจก็ณๆฅ่ฏขๅไธช็จๆท
List<User> selectpartuser(User user);
//้ช่ฏๆๆบๅฏไธๆง
// List<User> checktelephone(String telephone);
}
| UTF-8 | Java | 508 | java | MuserService.java | Java | [] | null | [] | package com.moneysaver.service;
import java.util.List;
import com.moneysaver.bean.User;
public interface MuserService {
//ๆฅ่ฏขๆๆ็จๆท
List<User> selectUser();
//ๅ ้ค็จๆท
int deleteuser(int id);
//ๆดๆฐๅฏ็
int updatepwd(int id);
//ๆดๆฐ็จๆท็ฑปๅ
int updatetype(User user);
//ๆทปๅ ็จๆท
int insertuser(User user);
//ๆจก็ณๆฅ่ฏขๅไธช็จๆท
List<User> selectpartuser(User user);
//้ช่ฏๆๆบๅฏไธๆง
// List<User> checktelephone(String telephone);
}
| 508 | 0.697674 | 0.697674 | 22 | 18.545454 | 13.852231 | 49 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2 | false | false | 7 |
85f7c8ac5d71cd5668d9f50372428abdc65607d0 | 6,485,400,643,608 | 0399cdff538dc88576c2d38ebeb6eed96577e57e | /src/GameEntities/GameObject.java | 452931e698eede67867027e26ec3691ebb5e28cf | [] | no_license | FaaizHaque/Bubble-Popper | https://github.com/FaaizHaque/Bubble-Popper | 1f750047ce4875fd2ea3c85bbbcdcd5d1337ef29 | 4500b7c8e995a4cedc510206d6241da7ab34ae2a | refs/heads/master | 2021-10-21T18:37:10.193000 | 2019-03-05T17:23:12 | 2019-03-05T17:23:12 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package GameEntities;
import java.awt.Graphics;
import java.awt.Rectangle;
public class GameObject {
int x;
int y;
int width;
int height;
/*
public void drawObject( Graphics g, int posX, int posY) {
}
*/
public int getWidth() {
return width;
}
public int getHeight() {
return height;
}
public void changeWidhth( int w) {
width = w;
}
public void changeHeight( int h) {
height = h;
}
public int getXCoordinates() {
return x;
}
public int getYCoordinates() {
return y;
}
public void changeXCoordinates( int xPos) {
x = xPos;
}
public void changeYCoordinates( int yPos) {
y = yPos;
}
public Rectangle getBounds() {
return new Rectangle( x, y, width, height);
}
}
| UTF-8 | Java | 785 | java | GameObject.java | Java | [] | null | [] | package GameEntities;
import java.awt.Graphics;
import java.awt.Rectangle;
public class GameObject {
int x;
int y;
int width;
int height;
/*
public void drawObject( Graphics g, int posX, int posY) {
}
*/
public int getWidth() {
return width;
}
public int getHeight() {
return height;
}
public void changeWidhth( int w) {
width = w;
}
public void changeHeight( int h) {
height = h;
}
public int getXCoordinates() {
return x;
}
public int getYCoordinates() {
return y;
}
public void changeXCoordinates( int xPos) {
x = xPos;
}
public void changeYCoordinates( int yPos) {
y = yPos;
}
public Rectangle getBounds() {
return new Rectangle( x, y, width, height);
}
}
| 785 | 0.6 | 0.6 | 54 | 12.537037 | 14.522923 | 58 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.444444 | false | false | 7 |
7e3852b6bc3830940a33b41f638122c55caf7f32 | 9,998,683,909,899 | 7489ff5479bf7ad463ebc387e19253c698dbd007 | /ooad/tic-tac-toe-gui-app/src/com/techlabs/ttt/GameResult.java | 8f3deed06fa10a5cebd336c0392e199425321549 | [] | no_license | akshay137/swabhav_1st | https://github.com/akshay137/swabhav_1st | c507cc6e075cbe10e346f214287116b155b01ccf | c1177add6429bf017dc317161b7b3fb77e4a538e | refs/heads/master | 2021-08-20T09:56:59.673000 | 2020-07-04T08:47:38 | 2020-07-04T08:47:38 | 223,364,924 | 0 | 0 | null | false | 2020-09-16T12:29:55 | 2019-11-22T09:05:22 | 2020-09-16T12:29:05 | 2020-09-16T12:29:49 | 13,885 | 0 | 0 | 0 | Java | false | false | package com.techlabs.ttt;
public enum GameResult {
WIN,
DRAW,
GAME_RUNNING
}
| UTF-8 | Java | 90 | java | GameResult.java | Java | [] | null | [] | package com.techlabs.ttt;
public enum GameResult {
WIN,
DRAW,
GAME_RUNNING
}
| 90 | 0.655556 | 0.655556 | 7 | 11.857142 | 9.402561 | 25 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.428571 | false | false | 7 |
3b03d4f47b2459958c1f1abbe7eaf4152acc2227 | 12,953,621,403,310 | f4158e7ae88e3ef694cc9b5d91093b4481cd7424 | /app/src/main/java/com/horrornumber1/horrordepartment/Adapters/SimpleRecyclerAdapter.java | 9d95c5f26a45121b1f0b22b31e9fe394cc755530 | [] | no_license | hirooms2/horror_dep | https://github.com/hirooms2/horror_dep | 846e8e15f89d89e0a218679f754aa99aa73025fe | 0489ebd5238125da032c23524c7ac236bb077cd9 | refs/heads/master | 2021-01-16T18:37:01.885000 | 2018-09-20T03:39:57 | 2018-09-20T03:39:57 | 100,097,899 | 0 | 0 | null | false | 2018-01-20T10:09:11 | 2017-08-12T07:51:05 | 2017-08-12T07:59:41 | 2018-01-20T10:09:11 | 154,270 | 0 | 0 | 1 | Java | false | null | package com.horrornumber1.horrordepartment.Adapters;
import android.graphics.Typeface;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.horrornumber1.horrordepartment.DataModel.Model;
import com.horrornumber1.horrordepartment.R;
import java.util.List;
public class SimpleRecyclerAdapter extends RecyclerView.Adapter<SimpleRecyclerAdapter.SimpleViewHolder>{
private List<Model> itemData;
public SimpleRecyclerAdapter(List<Model> itemData){
this.itemData = itemData;
}
@Override
public SimpleRecyclerAdapter.SimpleViewHolder onCreateViewHolder(ViewGroup parent, int viewType){
View itemLayoutView = LayoutInflater.from(parent.getContext()).inflate(R.layout.roar_item_view, null);
SimpleViewHolder viewHolder = new SimpleViewHolder(itemLayoutView);
return viewHolder;
}
@Override
public void onBindViewHolder(SimpleRecyclerAdapter.SimpleViewHolder viewHolder, int position){
viewHolder.txtViewTitle.setText(itemData.get(position).getTitle());
}
public static class SimpleViewHolder extends android.support.v7.widget.RecyclerView.ViewHolder {
public TextView txtViewTitle;
Typeface font = Typeface.createFromAsset(itemView.getContext().getAssets(), "fonts/nanumgothic.ttf");
public SimpleViewHolder(View itemLayoutView) {
super(itemLayoutView);
txtViewTitle = (TextView) itemLayoutView.findViewById(R.id.roar_item_title);
txtViewTitle.setTypeface(font);
}
}
@Override
public int getItemCount(){
return itemData.size();
}
}
| UTF-8 | Java | 1,740 | java | SimpleRecyclerAdapter.java | Java | [] | null | [] | package com.horrornumber1.horrordepartment.Adapters;
import android.graphics.Typeface;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.horrornumber1.horrordepartment.DataModel.Model;
import com.horrornumber1.horrordepartment.R;
import java.util.List;
public class SimpleRecyclerAdapter extends RecyclerView.Adapter<SimpleRecyclerAdapter.SimpleViewHolder>{
private List<Model> itemData;
public SimpleRecyclerAdapter(List<Model> itemData){
this.itemData = itemData;
}
@Override
public SimpleRecyclerAdapter.SimpleViewHolder onCreateViewHolder(ViewGroup parent, int viewType){
View itemLayoutView = LayoutInflater.from(parent.getContext()).inflate(R.layout.roar_item_view, null);
SimpleViewHolder viewHolder = new SimpleViewHolder(itemLayoutView);
return viewHolder;
}
@Override
public void onBindViewHolder(SimpleRecyclerAdapter.SimpleViewHolder viewHolder, int position){
viewHolder.txtViewTitle.setText(itemData.get(position).getTitle());
}
public static class SimpleViewHolder extends android.support.v7.widget.RecyclerView.ViewHolder {
public TextView txtViewTitle;
Typeface font = Typeface.createFromAsset(itemView.getContext().getAssets(), "fonts/nanumgothic.ttf");
public SimpleViewHolder(View itemLayoutView) {
super(itemLayoutView);
txtViewTitle = (TextView) itemLayoutView.findViewById(R.id.roar_item_title);
txtViewTitle.setTypeface(font);
}
}
@Override
public int getItemCount(){
return itemData.size();
}
}
| 1,740 | 0.746552 | 0.743678 | 54 | 31.222221 | 33.91256 | 110 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.481481 | false | false | 7 |
6b1db481fe6327e25aae2f39a0668744270499df | 29,996,051,641,274 | 67d67d41cf38dc2ca3ec834cd70378fb41147ce1 | /src/main/java/com/icomac/service/WebSocketConfig.java | b2b09ba1948e7dbc01f29d59819f908e440b4682 | [] | no_license | IComac/userLogin_chat | https://github.com/IComac/userLogin_chat | 0270adf3abaa4587a47848787e27d290a7dd7b36 | ae7dbc5709ea819adb92cb17a8a352f9954d8e4f | refs/heads/master | 2020-05-25T21:45:30.689000 | 2019-05-22T12:35:55 | 2019-05-22T12:35:55 | 188,004,685 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.icomac.service;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.socket.config.annotation.EnableWebSocket;
import org.springframework.web.socket.config.annotation.WebSocketConfigurer;
import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry;
import org.springframework.web.socket.handler.TextWebSocketHandler;
import org.springframework.web.socket.server.standard.ServletServerContainerFactoryBean;
import com.icomac.websocket.WebSocketHandler;
import com.icomac.websocket.WebSocketHandshakeInterceptor;
/**
* Spring WebSocket็้
็ฝฎ๏ผ่ฟ้้็จ็ๆฏๆณจ่งฃ็ๆนๅผ
*/
@Configuration
@EnableWebMvc
@EnableWebSocket
public class WebSocketConfig extends WebMvcConfigurerAdapter implements WebSocketConfigurer {
@Override
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
//1.ๆณจๅWebSocket
registry.addHandler(webSocketHandler(), "/websocket"). ////ๆณจๅHandler,่ฎพ็ฝฎwebsocket็ๅฐๅ
addInterceptors(myInterceptor()); //ๆณจๅInterceptor
System.out.println("After Regist");
}
@Bean
public TextWebSocketHandler webSocketHandler() {
return new WebSocketHandler();
}
@Bean
public WebSocketHandshakeInterceptor myInterceptor(){
return new WebSocketHandshakeInterceptor();
}
@Bean
public ServletServerContainerFactoryBean createWebSocketContainer() {
ServletServerContainerFactoryBean container = new ServletServerContainerFactoryBean();
container.setMaxTextMessageBufferSize(8192*4);
container.setMaxBinaryMessageBufferSize(8192*4);
return container;
}
}
| UTF-8 | Java | 1,981 | java | WebSocketConfig.java | Java | [] | null | [] | package com.icomac.service;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.socket.config.annotation.EnableWebSocket;
import org.springframework.web.socket.config.annotation.WebSocketConfigurer;
import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry;
import org.springframework.web.socket.handler.TextWebSocketHandler;
import org.springframework.web.socket.server.standard.ServletServerContainerFactoryBean;
import com.icomac.websocket.WebSocketHandler;
import com.icomac.websocket.WebSocketHandshakeInterceptor;
/**
* Spring WebSocket็้
็ฝฎ๏ผ่ฟ้้็จ็ๆฏๆณจ่งฃ็ๆนๅผ
*/
@Configuration
@EnableWebMvc
@EnableWebSocket
public class WebSocketConfig extends WebMvcConfigurerAdapter implements WebSocketConfigurer {
@Override
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
//1.ๆณจๅWebSocket
registry.addHandler(webSocketHandler(), "/websocket"). ////ๆณจๅHandler,่ฎพ็ฝฎwebsocket็ๅฐๅ
addInterceptors(myInterceptor()); //ๆณจๅInterceptor
System.out.println("After Regist");
}
@Bean
public TextWebSocketHandler webSocketHandler() {
return new WebSocketHandler();
}
@Bean
public WebSocketHandshakeInterceptor myInterceptor(){
return new WebSocketHandshakeInterceptor();
}
@Bean
public ServletServerContainerFactoryBean createWebSocketContainer() {
ServletServerContainerFactoryBean container = new ServletServerContainerFactoryBean();
container.setMaxTextMessageBufferSize(8192*4);
container.setMaxBinaryMessageBufferSize(8192*4);
return container;
}
}
| 1,981 | 0.764645 | 0.758942 | 50 | 37.580002 | 32.274506 | 98 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.56 | false | false | 7 |
245651c956a186d5778eb1915c86032bbcd4aada | 30,537,217,503,040 | de12bec43f69d55e639653bfd09a22ada6e40532 | /dayu-web/src/main/java/com/rookiefly/open/dubbo/dayu/web/task/InvokeReportTask.java | fa5f65960e83b3af72090b6a69eb742555169101 | [] | no_license | rookiefly/dayu | https://github.com/rookiefly/dayu | e91dc1f569cc9a74f3795d6ee2ba261e53bf9055 | 550bd111b10512cad0f23da0f71a24f20560390e | refs/heads/master | 2023-06-06T17:26:33.893000 | 2021-06-29T06:43:48 | 2021-06-29T06:43:48 | 342,225,987 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.rookiefly.open.dubbo.dayu.web.task;
import com.rookiefly.open.dubbo.dayu.biz.service.ApplicationService;
import com.rookiefly.open.dubbo.dayu.biz.service.HostService;
import com.rookiefly.open.dubbo.dayu.biz.service.InvokeService;
import com.rookiefly.open.dubbo.dayu.common.constants.MonitorConstants;
import com.rookiefly.open.dubbo.dayu.common.tools.TimeUtil;
import com.rookiefly.open.dubbo.dayu.dao.redis.manager.InvokeRedisManager;
import com.rookiefly.open.dubbo.dayu.dao.redis.manager.InvokeReportManager;
import com.rookiefly.open.dubbo.dayu.model.bo.HostBO;
import com.rookiefly.open.dubbo.dayu.model.entity.InvokeDO;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.common.constants.CommonConstants;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* ๆฅ่กจๆฐๆฎ๏ผๆฏๅฐๆถ็ป่ฎกไธๆฌกๅผๅง็ป่ฎก
*/
@Component
@Slf4j
public class InvokeReportTask {
@Resource
private InvokeReportManager invokeReportManager;
@Resource
private InvokeRedisManager invokeRedisManager;
@Resource
private InvokeService invokeBiz;
@Resource
private ApplicationService applicationService;
@Resource
private HostService hostService;
/**
* ๆฏๅคฉๆฏไธชๅฐๆถๅฐๆถ :01
*/
@Scheduled(cron = "0 1 * * * ?")
public void everyHourDo() {
//ๅบ็จ้ด่ฐ็จๆฐ้
try {
appSumOnHour();
} catch (Exception e) {
e.printStackTrace();
}
//ๅบ็จไฝไธบๆไพ่
ๆฏๅฐๆถ่ขซๆถ่ดน็ๆฐ้
try {
appConsumerHourInHour();
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* ๆฏๅคฉๅๆจ 00๏ผ01ๅๆง่ก
*/
@Scheduled(cron = "0 1 0 * * ?")
public void everyDayDo() {
//ๅบ็จไฝไธบๆไพ่
ๆฏๅคฉ่ขซๆถ่ดน็ๆฐ้
try {
appConsumerOnHourToDay();
} catch (Exception e) {
e.printStackTrace();
}
//ๅบ็จๆนๆณๆ่กๆฆ
try {
appMethodRankOnDay();
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* ๆฏๅคฉๆฏไธชๅฐๆถๅฐๆถ :01 ็ป่ฎกๆฏไธชๅบ็จๆฏไธชๅฐๆถ็ธไบ่ฐ็จๆ
ๅต
*/
private void appSumOnHour() {
Date now = new Date();
Date lastHourDate = TimeUtil.getBeforHourByNumber(now, -1);
String lastHourDay = TimeUtil.getDateString(now);
String lastHour = TimeUtil.getHourString(lastHourDate);
List<String> allApplication = applicationService.getAllApplicationsCache();
List<InvokeDO> invokeDOList = invokeRedisManager.getInvokeByHour(lastHour);
for (String applicationName : allApplication) {
Map<String, Map<String, Integer>> appDayMap = invokeReportManager.getAppRelationByAppOnDay(applicationName, lastHourDay);
Map<String, Integer> providerMap = appDayMap.get(CommonConstants.PROVIDER);
Map<String, Integer> consumerMap = appDayMap.get(CommonConstants.CONSUMER);
if (providerMap == null) {
providerMap = new HashMap<>();
appDayMap.put(CommonConstants.PROVIDER, providerMap);
}
if (consumerMap == null) {
consumerMap = new HashMap<>();
appDayMap.put(CommonConstants.CONSUMER, consumerMap);
}
boolean hasPro = false;
boolean hasConsu = false;
for (InvokeDO invokeDO : invokeDOList) {
String invokeType = invokeDO.getAppType();
if (invokeType.equals(CommonConstants.PROVIDER)) {
// ๅไธบๆไพ่
๏ผๆไพๆๅก--ๆพไธๅฐๆถ่ดน่
continue;
}
String providerHost = invokeDO.getProviderHost();
String providerPort = invokeDO.getProviderPort();
Set<String> nameSet = hostService.getAppNameByHost(new HostBO(providerHost, providerPort));
if (nameSet.size() != 1) {
// ๆไธๅชๆไธไธช
continue;
}
String appName = invokeDO.getApplication();
String providerName = nameSet.iterator().next();
if (applicationName.equals(appName)) {
Integer success = invokeDO.getSuccess();
// app ไฝไธบๆถ่ดน่
๏ผ่ขซๆไพ
Integer providerSum = providerMap.get(providerName) == null ? Integer.valueOf(0) : providerMap.get(providerName);
providerSum += success;
providerMap.put(providerName, providerSum);
hasPro = true;
}
if (applicationName.equals(providerName)) {
// app ไฝไธบๆไพ่
๏ผ่ขซๆถ่ดน
Integer success = invokeDO.getSuccess();
Integer consumerSum = consumerMap.get(appName) == null ? Integer.valueOf(0) : consumerMap.get(appName);
consumerSum += success;
consumerMap.put(appName, consumerSum);
hasConsu = true;
}
}
if (!hasPro) {
appDayMap.remove(CommonConstants.PROVIDER);
}
if (!hasConsu) {
appDayMap.remove(CommonConstants.CONSUMER);
}
if (hasConsu || hasPro) {
invokeReportManager.saveAppRelationByAppOnDay(applicationName, lastHourDay, appDayMap);
}
}
}
/**
* ๆฏๅฐๆถ็ๆฐๆฎ่ฐ็จ
*/
private void appConsumerHourInHour() {
Date now = new Date();
Date lastHourDate = TimeUtil.getBeforHourByNumber(now, -1);
String lastHourDay = TimeUtil.getDateString(now);
String lastHour = TimeUtil.getHourString(lastHourDate);
List<String> allApplication = applicationService.getAllApplicationsCache();
List<InvokeDO> invokeDOList = invokeRedisManager.getInvokeByHour(lastHour);
for (String applicationName : allApplication) {
Map<String, Map<String, ?>> saveMap = (Map<String, Map<String, ?>>) invokeReportManager.getConsumerByAppOnHour(applicationName, lastHourDay);
boolean isOk = false;
for (InvokeDO invokeDO : invokeDOList) {
String invokeType = invokeDO.getAppType();
if (invokeType.equals(CommonConstants.PROVIDER)) {
// ๅไธบๆไพ่
๏ผๆไพๆๅก--ๆพไธๅฐๆถ่ดน่
continue;
}
String providerHost = invokeDO.getProviderHost();
String providerPort = invokeDO.getProviderPort();
Set<String> nameSet = hostService.getAppNameByHost(new HostBO(providerHost, providerPort));
if (nameSet.size() != 1) {
// ๆไธๅชๆไธไธช
continue;
}
String appName = invokeDO.getApplication();
String providerName = nameSet.iterator().next();
if (applicationName.equals(providerName)) {
isOk = true;
// app ไฝไธบๆไพ่
๏ผ่ขซๆถ่ดน
Integer success = invokeDO.getSuccess();
Integer fail = invokeDO.getFailure();
// ๅญๅจ
Map<String, Object> hourSumMap = (Map<String, Object>) saveMap.get(appName);
if (null == hourSumMap) {
hourSumMap = new HashMap<>();
saveMap.put(appName, hourSumMap);
}
Map<String, Integer> sumMap = (Map<String, Integer>) hourSumMap.get(lastHour);
if (sumMap == null) {
sumMap = new HashMap<>();
sumMap.put(MonitorConstants.SUCCESS, success);
sumMap.put(MonitorConstants.FAIL, fail);
hourSumMap.put(lastHour, sumMap);
} else {
success += sumMap.get(MonitorConstants.SUCCESS);
fail += sumMap.get(MonitorConstants.FAIL);
sumMap.put(MonitorConstants.SUCCESS, success);
sumMap.put(MonitorConstants.FAIL, fail);
}
}
}
if (isOk) {
invokeReportManager.saveConsumerByAppOnHour(applicationName, lastHourDay, saveMap);
}
}
}
/**
* ๆฏๅคฉๅๆจ 00:01 ็ป่ฎกๆฏไธชๅบ็จๆจๅคฉ็ๆฏๅฐๆถๆถ่ดน่
ๆถ่ดนๆ
ๅต๏ผๆฑๆปไธบไธๅคฉ
*/
private void appConsumerOnHourToDay() {
String yesterday = TimeUtil.getBeforDateByNumber(new Date(), -1);
List<String> allApplication = applicationService.getAllApplicationsCache();
for (String applicationName : allApplication) {
Map<String, Map<String, ?>> saveMap = (Map<String, Map<String, ?>>) invokeReportManager.getConsumerByAppOnHour(applicationName, yesterday);
Map<String, Map<String, Integer>> dayMap = new HashMap<>();
for (Map.Entry<String, Map<String, ?>> mapEntry : saveMap.entrySet()) {
String consumerApp = mapEntry.getKey();
Map<String, ?> hourSumMap = mapEntry.getValue();
boolean isOk = false;
Integer success = 0;
Integer fail = 0;
for (Map.Entry<String, ?> hourEntry : hourSumMap.entrySet()) {
Map<String, Integer> sumMap = (Map<String, Integer>) hourEntry.getValue();
success += sumMap.get(MonitorConstants.SUCCESS);
fail += sumMap.get(MonitorConstants.FAIL);
isOk = true;
}
if (isOk) {
// ๅญๅฝๆฅ sourceAPP ่ขซ consumerApp ๆถ่ดน็ๆๅๆฐ
Map<String, Integer> numberMap = new HashMap<>();
numberMap.put(MonitorConstants.SUCCESS, success);
numberMap.put(MonitorConstants.FAIL, fail);
dayMap.put(consumerApp, numberMap);
}
}
if (!dayMap.isEmpty()) {
invokeReportManager.saveConsumerByAppOnDay(applicationName, yesterday, dayMap);
}
}
}
/**
* ๆฏๅคฉๅๆจ็ป่ฎกไนๅไธๅคฉ็ๆฏไธชๅบ็จๆ่กๆฆ
*/
private void appMethodRankOnDay() {
List<String> allApplication = applicationService.getAllApplicationsCache();
for (String applicationName : allApplication) {
invokeBiz.getMethodRankByAppName(applicationName);
}
}
} | UTF-8 | Java | 10,945 | java | InvokeReportTask.java | Java | [] | null | [] | package com.rookiefly.open.dubbo.dayu.web.task;
import com.rookiefly.open.dubbo.dayu.biz.service.ApplicationService;
import com.rookiefly.open.dubbo.dayu.biz.service.HostService;
import com.rookiefly.open.dubbo.dayu.biz.service.InvokeService;
import com.rookiefly.open.dubbo.dayu.common.constants.MonitorConstants;
import com.rookiefly.open.dubbo.dayu.common.tools.TimeUtil;
import com.rookiefly.open.dubbo.dayu.dao.redis.manager.InvokeRedisManager;
import com.rookiefly.open.dubbo.dayu.dao.redis.manager.InvokeReportManager;
import com.rookiefly.open.dubbo.dayu.model.bo.HostBO;
import com.rookiefly.open.dubbo.dayu.model.entity.InvokeDO;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.common.constants.CommonConstants;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* ๆฅ่กจๆฐๆฎ๏ผๆฏๅฐๆถ็ป่ฎกไธๆฌกๅผๅง็ป่ฎก
*/
@Component
@Slf4j
public class InvokeReportTask {
@Resource
private InvokeReportManager invokeReportManager;
@Resource
private InvokeRedisManager invokeRedisManager;
@Resource
private InvokeService invokeBiz;
@Resource
private ApplicationService applicationService;
@Resource
private HostService hostService;
/**
* ๆฏๅคฉๆฏไธชๅฐๆถๅฐๆถ :01
*/
@Scheduled(cron = "0 1 * * * ?")
public void everyHourDo() {
//ๅบ็จ้ด่ฐ็จๆฐ้
try {
appSumOnHour();
} catch (Exception e) {
e.printStackTrace();
}
//ๅบ็จไฝไธบๆไพ่
ๆฏๅฐๆถ่ขซๆถ่ดน็ๆฐ้
try {
appConsumerHourInHour();
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* ๆฏๅคฉๅๆจ 00๏ผ01ๅๆง่ก
*/
@Scheduled(cron = "0 1 0 * * ?")
public void everyDayDo() {
//ๅบ็จไฝไธบๆไพ่
ๆฏๅคฉ่ขซๆถ่ดน็ๆฐ้
try {
appConsumerOnHourToDay();
} catch (Exception e) {
e.printStackTrace();
}
//ๅบ็จๆนๆณๆ่กๆฆ
try {
appMethodRankOnDay();
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* ๆฏๅคฉๆฏไธชๅฐๆถๅฐๆถ :01 ็ป่ฎกๆฏไธชๅบ็จๆฏไธชๅฐๆถ็ธไบ่ฐ็จๆ
ๅต
*/
private void appSumOnHour() {
Date now = new Date();
Date lastHourDate = TimeUtil.getBeforHourByNumber(now, -1);
String lastHourDay = TimeUtil.getDateString(now);
String lastHour = TimeUtil.getHourString(lastHourDate);
List<String> allApplication = applicationService.getAllApplicationsCache();
List<InvokeDO> invokeDOList = invokeRedisManager.getInvokeByHour(lastHour);
for (String applicationName : allApplication) {
Map<String, Map<String, Integer>> appDayMap = invokeReportManager.getAppRelationByAppOnDay(applicationName, lastHourDay);
Map<String, Integer> providerMap = appDayMap.get(CommonConstants.PROVIDER);
Map<String, Integer> consumerMap = appDayMap.get(CommonConstants.CONSUMER);
if (providerMap == null) {
providerMap = new HashMap<>();
appDayMap.put(CommonConstants.PROVIDER, providerMap);
}
if (consumerMap == null) {
consumerMap = new HashMap<>();
appDayMap.put(CommonConstants.CONSUMER, consumerMap);
}
boolean hasPro = false;
boolean hasConsu = false;
for (InvokeDO invokeDO : invokeDOList) {
String invokeType = invokeDO.getAppType();
if (invokeType.equals(CommonConstants.PROVIDER)) {
// ๅไธบๆไพ่
๏ผๆไพๆๅก--ๆพไธๅฐๆถ่ดน่
continue;
}
String providerHost = invokeDO.getProviderHost();
String providerPort = invokeDO.getProviderPort();
Set<String> nameSet = hostService.getAppNameByHost(new HostBO(providerHost, providerPort));
if (nameSet.size() != 1) {
// ๆไธๅชๆไธไธช
continue;
}
String appName = invokeDO.getApplication();
String providerName = nameSet.iterator().next();
if (applicationName.equals(appName)) {
Integer success = invokeDO.getSuccess();
// app ไฝไธบๆถ่ดน่
๏ผ่ขซๆไพ
Integer providerSum = providerMap.get(providerName) == null ? Integer.valueOf(0) : providerMap.get(providerName);
providerSum += success;
providerMap.put(providerName, providerSum);
hasPro = true;
}
if (applicationName.equals(providerName)) {
// app ไฝไธบๆไพ่
๏ผ่ขซๆถ่ดน
Integer success = invokeDO.getSuccess();
Integer consumerSum = consumerMap.get(appName) == null ? Integer.valueOf(0) : consumerMap.get(appName);
consumerSum += success;
consumerMap.put(appName, consumerSum);
hasConsu = true;
}
}
if (!hasPro) {
appDayMap.remove(CommonConstants.PROVIDER);
}
if (!hasConsu) {
appDayMap.remove(CommonConstants.CONSUMER);
}
if (hasConsu || hasPro) {
invokeReportManager.saveAppRelationByAppOnDay(applicationName, lastHourDay, appDayMap);
}
}
}
/**
* ๆฏๅฐๆถ็ๆฐๆฎ่ฐ็จ
*/
private void appConsumerHourInHour() {
Date now = new Date();
Date lastHourDate = TimeUtil.getBeforHourByNumber(now, -1);
String lastHourDay = TimeUtil.getDateString(now);
String lastHour = TimeUtil.getHourString(lastHourDate);
List<String> allApplication = applicationService.getAllApplicationsCache();
List<InvokeDO> invokeDOList = invokeRedisManager.getInvokeByHour(lastHour);
for (String applicationName : allApplication) {
Map<String, Map<String, ?>> saveMap = (Map<String, Map<String, ?>>) invokeReportManager.getConsumerByAppOnHour(applicationName, lastHourDay);
boolean isOk = false;
for (InvokeDO invokeDO : invokeDOList) {
String invokeType = invokeDO.getAppType();
if (invokeType.equals(CommonConstants.PROVIDER)) {
// ๅไธบๆไพ่
๏ผๆไพๆๅก--ๆพไธๅฐๆถ่ดน่
continue;
}
String providerHost = invokeDO.getProviderHost();
String providerPort = invokeDO.getProviderPort();
Set<String> nameSet = hostService.getAppNameByHost(new HostBO(providerHost, providerPort));
if (nameSet.size() != 1) {
// ๆไธๅชๆไธไธช
continue;
}
String appName = invokeDO.getApplication();
String providerName = nameSet.iterator().next();
if (applicationName.equals(providerName)) {
isOk = true;
// app ไฝไธบๆไพ่
๏ผ่ขซๆถ่ดน
Integer success = invokeDO.getSuccess();
Integer fail = invokeDO.getFailure();
// ๅญๅจ
Map<String, Object> hourSumMap = (Map<String, Object>) saveMap.get(appName);
if (null == hourSumMap) {
hourSumMap = new HashMap<>();
saveMap.put(appName, hourSumMap);
}
Map<String, Integer> sumMap = (Map<String, Integer>) hourSumMap.get(lastHour);
if (sumMap == null) {
sumMap = new HashMap<>();
sumMap.put(MonitorConstants.SUCCESS, success);
sumMap.put(MonitorConstants.FAIL, fail);
hourSumMap.put(lastHour, sumMap);
} else {
success += sumMap.get(MonitorConstants.SUCCESS);
fail += sumMap.get(MonitorConstants.FAIL);
sumMap.put(MonitorConstants.SUCCESS, success);
sumMap.put(MonitorConstants.FAIL, fail);
}
}
}
if (isOk) {
invokeReportManager.saveConsumerByAppOnHour(applicationName, lastHourDay, saveMap);
}
}
}
/**
* ๆฏๅคฉๅๆจ 00:01 ็ป่ฎกๆฏไธชๅบ็จๆจๅคฉ็ๆฏๅฐๆถๆถ่ดน่
ๆถ่ดนๆ
ๅต๏ผๆฑๆปไธบไธๅคฉ
*/
private void appConsumerOnHourToDay() {
String yesterday = TimeUtil.getBeforDateByNumber(new Date(), -1);
List<String> allApplication = applicationService.getAllApplicationsCache();
for (String applicationName : allApplication) {
Map<String, Map<String, ?>> saveMap = (Map<String, Map<String, ?>>) invokeReportManager.getConsumerByAppOnHour(applicationName, yesterday);
Map<String, Map<String, Integer>> dayMap = new HashMap<>();
for (Map.Entry<String, Map<String, ?>> mapEntry : saveMap.entrySet()) {
String consumerApp = mapEntry.getKey();
Map<String, ?> hourSumMap = mapEntry.getValue();
boolean isOk = false;
Integer success = 0;
Integer fail = 0;
for (Map.Entry<String, ?> hourEntry : hourSumMap.entrySet()) {
Map<String, Integer> sumMap = (Map<String, Integer>) hourEntry.getValue();
success += sumMap.get(MonitorConstants.SUCCESS);
fail += sumMap.get(MonitorConstants.FAIL);
isOk = true;
}
if (isOk) {
// ๅญๅฝๆฅ sourceAPP ่ขซ consumerApp ๆถ่ดน็ๆๅๆฐ
Map<String, Integer> numberMap = new HashMap<>();
numberMap.put(MonitorConstants.SUCCESS, success);
numberMap.put(MonitorConstants.FAIL, fail);
dayMap.put(consumerApp, numberMap);
}
}
if (!dayMap.isEmpty()) {
invokeReportManager.saveConsumerByAppOnDay(applicationName, yesterday, dayMap);
}
}
}
/**
* ๆฏๅคฉๅๆจ็ป่ฎกไนๅไธๅคฉ็ๆฏไธชๅบ็จๆ่กๆฆ
*/
private void appMethodRankOnDay() {
List<String> allApplication = applicationService.getAllApplicationsCache();
for (String applicationName : allApplication) {
invokeBiz.getMethodRankByAppName(applicationName);
}
}
} | 10,945 | 0.570842 | 0.568071 | 276 | 36.927536 | 30.063011 | 153 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.634058 | false | false | 7 |
d5e0e48d013239343b8ba3e5ba92e218101c0f63 | 31,112,743,144,477 | 1a90f9254ad28babf85cb62abf45be02522659a5 | /MemberTest200513/src/c/UpdateCommand.java | a2d8a9f007dbbf655041ff8bf455798e6a1bbe5f | [] | no_license | wonhae/workspace_java_fromLee | https://github.com/wonhae/workspace_java_fromLee | a181f73b87df8c534099de5561112403f60516d4 | 4794b20a72ba48a5ed32233234ab09b2a668e31a | refs/heads/master | 2022-11-07T00:43:46.067000 | 2020-07-03T08:44:44 | 2020-07-03T08:44:44 | 276,850,592 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package c;
import java.util.Scanner;
import com.naver.DB;
import com.naver.MemberDTO;
import kr.co.ca.Command;
public class UpdateCommand implements Command {
@Override
public void execute(Scanner sc) {
System.out.println("์์ ํ id๋ฅผ ์
๋ ฅํ์ธ์");
String id = sc.nextLine();
MemberDTO dto = new MemberDTO(id, null, -1);
boolean isMember = DB.db.contains(dto);
//db์ generic = dto -> contains(o) ์ o์ dto ๋ง๋ค์ด์ฃผ๊ธฐ //contains ๋์ indexof ๋ก ํด๋๋จ
int i = DB.db.indexOf(dto); //๋ง์ผ๋ฉด index, ์๋๋ฉด -1๋ก ๊ฐ์ง๊ณ ์จ๋ค.
switch (i) {
case -1:
System.out.println("ํ์์ด ์๋๋๋ค");
break;
default:
System.out.println("์ด๋ฆ์ ์
๋ ฅํ์ธ์");
String name = sc.nextLine();
System.out.println("๋์ด๋ฅผ ์
๋ ฅํ์ธ์");
int age = sc.nextInt();
sc.nextLine();
//dto ๊ฐ์ ๋ฐ๊พผ๊ฒ
dto.setName(name);
dto.setAge(age);
//db ๋ฐ๊พธ๋๋ฒ -ํ์์์ด ์ด๋์๋์งํ์ธ
DB.db.set(i, dto);
break;
}
//
// if (i != -1) {
// System.out.println("์ด๋ฆ์ ์
๋ ฅํ์ธ์");
// String name = sc.nextLine();
//
// System.out.println("๋์ด๋ฅผ ์
๋ ฅํ์ธ์");
// int age = sc.nextInt();
// sc.nextLine();
//
// //dto ๊ฐ์ ๋ฐ๊พผ๊ฒ
// dto.setName(name);
// dto.setAge(age);
//
// //db ๋ฐ๊พธ๋๋ฒ -ํ์์์ด ์ด๋์๋์งํ์ธ
// DB.db.set(i, dto);
//
// } else {
// System.out.println("ํ์์ด ์๋๋๋ค.");
// }
//
//
// if (isMember) { //isMember = true ์ด๋ ๊ฒ์จ๋๋จ
// System.out.println("์ด๋ฆ์ ์
๋ ฅํ์ธ์");
// String name = sc.nextLine();
//
// System.out.println("๋์ด๋ฅผ ์
๋ ฅํ์ธ์");
// int age = sc.nextInt();
// sc.nextLine();
//
// //dto ๊ฐ์ ๋ฐ๊พผ๊ฒ
// dto.setName(name);
// dto.setAge(age);
//
// //db ๋ฐ๊พธ๋๋ฒ -ํ์์์ด ์ด๋์๋์งํ์ธ
// int idx = DB.db.indexOf(dto);
// DB.db.set(idx, dto); // idx ์ธ๋ฑ์ค๋ก ๊ฐ์ง๊ฒ์ dto๋ก ์์ ํ์ธ์!! (์ด์ set ๋ฐฐ์ธ๋ contains(ํ์์ฌ๋ถํ์ธ) or indexof(๋ง์ฝ ํ์์ด ์์ผ๋ฉด -1 )๋ก ์์ )
//
// } else {
// System.out.println("ํ์์ด ์๋๋๋ค.");
// }
//
}
}
| UTF-8 | Java | 2,262 | java | UpdateCommand.java | Java | [] | null | [] | package c;
import java.util.Scanner;
import com.naver.DB;
import com.naver.MemberDTO;
import kr.co.ca.Command;
public class UpdateCommand implements Command {
@Override
public void execute(Scanner sc) {
System.out.println("์์ ํ id๋ฅผ ์
๋ ฅํ์ธ์");
String id = sc.nextLine();
MemberDTO dto = new MemberDTO(id, null, -1);
boolean isMember = DB.db.contains(dto);
//db์ generic = dto -> contains(o) ์ o์ dto ๋ง๋ค์ด์ฃผ๊ธฐ //contains ๋์ indexof ๋ก ํด๋๋จ
int i = DB.db.indexOf(dto); //๋ง์ผ๋ฉด index, ์๋๋ฉด -1๋ก ๊ฐ์ง๊ณ ์จ๋ค.
switch (i) {
case -1:
System.out.println("ํ์์ด ์๋๋๋ค");
break;
default:
System.out.println("์ด๋ฆ์ ์
๋ ฅํ์ธ์");
String name = sc.nextLine();
System.out.println("๋์ด๋ฅผ ์
๋ ฅํ์ธ์");
int age = sc.nextInt();
sc.nextLine();
//dto ๊ฐ์ ๋ฐ๊พผ๊ฒ
dto.setName(name);
dto.setAge(age);
//db ๋ฐ๊พธ๋๋ฒ -ํ์์์ด ์ด๋์๋์งํ์ธ
DB.db.set(i, dto);
break;
}
//
// if (i != -1) {
// System.out.println("์ด๋ฆ์ ์
๋ ฅํ์ธ์");
// String name = sc.nextLine();
//
// System.out.println("๋์ด๋ฅผ ์
๋ ฅํ์ธ์");
// int age = sc.nextInt();
// sc.nextLine();
//
// //dto ๊ฐ์ ๋ฐ๊พผ๊ฒ
// dto.setName(name);
// dto.setAge(age);
//
// //db ๋ฐ๊พธ๋๋ฒ -ํ์์์ด ์ด๋์๋์งํ์ธ
// DB.db.set(i, dto);
//
// } else {
// System.out.println("ํ์์ด ์๋๋๋ค.");
// }
//
//
// if (isMember) { //isMember = true ์ด๋ ๊ฒ์จ๋๋จ
// System.out.println("์ด๋ฆ์ ์
๋ ฅํ์ธ์");
// String name = sc.nextLine();
//
// System.out.println("๋์ด๋ฅผ ์
๋ ฅํ์ธ์");
// int age = sc.nextInt();
// sc.nextLine();
//
// //dto ๊ฐ์ ๋ฐ๊พผ๊ฒ
// dto.setName(name);
// dto.setAge(age);
//
// //db ๋ฐ๊พธ๋๋ฒ -ํ์์์ด ์ด๋์๋์งํ์ธ
// int idx = DB.db.indexOf(dto);
// DB.db.set(idx, dto); // idx ์ธ๋ฑ์ค๋ก ๊ฐ์ง๊ฒ์ dto๋ก ์์ ํ์ธ์!! (์ด์ set ๋ฐฐ์ธ๋ contains(ํ์์ฌ๋ถํ์ธ) or indexof(๋ง์ฝ ํ์์ด ์์ผ๋ฉด -1 )๋ก ์์ )
//
// } else {
// System.out.println("ํ์์ด ์๋๋๋ค.");
// }
//
}
}
| 2,262 | 0.565405 | 0.562703 | 96 | 18.270834 | 18.870987 | 119 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.677083 | false | false | 7 |
2d6c3e60023ed436d609d12bc5f3f7b66f138809 | 10,668,698,802,959 | e60a6e3e4af03235ef93d8e4a97b8f69cfd6437c | /hedera-node/hedera-app-spi/src/testFixtures/java/com/hedera/node/app/spi/fixtures/TestKeyInfo.java | 57fc8b80d7ad0299a9c4dff70d843d289c18dab3 | [
"Apache-2.0"
] | permissive | hashgraph/hedera-services | https://github.com/hashgraph/hedera-services | bca04c759d2cc5b539f4fd726151c60c831035dd | 0b028f60bd92e4dc6524a068e75351ffe193ea40 | refs/heads/develop | 2023-08-17T05:06:10.782000 | 2023-08-16T21:57:57 | 2023-08-16T21:57:57 | 261,828,887 | 260 | 112 | Apache-2.0 | false | 2023-09-14T21:47:44 | 2020-05-06T17:17:43 | 2023-09-13T08:40:37 | 2023-09-14T21:47:43 | 332,528 | 227 | 86 | 1,359 | Java | false | false | /*
* Copyright (C) 2023 Hedera Hashgraph, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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.hedera.node.app.spi.fixtures;
import com.hedera.hapi.node.base.Key;
import com.hedera.pbj.runtime.io.buffer.Bytes;
import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.Nullable;
/** Holds information related to keys used in test {@link com.hedera.node.app.spi.fixtures.Scenarios} */
public record TestKeyInfo(
@NonNull Bytes privateKey, @NonNull Key publicKey, @NonNull Key uncompressedPublicKey, @Nullable Bytes alias) {}
| UTF-8 | Java | 1,090 | java | TestKeyInfo.java | Java | [
{
"context": "/*\n * Copyright (C) 2023 Hedera Hashgraph, LLC\n *\n * Licensed under the Apache License, Vers",
"end": 41,
"score": 0.9890907406806946,
"start": 25,
"tag": "NAME",
"value": "Hedera Hashgraph"
}
] | null | [] | /*
* Copyright (C) 2023 <NAME>, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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.hedera.node.app.spi.fixtures;
import com.hedera.hapi.node.base.Key;
import com.hedera.pbj.runtime.io.buffer.Bytes;
import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.Nullable;
/** Holds information related to keys used in test {@link com.hedera.node.app.spi.fixtures.Scenarios} */
public record TestKeyInfo(
@NonNull Bytes privateKey, @NonNull Key publicKey, @NonNull Key uncompressedPublicKey, @Nullable Bytes alias) {}
| 1,080 | 0.755046 | 0.747706 | 26 | 40.923077 | 32.904202 | 120 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.538462 | false | false | 7 |
ac4e6dc470176362f9279860df44c2cab4b18346 | 18,133,351,934,965 | d1308618d1370fef95d368960ef66ef3f3464962 | /src/main/java/net/vorps/bungee/commands/Fly.java | 5614baf34e3fcb5e782d2dc9e3cdd87794c7a5bc | [] | no_license | Vorps/Bungee | https://github.com/Vorps/Bungee | be8856525ab25da82e8dacbe1ae8e366e76aa493 | 78137e37fad15563138a385313f416b49d917e33 | refs/heads/master | 2022-12-20T22:03:40.426000 | 2020-09-20T15:30:25 | 2020-09-20T15:30:25 | 283,517,463 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package net.vorps.bungee.commands;
import net.vorps.api.commands.*;
import net.vorps.bungee.players.PlayerData;
public class Fly {
@CommandPermission(value = "sender", console = false)
public static void fly(CommandSender commandSender){
new CommandsAction("FLY", commandSender, (e) -> PlayerData.setFly(commandSender.getUUID(), e), () -> PlayerData.isFly(commandSender.getUUID())).toggle();
}
@CommandPermission(value = "sender", console = false)
public static void on(CommandSender commandSender){
new CommandsAction("FLY", commandSender, (e) -> PlayerData.setFly(commandSender.getUUID(), e), () -> PlayerData.isFly(commandSender.getUUID())).on();
}
@CommandPermission(value = "sender", console = false)
public static void off(CommandSender commandSender){
new CommandsAction("FLY", commandSender, (e) -> PlayerData.setFly(commandSender.getUUID(), e), () -> PlayerData.isFly(commandSender.getUUID())).off();
}
@CommandPermission("player")
public static void fly(CommandSender commandSender, @CommandParameter("PLAYER_EXCEPT_SENDER") Player player){
new CommandsAction("FLY", commandSender, (e) -> PlayerData.setFly(player.getUUID(), e), () -> PlayerData.isFly(player.getUUID())).toggle(player);
}
@CommandPermission("player")
public static void on(CommandSender commandSender, @CommandParameter("PLAYER_EXCEPT_SENDER") Player player){
new CommandsAction("FLY", commandSender, (e) -> PlayerData.setFly(player.getUUID(), e), () -> PlayerData.isFly(player.getUUID())).on(player);
}
@CommandPermission("player")
public static void off(CommandSender commandSender, @CommandParameter("PLAYER_EXCEPT_SENDER") Player player){
new CommandsAction("FLY", commandSender, (e) -> PlayerData.setFly(player.getUUID(), e), () -> PlayerData.isFly(player.getUUID())).off(player);
}
}
| UTF-8 | Java | 1,895 | java | Fly.java | Java | [] | null | [] | package net.vorps.bungee.commands;
import net.vorps.api.commands.*;
import net.vorps.bungee.players.PlayerData;
public class Fly {
@CommandPermission(value = "sender", console = false)
public static void fly(CommandSender commandSender){
new CommandsAction("FLY", commandSender, (e) -> PlayerData.setFly(commandSender.getUUID(), e), () -> PlayerData.isFly(commandSender.getUUID())).toggle();
}
@CommandPermission(value = "sender", console = false)
public static void on(CommandSender commandSender){
new CommandsAction("FLY", commandSender, (e) -> PlayerData.setFly(commandSender.getUUID(), e), () -> PlayerData.isFly(commandSender.getUUID())).on();
}
@CommandPermission(value = "sender", console = false)
public static void off(CommandSender commandSender){
new CommandsAction("FLY", commandSender, (e) -> PlayerData.setFly(commandSender.getUUID(), e), () -> PlayerData.isFly(commandSender.getUUID())).off();
}
@CommandPermission("player")
public static void fly(CommandSender commandSender, @CommandParameter("PLAYER_EXCEPT_SENDER") Player player){
new CommandsAction("FLY", commandSender, (e) -> PlayerData.setFly(player.getUUID(), e), () -> PlayerData.isFly(player.getUUID())).toggle(player);
}
@CommandPermission("player")
public static void on(CommandSender commandSender, @CommandParameter("PLAYER_EXCEPT_SENDER") Player player){
new CommandsAction("FLY", commandSender, (e) -> PlayerData.setFly(player.getUUID(), e), () -> PlayerData.isFly(player.getUUID())).on(player);
}
@CommandPermission("player")
public static void off(CommandSender commandSender, @CommandParameter("PLAYER_EXCEPT_SENDER") Player player){
new CommandsAction("FLY", commandSender, (e) -> PlayerData.setFly(player.getUUID(), e), () -> PlayerData.isFly(player.getUUID())).off(player);
}
}
| 1,895 | 0.703958 | 0.703958 | 37 | 50.216217 | 55.761139 | 161 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.054054 | false | false | 7 |
ede6471aaba2b8eee882d22fe70cd0eb8eff3e9e | 20,444,044,385,612 | e2543a9473e167540eb5faebe858b2d49015c8b2 | /JonathanSniderProjectOne/jonathanSniderProjectOne/src/main/java/servlets/HomePage.java | d067cb748f3a857942d6b0daadda8e37d5ad11c6 | [] | no_license | 1810Oct29SPARK/SniderJ | https://github.com/1810Oct29SPARK/SniderJ | 61f656c86c8fd2193fd1f3d0106513ef58e16cf4 | 39a84c38135095532de2834b7728e1e72a5cc8e5 | refs/heads/master | 2020-04-04T11:58:13.221000 | 2018-12-23T21:26:58 | 2018-12-23T21:26:58 | 155,909,805 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package servlets;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
/**
* Servlet implementation class Profile
*/
public class HomePage extends HttpServlet {
/**
*
*/
private static final long serialVersionUID = 1921801819225175967L;
/**
* @see HttpServlet#HttpServlet()
*/
public HomePage() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//Check whether as session exists for the incoming request
HttpSession session = request.getSession(false);
if (session != null && session.getAttribute("logInUsername") != null) {
request.getRequestDispatcher("homePage.html").forward(request, response);
}
else
{
System.out.println("for some reason I'm doing this");
response.sendRedirect("login");
}
}
}
| UTF-8 | Java | 1,209 | java | HomePage.java | Java | [] | null | [] | package servlets;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
/**
* Servlet implementation class Profile
*/
public class HomePage extends HttpServlet {
/**
*
*/
private static final long serialVersionUID = 1921801819225175967L;
/**
* @see HttpServlet#HttpServlet()
*/
public HomePage() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//Check whether as session exists for the incoming request
HttpSession session = request.getSession(false);
if (session != null && session.getAttribute("logInUsername") != null) {
request.getRequestDispatcher("homePage.html").forward(request, response);
}
else
{
System.out.println("for some reason I'm doing this");
response.sendRedirect("login");
}
}
}
| 1,209 | 0.71464 | 0.698925 | 46 | 25.282608 | 28.132191 | 118 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.478261 | false | false | 7 |
33a46bf476ceeb5cf5143bd90711a9e3e750b3a2 | 23,579,370,480,093 | 5ac40869a7f79cbb5f32ad4792c58f706634974a | /logica/src/decisao/DecisaoSimplesDesafio.java | 36a73bb4784a3c87f1955e57620964ea026d1591 | [] | no_license | patriciahedler/wsremotopatricia | https://github.com/patriciahedler/wsremotopatricia | a4e3b62aa873d4c5f644241f58915fbbd47084f2 | 05810b50b6196f0f02b23de4c36c1cf5165511ae | refs/heads/main | 2023-04-04T07:25:31.869000 | 2021-03-23T15:25:28 | 2021-03-23T15:25:28 | 349,073,709 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package decisao;
import javax.swing.JOptionPane;
public class DecisaoSimplesDesafio {
public static void main(String[] args) {
String nome =JOptionPane.showInputDialog("Digite seu nome");
int idade = Integer.parseInt(JOptionPane.showInputDialog("Digite a sua idade"));
if(idade< 16) {
System.out.println("Nรฃo pode votar");
}
if(idade>= 16 && idade<18 || idade>=70) {
System.out.println("Voto facultativo");
}
if(idade>=18 && idade<70) {
System.out.println("Voto Obrigatรณrio");
}
}
}
| ISO-8859-1 | Java | 535 | java | DecisaoSimplesDesafio.java | Java | [] | null | [] | package decisao;
import javax.swing.JOptionPane;
public class DecisaoSimplesDesafio {
public static void main(String[] args) {
String nome =JOptionPane.showInputDialog("Digite seu nome");
int idade = Integer.parseInt(JOptionPane.showInputDialog("Digite a sua idade"));
if(idade< 16) {
System.out.println("Nรฃo pode votar");
}
if(idade>= 16 && idade<18 || idade>=70) {
System.out.println("Voto facultativo");
}
if(idade>=18 && idade<70) {
System.out.println("Voto Obrigatรณrio");
}
}
}
| 535 | 0.664165 | 0.641651 | 29 | 17.379311 | 22.341263 | 83 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.586207 | false | false | 7 |
c0fa287581252f81ef7e90fd198ed6b3c16579b2 | 9,706,626,101,601 | 9b5b43ecfec9592bc28ecefa250a2f1a464930c0 | /app/src/main/java/com/finals/pdfier/utils/BottomNavigationUtils.java | 79dc8b3fd9ca76d5746aed343b9424647550f67e | [] | no_license | HenryUdorji/Pdfier | https://github.com/HenryUdorji/Pdfier | 1dbb5ad4f92cd31d2e6a7d473675c9564d6119dc | bb32dd77085f3b45248fba25dc2dbf09c378f228 | refs/heads/master | 2023-07-14T00:47:56.366000 | 2021-08-27T13:43:40 | 2021-08-27T13:43:40 | 384,129,595 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.finals.pdfier.utils;
import android.content.Context;
import android.content.Intent;
import android.view.MenuItem;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import com.finals.pdfier.R;
import com.finals.pdfier.ui.HomeActivity;
import com.finals.pdfier.ui.ListActivity;
import com.google.android.material.bottomnavigation.BottomNavigationView;
//
// Created by on 7/6/2021.
//
public class BottomNavigationUtils {
public static void enableBottomNavigation(Context context,
BottomNavigationView bottomNavigationView) {
bottomNavigationView.setOnNavigationItemSelectedListener(item -> {
int id = item.getItemId();
if (id == R.id.home) {
Intent intent = new Intent(context, HomeActivity.class);
context.startActivity(intent);
((AppCompatActivity)context).finish();
return true;
}
else if (id == R.id.list) {
Intent intent = new Intent(context, ListActivity.class);
context.startActivity(intent);
((AppCompatActivity)context).finish();
return true;
}
return false;
});
}
}
| UTF-8 | Java | 1,293 | java | BottomNavigationUtils.java | Java | [] | null | [] | package com.finals.pdfier.utils;
import android.content.Context;
import android.content.Intent;
import android.view.MenuItem;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import com.finals.pdfier.R;
import com.finals.pdfier.ui.HomeActivity;
import com.finals.pdfier.ui.ListActivity;
import com.google.android.material.bottomnavigation.BottomNavigationView;
//
// Created by on 7/6/2021.
//
public class BottomNavigationUtils {
public static void enableBottomNavigation(Context context,
BottomNavigationView bottomNavigationView) {
bottomNavigationView.setOnNavigationItemSelectedListener(item -> {
int id = item.getItemId();
if (id == R.id.home) {
Intent intent = new Intent(context, HomeActivity.class);
context.startActivity(intent);
((AppCompatActivity)context).finish();
return true;
}
else if (id == R.id.list) {
Intent intent = new Intent(context, ListActivity.class);
context.startActivity(intent);
((AppCompatActivity)context).finish();
return true;
}
return false;
});
}
}
| 1,293 | 0.629544 | 0.624903 | 39 | 32.153847 | 23.838709 | 85 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.615385 | false | false | 7 |
3d3bbeae8f6e1a66a01ddbc3c7e40ec74e057dde | 4,690,104,306,078 | 85d66443481098676e7e9f97f8bd57c5ca7074cb | /src/main/java/ua/ppadalka/webstore/product/resource/ProductCategoryResource.java | 5144e112031e647764b3d024e4a10225ff5f1288 | [] | no_license | paulwinner1995/web-store | https://github.com/paulwinner1995/web-store | db8573785bdb24b795728614c427afdf0ed6e5d7 | 88505e0df92c206a14cd72a62ded394635033ef5 | refs/heads/master | 2021-01-12T07:59:50.420000 | 2017-05-09T20:00:30 | 2017-05-09T20:00:30 | 77,082,390 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ua.ppadalka.webstore.product.resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import ua.ppadalka.webstore.product.dto.ProductCategoryDto;
import ua.ppadalka.webstore.product.mapper.ProductCategoryMapper;
import ua.ppadalka.webstore.product.service.ProductCategoryService;
import javax.validation.Valid;
import java.util.List;
import java.util.Optional;
@RestController
@RequestMapping(path = "/category", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public class ProductCategoryResource {
private final ProductCategoryService productCategoryService;
private final ProductCategoryMapper categoryMapper;
@Autowired
public ProductCategoryResource(ProductCategoryService categoryService,
ProductCategoryMapper categoryMapper) {
this.productCategoryService = categoryService;
this.categoryMapper = categoryMapper;
}
@GetMapping
public ResponseEntity<Page<ProductCategoryDto>> findCategories(Pageable pageable) {
return ResponseEntity.ok(productCategoryService.findCategories(pageable));
}
@GetMapping(path = "/names")
public ResponseEntity<List<String>> findCategoryNames(@RequestParam(name = "example") String example) {
return ResponseEntity.ok(productCategoryService.findCategoryNamesByExample(example));
}
@PostMapping
public ResponseEntity<ProductCategoryDto> createCategory(@Valid @RequestBody ProductCategoryDto category) {
return ResponseEntity.ok(productCategoryService.save(category));
}
@PutMapping
public ResponseEntity<ProductCategoryDto> updateCategory(@Valid @RequestBody ProductCategoryDto category) {
return ResponseEntity.ok(productCategoryService.save(category));
}
}
| UTF-8 | Java | 2,494 | java | ProductCategoryResource.java | Java | [] | null | [] | package ua.ppadalka.webstore.product.resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import ua.ppadalka.webstore.product.dto.ProductCategoryDto;
import ua.ppadalka.webstore.product.mapper.ProductCategoryMapper;
import ua.ppadalka.webstore.product.service.ProductCategoryService;
import javax.validation.Valid;
import java.util.List;
import java.util.Optional;
@RestController
@RequestMapping(path = "/category", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public class ProductCategoryResource {
private final ProductCategoryService productCategoryService;
private final ProductCategoryMapper categoryMapper;
@Autowired
public ProductCategoryResource(ProductCategoryService categoryService,
ProductCategoryMapper categoryMapper) {
this.productCategoryService = categoryService;
this.categoryMapper = categoryMapper;
}
@GetMapping
public ResponseEntity<Page<ProductCategoryDto>> findCategories(Pageable pageable) {
return ResponseEntity.ok(productCategoryService.findCategories(pageable));
}
@GetMapping(path = "/names")
public ResponseEntity<List<String>> findCategoryNames(@RequestParam(name = "example") String example) {
return ResponseEntity.ok(productCategoryService.findCategoryNamesByExample(example));
}
@PostMapping
public ResponseEntity<ProductCategoryDto> createCategory(@Valid @RequestBody ProductCategoryDto category) {
return ResponseEntity.ok(productCategoryService.save(category));
}
@PutMapping
public ResponseEntity<ProductCategoryDto> updateCategory(@Valid @RequestBody ProductCategoryDto category) {
return ResponseEntity.ok(productCategoryService.save(category));
}
}
| 2,494 | 0.801524 | 0.801123 | 58 | 42 | 32.137634 | 111 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.534483 | false | false | 7 |
052b4a91588b36d86fddec99338c1c02bb60eff3 | 14,516,989,476,909 | 5ee0a269a89b2f450f6e3aafea306c75c8cd20f2 | /src/main/java/com/kasperin/inventory_management/repository/StationaryRepository.java | 3f5d7bd4ecd0086788717878ecbf18b56e14bffd | [
"MIT"
] | permissive | KasperingOps/springboot_inventory_project | https://github.com/KasperingOps/springboot_inventory_project | 91e131667a97a57e841994a5678f1b6e68dd8d4c | 8961727e25b85a64251b9bbf9da6a98599fc13af | refs/heads/master | 2023-07-23T13:41:52.427000 | 2020-05-18T16:58:59 | 2020-05-18T16:58:59 | 265,023,218 | 0 | 0 | MIT | false | 2023-07-17T14:12:38 | 2020-05-18T18:15:16 | 2020-05-18T18:41:55 | 2023-07-17T14:12:38 | 162 | 0 | 0 | 1 | Java | false | false | package com.kasperin.inventory_management.repository;
import com.kasperin.inventory_management.domain.Stationary;
import org.springframework.data.jpa.repository.JpaRepository;
public interface StationaryRepository extends JpaRepository<Stationary, Long> {
Stationary findByNameIgnoreCase(String name);
boolean existsById(Long id);
boolean existsByNameIgnoreCase(String name);
}
| UTF-8 | Java | 394 | java | StationaryRepository.java | Java | [] | null | [] | package com.kasperin.inventory_management.repository;
import com.kasperin.inventory_management.domain.Stationary;
import org.springframework.data.jpa.repository.JpaRepository;
public interface StationaryRepository extends JpaRepository<Stationary, Long> {
Stationary findByNameIgnoreCase(String name);
boolean existsById(Long id);
boolean existsByNameIgnoreCase(String name);
}
| 394 | 0.822335 | 0.822335 | 12 | 31.833334 | 28.608953 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.583333 | false | false | 7 |
9c15170aa23ba99a7844c0a4600f894658d5f7be | 29,411,936,103,591 | 50f155906b655ae998dbcf58d660a38afeafadd4 | /src/main/java/ls/eclair/wechat_book/entity/Video.java | db2e9a9b57f3d9e8a47133a8813b99ee2df8ee29 | [] | no_license | ldovely/wechat_book | https://github.com/ldovely/wechat_book | e01570072e260ba6b1a038b38d31a764de763cde | 8e5a933e8c88232da04fa1c1f1dd38184b78d97b | refs/heads/master | 2021-08-31T01:32:03.847000 | 2017-12-20T03:59:58 | 2017-12-20T03:59:58 | 114,838,531 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ls.eclair.wechat_book.entity;
/**
* @author lisbo
* @description
* @since 2017-12-7 15:22
*/
public class Video {
//ๅชไฝๆไปถid
private String MediaId;
public String getMediaId() {
return MediaId;
}
public void setMediaId(String mediaId) {
MediaId = mediaId;
}
}
| UTF-8 | Java | 325 | java | Video.java | Java | [
{
"context": "kage ls.eclair.wechat_book.entity;\n\n/**\n * @author lisbo\n * @description\n * @since 2017-12-7 15:22\n */\n\n\np",
"end": 59,
"score": 0.9995558857917786,
"start": 54,
"tag": "USERNAME",
"value": "lisbo"
}
] | null | [] | package ls.eclair.wechat_book.entity;
/**
* @author lisbo
* @description
* @since 2017-12-7 15:22
*/
public class Video {
//ๅชไฝๆไปถid
private String MediaId;
public String getMediaId() {
return MediaId;
}
public void setMediaId(String mediaId) {
MediaId = mediaId;
}
}
| 325 | 0.608833 | 0.574133 | 23 | 12.782609 | 13.551693 | 44 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.173913 | false | false | 7 |
7122f50f021cf58f833127ee411fd3d419a35fb8 | 27,195,732,939,843 | f93068dd5536b2a9014c89fe0cc0a4755923a9c7 | /app/src/main/java/com/example/amitrai/sociallogin/activity/Activity_MainMenu.java | da172b3e7eeb2b70a22dadf481e7260cfdeefa8f | [] | no_license | amitrai98/social_login | https://github.com/amitrai98/social_login | 391f4a19ba77e67d41c562ba52dabaf07c55c7be | a12a4e8f0ba926f927b7a50c7c27a6f90968b011 | refs/heads/master | 2021-01-17T19:57:54.825000 | 2015-11-16T09:11:12 | 2015-11-16T09:11:12 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.amitrai.sociallogin.activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarActivity;
import android.view.View;
import android.widget.ListView;
import com.example.amitrai.sociallogin.R;
import com.example.amitrai.sociallogin.adapters.NavigationAdapter;
import com.example.amitrai.sociallogin.fragments.Fragment_Menu;
import com.mikepenz.materialdrawer.AccountHeader;
import com.mikepenz.materialdrawer.AccountHeaderBuilder;
import com.mikepenz.materialdrawer.Drawer;
import com.mikepenz.materialdrawer.DrawerBuilder;
import com.mikepenz.materialdrawer.model.DividerDrawerItem;
import com.mikepenz.materialdrawer.model.PrimaryDrawerItem;
import com.mikepenz.materialdrawer.model.ProfileDrawerItem;
import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem;
import com.mikepenz.materialdrawer.model.interfaces.IProfile;
import java.util.ArrayList;
import java.util.List;
/**
* Created by cynogen on 29/10/15.
*/
public class Activity_MainMenu extends ActionBarActivity{
private ListView drawer_list = null;
private android.support.v4.widget.DrawerLayout drawerLayout = null;
private NavigationAdapter adapter = null;
private List<String> options_list = new ArrayList<>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main_menu);
// init();
openMenuFragment();
initNavigationDrawer();
}
/**
* initalizing views
*/
private void init(){
drawer_list = (ListView) findViewById(R.id.left_drawer);
drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
View headerview = getLayoutInflater().inflate(R.layout.design_drawer_header, null);
drawer_list.addHeaderView(headerview);
adapter = new NavigationAdapter(this, options_list);
drawer_list.setAdapter(adapter);
adapter.notifyDataSetChanged();
}
private void initNavigationDrawer(){
// Create the AccountHeader
AccountHeader headerResult = new AccountHeaderBuilder()
.withActivity(this)
.withHeaderBackground(R.color.md_black_1000)
.withOnlyMainProfileImageVisible(true)
.addProfiles(
new ProfileDrawerItem().withName("").withEmail("www.test.com").withIcon(getResources().getDrawable(R.drawable.app_icon))
)
.withOnAccountHeaderListener(new AccountHeader.OnAccountHeaderListener() {
@Override
public boolean onProfileChanged(View view, IProfile profile, boolean currentProfile) {
return false;
}
})
.build();
//if you want to update the items at a later time it is recommended to keep it in a variable
PrimaryDrawerItem item1 = new PrimaryDrawerItem().withName(getResources().getString(R.string.facebook));
PrimaryDrawerItem item2 = new PrimaryDrawerItem().withName(getResources().getString(R.string.google));
PrimaryDrawerItem item3 = new PrimaryDrawerItem().withName(getResources().getString(R.string.twitter));
PrimaryDrawerItem item4 = new PrimaryDrawerItem().withName(getResources().getString(R.string.website));
PrimaryDrawerItem item5 = new PrimaryDrawerItem().withName(getResources().getString(R.string.phone_no));
PrimaryDrawerItem item6 = new PrimaryDrawerItem().withName(getResources().getString(R.string.share_app));
PrimaryDrawerItem item7 = new PrimaryDrawerItem().withName(getResources().getString(R.string.logout));
//create the drawer and remember the `Drawer` result object
new DrawerBuilder()
.withActivity(this)
.withAccountHeader(headerResult)
.addDrawerItems(
item1,
item2,
item3,
item4,
item5,
item6,
item7,
new DividerDrawerItem()
)
.withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {
@Override
public boolean onItemClick(View view, int position, IDrawerItem drawerItem) {
switch (position){
case 1:
break;
case 2:
break;
case 3:
break;
case 4:
openUrl();
break;
case 5:
break;
case 6:
openShareDialog();
break;
case 7:
logOut();
break;
}
return true;
}
})
.build();
// result.getActionBarDrawerToggle().setDrawerIndicatorEnabled(false);
// getActionBar().setDisplayHomeAsUpEnabled(true);
// Drawer drawer = new DrawerBuilder().withAccountHeader(headerResult).withActivity(this).build();
}
@Override
public void onBackPressed() {
int fragment_count = getSupportFragmentManager().getBackStackEntryCount();
if(fragment_count>1){
super.onBackPressed();
}else{
finish();
}
}
private void logOut(){
startActivity(new Intent(this, LoginActivity.class));
}
private void openShareDialog(){
// Intent share = new Intent(Intent.ACTION_SEND);
// share.setType("image/jpeg");
//
//
// share.putExtra(Intent.EXTRA_STREAM,
// Uri.parse("file:///sdcard/DCIM/Camera/myPic.jpg"));
//
// startActivity(Intent.createChooser(share, "Share App"));
try
{ Intent i = new Intent(Intent.ACTION_SEND);
i.setType("text/plain");
i.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.app_name));
String sAux = "\nLet me recommend you this application\n\n";
sAux = sAux + "https://play.google.com/store/apps/details?id=Orion.Soft \n\n";
i.putExtra(Intent.EXTRA_TEXT, sAux);
startActivity(Intent.createChooser(i, "choose one"));
}
catch(Exception e)
{ //e.toString();
}
}
private void openUrl(){
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.co.in"));
startActivity(browserIntent);
}
/**
* opens menu fragment
*/
private void openMenuFragment(){
getSupportFragmentManager()
.beginTransaction()
.add(R.id.container, new Fragment_Menu())
.addToBackStack(Fragment_Menu.class.getSimpleName())
.commit();
}
}
| UTF-8 | Java | 7,325 | java | Activity_MainMenu.java | Java | [
{
"context": "rayList;\nimport java.util.List;\n\n/**\n * Created by cynogen on 29/10/15.\n */\npublic class Activity_MainMenu e",
"end": 1045,
"score": 0.9996907114982605,
"start": 1038,
"tag": "USERNAME",
"value": "cynogen"
}
] | null | [] | package com.example.amitrai.sociallogin.activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarActivity;
import android.view.View;
import android.widget.ListView;
import com.example.amitrai.sociallogin.R;
import com.example.amitrai.sociallogin.adapters.NavigationAdapter;
import com.example.amitrai.sociallogin.fragments.Fragment_Menu;
import com.mikepenz.materialdrawer.AccountHeader;
import com.mikepenz.materialdrawer.AccountHeaderBuilder;
import com.mikepenz.materialdrawer.Drawer;
import com.mikepenz.materialdrawer.DrawerBuilder;
import com.mikepenz.materialdrawer.model.DividerDrawerItem;
import com.mikepenz.materialdrawer.model.PrimaryDrawerItem;
import com.mikepenz.materialdrawer.model.ProfileDrawerItem;
import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem;
import com.mikepenz.materialdrawer.model.interfaces.IProfile;
import java.util.ArrayList;
import java.util.List;
/**
* Created by cynogen on 29/10/15.
*/
public class Activity_MainMenu extends ActionBarActivity{
private ListView drawer_list = null;
private android.support.v4.widget.DrawerLayout drawerLayout = null;
private NavigationAdapter adapter = null;
private List<String> options_list = new ArrayList<>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main_menu);
// init();
openMenuFragment();
initNavigationDrawer();
}
/**
* initalizing views
*/
private void init(){
drawer_list = (ListView) findViewById(R.id.left_drawer);
drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
View headerview = getLayoutInflater().inflate(R.layout.design_drawer_header, null);
drawer_list.addHeaderView(headerview);
adapter = new NavigationAdapter(this, options_list);
drawer_list.setAdapter(adapter);
adapter.notifyDataSetChanged();
}
private void initNavigationDrawer(){
// Create the AccountHeader
AccountHeader headerResult = new AccountHeaderBuilder()
.withActivity(this)
.withHeaderBackground(R.color.md_black_1000)
.withOnlyMainProfileImageVisible(true)
.addProfiles(
new ProfileDrawerItem().withName("").withEmail("www.test.com").withIcon(getResources().getDrawable(R.drawable.app_icon))
)
.withOnAccountHeaderListener(new AccountHeader.OnAccountHeaderListener() {
@Override
public boolean onProfileChanged(View view, IProfile profile, boolean currentProfile) {
return false;
}
})
.build();
//if you want to update the items at a later time it is recommended to keep it in a variable
PrimaryDrawerItem item1 = new PrimaryDrawerItem().withName(getResources().getString(R.string.facebook));
PrimaryDrawerItem item2 = new PrimaryDrawerItem().withName(getResources().getString(R.string.google));
PrimaryDrawerItem item3 = new PrimaryDrawerItem().withName(getResources().getString(R.string.twitter));
PrimaryDrawerItem item4 = new PrimaryDrawerItem().withName(getResources().getString(R.string.website));
PrimaryDrawerItem item5 = new PrimaryDrawerItem().withName(getResources().getString(R.string.phone_no));
PrimaryDrawerItem item6 = new PrimaryDrawerItem().withName(getResources().getString(R.string.share_app));
PrimaryDrawerItem item7 = new PrimaryDrawerItem().withName(getResources().getString(R.string.logout));
//create the drawer and remember the `Drawer` result object
new DrawerBuilder()
.withActivity(this)
.withAccountHeader(headerResult)
.addDrawerItems(
item1,
item2,
item3,
item4,
item5,
item6,
item7,
new DividerDrawerItem()
)
.withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {
@Override
public boolean onItemClick(View view, int position, IDrawerItem drawerItem) {
switch (position){
case 1:
break;
case 2:
break;
case 3:
break;
case 4:
openUrl();
break;
case 5:
break;
case 6:
openShareDialog();
break;
case 7:
logOut();
break;
}
return true;
}
})
.build();
// result.getActionBarDrawerToggle().setDrawerIndicatorEnabled(false);
// getActionBar().setDisplayHomeAsUpEnabled(true);
// Drawer drawer = new DrawerBuilder().withAccountHeader(headerResult).withActivity(this).build();
}
@Override
public void onBackPressed() {
int fragment_count = getSupportFragmentManager().getBackStackEntryCount();
if(fragment_count>1){
super.onBackPressed();
}else{
finish();
}
}
private void logOut(){
startActivity(new Intent(this, LoginActivity.class));
}
private void openShareDialog(){
// Intent share = new Intent(Intent.ACTION_SEND);
// share.setType("image/jpeg");
//
//
// share.putExtra(Intent.EXTRA_STREAM,
// Uri.parse("file:///sdcard/DCIM/Camera/myPic.jpg"));
//
// startActivity(Intent.createChooser(share, "Share App"));
try
{ Intent i = new Intent(Intent.ACTION_SEND);
i.setType("text/plain");
i.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.app_name));
String sAux = "\nLet me recommend you this application\n\n";
sAux = sAux + "https://play.google.com/store/apps/details?id=Orion.Soft \n\n";
i.putExtra(Intent.EXTRA_TEXT, sAux);
startActivity(Intent.createChooser(i, "choose one"));
}
catch(Exception e)
{ //e.toString();
}
}
private void openUrl(){
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.co.in"));
startActivity(browserIntent);
}
/**
* opens menu fragment
*/
private void openMenuFragment(){
getSupportFragmentManager()
.beginTransaction()
.add(R.id.container, new Fragment_Menu())
.addToBackStack(Fragment_Menu.class.getSimpleName())
.commit();
}
}
| 7,325 | 0.587167 | 0.582389 | 223 | 31.847534 | 30.536959 | 144 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.457399 | false | false | 7 |
ca2ed164978af204f337292921d4ca95cebdce7e | 24,043,226,989,547 | 57b6fa831fe532cf0739135c77946f0061e3fbf5 | /Plugins/JVM/java/src/org/nwnx/nwnx2/jvm/constants/AoeMob.java | a09c9e56363ddb4b7899906332816ab8b999fb41 | [
"MIT"
] | permissive | presscad/nwnee | https://github.com/presscad/nwnee | dfcb90767258522f2b23afd9437d3dcad74f936d | 0f36b281524e0b7e9796bcf30f924792bf9b8a38 | refs/heads/master | 2020-08-22T05:26:11.221000 | 2018-11-24T16:45:45 | 2018-11-24T16:45:45 | 216,326,718 | 1 | 0 | MIT | true | 2019-10-20T07:54:45 | 2019-10-20T07:54:45 | 2019-06-04T04:30:24 | 2018-11-24T16:49:42 | 14,301 | 0 | 0 | 0 | null | false | false | package org.nwnx.nwnx2.jvm.constants;
/**
* This class contains all unique constants beginning with "AOE_MOB".
* Non-distinct keys are filtered; only the LAST appearing was
* kept.
*/
public final class AoeMob {
private AoeMob() {}
public final static int BLINDING = 17;
public final static int CIRCCHAOS = 15;
public final static int CIRCEVIL = 12;
public final static int CIRCGOOD = 13;
public final static int CIRCLAW = 14;
public final static int DRAGON_FEAR = 36;
public final static int ELECTRICAL = 25;
public final static int FEAR = 16;
public final static int FIRE = 23;
public final static int FROST = 24;
public final static int HORRIFICAPPEARANCE = 44;
public final static int INVISIBILITY_PURGE = 35;
public final static int MENACE = 19;
public final static int PROTECTION = 22;
public final static int SILENCE = 30;
public final static int STUN = 21;
public final static int TIDE_OF_BATTLE = 41;
public final static int TROGLODYTE_STENCH = 45;
public final static int TYRANT_FOG = 27;
public final static int UNEARTHLY = 18;
public final static int UNNATURAL = 20;
public static String nameOf(int value) {
if (value == 17) return "AoeMob.BLINDING";
if (value == 15) return "AoeMob.CIRCCHAOS";
if (value == 12) return "AoeMob.CIRCEVIL";
if (value == 13) return "AoeMob.CIRCGOOD";
if (value == 14) return "AoeMob.CIRCLAW";
if (value == 36) return "AoeMob.DRAGON_FEAR";
if (value == 25) return "AoeMob.ELECTRICAL";
if (value == 16) return "AoeMob.FEAR";
if (value == 23) return "AoeMob.FIRE";
if (value == 24) return "AoeMob.FROST";
if (value == 44) return "AoeMob.HORRIFICAPPEARANCE";
if (value == 35) return "AoeMob.INVISIBILITY_PURGE";
if (value == 19) return "AoeMob.MENACE";
if (value == 22) return "AoeMob.PROTECTION";
if (value == 30) return "AoeMob.SILENCE";
if (value == 21) return "AoeMob.STUN";
if (value == 41) return "AoeMob.TIDE_OF_BATTLE";
if (value == 45) return "AoeMob.TROGLODYTE_STENCH";
if (value == 27) return "AoeMob.TYRANT_FOG";
if (value == 18) return "AoeMob.UNEARTHLY";
if (value == 20) return "AoeMob.UNNATURAL";
return "AoeMob.(not found: " + value + ")";
}
public static String nameOf(float value) {
return "AoeMob.(not found: " + value + ")";
}
public static String nameOf(String value) {
return "AoeMob.(not found: " + value + ")";
}
}
| UTF-8 | Java | 2,438 | java | AoeMob.java | Java | [] | null | [] | package org.nwnx.nwnx2.jvm.constants;
/**
* This class contains all unique constants beginning with "AOE_MOB".
* Non-distinct keys are filtered; only the LAST appearing was
* kept.
*/
public final class AoeMob {
private AoeMob() {}
public final static int BLINDING = 17;
public final static int CIRCCHAOS = 15;
public final static int CIRCEVIL = 12;
public final static int CIRCGOOD = 13;
public final static int CIRCLAW = 14;
public final static int DRAGON_FEAR = 36;
public final static int ELECTRICAL = 25;
public final static int FEAR = 16;
public final static int FIRE = 23;
public final static int FROST = 24;
public final static int HORRIFICAPPEARANCE = 44;
public final static int INVISIBILITY_PURGE = 35;
public final static int MENACE = 19;
public final static int PROTECTION = 22;
public final static int SILENCE = 30;
public final static int STUN = 21;
public final static int TIDE_OF_BATTLE = 41;
public final static int TROGLODYTE_STENCH = 45;
public final static int TYRANT_FOG = 27;
public final static int UNEARTHLY = 18;
public final static int UNNATURAL = 20;
public static String nameOf(int value) {
if (value == 17) return "AoeMob.BLINDING";
if (value == 15) return "AoeMob.CIRCCHAOS";
if (value == 12) return "AoeMob.CIRCEVIL";
if (value == 13) return "AoeMob.CIRCGOOD";
if (value == 14) return "AoeMob.CIRCLAW";
if (value == 36) return "AoeMob.DRAGON_FEAR";
if (value == 25) return "AoeMob.ELECTRICAL";
if (value == 16) return "AoeMob.FEAR";
if (value == 23) return "AoeMob.FIRE";
if (value == 24) return "AoeMob.FROST";
if (value == 44) return "AoeMob.HORRIFICAPPEARANCE";
if (value == 35) return "AoeMob.INVISIBILITY_PURGE";
if (value == 19) return "AoeMob.MENACE";
if (value == 22) return "AoeMob.PROTECTION";
if (value == 30) return "AoeMob.SILENCE";
if (value == 21) return "AoeMob.STUN";
if (value == 41) return "AoeMob.TIDE_OF_BATTLE";
if (value == 45) return "AoeMob.TROGLODYTE_STENCH";
if (value == 27) return "AoeMob.TYRANT_FOG";
if (value == 18) return "AoeMob.UNEARTHLY";
if (value == 20) return "AoeMob.UNNATURAL";
return "AoeMob.(not found: " + value + ")";
}
public static String nameOf(float value) {
return "AoeMob.(not found: " + value + ")";
}
public static String nameOf(String value) {
return "AoeMob.(not found: " + value + ")";
}
}
| 2,438 | 0.669401 | 0.634537 | 65 | 36.50769 | 17.814535 | 69 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.723077 | false | false | 7 |
b11a1a28f5d74cc0f8e78cd26d2ccfda571ea2c8 | 29,343,216,607,603 | da438b467106534ad4bbf8c2068079faeb509b05 | /spring-boot-validate/src/main/java/com.slz.validate/commonException/ResponseCode.java | edfac036e4c24e074ec5588cf91f17f7a732cd0e | [] | no_license | xeon-ye/spring-boot | https://github.com/xeon-ye/spring-boot | 23abe873770771af02464f6b7fe51ddc1ab2b762 | 0933ece87ab3eb250f6095e6c03c8fa670a22017 | refs/heads/master | 2023-03-24T19:26:04.945000 | 2021-03-12T03:36:38 | 2021-03-12T03:36:38 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.slz.validate.commonException;
/**
* @className OperationEnum
* @description ่ฟๅ็ผ็
* @author tlw
* @date 2019/8/7 7:56
* @version 1.0
**/
public enum ResponseCode {
/** ๆๅ */
SUCCESS(0, "ok"),
/** ็ณป็ป้่ฏฏ */
SYS_ERROR(-1, "system error"),
/** ็ปๅฝ่ถ
ๆถ */
LOGIN_TIMEOUT(10000000, "็ปๅฝๅคฑๆ"),
/** ๆ้ๅผๅธธ */
AUTH_ERROR(-98, "unauthorized"),
/** ไธๅกๅผๅธธ */
SERVICE_ERROR(-2, "biz error"),
/** ้ๆณ่ฏทๆฑ */
ILLEGAL_REQUEST (-1, "illegal request"),
/** ๆฅๆ ๆญค่ตๆบ */
NOT_FOUND_RESOURCE(-1,"resource not found"),
/** ็ผบๅฐๅๆฐ */
MISS_PARAMS(10220001, "missed parameter"),
/** ๅๆฐ้่ฏฏ */
PARAMS_ERROR(10220002, "invalid param"),
/** ไธ่ฝฝ้่ฏฏ */
DOWNLOAD_ERROR(10220003, "download error"),
PRIMARY_SYS_ERROR(-1000,"system is busy"),
;
private final Integer val;
private final String msg;
ResponseCode(Integer value, String msg) {
this.val = value;
this.msg = msg;
}
public Integer val() {
return val;
}
public String msg() {
return msg;
}
} | UTF-8 | Java | 1,092 | java | ResponseCode.java | Java | [
{
"context": "ssName OperationEnum\n* @description ่ฟๅ็ผ็ \n* @author tlw\n* @date 2019/8/7 7:56\n* @version 1.0\n**/\npublic e",
"end": 108,
"score": 0.9995176792144775,
"start": 105,
"tag": "USERNAME",
"value": "tlw"
}
] | null | [] | package com.slz.validate.commonException;
/**
* @className OperationEnum
* @description ่ฟๅ็ผ็
* @author tlw
* @date 2019/8/7 7:56
* @version 1.0
**/
public enum ResponseCode {
/** ๆๅ */
SUCCESS(0, "ok"),
/** ็ณป็ป้่ฏฏ */
SYS_ERROR(-1, "system error"),
/** ็ปๅฝ่ถ
ๆถ */
LOGIN_TIMEOUT(10000000, "็ปๅฝๅคฑๆ"),
/** ๆ้ๅผๅธธ */
AUTH_ERROR(-98, "unauthorized"),
/** ไธๅกๅผๅธธ */
SERVICE_ERROR(-2, "biz error"),
/** ้ๆณ่ฏทๆฑ */
ILLEGAL_REQUEST (-1, "illegal request"),
/** ๆฅๆ ๆญค่ตๆบ */
NOT_FOUND_RESOURCE(-1,"resource not found"),
/** ็ผบๅฐๅๆฐ */
MISS_PARAMS(10220001, "missed parameter"),
/** ๅๆฐ้่ฏฏ */
PARAMS_ERROR(10220002, "invalid param"),
/** ไธ่ฝฝ้่ฏฏ */
DOWNLOAD_ERROR(10220003, "download error"),
PRIMARY_SYS_ERROR(-1000,"system is busy"),
;
private final Integer val;
private final String msg;
ResponseCode(Integer value, String msg) {
this.val = value;
this.msg = msg;
}
public Integer val() {
return val;
}
public String msg() {
return msg;
}
} | 1,092 | 0.602204 | 0.548096 | 54 | 17.5 | 14.476994 | 45 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1 | false | false | 7 |
ae78e8675b4eefc929d1c8f8773552c71104a069 | 29,343,216,607,566 | d4b6877c43f01efd7938150024629f716d3f4d4c | /src/main/java/com/jackiecrazi/taoism/common/item/weapon/melee/axe/BanFu.java | 7acb45392a42edda177a5c9061f4a93b7c14b3ab | [] | no_license | mindy15963/Taoism | https://github.com/mindy15963/Taoism | fc0de4de321434e9e566a1cdf097db56cf41da37 | e3cfa970e0316a1d28b2d665b83f96914fa2ad46 | refs/heads/master | 2022-04-17T09:17:53.115000 | 2020-04-13T06:50:02 | 2020-04-13T06:50:02 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.jackiecrazi.taoism.common.item.weapon.melee.axe;
import com.jackiecrazi.taoism.Taoism;
import com.jackiecrazi.taoism.api.PartDefinition;
import com.jackiecrazi.taoism.api.StaticRefs;
import com.jackiecrazi.taoism.capability.TaoCasterData;
import com.jackiecrazi.taoism.common.item.weapon.melee.TaoWeapon;
import com.jackiecrazi.taoism.potions.TaoPotion;
import net.minecraft.client.resources.I18n;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.DamageSource;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World;
import javax.annotation.Nullable;
import java.util.List;
public class BanFu extends TaoWeapon {
//Like the axe, a powerful weapon designed to counter heavy armor. Good power and defense potential, decent reach, combo and trickery
//Leap attacks deal double damage, attacks always decrease posture,
// and lowers the enemy's defense by 2 points per successful attack per chi level, for 3 seconds
public BanFu() {
super(3, 1.2, 7f, 1.7f);
}
@Override
public PartDefinition[] getPartNames(ItemStack is) {
return StaticRefs.SIMPLE;
}
@Override
public int getComboLength(EntityLivingBase wielder, ItemStack is) {
return 1;
}
@Override
public float critDamage(EntityLivingBase attacker, EntityLivingBase target, ItemStack item) {
return !attacker.onGround ? 2f : 1f;
}
@Override
public float getReach(EntityLivingBase p, ItemStack is) {
return 4f;
}
@Override
public void parrySkill(EntityLivingBase attacker, EntityLivingBase defender, ItemStack item) {
//trap the opponent's weapon, resetting attack timer.
//the next attack in 5 seconds deals 0.35*damage posture regardless of block.
Taoism.setAtk(defender, 0);
super.parrySkill(attacker, defender, item);
}
public int getMaxChargeTime() {
return 100;
}
@Override
public float postureMultiplierDefend(EntityLivingBase attacker, EntityLivingBase defender, ItemStack item, float amount) {
return 0.5f;
}
@Override
protected void applyEffects(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker, int chi) {
if (chi > 0)
target.addPotionEffect(new PotionEffect(TaoPotion.ARMORBREAK, 60, (chi) - 1));
}
@Override
public void attackStart(DamageSource ds, EntityLivingBase attacker, EntityLivingBase target, ItemStack item, float orig) {
if (isCharged(attacker, item)) {
TaoCasterData.getTaoCap(target).consumePosture(orig * 0.35f, true);
}
dischargeWeapon(attacker, item);
}
@Override
protected void perkDesc(ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn) {
tooltip.add(TextFormatting.DARK_GREEN + I18n.format("weapon.disshield") + TextFormatting.RESET);
tooltip.add(I18n.format("banfu.leap"));
tooltip.add(I18n.format("banfu.cleave"));
tooltip.add(I18n.format("banfu.riposte"));
}
public boolean canDisableShield(ItemStack stack, ItemStack shield, EntityLivingBase entity, EntityLivingBase attacker) {
return !attacker.onGround;
}
}
| UTF-8 | Java | 3,376 | java | BanFu.java | Java | [] | null | [] | package com.jackiecrazi.taoism.common.item.weapon.melee.axe;
import com.jackiecrazi.taoism.Taoism;
import com.jackiecrazi.taoism.api.PartDefinition;
import com.jackiecrazi.taoism.api.StaticRefs;
import com.jackiecrazi.taoism.capability.TaoCasterData;
import com.jackiecrazi.taoism.common.item.weapon.melee.TaoWeapon;
import com.jackiecrazi.taoism.potions.TaoPotion;
import net.minecraft.client.resources.I18n;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.DamageSource;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World;
import javax.annotation.Nullable;
import java.util.List;
public class BanFu extends TaoWeapon {
//Like the axe, a powerful weapon designed to counter heavy armor. Good power and defense potential, decent reach, combo and trickery
//Leap attacks deal double damage, attacks always decrease posture,
// and lowers the enemy's defense by 2 points per successful attack per chi level, for 3 seconds
public BanFu() {
super(3, 1.2, 7f, 1.7f);
}
@Override
public PartDefinition[] getPartNames(ItemStack is) {
return StaticRefs.SIMPLE;
}
@Override
public int getComboLength(EntityLivingBase wielder, ItemStack is) {
return 1;
}
@Override
public float critDamage(EntityLivingBase attacker, EntityLivingBase target, ItemStack item) {
return !attacker.onGround ? 2f : 1f;
}
@Override
public float getReach(EntityLivingBase p, ItemStack is) {
return 4f;
}
@Override
public void parrySkill(EntityLivingBase attacker, EntityLivingBase defender, ItemStack item) {
//trap the opponent's weapon, resetting attack timer.
//the next attack in 5 seconds deals 0.35*damage posture regardless of block.
Taoism.setAtk(defender, 0);
super.parrySkill(attacker, defender, item);
}
public int getMaxChargeTime() {
return 100;
}
@Override
public float postureMultiplierDefend(EntityLivingBase attacker, EntityLivingBase defender, ItemStack item, float amount) {
return 0.5f;
}
@Override
protected void applyEffects(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker, int chi) {
if (chi > 0)
target.addPotionEffect(new PotionEffect(TaoPotion.ARMORBREAK, 60, (chi) - 1));
}
@Override
public void attackStart(DamageSource ds, EntityLivingBase attacker, EntityLivingBase target, ItemStack item, float orig) {
if (isCharged(attacker, item)) {
TaoCasterData.getTaoCap(target).consumePosture(orig * 0.35f, true);
}
dischargeWeapon(attacker, item);
}
@Override
protected void perkDesc(ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn) {
tooltip.add(TextFormatting.DARK_GREEN + I18n.format("weapon.disshield") + TextFormatting.RESET);
tooltip.add(I18n.format("banfu.leap"));
tooltip.add(I18n.format("banfu.cleave"));
tooltip.add(I18n.format("banfu.riposte"));
}
public boolean canDisableShield(ItemStack stack, ItemStack shield, EntityLivingBase entity, EntityLivingBase attacker) {
return !attacker.onGround;
}
}
| 3,376 | 0.722453 | 0.7109 | 93 | 35.301075 | 35.571762 | 137 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.795699 | false | false | 7 |
ebb11820ef8a610f71f73a0ee73b8390c3bcdf54 | 3,676,492,057,118 | b73ea7be9ea09939832ec179cc4cea37a3140761 | /ETA/Core/src/main/java/com/thomsonreuters/upa/transport/CredentialsInfo.java | 95fef1d85a5b75556c1f466985ab746feab44685 | [] | no_license | Addicticks/ElektronSDK-Mavenized | https://github.com/Addicticks/ElektronSDK-Mavenized | ac0c0b057dce0b156918eee14b180a3cdeb8c27d | 46723af1538972a434fd06dee7968dd5a953904f | refs/heads/master | 2021-01-18T03:11:28.394000 | 2018-09-22T19:24:05 | 2018-09-22T19:24:05 | 85,842,448 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.thomsonreuters.upa.transport;
/**
* Options used for configuring proxy credentials, which might be needed during a tunneling connection.
*
* Supported authentication protocols are: Negotiate/Kerberos, Kerberos, NTLM, and Basic.
*
* Protocols Negotiate/Kerberos or Kerberos require the following options:
* HTTPproxyUsername, HTTPproxyPasswd, HTTPproxyDomain, and HTTPproxyKRB5configFile
*
* Protocol NTLM requires the following options:
* HTTPproxyUsername, HTTPproxyPasswd, HTTPproxyDomain, and HTTPproxyLocalHostname
*
* Protocol Basic requires the following options:
* HTTPproxyUsername and HTTPproxyPasswd
*
* @see ConnectOptions
*/
public interface CredentialsInfo
{
/**
* The username to authenticate.
* Needed for all authentication protocols
*
* @param HTTPproxyUsername
*/
public void HTTPproxyUsername(String HTTPproxyUsername);
/**
* The username to authenticate.
* Needed for all authentication protocols.
*
* @return the HTTPproxyUsername
*/
public String HTTPproxyUsername();
/**
* The password to authenticate.
* Needed for all authentication protocols.
*
* @param HTTPproxyPasswd
*/
public void HTTPproxyPasswd(String HTTPproxyPasswd);
/**
* The password to authenticate.
* Needed for all authentication protocols.
*
* @return the HTTPproxyPasswd
*/
public String HTTPproxyPasswd();
/**
*
* The domain of the user to authenticate.
* Needed for NTLM or for Negotiate/Kerberos or for Kerberos authentication protocols.
*
* For Negotiate/Kerberos or for Kerberos authentication protocols, HTTPproxyDomain
* should be the same as the domain in the 'realms' and 'domain_realm' sections of
* the Kerberos configuration file ({@link #HTTPproxyKRB5configFile()}).
*
* @param HTTPproxyDomain
*/
public void HTTPproxyDomain(String HTTPproxyDomain);
/**
*
* The domain of the user to authenticate.
* Needed for NTLM or for Negotiate/Kerberos or for Kerberos authentication protocols.
*
* For Negotiate/Kerberos or for Kerberos authentication protocols, HTTPproxyDomain
* should be the same as the domain in the 'realms' and 'domain_realm' sections of
* the Kerberos configuration file ({@link #HTTPproxyKRB5configFile()}).
*
* @return the HTTPproxyDomain
*/
public String HTTPproxyDomain();
/**
*
* The local hostname of the client.
* Needed for NTLM authentication protocol only.
*
* @param HTTPproxyLocalHostname
*/
public void HTTPproxyLocalHostname(String HTTPproxyLocalHostname);
/**
*
* The local hostname of the client.
* Needed for NTLM authentication protocol only.
*
* @return the HTTPproxyLocalHostname
*/
public String HTTPproxyLocalHostname();
/**
*
* The complete path of the Kerberos5 configuration file (krb5.ini or krb5.conf, or custom file).
* Needed for Negotiate/Kerberos and Kerberos authentications.
*
* The default locations could be the following:
* Windows: c:\winnt\krb5.ini or c:\windows\krb5.ini
* Linux: /etc/krb5.conf
* Other Unix: /etc/krb5/krb5.conf
*
* @param HTTPproxyKRB5configFile
*/
public void HTTPproxyKRB5configFile(String HTTPproxyKRB5configFile);
/**
*
* The complete path of the Kerberos5 configuration file (krb5.ini or krb5.conf, or custom file).
* Needed for Negotiate/Kerberos and Kerberos authentications.
*
* The default locations could be the following:
* Windows: c:\winnt\krb5.ini or c:\windows\krb5.ini
* Linux: /etc/krb5.conf
* Other Unix: /etc/krb5/krb5.conf
*
* @return the HTTPproxyKRB5configFile
*/
public String HTTPproxyKRB5configFile();
} | UTF-8 | Java | 4,039 | java | CredentialsInfo.java | Java | [] | null | [] | package com.thomsonreuters.upa.transport;
/**
* Options used for configuring proxy credentials, which might be needed during a tunneling connection.
*
* Supported authentication protocols are: Negotiate/Kerberos, Kerberos, NTLM, and Basic.
*
* Protocols Negotiate/Kerberos or Kerberos require the following options:
* HTTPproxyUsername, HTTPproxyPasswd, HTTPproxyDomain, and HTTPproxyKRB5configFile
*
* Protocol NTLM requires the following options:
* HTTPproxyUsername, HTTPproxyPasswd, HTTPproxyDomain, and HTTPproxyLocalHostname
*
* Protocol Basic requires the following options:
* HTTPproxyUsername and HTTPproxyPasswd
*
* @see ConnectOptions
*/
public interface CredentialsInfo
{
/**
* The username to authenticate.
* Needed for all authentication protocols
*
* @param HTTPproxyUsername
*/
public void HTTPproxyUsername(String HTTPproxyUsername);
/**
* The username to authenticate.
* Needed for all authentication protocols.
*
* @return the HTTPproxyUsername
*/
public String HTTPproxyUsername();
/**
* The password to authenticate.
* Needed for all authentication protocols.
*
* @param HTTPproxyPasswd
*/
public void HTTPproxyPasswd(String HTTPproxyPasswd);
/**
* The password to authenticate.
* Needed for all authentication protocols.
*
* @return the HTTPproxyPasswd
*/
public String HTTPproxyPasswd();
/**
*
* The domain of the user to authenticate.
* Needed for NTLM or for Negotiate/Kerberos or for Kerberos authentication protocols.
*
* For Negotiate/Kerberos or for Kerberos authentication protocols, HTTPproxyDomain
* should be the same as the domain in the 'realms' and 'domain_realm' sections of
* the Kerberos configuration file ({@link #HTTPproxyKRB5configFile()}).
*
* @param HTTPproxyDomain
*/
public void HTTPproxyDomain(String HTTPproxyDomain);
/**
*
* The domain of the user to authenticate.
* Needed for NTLM or for Negotiate/Kerberos or for Kerberos authentication protocols.
*
* For Negotiate/Kerberos or for Kerberos authentication protocols, HTTPproxyDomain
* should be the same as the domain in the 'realms' and 'domain_realm' sections of
* the Kerberos configuration file ({@link #HTTPproxyKRB5configFile()}).
*
* @return the HTTPproxyDomain
*/
public String HTTPproxyDomain();
/**
*
* The local hostname of the client.
* Needed for NTLM authentication protocol only.
*
* @param HTTPproxyLocalHostname
*/
public void HTTPproxyLocalHostname(String HTTPproxyLocalHostname);
/**
*
* The local hostname of the client.
* Needed for NTLM authentication protocol only.
*
* @return the HTTPproxyLocalHostname
*/
public String HTTPproxyLocalHostname();
/**
*
* The complete path of the Kerberos5 configuration file (krb5.ini or krb5.conf, or custom file).
* Needed for Negotiate/Kerberos and Kerberos authentications.
*
* The default locations could be the following:
* Windows: c:\winnt\krb5.ini or c:\windows\krb5.ini
* Linux: /etc/krb5.conf
* Other Unix: /etc/krb5/krb5.conf
*
* @param HTTPproxyKRB5configFile
*/
public void HTTPproxyKRB5configFile(String HTTPproxyKRB5configFile);
/**
*
* The complete path of the Kerberos5 configuration file (krb5.ini or krb5.conf, or custom file).
* Needed for Negotiate/Kerberos and Kerberos authentications.
*
* The default locations could be the following:
* Windows: c:\winnt\krb5.ini or c:\windows\krb5.ini
* Linux: /etc/krb5.conf
* Other Unix: /etc/krb5/krb5.conf
*
* @return the HTTPproxyKRB5configFile
*/
public String HTTPproxyKRB5configFile();
} | 4,039 | 0.660312 | 0.65437 | 124 | 31.580645 | 29.143997 | 103 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.201613 | false | false | 7 |
b43cc4af5de9df128b7386f4acdd6f1846e37148 | 12,515,534,739,983 | bd590deef3976cdefb8f661354c40bfb2a707394 | /hotel/src/main/java/com/hotel/service/IGuestRoomRankBiz.java | c0f4cb83eda6a8a5dc0d53054f5e5c338f62c09b | [] | no_license | rarae/hotel | https://github.com/rarae/hotel | 1e46f8e64201b962949c6b3b8fde0d15f47f911b | 404d99abd115cb5bbe1733ec94e980d2bdbd81e6 | refs/heads/master | 2022-12-22T19:42:44.960000 | 2021-05-16T11:48:51 | 2021-05-16T11:48:51 | 128,399,731 | 1 | 0 | null | false | 2022-12-16T10:55:01 | 2018-04-06T13:40:38 | 2021-05-16T11:49:58 | 2022-12-16T10:54:59 | 65,098 | 0 | 0 | 5 | HTML | false | false | package com.hotel.service;
import com.hotel.entity.GuestRoomRank;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface IGuestRoomRankBiz {
List<GuestRoomRank> listAllGuestRoomRank();
List<GuestRoomRank> listPagedGuestRoomRankt(@Param("pageIndex") int pageIndex, @Param("pageSize") int pageSize);
int count();
int updateGuestRoomRank(GuestRoomRank guestRoomRank);
int deleteGuestRoomRank(GuestRoomRank guestRoomRank);
int insertGuestRoomRank(GuestRoomRank guestRoomRank);
GuestRoomRank getGuestRoomRankByRank(GuestRoomRank guestRoomRank);
List<GuestRoomRank> queryGuestRoomRank(String keyword);
}
| UTF-8 | Java | 663 | java | IGuestRoomRankBiz.java | Java | [] | null | [] | package com.hotel.service;
import com.hotel.entity.GuestRoomRank;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface IGuestRoomRankBiz {
List<GuestRoomRank> listAllGuestRoomRank();
List<GuestRoomRank> listPagedGuestRoomRankt(@Param("pageIndex") int pageIndex, @Param("pageSize") int pageSize);
int count();
int updateGuestRoomRank(GuestRoomRank guestRoomRank);
int deleteGuestRoomRank(GuestRoomRank guestRoomRank);
int insertGuestRoomRank(GuestRoomRank guestRoomRank);
GuestRoomRank getGuestRoomRankByRank(GuestRoomRank guestRoomRank);
List<GuestRoomRank> queryGuestRoomRank(String keyword);
}
| 663 | 0.799397 | 0.799397 | 18 | 35.833332 | 30.44713 | 116 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.722222 | false | false | 7 |
e807cb44e8843668b550071576acc597a9f51a9b | 29,618,094,494,172 | 51f4c4744a6f8e1584d904107e8e1216c4f942ad | /Algoritmos y Programaciรณn 3/Teorรญa/Final - 2019-07-25/final-alumno/src/especialistas/PanaderoHabilidad.java | 4b3e2342fce6895e929de72755370f2bb895e861 | [] | no_license | gltaborda/Facultad | https://github.com/gltaborda/Facultad | abce661730e18943256dcd6ab4f6efc258a08686 | d3e835f30bf2bcb6fd52b9835d65b036314161a6 | refs/heads/master | 2021-07-06T22:24:21.535000 | 2021-05-05T15:25:20 | 2021-05-05T15:25:20 | 239,361,293 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package especialistas;
import Comidas.Comida;
public interface PanaderoHabilidad {
public Comida hacerPan();
}
| UTF-8 | Java | 118 | java | PanaderoHabilidad.java | Java | [] | null | [] | package especialistas;
import Comidas.Comida;
public interface PanaderoHabilidad {
public Comida hacerPan();
}
| 118 | 0.771186 | 0.771186 | 9 | 12.111111 | 13.428365 | 36 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.666667 | false | false | 7 |
3677eac5c0166bc5acef13f023fae444078faecb | 26,766,236,229,339 | eadbd6ba5a2d5c960ffa9788f5f7e79eeb98384d | /src/com/google/common/util/concurrent/d$1.java | 9d88045eee404ec06aa24fd5b7292cc87b525399 | [] | no_license | marcoucou/com.tinder | https://github.com/marcoucou/com.tinder | 37edc3b9fb22496258f3a8670e6349ce5b1d8993 | c68f08f7cacf76bf7f103016754eb87b1c0ac30d | refs/heads/master | 2022-04-18T23:01:15.638000 | 2020-04-14T18:04:10 | 2020-04-14T18:04:10 | 255,685,521 | 0 | 0 | null | true | 2020-04-14T18:00:06 | 2020-04-14T18:00:05 | 2015-07-05T03:44:25 | 2015-07-05T03:38:27 | 22,496 | 0 | 0 | 0 | null | false | false | package com.google.common.util.concurrent;
final class d$1
implements b<I, O>
{}
/* Location:
* Qualified Name: com.google.common.util.concurrent.d.1
* Java Class Version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | UTF-8 | Java | 223 | java | d$1.java | Java | [] | null | [] | package com.google.common.util.concurrent;
final class d$1
implements b<I, O>
{}
/* Location:
* Qualified Name: com.google.common.util.concurrent.d.1
* Java Class Version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | 223 | 0.668161 | 0.627803 | 11 | 19.363636 | 18.504412 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.181818 | false | false | 7 |
ba1c904995a18ff8bbaa676f2e7a44df36a0a1ec | 7,249,904,844,951 | 94eb3e6283479574027028af549efdeffc13e853 | /Piano/src/com/Piano/MiddleButton.java | c3b8b21671634b627a27389f626f085ba9393fec | [] | no_license | themoralpanda/Piano | https://github.com/themoralpanda/Piano | ef414eeec3b5817bfb0fce1f04952c576f7e210c | e5f64f2c6f7149aad078043e892204c6a8e8d23d | refs/heads/master | 2021-09-01T06:53:23.168000 | 2017-12-25T13:54:16 | 2017-12-25T13:54:16 | 115,341,053 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.Piano;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Polygon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class MiddleButton extends JButton {
private Polygon shape;
int width , height;
int p1_x, p1_y , p2_x, p2_y, p3_x, p3_y, p4_x, p4_y, p5_x, p5_y , p6_x , p6_y, p7_x, p7_y, p8_x, p8_y;
public MiddleButton(int width, int height, int p1_x,int p1_y ,int p2_x,int p2_y,int p3_x,int p3_y,int p4_x,int p4_y,int p5_x,int p5_y ,int p6_x ,int p6_y, int p7_x, int p7_y, int p8_x, int p8_y) {
this.shape = new Polygon();
this.width = width;
this.height = height;
this.p1_x = p1_x;
this.p1_y = p1_y;
this.p2_x = p2_x;
this.p2_y = p2_y;
this.p3_x = p3_x;
this.p3_y = p3_y;
this.p4_x = p4_x;
this.p4_y = p4_y;
this.p5_x = p5_x;
this.p5_y = p5_y;
this.p6_x = p6_x;
this.p6_y = p6_y;
this.p7_y = p7_y;
this.p7_x = p7_x;
this.p8_y = p8_y;
this.p8_y = p8_x;
// initialisiere Form
this.initialize();
}
protected void initialize() {
Point p1, p2, p3, p4, p5, p6 , p7, p8;
this.setSize(150, 250);
p1 = new Point(p1_x, p1_y);
p2 = new Point(p2_x, p2_y);
p3 = new Point(p3_x, p3_y);
p4 = new Point(p4_y, p4_y);
p5 = new Point(p5_x, p5_y);
p6 = new Point(p6_x, p6_y);
p7 = new Point(p7_x, p7_y);
p8 = new Point(p8_x, p8_y);
this.shape.addPoint((int) Math.round(p1.getX()),
(int) Math.round(p1.getY()));
this.shape.addPoint((int) Math.round(p2.getX()),
(int) Math.round(p2.getY()));
this.shape.addPoint((int) Math.round(p3.getX()),
(int) Math.round(p3.getY()));
this.shape.addPoint((int) Math.round(p4.getX()),
(int) Math.round(p4.getY()));
this.shape.addPoint((int) Math.round(p5.getX()),
(int) Math.round(p5.getY()));
this.shape.addPoint((int) Math.round(p6.getX()),
(int) Math.round(p6.getY()));
this.shape.addPoint((int) Math.round(p7.getX()),
(int) Math.round(p7.getY()));
this.shape.addPoint((int) Math.round(p8.getX()),
(int) Math.round(p8.getY()));
this.setMinimumSize(this.getSize());
this.setMaximumSize(this.getSize());
this.setPreferredSize(this.getSize());
}
// Hit detection
public boolean contains(int x, int y) {
return this.shape.contains(x, y);
}
// Zeichne den Button
protected void paintComponent(Graphics g) {
Graphics2D gCopy = (Graphics2D) g.create();
gCopy.fillPolygon(this.shape);
}
// zeichne die Border
protected void paintBorder(Graphics g) {
}
}
| UTF-8 | Java | 3,119 | java | MiddleButton.java | Java | [] | null | [] | package com.Piano;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Polygon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class MiddleButton extends JButton {
private Polygon shape;
int width , height;
int p1_x, p1_y , p2_x, p2_y, p3_x, p3_y, p4_x, p4_y, p5_x, p5_y , p6_x , p6_y, p7_x, p7_y, p8_x, p8_y;
public MiddleButton(int width, int height, int p1_x,int p1_y ,int p2_x,int p2_y,int p3_x,int p3_y,int p4_x,int p4_y,int p5_x,int p5_y ,int p6_x ,int p6_y, int p7_x, int p7_y, int p8_x, int p8_y) {
this.shape = new Polygon();
this.width = width;
this.height = height;
this.p1_x = p1_x;
this.p1_y = p1_y;
this.p2_x = p2_x;
this.p2_y = p2_y;
this.p3_x = p3_x;
this.p3_y = p3_y;
this.p4_x = p4_x;
this.p4_y = p4_y;
this.p5_x = p5_x;
this.p5_y = p5_y;
this.p6_x = p6_x;
this.p6_y = p6_y;
this.p7_y = p7_y;
this.p7_x = p7_x;
this.p8_y = p8_y;
this.p8_y = p8_x;
// initialisiere Form
this.initialize();
}
protected void initialize() {
Point p1, p2, p3, p4, p5, p6 , p7, p8;
this.setSize(150, 250);
p1 = new Point(p1_x, p1_y);
p2 = new Point(p2_x, p2_y);
p3 = new Point(p3_x, p3_y);
p4 = new Point(p4_y, p4_y);
p5 = new Point(p5_x, p5_y);
p6 = new Point(p6_x, p6_y);
p7 = new Point(p7_x, p7_y);
p8 = new Point(p8_x, p8_y);
this.shape.addPoint((int) Math.round(p1.getX()),
(int) Math.round(p1.getY()));
this.shape.addPoint((int) Math.round(p2.getX()),
(int) Math.round(p2.getY()));
this.shape.addPoint((int) Math.round(p3.getX()),
(int) Math.round(p3.getY()));
this.shape.addPoint((int) Math.round(p4.getX()),
(int) Math.round(p4.getY()));
this.shape.addPoint((int) Math.round(p5.getX()),
(int) Math.round(p5.getY()));
this.shape.addPoint((int) Math.round(p6.getX()),
(int) Math.round(p6.getY()));
this.shape.addPoint((int) Math.round(p7.getX()),
(int) Math.round(p7.getY()));
this.shape.addPoint((int) Math.round(p8.getX()),
(int) Math.round(p8.getY()));
this.setMinimumSize(this.getSize());
this.setMaximumSize(this.getSize());
this.setPreferredSize(this.getSize());
}
// Hit detection
public boolean contains(int x, int y) {
return this.shape.contains(x, y);
}
// Zeichne den Button
protected void paintComponent(Graphics g) {
Graphics2D gCopy = (Graphics2D) g.create();
gCopy.fillPolygon(this.shape);
}
// zeichne die Border
protected void paintBorder(Graphics g) {
}
}
| 3,119 | 0.507214 | 0.468419 | 104 | 27.990385 | 25.50622 | 201 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.096154 | false | false | 7 |
2386cef1a49477d58362b67a16e14487c99e8a83 | 12,867,722,027,752 | 86ad22afbfb2b164693cf0c7368ac6d50794592d | /app/src/main/java/com/wentao/xrichtextdemo/db/MyDbHelper.java | 8f8cde32b09444d566d2d482c1777191a997313d | [] | no_license | wentaoStudy/OneEasyNote | https://github.com/wentaoStudy/OneEasyNote | 5299793b165bb27d749518341b9b694217da1590 | 562c3c430cf88d62c0b35de654cbf4cb69ef9b92 | refs/heads/master | 2020-05-30T15:19:06.192000 | 2020-04-02T10:18:09 | 2020-04-02T10:18:09 | 189,814,772 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.wentao.xrichtextdemo.db;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
public class MyDbHelper extends SQLiteOpenHelper {
private final static String DB_NAME = "radio.db";// ๆฐๆฎๅบๆไปถๅ
private final static int DB_VERSION = 1;// ๆฐๆฎๅบ็ๆฌ
public MyDbHelper(Context context) {
super(context, DB_NAME, null, DB_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
//ๅๅปบๅ็ฑป่กจ
db.execSQL("create table db_radio(r_id String primary key , " +
"r_name varchar, r_create_time varchar, r_length varchar , r_address varchar)");
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
}
}
| UTF-8 | Java | 822 | java | MyDbHelper.java | Java | [] | null | [] | package com.wentao.xrichtextdemo.db;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
public class MyDbHelper extends SQLiteOpenHelper {
private final static String DB_NAME = "radio.db";// ๆฐๆฎๅบๆไปถๅ
private final static int DB_VERSION = 1;// ๆฐๆฎๅบ็ๆฌ
public MyDbHelper(Context context) {
super(context, DB_NAME, null, DB_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
//ๅๅปบๅ็ฑป่กจ
db.execSQL("create table db_radio(r_id String primary key , " +
"r_name varchar, r_create_time varchar, r_length varchar , r_address varchar)");
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
}
}
| 822 | 0.692405 | 0.691139 | 28 | 27.214285 | 28.089598 | 96 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.607143 | false | false | 7 |
f62e20e3deaa8d93b0fa1b164c802a286e02a3b0 | 6,528,350,338,839 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/3/3_fa0eb6ce6f4d2edccfbebd8e558d34d2b7db302b/Configurations/3_fa0eb6ce6f4d2edccfbebd8e558d34d2b7db302b_Configurations_t.java | 6db66f3cae982fa6d8e3c29a8ba702fc21c71463 | [] | no_license | zhongxingyu/Seer | https://github.com/zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516000 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | false | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | 2023-06-21T00:53:27 | 2023-06-22T07:55:57 | 2,849,868 | 2 | 2 | 0 | null | false | false | /*
* ###
* Framework Web Archive
* %%
* Copyright (C) 1999 - 2012 Photon Infotech Inc.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ###
*/
package com.photon.phresco.framework.actions.applications;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import com.opensymphony.xwork2.Action;
import com.photon.phresco.commons.api.ConfigManager;
import com.photon.phresco.commons.model.PropertyTemplate;
import com.photon.phresco.commons.model.SettingsTemplate;
import com.photon.phresco.configuration.Environment;
import com.photon.phresco.exception.ConfigurationException;
import com.photon.phresco.exception.PhrescoException;
import com.photon.phresco.framework.PhrescoFrameworkFactory;
import com.photon.phresco.framework.actions.FrameworkBaseAction;
import com.photon.phresco.framework.api.Project;
import com.photon.phresco.framework.api.ProjectAdministrator;
import com.photon.phresco.framework.commons.FrameworkUtil;
import com.photon.phresco.framework.commons.LogErrorReport;
import com.photon.phresco.framework.impl.EnvironmentComparator;
import com.photon.phresco.framework.model.CertificateInfo;
import com.photon.phresco.framework.model.PropertyInfo;
import com.photon.phresco.framework.model.SettingsInfo;
import com.photon.phresco.util.Constants;
import com.photon.phresco.util.TechnologyTypes;
import com.photon.phresco.util.Utility;
public class Configurations extends FrameworkBaseAction {
private static final long serialVersionUID = -4883865658298200459L;
private Map<String, String> dbDriverMap = new HashMap<String, String>(8);
private static final Logger S_LOGGER = Logger.getLogger(Configurations.class);
private static Boolean debugEnabled = S_LOGGER.isDebugEnabled();
private String configName = null;
private String description = null;
private String oldName = null;
private String[] appliesto = null;
private String projectCode = null;
private String nameError = null;
private String typeError = null;
private String portError = null;
private String dynamicError = "";
private boolean isValidated = false;
private String envName = null;
private String configType = null;
private String oldConfigType = null;
private String envError = null;
private String emailError = null;
private String remoteDeploymentChk = null;
// Environemnt delete
private boolean isEnvDeleteSuceess = true;
private String envDeleteMsg = null;
private List<String> projectInfoVersions = null;
// For IIS server
private String appName = "";
private String nameOfSite = "";
private String siteCoreInstPath = "";
private String appNameError = null;
private String siteNameError = null;
private String siteCoreInstPathError = null;
//set as default envs
private String setAsDefaultEnv = "";
private boolean flag = false;
public String list() {
if (S_LOGGER.isDebugEnabled()) {
S_LOGGER.debug("Configuration.list() entered");
}
Project project = null;
try {
List<Environment> environments = getEnvironments();
// configManager.get
// project = administrator.getProject(projectCode);
// List<Environment> environments = administrator.getEnvironments(project);
// configManager.getEnvironments(names);
// getHttpRequest().setAttribute(ENVIRONMENTS, environments);
// List<SettingsInfo> configurations = administrator.configurations(project);
String cloneConfigStatus = getHttpRequest().getParameter(CLONE_CONFIG_STATUS);
if (cloneConfigStatus != null) {
addActionMessage(getText(ENV_CLONE_SUCCESS));
}
} catch (Exception e) {
if (debugEnabled) {
S_LOGGER.error("Entered into catch block of Configurations.list()" + FrameworkUtil.getStackTraceAsString(e));
}
new LogErrorReport(e, "Configurations list");
}
getHttpRequest().setAttribute(REQ_PROJECT, project);
getHttpRequest().setAttribute(REQ_SELECTED_MENU, APPLICATIONS);
return APP_LIST;
}
/**
* @return
* @throws PhrescoException
* @throws ConfigurationException
*/
private List<Environment> getEnvironments() throws PhrescoException, ConfigurationException {
ConfigManager configManager = getConfigManager();
return configManager.getEnvironments();
}
/**
* @return
* @throws PhrescoException
*/
private ConfigManager getConfigManager() throws PhrescoException {
File appDir = new File(getAppHome());
return PhrescoFrameworkFactory.getConfigManager(appDir);
}
public String add() {
if (debugEnabled) {
S_LOGGER.debug("Entering Method Configurations.add()");
}
getHttpSession().removeAttribute(REQ_CONFIG_INFO);
try {
ProjectAdministrator administrator = getProjectAdministrator();
Project project = administrator.getProject(projectCode);
List<SettingsTemplate> settingsTemplates = administrator.getSettingsTemplates();
getHttpSession().setAttribute(SESSION_SETTINGS_TEMPLATES, settingsTemplates);
List<Environment> environments = administrator.getEnvironments(project);
getHttpRequest().setAttribute(ENVIRONMENTS, environments);
Collections.sort(environments, new EnvironmentComparator());
getHttpSession().removeAttribute(ERROR_SETTINGS);
getHttpRequest().setAttribute(REQ_PROJECT, project);
} catch (Exception e) {
if (debugEnabled) {
S_LOGGER.error("Entered into catch block of Configurations.add()" + FrameworkUtil.getStackTraceAsString(e));
}
new LogErrorReport(e, "Configurations add");
}
getHttpRequest().setAttribute(REQ_SELECTED_MENU, APPLICATIONS);
return APP_CONFIG_ADD;
}
public String save() {
if (debugEnabled) {
S_LOGGER.debug("Entering Method Configurations.save()");
}
try {
initDriverMap();
ProjectAdministrator administrator = PhrescoFrameworkFactory.getProjectAdministrator();
Project project = administrator.getProject(projectCode);
if(!validate(administrator, null)) {
isValidated = true;
return Action.SUCCESS;
}
List<PropertyInfo> propertyInfoList = new ArrayList<PropertyInfo>();
String key = null;
String value = null;
if (REQ_CONFIG_TYPE_OTHER.equals(configType)) {
String[] keys = getHttpRequest().getParameterValues(REQ_CONFIG_PROP_KEY);
if (!ArrayUtils.isEmpty(keys)) {
for (String propertyKey : keys) {
value = getHttpRequest().getParameter(propertyKey);
propertyInfoList.add(new PropertyInfo(propertyKey, value));
}
}
} else {
SettingsTemplate selectedSettingTemplate = administrator.getSettingsTemplate(configType);
List<PropertyTemplate> propertyTemplates = selectedSettingTemplate.getProperties();
boolean isIISServer = false;
for (PropertyTemplate propertyTemplate : propertyTemplates) {
if (propertyTemplate.getKey().equals(Constants.SETTINGS_TEMPLATE_SERVER) || propertyTemplate.getKey().equals(Constants.SETTINGS_TEMPLATE_DB)) {
List<PropertyTemplate> compPropertyTemplates = propertyTemplate.getPropertyTemplates();
for (PropertyTemplate compPropertyTemplate : compPropertyTemplates) {
key = compPropertyTemplate.getKey();
value = getHttpRequest().getParameter(key);
if (propertyTemplate.getKey().equals(Constants.SETTINGS_TEMPLATE_DB) && key.equals("type")) {
value = value.trim().toLowerCase();
propertyInfoList.add(new PropertyInfo(key, value.trim()));
String dbDriver = getDbDriver(value);
propertyInfoList.add(new PropertyInfo(Constants.DB_DRIVER, dbDriver.trim()));
} else {
propertyInfoList.add(new PropertyInfo(key, value.trim()));
}
if ("type".equals(key) && "IIS".equals(value)) {
isIISServer = true;
}
}
} else {
key = propertyTemplate.getKey();
value = getHttpRequest().getParameter(key);
if(key.equals("remoteDeployment")){
value = remoteDeploymentChk;
}
value = value.trim();
if(key.equals(ADDITIONAL_CONTEXT_PATH)){
String addcontext = value;
if(!addcontext.startsWith("/")) {
value = "/" + value;
}
}
if ("certificate".equals(key)) {
String env = getHttpRequest().getParameter(ENVIRONMENTS);
if (StringUtils.isNotEmpty(value)) {
File file = new File(value);
if (file.exists()) {
String path = Utility.getProjectHome().replace("\\", "/");
value = value.replace(path + projectCode + "/", "");
} else {
value = FOLDER_DOT_PHRESCO + FILE_SEPARATOR + "certificates" +
FILE_SEPARATOR + env + "-" + configName + ".crt";
saveCertificateFile(value);
}
}
}
propertyInfoList.add(new PropertyInfo(propertyTemplate.getKey(), value));
}
if (S_LOGGER.isDebugEnabled()) {
S_LOGGER.debug("Configuration.save() key " + propertyTemplate.getKey() + "and Value is " + value);
}
}
if(TechnologyTypes.SITE_CORE.equals(project.getApplicationInfo().getTechInfo().getVersion())) {
propertyInfoList.add(new PropertyInfo(SETTINGS_TEMP_SITECORE_INST_PATH, siteCoreInstPath));
}
if (isIISServer) {
propertyInfoList.add(new PropertyInfo(SETTINGS_TEMP_KEY_APP_NAME, appName));
propertyInfoList.add(new PropertyInfo(SETTINGS_TEMP_KEY_SITE_NAME, nameOfSite));
}
}
SettingsInfo settingsInfo = new SettingsInfo(configName, description, configType);
settingsInfo.setAppliesTo(Arrays.asList(project.getApplicationInfo().getTechInfo().getVersion()));
settingsInfo.setPropertyInfos(propertyInfoList);
getHttpRequest().setAttribute(REQ_CONFIG_INFO, settingsInfo);
getHttpRequest().setAttribute(REQ_PROJECT_CODE, projectCode);
getHttpRequest().setAttribute(REQ_PROJECT, project);
String[] environments = getHttpRequest().getParameterValues(ENVIRONMENTS);
StringBuilder sb = new StringBuilder();
for (String envs : environments) {
if (sb.length() > 0) sb.append(',');
sb.append(envs);
}
administrator.createConfiguration(settingsInfo, sb.toString(), project);
if (SERVER.equals(configType)){
addActionMessage(getText(SUCCESS_SERVER, Collections.singletonList(configName)));
}
else if (DATABASE.equals(configType)) {
addActionMessage(getText(SUCCESS_DATABASE, Collections.singletonList(configName)));
}
else if (WEBSERVICE.equals(configType)) {
addActionMessage(getText(SUCCESS_WEBSERVICE, Collections.singletonList(configName)));
}
else {
addActionMessage(getText(SUCCESS_EMAIL, Collections.singletonList(configName)));
}
getHttpSession().removeAttribute(ERROR_SETTINGS);
} catch (Exception e) {
if (debugEnabled) {
S_LOGGER.error("Entered into catch block of Configurations.save()" + FrameworkUtil.getStackTraceAsString(e));
}
new LogErrorReport(e, "Configurations save");
}
getHttpRequest().setAttribute(REQ_SELECTED_MENU, APPLICATIONS);
return list();
}
private String getDbDriver(String dbtype) {
return dbDriverMap.get(dbtype);
}
private void initDriverMap() {
dbDriverMap.put("mysql", "com.mysql.jdbc.Driver");
dbDriverMap.put("oracle", "oracle.jdbc.OracleDriver");
dbDriverMap.put("hsql", "org.hsql.jdbcDriver");
dbDriverMap.put("mssql", "com.microsoft.sqlserver.jdbc.SQLServerDriver");
dbDriverMap.put("db2", "com.ibm.db2.jcc.DB2Driver");
dbDriverMap.put("mongodb", "com.mongodb.jdbc.MongoDriver");
}
private void saveCertificateFile(String path) throws PhrescoException {
try {
String host = (String)getHttpRequest().getParameter(SERVER_HOST);
int port = Integer.parseInt(getHttpRequest().getParameter(SERVER_PORT));
String certificateName = (String)getHttpRequest().getParameter("certificate");
ProjectAdministrator administrator = PhrescoFrameworkFactory.getProjectAdministrator();
List<CertificateInfo> certificates = administrator.getCertificate(host, port);
if (CollectionUtils.isNotEmpty(certificates)) {
for (CertificateInfo certificate : certificates) {
if (certificate.getDisplayName().equals(certificateName)) {
administrator.addCertificate(certificate, new File(Utility.getProjectHome() + projectCode + "/" + path));
}
}
}
} catch (Exception e) {
throw new PhrescoException(e);
}
}
public String createEnvironment() {
try {
String[] split = null;
ProjectAdministrator administrator = PhrescoFrameworkFactory
.getProjectAdministrator();
Project project = administrator.getProject(projectCode);
String envs = getHttpRequest().getParameter(ENVIRONMENT_VALUES);
String selectedItems = getHttpRequest().getParameter("deletableEnvs");
if(StringUtils.isNotEmpty(selectedItems)){
deleteEnvironment(selectedItems);
}
List<Environment> environments = new ArrayList<Environment>();
if (StringUtils.isNotEmpty(envs)) {
List<String> listSelectedEnvs = new ArrayList<String>(
Arrays.asList(envs.split("#SEP#")));
for (String listSelectedEnv : listSelectedEnvs) {
try {
split = listSelectedEnv.split("#DSEP#");
environments.add(new Environment(split[0], split[1],
false));
} catch (ArrayIndexOutOfBoundsException e) {
environments.add(new Environment(split[0], "", false));
}
}
}
administrator.createEnvironments(project, environments, false);
if(StringUtils.isNotEmpty(selectedItems) && CollectionUtils.isNotEmpty(environments)) {
addActionMessage(getText(UPDATE_ENVIRONMENT));
} else if(StringUtils.isNotEmpty(selectedItems) && CollectionUtils.isEmpty(environments)){
addActionMessage(getText(DELETE_ENVIRONMENT));
} else if(CollectionUtils.isNotEmpty(environments) && StringUtils.isEmpty(selectedItems)) {
addActionMessage(getText(CREATE_SUCCESS_ENVIRONMENT));
}
} catch(Exception e) {
if (debugEnabled) {
S_LOGGER.error("Entered into catch block of Configurations.createEnvironment()" + FrameworkUtil.getStackTraceAsString(e));
}
addActionMessage(getText(CREATE_FAILURE_ENVIRONMENT));
}
return list();
}
public String deleteEnvironment(String selectedItems) {
try {
ProjectAdministrator administrator = PhrescoFrameworkFactory.getProjectAdministrator();
Project project = administrator.getProject(projectCode);
List<String> envNames = Arrays.asList(selectedItems.split(","));
List<String> deletableEnvs = new ArrayList<String>();
for (String envName : envNames) {
// Check if configurations are already exist
List<SettingsInfo> configurations = administrator.configurationsByEnvName(envName, project);
if (CollectionUtils.isEmpty(configurations)) {
deletableEnvs.add(envName);
}
}
if (isEnvDeleteSuceess == true) {
// Delete Environment
administrator.deleteEnvironments(deletableEnvs, project);
}
} catch(Exception e) {
if (debugEnabled) {
S_LOGGER.error("Entered into catch block of Configurations.deleteEnvironment()" + FrameworkUtil.getStackTraceAsString(e));
}
}
return SUCCESS;
}
public String checkForRemove(){
try {
ProjectAdministrator administrator = PhrescoFrameworkFactory.getProjectAdministrator();
Project project = administrator.getProject(projectCode);
String removeItems = getHttpRequest().getParameter(DELETABLE_ENVS);
List<String> unDeletableEnvs = new ArrayList<String>();
List<String> envs = Arrays.asList(removeItems.split(","));
for (String env : envs) {
// Check if configurations are already exist
List<SettingsInfo> configurations = administrator.configurationsByEnvName(env, project);
if (CollectionUtils.isNotEmpty(configurations)) {
unDeletableEnvs.add(env);
if(unDeletableEnvs.size() > 1){
setEnvError(getText(ERROR_ENVS_REMOVE, Collections.singletonList(unDeletableEnvs)));
} else{
setEnvError(getText(ERROR_ENV_REMOVE, Collections.singletonList(unDeletableEnvs)));
}
}
}
} catch(Exception e) {
S_LOGGER.error("Entered into catch block of Configurations.checkForRemove()" + FrameworkUtil.getStackTraceAsString(e));
}
return SUCCESS;
}
public String checkDuplicateEnv() throws PhrescoException {
try {
ProjectAdministrator administrator = PhrescoFrameworkFactory.getProjectAdministrator();
Project project = administrator.getProject(projectCode);
String envs = getHttpRequest().getParameter(ENVIRONMENT_VALUES);
Collection<String> availableConfigEnvs = administrator.getEnvNames(project);
for (String env : availableConfigEnvs) {
if(env.equalsIgnoreCase(envs)) {
setEnvError(getText(ERROR_ENV_DUPLICATE, Collections.singletonList(envs)));
}
}
availableConfigEnvs = administrator.getEnvNames();
for (String env : availableConfigEnvs) {
if(env.equalsIgnoreCase(envs)){
setEnvError(getText(ERROR_DUPLICATE_NAME_IN_SETTINGS, Collections.singletonList(envs)));
}
}
} catch(Exception e) {
throw new PhrescoException(e);
}
return SUCCESS;
}
private boolean validate(ProjectAdministrator administrator, String fromPage) throws PhrescoException {
if (debugEnabled) {
S_LOGGER.debug("Entering Method Configurations.validate(ProjectAdministrator administrator, String fromPage)");
S_LOGGER.debug("validate() Frompage = " + fromPage);
}
boolean validate = true;
String[] environments = getHttpRequest().getParameterValues(ENVIRONMENTS);
if (StringUtils.isEmpty(configType)) {
setTypeError(getText(NO_CONFIG_TYPE));
return false;
}
if (StringUtils.isEmpty(configName.trim())) {
setNameError(ERROR_NAME);
validate = false;
}
if (ArrayUtils.isEmpty(environments)) {
setEnvError(ERROR_ENV);
return false;
}
Project project = administrator.getProject(projectCode);
String techId = project.getApplicationInfo().getTechInfo().getVersion();
if(StringUtils.isNotEmpty(configName) && !configName.equals(oldName)) {
for (String environment : environments) {
List<SettingsInfo> configurations = administrator.configurationsByEnvName(environment, project);
for (SettingsInfo configuration : configurations) {
if(configName.trim().equalsIgnoreCase(configuration.getName())) {
setNameError(ERROR_DUPLICATE_NAME);
validate = false;
}
}
}
}
if (StringUtils.isEmpty(fromPage) || (StringUtils.isNotEmpty(fromPage) && !configType.equals(oldConfigType))) {
if (configType.equals(Constants.SETTINGS_TEMPLATE_SERVER) || configType.equals(Constants.SETTINGS_TEMPLATE_EMAIL)) {
for (String env : environments) {
List<SettingsInfo> settingsinfos = administrator.configurations(project, env, configType, oldName);
if(CollectionUtils.isNotEmpty( settingsinfos)) {
setTypeError(CONFIG_ALREADY_EXIST);
validate = false;
}
}
}
}
if (!REQ_CONFIG_TYPE_OTHER.equals(configType)) {
SettingsTemplate selectedSettingTemplate = administrator.getSettingsTemplate(configType);
boolean serverTypeValidation = false;
boolean isIISServer = false;
for (PropertyTemplate propertyTemplate : selectedSettingTemplate.getProperties()) {
String key = null;
String value = null;
if (propertyTemplate.getKey().equals("Server") || propertyTemplate.getKey().equals("Database")) {
List<PropertyTemplate> compPropertyTemplates = propertyTemplate.getPropertyTemplates();
for (PropertyTemplate compPropertyTemplate : compPropertyTemplates) {
key = compPropertyTemplate.getKey();
value = getHttpRequest().getParameter(key);
//If nodeJs server selected , there should not be valition for deploy dir.
if ("type".equals(key) && "NodeJS".equals(value)) {
serverTypeValidation = true;
}
if ("type".equals(key) && "IIS".equals(value)) {
isIISServer = true;
}
}
} else {
key = propertyTemplate.getKey();
}
value = getHttpRequest().getParameter(key);
boolean isRequired = propertyTemplate.isRequired();
if ((serverTypeValidation && "deploy_dir".equals(key)) || TechnologyTypes.ANDROIDS.contains(techId)) {
isRequired = false;
}
if (isIISServer && ("context".equals(key))) {
isRequired = false;
}
// validation for UserName & Password for RemoteDeployment
boolean remoteDeply = Boolean.parseBoolean(remoteDeploymentChk);
if(remoteDeply){
if ("admin_username".equals(key) || "admin_password".equals(key)) {
isRequired = true;
}
if("deploy_dir".equals(key)){
isRequired = false;
}
}
if (TechnologyTypes.SITE_CORE.equals(techId) && "deploy_dir".equals(key)) {
isRequired = false;
}
if(isRequired == true && StringUtils.isEmpty(value.trim())){
String field = propertyTemplate.getName();
dynamicError += propertyTemplate.getKey() + ":" + field + " is empty" + ",";
}
}
if (StringUtils.isNotEmpty(dynamicError)) {
dynamicError = dynamicError.substring(0, dynamicError.length() - 1);
setDynamicError(dynamicError);
validate = false;
}
if (isIISServer) {
if (StringUtils.isEmpty(appName)) {
setAppNameError("App Name is missing");
validate = false;
}
if (StringUtils.isEmpty(nameOfSite)) {
setSiteNameError("Site Name is missing");
validate = false;
}
}
if (StringUtils.isNotEmpty(getHttpRequest().getParameter("port"))) {
int value = Integer.parseInt(getHttpRequest().getParameter("port"));
if (validate && (value < 1 || value > 65535)) {
setPortError(ERROR_PORT);
validate = false;
}
}
if (StringUtils.isNotEmpty(getHttpRequest().getParameter("emailid"))) {
String value = getHttpRequest().getParameter("emailid");
Pattern p = Pattern.compile("^[_A-Za-z0-9-]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$");
Matcher m = p.matcher(value);
boolean b = m.matches();
if(!b) {
setEmailError(ERROR_EMAIL);
validate = false;
}
}
if (TechnologyTypes.SITE_CORE.equals(techId) && StringUtils.isEmpty(siteCoreInstPath)) {
setSiteCoreInstPathError("SiteCore Installation path Location is missing");
validate = false;
}
}
return validate;
}
public String edit() {
if (debugEnabled) {
S_LOGGER.debug("Entering Method Configurations.edit()");
}
try {
ProjectAdministrator administrator = getProjectAdministrator();
List<SettingsTemplate> settingsTemplates = administrator.getSettingsTemplates();
getHttpSession().setAttribute(SESSION_SETTINGS_TEMPLATES, settingsTemplates);
Project project = administrator.getProject(projectCode);
SettingsInfo selectedConfigInfo = administrator.configuration(oldName, getEnvName(), project);
if (debugEnabled) {
S_LOGGER.debug("Configurations.edit() old name" + oldName);
}
List<Environment> environments = administrator.getEnvironments(project);
getHttpRequest().setAttribute(ENVIRONMENTS, environments);
getHttpRequest().setAttribute(SESSION_OLD_NAME, oldName);
getHttpRequest().setAttribute(REQ_CONFIG_INFO, selectedConfigInfo);
getHttpRequest().setAttribute(REQ_FROM_PAGE, FROM_PAGE_EDIT);
getHttpRequest().setAttribute(REQ_PROJECT, project);
getHttpSession().removeAttribute(ERROR_SETTINGS);
getHttpRequest().setAttribute("currentEnv", envName);
} catch (Exception e) {
if (debugEnabled) {
S_LOGGER.error("Entered into catch block of Configurations.edit()" + FrameworkUtil.getStackTraceAsString(e));
}
new LogErrorReport(e, "Configurations edit");
}
getHttpRequest().setAttribute(REQ_SELECTED_MENU, APPLICATIONS);
return APP_CONFIG_EDIT;
}
public String update() {
if (debugEnabled) {
S_LOGGER.debug("Entering Method Configurations.update()");
}
try {
initDriverMap();
ProjectAdministrator administrator = PhrescoFrameworkFactory.getProjectAdministrator();
Project project = administrator.getProject(projectCode);
List<PropertyInfo> propertyInfoList = new ArrayList<PropertyInfo>();
String key = null;
String value = null;
if (REQ_CONFIG_TYPE_OTHER.equals(configType)) {
String[] keys = getHttpRequest().getParameterValues(REQ_CONFIG_PROP_KEY);
if (!ArrayUtils.isEmpty(keys)) {
for (String propertyKey : keys) {
value = getHttpRequest().getParameter(propertyKey);
propertyInfoList.add(new PropertyInfo(propertyKey, value));
}
}
} else {
SettingsTemplate selectedSettingTemplate = administrator.getSettingsTemplate(configType);
List<PropertyTemplate> propertyTemplates = selectedSettingTemplate.getProperties();
boolean isIISServer = false;
for (PropertyTemplate propertyTemplate : propertyTemplates) {
if (propertyTemplate.getKey().equals(Constants.SETTINGS_TEMPLATE_SERVER) || propertyTemplate.getKey().equals(Constants.SETTINGS_TEMPLATE_DB)) {
List<PropertyTemplate> compPropertyTemplates = propertyTemplate.getPropertyTemplates();
for (PropertyTemplate compPropertyTemplate : compPropertyTemplates) {
key = compPropertyTemplate.getKey();
value = getHttpRequest().getParameter(key);
if (propertyTemplate.getKey().equals(Constants.SETTINGS_TEMPLATE_DB) && key.equals("type")) {
value = value.trim().toLowerCase();
propertyInfoList.add(new PropertyInfo(key, value.trim()));
String dbDriver = getDbDriver(value);
propertyInfoList.add(new PropertyInfo(Constants.DB_DRIVER, dbDriver.trim()));
} else {
propertyInfoList.add(new PropertyInfo(key, value.trim()));
}
if ("type".equals(key) && "IIS".equals(value)) {
isIISServer = true;
}
}
} else {
value = getHttpRequest().getParameter(propertyTemplate.getKey());
if(propertyTemplate.getKey().equals("remoteDeployment")){
value = remoteDeploymentChk;
}
if ("certificate".equals(key)) {
String env = getHttpRequest().getParameter(ENVIRONMENTS);
if (StringUtils.isNotEmpty(value)) {
File file = new File(value);
if (file.exists()) {
String path = Utility.getProjectHome().replace("\\", "/");
value = value.replace(path + projectCode + "/", "");
} else {
value = FOLDER_DOT_PHRESCO + FILE_SEPARATOR + "certificates" +
FILE_SEPARATOR + env + "-" + configName + ".crt";
saveCertificateFile(value);
}
}
}
value = value.trim();
propertyInfoList.add(new PropertyInfo(propertyTemplate.getKey(), value));
}
}
if(TechnologyTypes.SITE_CORE.equals(project.getApplicationInfo().getTechInfo().getVersion())) {
propertyInfoList.add(new PropertyInfo(SETTINGS_TEMP_SITECORE_INST_PATH, siteCoreInstPath));
}
if (isIISServer) {
propertyInfoList.add(new PropertyInfo(SETTINGS_TEMP_KEY_APP_NAME, appName));
propertyInfoList.add(new PropertyInfo(SETTINGS_TEMP_KEY_SITE_NAME, nameOfSite));
}
}
SettingsInfo settingsInfo = new SettingsInfo(configName, description, configType);
settingsInfo.setPropertyInfos(propertyInfoList);
settingsInfo.setAppliesTo(appliesto != null ? Arrays.asList(appliesto):null);
if (debugEnabled) {
S_LOGGER.debug("Settings Info object value" + settingsInfo.toString());
}
getHttpRequest().setAttribute(REQ_CONFIG_INFO, settingsInfo);
getHttpRequest().setAttribute(REQ_PROJECT, project);
if(!validate(administrator, FROM_PAGE_EDIT)) {
isValidated = true;
getHttpRequest().setAttribute(REQ_FROM_PAGE, FROM_PAGE_EDIT);
getHttpRequest().setAttribute(REQ_OLD_NAME, oldName);
return Action.SUCCESS;
}
String environment = getHttpRequest().getParameter(ENVIRONMENTS);
administrator.updateConfiguration(environment, oldName, settingsInfo, project);
addActionMessage("Configuration updated successfully");
} catch (Exception e) {
if (debugEnabled) {
S_LOGGER.error("Entered into catch block of Configurations.update()" + FrameworkUtil.getStackTraceAsString(e));
}
new LogErrorReport(e, "Configurations update");
}
getHttpRequest().setAttribute(REQ_SELECTED_MENU, APPLICATIONS);
return list();
}
public String delete() {
if (debugEnabled) {
S_LOGGER.debug("Entering Method Configurations.delete()");
}
try {
ProjectAdministrator administrator = getProjectAdministrator();
Project project = administrator.getProject(projectCode);
addActionMessage(getText(SUCCESS_CONFIG_DELETE));
getHttpRequest().setAttribute(REQ_PROJECT, project);
List<String> configurationNames = new ArrayList<String>();
String[] selectedNames = getHttpRequest().getParameterValues(REQ_SELECTED_ITEMS);
Map<String, List<String>> deleteConfigs = new HashMap<String , List<String>>();
for(int i = 0; i < selectedNames.length; i++){
String[] split = selectedNames[i].split(",");
String envName = split[0];
List<String> configNames = deleteConfigs.get(envName);
if (configNames == null) {
configNames = new ArrayList<String>(3);
}
configNames.add(split[1]);
deleteConfigs.put(envName, configNames);
}
administrator.deleteConfigurations(deleteConfigs, project);
for (String name : selectedNames) {
configurationNames.add(name);
}
} catch (Exception e) {
if (debugEnabled) {
S_LOGGER.error("Entered into catch block of Configurations.delete()" + FrameworkUtil.getStackTraceAsString(e));
}
new LogErrorReport(e, "Configurations delete");
}
getHttpRequest().setAttribute(REQ_SELECTED_MENU, APPLICATIONS);
return list();
}
public String configurationsType() {
if (debugEnabled) {
S_LOGGER.debug("Entering Method Settings.settingsType()");
}
try {
String projectCode = (String)getHttpRequest().getParameter(REQ_PROJECT_CODE);
String oldName = (String)getHttpRequest().getParameter(REQ_OLD_NAME);
ProjectAdministrator administrator = getProjectAdministrator();
Project project = administrator.getProject(projectCode);
SettingsTemplate settingsTemplate = administrator.getSettingsTemplate(configType);
if(Constants.SETTINGS_TEMPLATE_SERVER.equals(configType)) {
List<String> projectInfoServers = project.getApplicationInfo().getSelectedServers();
getHttpRequest().setAttribute(REQ_PROJECT_INFO_SERVERS, projectInfoServers);
}
if(Constants.SETTINGS_TEMPLATE_DB.equals(configType)) {
List<String> projectInfoDatabases = project.getApplicationInfo().getSelectedDatabases();
getHttpRequest().setAttribute(REQ_PROJECT_INFO_DATABASES, projectInfoDatabases);
}
SettingsInfo selectedConfigInfo = null;
if(StringUtils.isNotEmpty(oldName)) {
selectedConfigInfo = administrator.configuration(oldName, getEnvName(), project);
} else {
selectedConfigInfo = (SettingsInfo)getHttpRequest().getAttribute(REQ_CONFIG_INFO);
}
getHttpRequest().setAttribute(REQ_PROJECT, project);
getHttpRequest().setAttribute(REQ_CURRENT_SETTINGS_TEMPLATE, settingsTemplate);
// getHttpRequest().setAttribute(REQ_ALL_TECHNOLOGIES, administrator.getAllTechnologies());//TODO:Need to handle
getHttpRequest().setAttribute(SESSION_OLD_NAME, oldName);
getHttpRequest().setAttribute(REQ_CONFIG_INFO, selectedConfigInfo);
getHttpRequest().setAttribute(REQ_FROM_PAGE, FROM_PAGE_EDIT);
} catch (Exception e) {
if (debugEnabled) {
S_LOGGER.error("Entered into catch block of Configurations.configurationsType()" + FrameworkUtil.getStackTraceAsString(e));
}
new LogErrorReport(e, "Configurations type");
}
return SETTINGS_TYPE;
}
public String openEnvironmentPopup() {
try {
getHttpRequest().setAttribute(ENVIRONMENTS, getEnvironments());
} catch (PhrescoException e) {
showErrorPopup(e, getText(CONFIG_FILE_FAIL));
} catch (ConfigurationException e) {
showErrorPopup(new PhrescoException(e), getText(CONFIG_FAIL_ENVS));
}
return APP_ENVIRONMENT;
}
public String setAsDefault() {
S_LOGGER.debug("Entering Method Configurations.setAsDefault()");
S_LOGGER.debug("SetAsdefault" + setAsDefaultEnv);
try {
ProjectAdministrator administrator = PhrescoFrameworkFactory.getProjectAdministrator();
Project project = administrator.getProject(projectCode);
if (StringUtils.isEmpty(setAsDefaultEnv)) {
setEnvError(getText(SELECT_ENV_TO_SET_AS_DEFAULT));
S_LOGGER.debug("Env value is empty");
}
List<Environment> enviroments = administrator.getEnvironments(project);
boolean envAvailable = false;
for (Environment environment : enviroments) {
if(environment.getName().equals(setAsDefaultEnv)) {
envAvailable = true;
}
}
if(!envAvailable) {
setEnvError(getText(ENV_NOT_VALID));
S_LOGGER.debug("unable to find configuration in xml");
return SUCCESS;
}
administrator.setAsDefaultEnv(setAsDefaultEnv, project);
setEnvError(getText(ENV_SET_AS_DEFAULT_SUCCESS, Collections.singletonList(setAsDefaultEnv)));
// set flag value to indicate , successfully env set as default
flag = true;
S_LOGGER.debug("successfully updated the config xml");
} catch(Exception e) {
setEnvError(getText(ENV_SET_AS_DEFAULT_ERROR));
S_LOGGER.error("Entered into catch block of Configurations.setAsDefault()" + FrameworkUtil.getStackTraceAsString(e));
}
return SUCCESS;
}
public String cloneConfigPopup() {
S_LOGGER.debug("Entering Method Configurations.cloneConfigPopup()");
try {
ProjectAdministrator administrator = PhrescoFrameworkFactory.getProjectAdministrator();
Project project = administrator.getProject(projectCode);
List<Environment> environments = administrator.getEnvironments(project);
getHttpRequest().setAttribute(ENVIRONMENTS, environments);
getHttpRequest().setAttribute(REQ_PROJECT_CODE, projectCode);
getHttpRequest().setAttribute(CLONE_FROM_CONFIG_NAME, configName);
getHttpRequest().setAttribute(CLONE_FROM_ENV_NAME, envName);
getHttpRequest().setAttribute(CLONE_FROM_CONFIG_TYPE, configType);
} catch (Exception e) {
if (debugEnabled) {
S_LOGGER.error("Entered into catch block of Configurations.cloneConfigPopup()" + FrameworkUtil.getStackTraceAsString(e));
}
}
return SUCCESS;
}
public String cloneConfiguration() {
S_LOGGER.debug("Entering Method Configurations.cloneConfiguration()");
try {
ProjectAdministrator administrator = PhrescoFrameworkFactory.getProjectAdministrator();
Project project = administrator.getProject(projectCode);
String cloneFromEnvName = getHttpRequest().getParameter(CLONE_FROM_ENV_NAME);
String cloneFromConfigType = getHttpRequest().getParameter(CLONE_FROM_CONFIG_TYPE);
String cloneFromConfigName = getHttpRequest().getParameter(CLONE_FROM_CONFIG_NAME);
boolean configExists = isConfigExists(project, envName, cloneFromConfigType, cloneFromConfigName);
if (!configExists) {
List<SettingsInfo> configurations = administrator.configurations(project, cloneFromEnvName, cloneFromConfigType, cloneFromConfigName);
if (CollectionUtils.isNotEmpty(configurations)) {
SettingsInfo settingsInfo = configurations.get(0);
settingsInfo.setName(configName);
settingsInfo.setDescription(description);
administrator.createConfiguration(settingsInfo, envName, project);
}
flag = true;
} else {
setEnvError(getText(CONFIG_ALREADY_EXIST));
flag = false;
}
} catch (Exception e) {
flag = false;
setEnvError(getText(CONFIGURATION_CLONNING_FAILED));
}
return SUCCESS;
}
public boolean isConfigExists(Project project, String envName, String configType, String cloneFromConfigName) throws PhrescoException {
try {
if (configType.equals(Constants.SETTINGS_TEMPLATE_SERVER) || configType.equals(Constants.SETTINGS_TEMPLATE_EMAIL)) {
ProjectAdministrator administrator = PhrescoFrameworkFactory.getProjectAdministrator();
List<SettingsInfo> settingsinfos = administrator.configurations(project, envName, configType, cloneFromConfigName);
if(CollectionUtils.isNotEmpty( settingsinfos)) {
// setTypeError(CONFIG_ALREADY_EXIST);
return true;
}
}
return false;
} catch (Exception e) {
throw new PhrescoException(e);
}
}
public String fetchProjectInfoVersions() {
try {
String configType = getHttpRequest().getParameter("configType");
String name = getHttpRequest().getParameter("name");
ProjectAdministrator administrator = PhrescoFrameworkFactory.getProjectAdministrator();
Project project = administrator.getProject(projectCode);
//TODO:Need to handle
/*Technology technology = project.getApplicationInfo().getTechnology();
if ("Server".equals(configType)) {
List<Server> servers = technology.getServers();
if (servers != null && CollectionUtils.isNotEmpty(servers)) {
for (Server server : servers) {
if (server.getName().equals(name)) {
setProjectInfoVersions(server.getVersions());
}
}
}
}
if ("Database".equals(configType)) {
List<Database> databases = technology.getDatabases();
if (databases != null && CollectionUtils.isNotEmpty(databases)) {
for (Database database : databases) {
if (database.getName().equals(name)) {
setProjectInfoVersions(database.getVersions());
}
}
}
}*/
} catch (Exception e) {
}
return SUCCESS;
}
public String getConfigName() {
return configName;
}
public void setConfigName(String configName) {
this.configName = configName;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getOldName() {
return oldName;
}
public void setOldName(String oldName) {
this.oldName = oldName;
}
public String[] getAppliesto() {
return appliesto;
}
public void setAppliesto(String[] appliesto) {
this.appliesto = appliesto;
}
public String getProjectCode() {
return projectCode;
}
public void setProjectCode(String projectCode) {
this.projectCode = projectCode;
}
public String getNameError() {
return nameError;
}
public void setNameError(String nameError) {
this.nameError = nameError;
}
public String getTypeError() {
return typeError;
}
public void setTypeError(String typeError) {
this.typeError = typeError;
}
public String getDynamicError() {
return dynamicError;
}
public void setDynamicError(String dynamicError) {
this.dynamicError = dynamicError;
}
public boolean isValidated() {
return isValidated;
}
public void setValidated(boolean isValidated) {
this.isValidated = isValidated;
}
public String getEnvName() {
return envName;
}
public void setEnvName(String envName) {
this.envName = envName;
}
public String getConfigType() {
return configType;
}
public void setConfigType(String configType) {
this.configType = configType;
}
public String getEnvError() {
return envError;
}
public void setEnvError(String envError) {
this.envError = envError;
}
public boolean isEnvDeleteSuceess() {
return isEnvDeleteSuceess;
}
public void setEnvDeleteSuceess(boolean isEnvDeleteSuceess) {
this.isEnvDeleteSuceess = isEnvDeleteSuceess;
}
public String getEnvDeleteMsg() {
return envDeleteMsg;
}
public void setEnvDeleteMsg(String envDeleteMsg) {
this.envDeleteMsg = envDeleteMsg;
}
public List<String> getProjectInfoVersions() {
return projectInfoVersions;
}
public void setProjectInfoVersions(List<String> projectInfoVersions) {
this.projectInfoVersions = projectInfoVersions;
}
public String getOldConfigType() {
return oldConfigType;
}
public void setOldConfigType(String oldConfigType) {
this.oldConfigType = oldConfigType;
}
public String getPortError() {
return portError;
}
public void setPortError(String portError) {
this.portError = portError;
}
public String getEmailError() {
return emailError;
}
public void setEmailError(String emailError) {
this.emailError = emailError;
}
public String getRemoteDeploymentChk() {
return remoteDeploymentChk;
}
public void setRemoteDeploymentChk(String remoteDeploymentChk) {
this.remoteDeploymentChk = remoteDeploymentChk;
}
public String getAppName() {
return appName;
}
public void setAppName(String appName) {
this.appName = appName;
}
public String getAppNameError() {
return appNameError;
}
public void setAppNameError(String appNameError) {
this.appNameError = appNameError;
}
public String getSiteNameError() {
return siteNameError;
}
public void setSiteNameError(String siteNameError) {
this.siteNameError = siteNameError;
}
public String getNameOfSite() {
return nameOfSite;
}
public void setNameOfSite(String nameOfSite) {
this.nameOfSite = nameOfSite;
}
public String getSiteCoreInstPath() {
return siteCoreInstPath;
}
public void setSiteCoreInstPath(String siteCoreInstPath) {
this.siteCoreInstPath = siteCoreInstPath;
}
public String getSiteCoreInstPathError() {
return siteCoreInstPathError;
}
public void setSiteCoreInstPathError(String siteCoreInstPathError) {
this.siteCoreInstPathError = siteCoreInstPathError;
}
public String getSetAsDefaultEnv() {
return setAsDefaultEnv;
}
public void setSetAsDefaultEnv(String setAsDefaultEnv) {
this.setAsDefaultEnv = setAsDefaultEnv;
}
public boolean isFlag() {
return flag;
}
public void setFlag(boolean flag) {
this.flag = flag;
}
}
| UTF-8 | Java | 48,158 | java | 3_fa0eb6ce6f4d2edccfbebd8e558d34d2b7db302b_Configurations_t.java | Java | [
{
"context": " if(remoteDeply){\n if (\"admin_username\".equals(key) || \"admin_password\".equals(key)) {\n ",
"end": 24291,
"score": 0.9969632625579834,
"start": 24277,
"tag": "USERNAME",
"value": "admin_username"
}
] | null | [] | /*
* ###
* Framework Web Archive
* %%
* Copyright (C) 1999 - 2012 Photon Infotech Inc.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ###
*/
package com.photon.phresco.framework.actions.applications;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import com.opensymphony.xwork2.Action;
import com.photon.phresco.commons.api.ConfigManager;
import com.photon.phresco.commons.model.PropertyTemplate;
import com.photon.phresco.commons.model.SettingsTemplate;
import com.photon.phresco.configuration.Environment;
import com.photon.phresco.exception.ConfigurationException;
import com.photon.phresco.exception.PhrescoException;
import com.photon.phresco.framework.PhrescoFrameworkFactory;
import com.photon.phresco.framework.actions.FrameworkBaseAction;
import com.photon.phresco.framework.api.Project;
import com.photon.phresco.framework.api.ProjectAdministrator;
import com.photon.phresco.framework.commons.FrameworkUtil;
import com.photon.phresco.framework.commons.LogErrorReport;
import com.photon.phresco.framework.impl.EnvironmentComparator;
import com.photon.phresco.framework.model.CertificateInfo;
import com.photon.phresco.framework.model.PropertyInfo;
import com.photon.phresco.framework.model.SettingsInfo;
import com.photon.phresco.util.Constants;
import com.photon.phresco.util.TechnologyTypes;
import com.photon.phresco.util.Utility;
public class Configurations extends FrameworkBaseAction {
private static final long serialVersionUID = -4883865658298200459L;
private Map<String, String> dbDriverMap = new HashMap<String, String>(8);
private static final Logger S_LOGGER = Logger.getLogger(Configurations.class);
private static Boolean debugEnabled = S_LOGGER.isDebugEnabled();
private String configName = null;
private String description = null;
private String oldName = null;
private String[] appliesto = null;
private String projectCode = null;
private String nameError = null;
private String typeError = null;
private String portError = null;
private String dynamicError = "";
private boolean isValidated = false;
private String envName = null;
private String configType = null;
private String oldConfigType = null;
private String envError = null;
private String emailError = null;
private String remoteDeploymentChk = null;
// Environemnt delete
private boolean isEnvDeleteSuceess = true;
private String envDeleteMsg = null;
private List<String> projectInfoVersions = null;
// For IIS server
private String appName = "";
private String nameOfSite = "";
private String siteCoreInstPath = "";
private String appNameError = null;
private String siteNameError = null;
private String siteCoreInstPathError = null;
//set as default envs
private String setAsDefaultEnv = "";
private boolean flag = false;
public String list() {
if (S_LOGGER.isDebugEnabled()) {
S_LOGGER.debug("Configuration.list() entered");
}
Project project = null;
try {
List<Environment> environments = getEnvironments();
// configManager.get
// project = administrator.getProject(projectCode);
// List<Environment> environments = administrator.getEnvironments(project);
// configManager.getEnvironments(names);
// getHttpRequest().setAttribute(ENVIRONMENTS, environments);
// List<SettingsInfo> configurations = administrator.configurations(project);
String cloneConfigStatus = getHttpRequest().getParameter(CLONE_CONFIG_STATUS);
if (cloneConfigStatus != null) {
addActionMessage(getText(ENV_CLONE_SUCCESS));
}
} catch (Exception e) {
if (debugEnabled) {
S_LOGGER.error("Entered into catch block of Configurations.list()" + FrameworkUtil.getStackTraceAsString(e));
}
new LogErrorReport(e, "Configurations list");
}
getHttpRequest().setAttribute(REQ_PROJECT, project);
getHttpRequest().setAttribute(REQ_SELECTED_MENU, APPLICATIONS);
return APP_LIST;
}
/**
* @return
* @throws PhrescoException
* @throws ConfigurationException
*/
private List<Environment> getEnvironments() throws PhrescoException, ConfigurationException {
ConfigManager configManager = getConfigManager();
return configManager.getEnvironments();
}
/**
* @return
* @throws PhrescoException
*/
private ConfigManager getConfigManager() throws PhrescoException {
File appDir = new File(getAppHome());
return PhrescoFrameworkFactory.getConfigManager(appDir);
}
public String add() {
if (debugEnabled) {
S_LOGGER.debug("Entering Method Configurations.add()");
}
getHttpSession().removeAttribute(REQ_CONFIG_INFO);
try {
ProjectAdministrator administrator = getProjectAdministrator();
Project project = administrator.getProject(projectCode);
List<SettingsTemplate> settingsTemplates = administrator.getSettingsTemplates();
getHttpSession().setAttribute(SESSION_SETTINGS_TEMPLATES, settingsTemplates);
List<Environment> environments = administrator.getEnvironments(project);
getHttpRequest().setAttribute(ENVIRONMENTS, environments);
Collections.sort(environments, new EnvironmentComparator());
getHttpSession().removeAttribute(ERROR_SETTINGS);
getHttpRequest().setAttribute(REQ_PROJECT, project);
} catch (Exception e) {
if (debugEnabled) {
S_LOGGER.error("Entered into catch block of Configurations.add()" + FrameworkUtil.getStackTraceAsString(e));
}
new LogErrorReport(e, "Configurations add");
}
getHttpRequest().setAttribute(REQ_SELECTED_MENU, APPLICATIONS);
return APP_CONFIG_ADD;
}
public String save() {
if (debugEnabled) {
S_LOGGER.debug("Entering Method Configurations.save()");
}
try {
initDriverMap();
ProjectAdministrator administrator = PhrescoFrameworkFactory.getProjectAdministrator();
Project project = administrator.getProject(projectCode);
if(!validate(administrator, null)) {
isValidated = true;
return Action.SUCCESS;
}
List<PropertyInfo> propertyInfoList = new ArrayList<PropertyInfo>();
String key = null;
String value = null;
if (REQ_CONFIG_TYPE_OTHER.equals(configType)) {
String[] keys = getHttpRequest().getParameterValues(REQ_CONFIG_PROP_KEY);
if (!ArrayUtils.isEmpty(keys)) {
for (String propertyKey : keys) {
value = getHttpRequest().getParameter(propertyKey);
propertyInfoList.add(new PropertyInfo(propertyKey, value));
}
}
} else {
SettingsTemplate selectedSettingTemplate = administrator.getSettingsTemplate(configType);
List<PropertyTemplate> propertyTemplates = selectedSettingTemplate.getProperties();
boolean isIISServer = false;
for (PropertyTemplate propertyTemplate : propertyTemplates) {
if (propertyTemplate.getKey().equals(Constants.SETTINGS_TEMPLATE_SERVER) || propertyTemplate.getKey().equals(Constants.SETTINGS_TEMPLATE_DB)) {
List<PropertyTemplate> compPropertyTemplates = propertyTemplate.getPropertyTemplates();
for (PropertyTemplate compPropertyTemplate : compPropertyTemplates) {
key = compPropertyTemplate.getKey();
value = getHttpRequest().getParameter(key);
if (propertyTemplate.getKey().equals(Constants.SETTINGS_TEMPLATE_DB) && key.equals("type")) {
value = value.trim().toLowerCase();
propertyInfoList.add(new PropertyInfo(key, value.trim()));
String dbDriver = getDbDriver(value);
propertyInfoList.add(new PropertyInfo(Constants.DB_DRIVER, dbDriver.trim()));
} else {
propertyInfoList.add(new PropertyInfo(key, value.trim()));
}
if ("type".equals(key) && "IIS".equals(value)) {
isIISServer = true;
}
}
} else {
key = propertyTemplate.getKey();
value = getHttpRequest().getParameter(key);
if(key.equals("remoteDeployment")){
value = remoteDeploymentChk;
}
value = value.trim();
if(key.equals(ADDITIONAL_CONTEXT_PATH)){
String addcontext = value;
if(!addcontext.startsWith("/")) {
value = "/" + value;
}
}
if ("certificate".equals(key)) {
String env = getHttpRequest().getParameter(ENVIRONMENTS);
if (StringUtils.isNotEmpty(value)) {
File file = new File(value);
if (file.exists()) {
String path = Utility.getProjectHome().replace("\\", "/");
value = value.replace(path + projectCode + "/", "");
} else {
value = FOLDER_DOT_PHRESCO + FILE_SEPARATOR + "certificates" +
FILE_SEPARATOR + env + "-" + configName + ".crt";
saveCertificateFile(value);
}
}
}
propertyInfoList.add(new PropertyInfo(propertyTemplate.getKey(), value));
}
if (S_LOGGER.isDebugEnabled()) {
S_LOGGER.debug("Configuration.save() key " + propertyTemplate.getKey() + "and Value is " + value);
}
}
if(TechnologyTypes.SITE_CORE.equals(project.getApplicationInfo().getTechInfo().getVersion())) {
propertyInfoList.add(new PropertyInfo(SETTINGS_TEMP_SITECORE_INST_PATH, siteCoreInstPath));
}
if (isIISServer) {
propertyInfoList.add(new PropertyInfo(SETTINGS_TEMP_KEY_APP_NAME, appName));
propertyInfoList.add(new PropertyInfo(SETTINGS_TEMP_KEY_SITE_NAME, nameOfSite));
}
}
SettingsInfo settingsInfo = new SettingsInfo(configName, description, configType);
settingsInfo.setAppliesTo(Arrays.asList(project.getApplicationInfo().getTechInfo().getVersion()));
settingsInfo.setPropertyInfos(propertyInfoList);
getHttpRequest().setAttribute(REQ_CONFIG_INFO, settingsInfo);
getHttpRequest().setAttribute(REQ_PROJECT_CODE, projectCode);
getHttpRequest().setAttribute(REQ_PROJECT, project);
String[] environments = getHttpRequest().getParameterValues(ENVIRONMENTS);
StringBuilder sb = new StringBuilder();
for (String envs : environments) {
if (sb.length() > 0) sb.append(',');
sb.append(envs);
}
administrator.createConfiguration(settingsInfo, sb.toString(), project);
if (SERVER.equals(configType)){
addActionMessage(getText(SUCCESS_SERVER, Collections.singletonList(configName)));
}
else if (DATABASE.equals(configType)) {
addActionMessage(getText(SUCCESS_DATABASE, Collections.singletonList(configName)));
}
else if (WEBSERVICE.equals(configType)) {
addActionMessage(getText(SUCCESS_WEBSERVICE, Collections.singletonList(configName)));
}
else {
addActionMessage(getText(SUCCESS_EMAIL, Collections.singletonList(configName)));
}
getHttpSession().removeAttribute(ERROR_SETTINGS);
} catch (Exception e) {
if (debugEnabled) {
S_LOGGER.error("Entered into catch block of Configurations.save()" + FrameworkUtil.getStackTraceAsString(e));
}
new LogErrorReport(e, "Configurations save");
}
getHttpRequest().setAttribute(REQ_SELECTED_MENU, APPLICATIONS);
return list();
}
private String getDbDriver(String dbtype) {
return dbDriverMap.get(dbtype);
}
private void initDriverMap() {
dbDriverMap.put("mysql", "com.mysql.jdbc.Driver");
dbDriverMap.put("oracle", "oracle.jdbc.OracleDriver");
dbDriverMap.put("hsql", "org.hsql.jdbcDriver");
dbDriverMap.put("mssql", "com.microsoft.sqlserver.jdbc.SQLServerDriver");
dbDriverMap.put("db2", "com.ibm.db2.jcc.DB2Driver");
dbDriverMap.put("mongodb", "com.mongodb.jdbc.MongoDriver");
}
private void saveCertificateFile(String path) throws PhrescoException {
try {
String host = (String)getHttpRequest().getParameter(SERVER_HOST);
int port = Integer.parseInt(getHttpRequest().getParameter(SERVER_PORT));
String certificateName = (String)getHttpRequest().getParameter("certificate");
ProjectAdministrator administrator = PhrescoFrameworkFactory.getProjectAdministrator();
List<CertificateInfo> certificates = administrator.getCertificate(host, port);
if (CollectionUtils.isNotEmpty(certificates)) {
for (CertificateInfo certificate : certificates) {
if (certificate.getDisplayName().equals(certificateName)) {
administrator.addCertificate(certificate, new File(Utility.getProjectHome() + projectCode + "/" + path));
}
}
}
} catch (Exception e) {
throw new PhrescoException(e);
}
}
public String createEnvironment() {
try {
String[] split = null;
ProjectAdministrator administrator = PhrescoFrameworkFactory
.getProjectAdministrator();
Project project = administrator.getProject(projectCode);
String envs = getHttpRequest().getParameter(ENVIRONMENT_VALUES);
String selectedItems = getHttpRequest().getParameter("deletableEnvs");
if(StringUtils.isNotEmpty(selectedItems)){
deleteEnvironment(selectedItems);
}
List<Environment> environments = new ArrayList<Environment>();
if (StringUtils.isNotEmpty(envs)) {
List<String> listSelectedEnvs = new ArrayList<String>(
Arrays.asList(envs.split("#SEP#")));
for (String listSelectedEnv : listSelectedEnvs) {
try {
split = listSelectedEnv.split("#DSEP#");
environments.add(new Environment(split[0], split[1],
false));
} catch (ArrayIndexOutOfBoundsException e) {
environments.add(new Environment(split[0], "", false));
}
}
}
administrator.createEnvironments(project, environments, false);
if(StringUtils.isNotEmpty(selectedItems) && CollectionUtils.isNotEmpty(environments)) {
addActionMessage(getText(UPDATE_ENVIRONMENT));
} else if(StringUtils.isNotEmpty(selectedItems) && CollectionUtils.isEmpty(environments)){
addActionMessage(getText(DELETE_ENVIRONMENT));
} else if(CollectionUtils.isNotEmpty(environments) && StringUtils.isEmpty(selectedItems)) {
addActionMessage(getText(CREATE_SUCCESS_ENVIRONMENT));
}
} catch(Exception e) {
if (debugEnabled) {
S_LOGGER.error("Entered into catch block of Configurations.createEnvironment()" + FrameworkUtil.getStackTraceAsString(e));
}
addActionMessage(getText(CREATE_FAILURE_ENVIRONMENT));
}
return list();
}
public String deleteEnvironment(String selectedItems) {
try {
ProjectAdministrator administrator = PhrescoFrameworkFactory.getProjectAdministrator();
Project project = administrator.getProject(projectCode);
List<String> envNames = Arrays.asList(selectedItems.split(","));
List<String> deletableEnvs = new ArrayList<String>();
for (String envName : envNames) {
// Check if configurations are already exist
List<SettingsInfo> configurations = administrator.configurationsByEnvName(envName, project);
if (CollectionUtils.isEmpty(configurations)) {
deletableEnvs.add(envName);
}
}
if (isEnvDeleteSuceess == true) {
// Delete Environment
administrator.deleteEnvironments(deletableEnvs, project);
}
} catch(Exception e) {
if (debugEnabled) {
S_LOGGER.error("Entered into catch block of Configurations.deleteEnvironment()" + FrameworkUtil.getStackTraceAsString(e));
}
}
return SUCCESS;
}
public String checkForRemove(){
try {
ProjectAdministrator administrator = PhrescoFrameworkFactory.getProjectAdministrator();
Project project = administrator.getProject(projectCode);
String removeItems = getHttpRequest().getParameter(DELETABLE_ENVS);
List<String> unDeletableEnvs = new ArrayList<String>();
List<String> envs = Arrays.asList(removeItems.split(","));
for (String env : envs) {
// Check if configurations are already exist
List<SettingsInfo> configurations = administrator.configurationsByEnvName(env, project);
if (CollectionUtils.isNotEmpty(configurations)) {
unDeletableEnvs.add(env);
if(unDeletableEnvs.size() > 1){
setEnvError(getText(ERROR_ENVS_REMOVE, Collections.singletonList(unDeletableEnvs)));
} else{
setEnvError(getText(ERROR_ENV_REMOVE, Collections.singletonList(unDeletableEnvs)));
}
}
}
} catch(Exception e) {
S_LOGGER.error("Entered into catch block of Configurations.checkForRemove()" + FrameworkUtil.getStackTraceAsString(e));
}
return SUCCESS;
}
public String checkDuplicateEnv() throws PhrescoException {
try {
ProjectAdministrator administrator = PhrescoFrameworkFactory.getProjectAdministrator();
Project project = administrator.getProject(projectCode);
String envs = getHttpRequest().getParameter(ENVIRONMENT_VALUES);
Collection<String> availableConfigEnvs = administrator.getEnvNames(project);
for (String env : availableConfigEnvs) {
if(env.equalsIgnoreCase(envs)) {
setEnvError(getText(ERROR_ENV_DUPLICATE, Collections.singletonList(envs)));
}
}
availableConfigEnvs = administrator.getEnvNames();
for (String env : availableConfigEnvs) {
if(env.equalsIgnoreCase(envs)){
setEnvError(getText(ERROR_DUPLICATE_NAME_IN_SETTINGS, Collections.singletonList(envs)));
}
}
} catch(Exception e) {
throw new PhrescoException(e);
}
return SUCCESS;
}
private boolean validate(ProjectAdministrator administrator, String fromPage) throws PhrescoException {
if (debugEnabled) {
S_LOGGER.debug("Entering Method Configurations.validate(ProjectAdministrator administrator, String fromPage)");
S_LOGGER.debug("validate() Frompage = " + fromPage);
}
boolean validate = true;
String[] environments = getHttpRequest().getParameterValues(ENVIRONMENTS);
if (StringUtils.isEmpty(configType)) {
setTypeError(getText(NO_CONFIG_TYPE));
return false;
}
if (StringUtils.isEmpty(configName.trim())) {
setNameError(ERROR_NAME);
validate = false;
}
if (ArrayUtils.isEmpty(environments)) {
setEnvError(ERROR_ENV);
return false;
}
Project project = administrator.getProject(projectCode);
String techId = project.getApplicationInfo().getTechInfo().getVersion();
if(StringUtils.isNotEmpty(configName) && !configName.equals(oldName)) {
for (String environment : environments) {
List<SettingsInfo> configurations = administrator.configurationsByEnvName(environment, project);
for (SettingsInfo configuration : configurations) {
if(configName.trim().equalsIgnoreCase(configuration.getName())) {
setNameError(ERROR_DUPLICATE_NAME);
validate = false;
}
}
}
}
if (StringUtils.isEmpty(fromPage) || (StringUtils.isNotEmpty(fromPage) && !configType.equals(oldConfigType))) {
if (configType.equals(Constants.SETTINGS_TEMPLATE_SERVER) || configType.equals(Constants.SETTINGS_TEMPLATE_EMAIL)) {
for (String env : environments) {
List<SettingsInfo> settingsinfos = administrator.configurations(project, env, configType, oldName);
if(CollectionUtils.isNotEmpty( settingsinfos)) {
setTypeError(CONFIG_ALREADY_EXIST);
validate = false;
}
}
}
}
if (!REQ_CONFIG_TYPE_OTHER.equals(configType)) {
SettingsTemplate selectedSettingTemplate = administrator.getSettingsTemplate(configType);
boolean serverTypeValidation = false;
boolean isIISServer = false;
for (PropertyTemplate propertyTemplate : selectedSettingTemplate.getProperties()) {
String key = null;
String value = null;
if (propertyTemplate.getKey().equals("Server") || propertyTemplate.getKey().equals("Database")) {
List<PropertyTemplate> compPropertyTemplates = propertyTemplate.getPropertyTemplates();
for (PropertyTemplate compPropertyTemplate : compPropertyTemplates) {
key = compPropertyTemplate.getKey();
value = getHttpRequest().getParameter(key);
//If nodeJs server selected , there should not be valition for deploy dir.
if ("type".equals(key) && "NodeJS".equals(value)) {
serverTypeValidation = true;
}
if ("type".equals(key) && "IIS".equals(value)) {
isIISServer = true;
}
}
} else {
key = propertyTemplate.getKey();
}
value = getHttpRequest().getParameter(key);
boolean isRequired = propertyTemplate.isRequired();
if ((serverTypeValidation && "deploy_dir".equals(key)) || TechnologyTypes.ANDROIDS.contains(techId)) {
isRequired = false;
}
if (isIISServer && ("context".equals(key))) {
isRequired = false;
}
// validation for UserName & Password for RemoteDeployment
boolean remoteDeply = Boolean.parseBoolean(remoteDeploymentChk);
if(remoteDeply){
if ("admin_username".equals(key) || "admin_password".equals(key)) {
isRequired = true;
}
if("deploy_dir".equals(key)){
isRequired = false;
}
}
if (TechnologyTypes.SITE_CORE.equals(techId) && "deploy_dir".equals(key)) {
isRequired = false;
}
if(isRequired == true && StringUtils.isEmpty(value.trim())){
String field = propertyTemplate.getName();
dynamicError += propertyTemplate.getKey() + ":" + field + " is empty" + ",";
}
}
if (StringUtils.isNotEmpty(dynamicError)) {
dynamicError = dynamicError.substring(0, dynamicError.length() - 1);
setDynamicError(dynamicError);
validate = false;
}
if (isIISServer) {
if (StringUtils.isEmpty(appName)) {
setAppNameError("App Name is missing");
validate = false;
}
if (StringUtils.isEmpty(nameOfSite)) {
setSiteNameError("Site Name is missing");
validate = false;
}
}
if (StringUtils.isNotEmpty(getHttpRequest().getParameter("port"))) {
int value = Integer.parseInt(getHttpRequest().getParameter("port"));
if (validate && (value < 1 || value > 65535)) {
setPortError(ERROR_PORT);
validate = false;
}
}
if (StringUtils.isNotEmpty(getHttpRequest().getParameter("emailid"))) {
String value = getHttpRequest().getParameter("emailid");
Pattern p = Pattern.compile("^[_A-Za-z0-9-]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$");
Matcher m = p.matcher(value);
boolean b = m.matches();
if(!b) {
setEmailError(ERROR_EMAIL);
validate = false;
}
}
if (TechnologyTypes.SITE_CORE.equals(techId) && StringUtils.isEmpty(siteCoreInstPath)) {
setSiteCoreInstPathError("SiteCore Installation path Location is missing");
validate = false;
}
}
return validate;
}
public String edit() {
if (debugEnabled) {
S_LOGGER.debug("Entering Method Configurations.edit()");
}
try {
ProjectAdministrator administrator = getProjectAdministrator();
List<SettingsTemplate> settingsTemplates = administrator.getSettingsTemplates();
getHttpSession().setAttribute(SESSION_SETTINGS_TEMPLATES, settingsTemplates);
Project project = administrator.getProject(projectCode);
SettingsInfo selectedConfigInfo = administrator.configuration(oldName, getEnvName(), project);
if (debugEnabled) {
S_LOGGER.debug("Configurations.edit() old name" + oldName);
}
List<Environment> environments = administrator.getEnvironments(project);
getHttpRequest().setAttribute(ENVIRONMENTS, environments);
getHttpRequest().setAttribute(SESSION_OLD_NAME, oldName);
getHttpRequest().setAttribute(REQ_CONFIG_INFO, selectedConfigInfo);
getHttpRequest().setAttribute(REQ_FROM_PAGE, FROM_PAGE_EDIT);
getHttpRequest().setAttribute(REQ_PROJECT, project);
getHttpSession().removeAttribute(ERROR_SETTINGS);
getHttpRequest().setAttribute("currentEnv", envName);
} catch (Exception e) {
if (debugEnabled) {
S_LOGGER.error("Entered into catch block of Configurations.edit()" + FrameworkUtil.getStackTraceAsString(e));
}
new LogErrorReport(e, "Configurations edit");
}
getHttpRequest().setAttribute(REQ_SELECTED_MENU, APPLICATIONS);
return APP_CONFIG_EDIT;
}
public String update() {
if (debugEnabled) {
S_LOGGER.debug("Entering Method Configurations.update()");
}
try {
initDriverMap();
ProjectAdministrator administrator = PhrescoFrameworkFactory.getProjectAdministrator();
Project project = administrator.getProject(projectCode);
List<PropertyInfo> propertyInfoList = new ArrayList<PropertyInfo>();
String key = null;
String value = null;
if (REQ_CONFIG_TYPE_OTHER.equals(configType)) {
String[] keys = getHttpRequest().getParameterValues(REQ_CONFIG_PROP_KEY);
if (!ArrayUtils.isEmpty(keys)) {
for (String propertyKey : keys) {
value = getHttpRequest().getParameter(propertyKey);
propertyInfoList.add(new PropertyInfo(propertyKey, value));
}
}
} else {
SettingsTemplate selectedSettingTemplate = administrator.getSettingsTemplate(configType);
List<PropertyTemplate> propertyTemplates = selectedSettingTemplate.getProperties();
boolean isIISServer = false;
for (PropertyTemplate propertyTemplate : propertyTemplates) {
if (propertyTemplate.getKey().equals(Constants.SETTINGS_TEMPLATE_SERVER) || propertyTemplate.getKey().equals(Constants.SETTINGS_TEMPLATE_DB)) {
List<PropertyTemplate> compPropertyTemplates = propertyTemplate.getPropertyTemplates();
for (PropertyTemplate compPropertyTemplate : compPropertyTemplates) {
key = compPropertyTemplate.getKey();
value = getHttpRequest().getParameter(key);
if (propertyTemplate.getKey().equals(Constants.SETTINGS_TEMPLATE_DB) && key.equals("type")) {
value = value.trim().toLowerCase();
propertyInfoList.add(new PropertyInfo(key, value.trim()));
String dbDriver = getDbDriver(value);
propertyInfoList.add(new PropertyInfo(Constants.DB_DRIVER, dbDriver.trim()));
} else {
propertyInfoList.add(new PropertyInfo(key, value.trim()));
}
if ("type".equals(key) && "IIS".equals(value)) {
isIISServer = true;
}
}
} else {
value = getHttpRequest().getParameter(propertyTemplate.getKey());
if(propertyTemplate.getKey().equals("remoteDeployment")){
value = remoteDeploymentChk;
}
if ("certificate".equals(key)) {
String env = getHttpRequest().getParameter(ENVIRONMENTS);
if (StringUtils.isNotEmpty(value)) {
File file = new File(value);
if (file.exists()) {
String path = Utility.getProjectHome().replace("\\", "/");
value = value.replace(path + projectCode + "/", "");
} else {
value = FOLDER_DOT_PHRESCO + FILE_SEPARATOR + "certificates" +
FILE_SEPARATOR + env + "-" + configName + ".crt";
saveCertificateFile(value);
}
}
}
value = value.trim();
propertyInfoList.add(new PropertyInfo(propertyTemplate.getKey(), value));
}
}
if(TechnologyTypes.SITE_CORE.equals(project.getApplicationInfo().getTechInfo().getVersion())) {
propertyInfoList.add(new PropertyInfo(SETTINGS_TEMP_SITECORE_INST_PATH, siteCoreInstPath));
}
if (isIISServer) {
propertyInfoList.add(new PropertyInfo(SETTINGS_TEMP_KEY_APP_NAME, appName));
propertyInfoList.add(new PropertyInfo(SETTINGS_TEMP_KEY_SITE_NAME, nameOfSite));
}
}
SettingsInfo settingsInfo = new SettingsInfo(configName, description, configType);
settingsInfo.setPropertyInfos(propertyInfoList);
settingsInfo.setAppliesTo(appliesto != null ? Arrays.asList(appliesto):null);
if (debugEnabled) {
S_LOGGER.debug("Settings Info object value" + settingsInfo.toString());
}
getHttpRequest().setAttribute(REQ_CONFIG_INFO, settingsInfo);
getHttpRequest().setAttribute(REQ_PROJECT, project);
if(!validate(administrator, FROM_PAGE_EDIT)) {
isValidated = true;
getHttpRequest().setAttribute(REQ_FROM_PAGE, FROM_PAGE_EDIT);
getHttpRequest().setAttribute(REQ_OLD_NAME, oldName);
return Action.SUCCESS;
}
String environment = getHttpRequest().getParameter(ENVIRONMENTS);
administrator.updateConfiguration(environment, oldName, settingsInfo, project);
addActionMessage("Configuration updated successfully");
} catch (Exception e) {
if (debugEnabled) {
S_LOGGER.error("Entered into catch block of Configurations.update()" + FrameworkUtil.getStackTraceAsString(e));
}
new LogErrorReport(e, "Configurations update");
}
getHttpRequest().setAttribute(REQ_SELECTED_MENU, APPLICATIONS);
return list();
}
public String delete() {
if (debugEnabled) {
S_LOGGER.debug("Entering Method Configurations.delete()");
}
try {
ProjectAdministrator administrator = getProjectAdministrator();
Project project = administrator.getProject(projectCode);
addActionMessage(getText(SUCCESS_CONFIG_DELETE));
getHttpRequest().setAttribute(REQ_PROJECT, project);
List<String> configurationNames = new ArrayList<String>();
String[] selectedNames = getHttpRequest().getParameterValues(REQ_SELECTED_ITEMS);
Map<String, List<String>> deleteConfigs = new HashMap<String , List<String>>();
for(int i = 0; i < selectedNames.length; i++){
String[] split = selectedNames[i].split(",");
String envName = split[0];
List<String> configNames = deleteConfigs.get(envName);
if (configNames == null) {
configNames = new ArrayList<String>(3);
}
configNames.add(split[1]);
deleteConfigs.put(envName, configNames);
}
administrator.deleteConfigurations(deleteConfigs, project);
for (String name : selectedNames) {
configurationNames.add(name);
}
} catch (Exception e) {
if (debugEnabled) {
S_LOGGER.error("Entered into catch block of Configurations.delete()" + FrameworkUtil.getStackTraceAsString(e));
}
new LogErrorReport(e, "Configurations delete");
}
getHttpRequest().setAttribute(REQ_SELECTED_MENU, APPLICATIONS);
return list();
}
public String configurationsType() {
if (debugEnabled) {
S_LOGGER.debug("Entering Method Settings.settingsType()");
}
try {
String projectCode = (String)getHttpRequest().getParameter(REQ_PROJECT_CODE);
String oldName = (String)getHttpRequest().getParameter(REQ_OLD_NAME);
ProjectAdministrator administrator = getProjectAdministrator();
Project project = administrator.getProject(projectCode);
SettingsTemplate settingsTemplate = administrator.getSettingsTemplate(configType);
if(Constants.SETTINGS_TEMPLATE_SERVER.equals(configType)) {
List<String> projectInfoServers = project.getApplicationInfo().getSelectedServers();
getHttpRequest().setAttribute(REQ_PROJECT_INFO_SERVERS, projectInfoServers);
}
if(Constants.SETTINGS_TEMPLATE_DB.equals(configType)) {
List<String> projectInfoDatabases = project.getApplicationInfo().getSelectedDatabases();
getHttpRequest().setAttribute(REQ_PROJECT_INFO_DATABASES, projectInfoDatabases);
}
SettingsInfo selectedConfigInfo = null;
if(StringUtils.isNotEmpty(oldName)) {
selectedConfigInfo = administrator.configuration(oldName, getEnvName(), project);
} else {
selectedConfigInfo = (SettingsInfo)getHttpRequest().getAttribute(REQ_CONFIG_INFO);
}
getHttpRequest().setAttribute(REQ_PROJECT, project);
getHttpRequest().setAttribute(REQ_CURRENT_SETTINGS_TEMPLATE, settingsTemplate);
// getHttpRequest().setAttribute(REQ_ALL_TECHNOLOGIES, administrator.getAllTechnologies());//TODO:Need to handle
getHttpRequest().setAttribute(SESSION_OLD_NAME, oldName);
getHttpRequest().setAttribute(REQ_CONFIG_INFO, selectedConfigInfo);
getHttpRequest().setAttribute(REQ_FROM_PAGE, FROM_PAGE_EDIT);
} catch (Exception e) {
if (debugEnabled) {
S_LOGGER.error("Entered into catch block of Configurations.configurationsType()" + FrameworkUtil.getStackTraceAsString(e));
}
new LogErrorReport(e, "Configurations type");
}
return SETTINGS_TYPE;
}
public String openEnvironmentPopup() {
try {
getHttpRequest().setAttribute(ENVIRONMENTS, getEnvironments());
} catch (PhrescoException e) {
showErrorPopup(e, getText(CONFIG_FILE_FAIL));
} catch (ConfigurationException e) {
showErrorPopup(new PhrescoException(e), getText(CONFIG_FAIL_ENVS));
}
return APP_ENVIRONMENT;
}
public String setAsDefault() {
S_LOGGER.debug("Entering Method Configurations.setAsDefault()");
S_LOGGER.debug("SetAsdefault" + setAsDefaultEnv);
try {
ProjectAdministrator administrator = PhrescoFrameworkFactory.getProjectAdministrator();
Project project = administrator.getProject(projectCode);
if (StringUtils.isEmpty(setAsDefaultEnv)) {
setEnvError(getText(SELECT_ENV_TO_SET_AS_DEFAULT));
S_LOGGER.debug("Env value is empty");
}
List<Environment> enviroments = administrator.getEnvironments(project);
boolean envAvailable = false;
for (Environment environment : enviroments) {
if(environment.getName().equals(setAsDefaultEnv)) {
envAvailable = true;
}
}
if(!envAvailable) {
setEnvError(getText(ENV_NOT_VALID));
S_LOGGER.debug("unable to find configuration in xml");
return SUCCESS;
}
administrator.setAsDefaultEnv(setAsDefaultEnv, project);
setEnvError(getText(ENV_SET_AS_DEFAULT_SUCCESS, Collections.singletonList(setAsDefaultEnv)));
// set flag value to indicate , successfully env set as default
flag = true;
S_LOGGER.debug("successfully updated the config xml");
} catch(Exception e) {
setEnvError(getText(ENV_SET_AS_DEFAULT_ERROR));
S_LOGGER.error("Entered into catch block of Configurations.setAsDefault()" + FrameworkUtil.getStackTraceAsString(e));
}
return SUCCESS;
}
public String cloneConfigPopup() {
S_LOGGER.debug("Entering Method Configurations.cloneConfigPopup()");
try {
ProjectAdministrator administrator = PhrescoFrameworkFactory.getProjectAdministrator();
Project project = administrator.getProject(projectCode);
List<Environment> environments = administrator.getEnvironments(project);
getHttpRequest().setAttribute(ENVIRONMENTS, environments);
getHttpRequest().setAttribute(REQ_PROJECT_CODE, projectCode);
getHttpRequest().setAttribute(CLONE_FROM_CONFIG_NAME, configName);
getHttpRequest().setAttribute(CLONE_FROM_ENV_NAME, envName);
getHttpRequest().setAttribute(CLONE_FROM_CONFIG_TYPE, configType);
} catch (Exception e) {
if (debugEnabled) {
S_LOGGER.error("Entered into catch block of Configurations.cloneConfigPopup()" + FrameworkUtil.getStackTraceAsString(e));
}
}
return SUCCESS;
}
public String cloneConfiguration() {
S_LOGGER.debug("Entering Method Configurations.cloneConfiguration()");
try {
ProjectAdministrator administrator = PhrescoFrameworkFactory.getProjectAdministrator();
Project project = administrator.getProject(projectCode);
String cloneFromEnvName = getHttpRequest().getParameter(CLONE_FROM_ENV_NAME);
String cloneFromConfigType = getHttpRequest().getParameter(CLONE_FROM_CONFIG_TYPE);
String cloneFromConfigName = getHttpRequest().getParameter(CLONE_FROM_CONFIG_NAME);
boolean configExists = isConfigExists(project, envName, cloneFromConfigType, cloneFromConfigName);
if (!configExists) {
List<SettingsInfo> configurations = administrator.configurations(project, cloneFromEnvName, cloneFromConfigType, cloneFromConfigName);
if (CollectionUtils.isNotEmpty(configurations)) {
SettingsInfo settingsInfo = configurations.get(0);
settingsInfo.setName(configName);
settingsInfo.setDescription(description);
administrator.createConfiguration(settingsInfo, envName, project);
}
flag = true;
} else {
setEnvError(getText(CONFIG_ALREADY_EXIST));
flag = false;
}
} catch (Exception e) {
flag = false;
setEnvError(getText(CONFIGURATION_CLONNING_FAILED));
}
return SUCCESS;
}
public boolean isConfigExists(Project project, String envName, String configType, String cloneFromConfigName) throws PhrescoException {
try {
if (configType.equals(Constants.SETTINGS_TEMPLATE_SERVER) || configType.equals(Constants.SETTINGS_TEMPLATE_EMAIL)) {
ProjectAdministrator administrator = PhrescoFrameworkFactory.getProjectAdministrator();
List<SettingsInfo> settingsinfos = administrator.configurations(project, envName, configType, cloneFromConfigName);
if(CollectionUtils.isNotEmpty( settingsinfos)) {
// setTypeError(CONFIG_ALREADY_EXIST);
return true;
}
}
return false;
} catch (Exception e) {
throw new PhrescoException(e);
}
}
public String fetchProjectInfoVersions() {
try {
String configType = getHttpRequest().getParameter("configType");
String name = getHttpRequest().getParameter("name");
ProjectAdministrator administrator = PhrescoFrameworkFactory.getProjectAdministrator();
Project project = administrator.getProject(projectCode);
//TODO:Need to handle
/*Technology technology = project.getApplicationInfo().getTechnology();
if ("Server".equals(configType)) {
List<Server> servers = technology.getServers();
if (servers != null && CollectionUtils.isNotEmpty(servers)) {
for (Server server : servers) {
if (server.getName().equals(name)) {
setProjectInfoVersions(server.getVersions());
}
}
}
}
if ("Database".equals(configType)) {
List<Database> databases = technology.getDatabases();
if (databases != null && CollectionUtils.isNotEmpty(databases)) {
for (Database database : databases) {
if (database.getName().equals(name)) {
setProjectInfoVersions(database.getVersions());
}
}
}
}*/
} catch (Exception e) {
}
return SUCCESS;
}
public String getConfigName() {
return configName;
}
public void setConfigName(String configName) {
this.configName = configName;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getOldName() {
return oldName;
}
public void setOldName(String oldName) {
this.oldName = oldName;
}
public String[] getAppliesto() {
return appliesto;
}
public void setAppliesto(String[] appliesto) {
this.appliesto = appliesto;
}
public String getProjectCode() {
return projectCode;
}
public void setProjectCode(String projectCode) {
this.projectCode = projectCode;
}
public String getNameError() {
return nameError;
}
public void setNameError(String nameError) {
this.nameError = nameError;
}
public String getTypeError() {
return typeError;
}
public void setTypeError(String typeError) {
this.typeError = typeError;
}
public String getDynamicError() {
return dynamicError;
}
public void setDynamicError(String dynamicError) {
this.dynamicError = dynamicError;
}
public boolean isValidated() {
return isValidated;
}
public void setValidated(boolean isValidated) {
this.isValidated = isValidated;
}
public String getEnvName() {
return envName;
}
public void setEnvName(String envName) {
this.envName = envName;
}
public String getConfigType() {
return configType;
}
public void setConfigType(String configType) {
this.configType = configType;
}
public String getEnvError() {
return envError;
}
public void setEnvError(String envError) {
this.envError = envError;
}
public boolean isEnvDeleteSuceess() {
return isEnvDeleteSuceess;
}
public void setEnvDeleteSuceess(boolean isEnvDeleteSuceess) {
this.isEnvDeleteSuceess = isEnvDeleteSuceess;
}
public String getEnvDeleteMsg() {
return envDeleteMsg;
}
public void setEnvDeleteMsg(String envDeleteMsg) {
this.envDeleteMsg = envDeleteMsg;
}
public List<String> getProjectInfoVersions() {
return projectInfoVersions;
}
public void setProjectInfoVersions(List<String> projectInfoVersions) {
this.projectInfoVersions = projectInfoVersions;
}
public String getOldConfigType() {
return oldConfigType;
}
public void setOldConfigType(String oldConfigType) {
this.oldConfigType = oldConfigType;
}
public String getPortError() {
return portError;
}
public void setPortError(String portError) {
this.portError = portError;
}
public String getEmailError() {
return emailError;
}
public void setEmailError(String emailError) {
this.emailError = emailError;
}
public String getRemoteDeploymentChk() {
return remoteDeploymentChk;
}
public void setRemoteDeploymentChk(String remoteDeploymentChk) {
this.remoteDeploymentChk = remoteDeploymentChk;
}
public String getAppName() {
return appName;
}
public void setAppName(String appName) {
this.appName = appName;
}
public String getAppNameError() {
return appNameError;
}
public void setAppNameError(String appNameError) {
this.appNameError = appNameError;
}
public String getSiteNameError() {
return siteNameError;
}
public void setSiteNameError(String siteNameError) {
this.siteNameError = siteNameError;
}
public String getNameOfSite() {
return nameOfSite;
}
public void setNameOfSite(String nameOfSite) {
this.nameOfSite = nameOfSite;
}
public String getSiteCoreInstPath() {
return siteCoreInstPath;
}
public void setSiteCoreInstPath(String siteCoreInstPath) {
this.siteCoreInstPath = siteCoreInstPath;
}
public String getSiteCoreInstPathError() {
return siteCoreInstPathError;
}
public void setSiteCoreInstPathError(String siteCoreInstPathError) {
this.siteCoreInstPathError = siteCoreInstPathError;
}
public String getSetAsDefaultEnv() {
return setAsDefaultEnv;
}
public void setSetAsDefaultEnv(String setAsDefaultEnv) {
this.setAsDefaultEnv = setAsDefaultEnv;
}
public boolean isFlag() {
return flag;
}
public void setFlag(boolean flag) {
this.flag = flag;
}
}
| 48,158 | 0.630799 | 0.62947 | 1,180 | 39.811016 | 31.630478 | 158 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.972881 | false | false | 7 |
66642ab00fc70954ee5a523cc2ad07c9111ea2f9 | 19,404,662,250,817 | 439e09fb46e3bf5267e0ec426ce8146e65c635ff | /src/ejemploconsola/EjemploConsola.java | 98ffe8d4bb27551a1f1c5896a426fded861a6aad | [] | no_license | DaniBardera/EjercicioMaximos | https://github.com/DaniBardera/EjercicioMaximos | 3d9c5f988bcfb3d9635f7f71de758fab26bfd15f | 87ec1b08f2bdfdbef042a48ecbac95033e7cfd76 | refs/heads/master | 2020-04-16T18:59:51.483000 | 2019-02-06T12:29:15 | 2019-02-06T12:29:15 | 165,843,019 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ejemploconsola;
import java.util.Arrays;
/*
* @author Daniel Bardera
*/
public class EjemploConsola {
//declaro un array de ints de instancia
int[] listaNumeros = {200, 31, 27, 2, 5, 99};
int[] listaNumeros2 = {-11, 5, -34, 7, 209, 33, 77, 7};
int[] listaNumeros3 = {0, 2000, -4, 1581, 5, 999, 777, 9};
int[] listaNumeros4 = {-5, -5, -6, -60, -400};
/*
el mรฉtodo mรกximos va a calcular el mรกximo y el segundo mรกximo
de una lista de numeros
*/
private int[] maximos(int[] lista) {
// declaramos un array de 2 elementos para guardar el 2ยบ mรกximo
int[] listaMaximos = {lista[0], lista[1]};
//vamos a probar a cambiar con lista1
//Empiezo a comparar desde la posiciรณn 1, no desde la 0
for (int i = 1; i < lista.length; i++) {
// length devuelve el numero de elementos del array
if (lista[i] >= listaMaximos[0]) {
/*si llega aquรญ, es que el nรบmero que estoy comparando es
mayor o igual que el que tengo primero en la lista de mรกximos*/
/* VERSIรN INICIAL:
if(i!=0) {
//desplazo sรณlo a la derecha si no estoy justo en la primera posiciรณn
listaMaximos [1] = listaMaximos[0];
} */
listaMaximos[1] = listaMaximos[0];
//desplazo a la derecha el que habรญa como maximo
listaMaximos[0] = lista[i];
//pongo en la primera posiciรณn el nuevo mรกximo
}
else if (lista[i] >= listaMaximos[1]) {
/*compruebo si el nรบmero que estoy leyendo es mayor que el
SEGUNDO de la lista de mรกximos*/
listaMaximos[1] = lista[i];
// pongo en la SEGUNDA posiciรณn al nuevo SEGUNDO mรกximo
}
}
return listaMaximos;
}
private boolean palindromo (String cadena) {
//Primera fase: creo un nuevo String que sea una copia del
//del anterior sin espacios en blanco
String auxiliar = "";
// las comillas dobles indican que es un string
for (int i=0; i<cadena.length(); i++){
if (cadena.charAt(i) != ' ' ){
// las comillas simples indican que es un char
// con este mรฉtodo hacemos que entre solo para quitar los espacios
auxiliar = auxiliar + cadena.charAt(i);
// el + sirve para concatenar strings
}
}
//ahora en auxiliar tengo el string pero sin espacios en blanco
//declaro dos indices para que digan que posiciones estoy comparando
int indiceIzq = 0;
int indiceDer = auxiliar.length()-1;
//mientras sean iguales los caracteres en esas posiciones la palabra
//serรก un palรญndromo, en el momento que una de esas comparaciones
//falle es que no es un palรญndromo
//ademรกs, si el รญndice izquierdo es mayor que el derecho, ya he
//chequeado toda la frase
while (auxiliar.charAt(indiceIzq)== auxiliar.charAt(indiceDer)&& indiceIzq <= indiceDer){
indiceIzq++;
indiceDer--;
}
boolean resultado = true;
if (indiceIzq < indiceDer){
// si esto se cumple es que la palabra no es un palรญndromo
resultado = false;
System.out.print("NO ES UN PALรNDROMO");
}
return resultado;
}
private void palindromoV2 (String cadena){
String auxiliar = "";
for (int i=0; i<cadena.length(); i++){
if (cadena.charAt(i) != ' '){
auxiliar = auxiliar + cadena.charAt(i);
}
}
/* aquรญ ya tengo en el string auxiliar todas las letras de la
palabra original, pero sin espacios en blanco*/
int indiceIzq = 0;
int indiceDer = auxiliar.length() -1;
while (auxiliar.charAt(indiceIzq)== auxiliar.charAt(indiceDer)
&& indiceIzq <= indiceDer){
indiceIzq++;
indiceDer--;
}
if (indiceIzq < indiceDer) {
System.out.println("La cadena " + cadena + " NO es un palรญndromo");
}
else {
System.out.println("La cadena " + cadena + " SI es un palรญndromo");
}
}
private boolean isograma (String cadena) {
for (int i=0; i< cadena.length()-1; i++){
//colocando el -1 hacemos que no mire la รบltima con las demรกs
//ya que no nos interesa
for (int j=i+1; j< cadena.length(); j++){
// colocamos el +1 para que no lo mire con la primera letra sino
//con la segunda
if (cadena.charAt(j) == cadena.charAt(i)){
//comparamos la cadena i con la j
return false;
}
}
}
return true;
}
private void imprimeMes(int numx){
if (numx >7){
numx = 7;
}
//filtra el nรบmero para que siempre valga entre 0 y 7
int contador = 0;
//pintara tantas xx como numX sea
for (int j=1; j<numx; j++){
System.out.print("XX ");
contador = contador + 1;
}
for (int i=1; i<=31; i++){
if (contador <=7){
if (i<=9){
System.out.print("0" + i);
System.out.print(" ");
}}
if (i>9){
System.out.print(i);
System.out.print(" ");
}
contador = contador + 1;
if(contador==7){
System.out.println("");
contador = 0;
}
}
for(int x=contador; x<7; x++){
System.out.print("XX ");
}
}
private boolean esAnagrama (String palabraA, String palabraB){
palabraA = palabraA.toUpperCase();
palabraB = palabraB.toUpperCase();
// de esta forma pasa todas las letras a mayรบsculas
boolean anagrama = false; //indica si las palabras son anagramas o no
if(palabraA.length() == palabraB.length()){
// solo entra a chequear si las dos palabras tienen el mismo nรบmero de letras
for (int i=0; i<palabraA.length(); i++){
int posicion = 0;
while (posicion < palabraB.length() && palabraA.charAt(i)!= palabraB.charAt(posicion)){
//con esto comparamos la primera palabra con el otro string y no compara infinitas veces
posicion++;
//esto hace que busque si es o no igual cada letra
//en el caso de ser igual sale del bucle
}
if (posicion == palabraB.length()){
//la letra no estaba por lo que retorna falso
return false;
}
else {
palabraB = palabraB.substring(0, posicion) + palabraB.substring(posicion+1);
//para eliminar el caracter que hayamos encontrado igual
}
}
if (palabraB.length()== 0){
return true;
}
}
return anagrama;
}
private void hazAcronimo (String frase){
String acronimo= "";
acronimo = frase.substring(0,1);
for (int i=0; i< frase.length()-1; i++){
if (frase.charAt(i) == ' '){
acronimo = acronimo + frase.charAt(i+1);
}
System.out.println("El acronimo de " + frase +" es" + acronimo);
}
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
EjemploConsola ejercicios = new EjemploConsola();
/*
cuando creamos un objeto como ejercicios para poder llamar a las
propiedades del mรฉtodo
*/
/*
System.out.println(Arrays.toString(ejercicios.maximos(ejercicios.listaNumeros)));
System.out.println(Arrays.toString(ejercicios.maximos(ejercicios.listaNumeros2)));
System.out.println(Arrays.toString(ejercicios.maximos(ejercicios.listaNumeros3)));
System.out.println(Arrays.toString(ejercicios.maximos(ejercicios.listaNumeros4)));
System.out.println(ejercicios.palindromo("ACASO HUBO BUHOS ACA"));
ejercicios.palindromoV2("ACASO HUBO BUHOS ACA");
System.out.println(ejercicios.isograma("MURCIELAGO"));
System.out.println(ejercicios.isograma("MURCIELAGOO"));
for (int i=0; i<7; i++){
ejercicios.imprimeMes(i);
System.out.println();
}
*/
/*
System.out.println("roma amor " + ejercicios.esAnagrama("roma", "amor"));
System.out.println("cabron bronca " + ejercicios.esAnagrama("cabron", "bronca"));
System.out.println("jamon pepee " + ejercicios.esAnagrama("jamon", "pepee"));
System.out.println("iamlordvoldemort tommarvoloriddle " + ejercicios.esAnagrama("iamlordvoldemort", "tommarvoloriddle"));
*/
}
}
| UTF-8 | Java | 9,257 | java | EjemploConsola.java | Java | [
{
"context": "ola;\r\n\r\nimport java.util.Arrays;\r\n\r\n/*\r\n * @author Daniel Bardera\r\n */\r\npublic class EjemploConsola {\r\n\r\n //decl",
"end": 84,
"score": 0.9998170137405396,
"start": 70,
"tag": "NAME",
"value": "Daniel Bardera"
},
{
"context": "ronca\")); \r\n \r\n System.out.println(\"jamon pepee \" + ejercicios.esAnagrama(\"jamon\", \"pepee\")",
"end": 9010,
"score": 0.7602543830871582,
"start": 9005,
"tag": "NAME",
"value": "jamon"
},
{
"context": "; \r\n \r\n System.out.println(\"jamon pepee \" + ejercicios.esAnagrama(\"jamon\", \"pepee\"));\r\n ",
"end": 9015,
"score": 0.5380561351776123,
"start": 9013,
"tag": "NAME",
"value": "pe"
},
{
"context": "t.println(\"jamon pepee \" + ejercicios.esAnagrama(\"jamon\", \"pepee\"));\r\n System.out.println(\"iamlor",
"end": 9049,
"score": 0.6442440748214722,
"start": 9044,
"tag": "NAME",
"value": "jamon"
},
{
"context": "(\"jamon pepee \" + ejercicios.esAnagrama(\"jamon\", \"pepee\"));\r\n System.out.println(\"iamlordvoldemor",
"end": 9058,
"score": 0.7563216090202332,
"start": 9053,
"tag": "NAME",
"value": "pepee"
},
{
"context": "le \" + ejercicios.esAnagrama(\"iamlordvoldemort\", \"tommarvoloriddle\"));\r\n */\r\n }\r\n}\r\n",
"end": 9177,
"score": 0.4890018701553345,
"start": 9174,
"tag": "USERNAME",
"value": "tom"
}
] | null | [] | package ejemploconsola;
import java.util.Arrays;
/*
* @author <NAME>
*/
public class EjemploConsola {
//declaro un array de ints de instancia
int[] listaNumeros = {200, 31, 27, 2, 5, 99};
int[] listaNumeros2 = {-11, 5, -34, 7, 209, 33, 77, 7};
int[] listaNumeros3 = {0, 2000, -4, 1581, 5, 999, 777, 9};
int[] listaNumeros4 = {-5, -5, -6, -60, -400};
/*
el mรฉtodo mรกximos va a calcular el mรกximo y el segundo mรกximo
de una lista de numeros
*/
private int[] maximos(int[] lista) {
// declaramos un array de 2 elementos para guardar el 2ยบ mรกximo
int[] listaMaximos = {lista[0], lista[1]};
//vamos a probar a cambiar con lista1
//Empiezo a comparar desde la posiciรณn 1, no desde la 0
for (int i = 1; i < lista.length; i++) {
// length devuelve el numero de elementos del array
if (lista[i] >= listaMaximos[0]) {
/*si llega aquรญ, es que el nรบmero que estoy comparando es
mayor o igual que el que tengo primero en la lista de mรกximos*/
/* VERSIรN INICIAL:
if(i!=0) {
//desplazo sรณlo a la derecha si no estoy justo en la primera posiciรณn
listaMaximos [1] = listaMaximos[0];
} */
listaMaximos[1] = listaMaximos[0];
//desplazo a la derecha el que habรญa como maximo
listaMaximos[0] = lista[i];
//pongo en la primera posiciรณn el nuevo mรกximo
}
else if (lista[i] >= listaMaximos[1]) {
/*compruebo si el nรบmero que estoy leyendo es mayor que el
SEGUNDO de la lista de mรกximos*/
listaMaximos[1] = lista[i];
// pongo en la SEGUNDA posiciรณn al nuevo SEGUNDO mรกximo
}
}
return listaMaximos;
}
private boolean palindromo (String cadena) {
//Primera fase: creo un nuevo String que sea una copia del
//del anterior sin espacios en blanco
String auxiliar = "";
// las comillas dobles indican que es un string
for (int i=0; i<cadena.length(); i++){
if (cadena.charAt(i) != ' ' ){
// las comillas simples indican que es un char
// con este mรฉtodo hacemos que entre solo para quitar los espacios
auxiliar = auxiliar + cadena.charAt(i);
// el + sirve para concatenar strings
}
}
//ahora en auxiliar tengo el string pero sin espacios en blanco
//declaro dos indices para que digan que posiciones estoy comparando
int indiceIzq = 0;
int indiceDer = auxiliar.length()-1;
//mientras sean iguales los caracteres en esas posiciones la palabra
//serรก un palรญndromo, en el momento que una de esas comparaciones
//falle es que no es un palรญndromo
//ademรกs, si el รญndice izquierdo es mayor que el derecho, ya he
//chequeado toda la frase
while (auxiliar.charAt(indiceIzq)== auxiliar.charAt(indiceDer)&& indiceIzq <= indiceDer){
indiceIzq++;
indiceDer--;
}
boolean resultado = true;
if (indiceIzq < indiceDer){
// si esto se cumple es que la palabra no es un palรญndromo
resultado = false;
System.out.print("NO ES UN PALรNDROMO");
}
return resultado;
}
private void palindromoV2 (String cadena){
String auxiliar = "";
for (int i=0; i<cadena.length(); i++){
if (cadena.charAt(i) != ' '){
auxiliar = auxiliar + cadena.charAt(i);
}
}
/* aquรญ ya tengo en el string auxiliar todas las letras de la
palabra original, pero sin espacios en blanco*/
int indiceIzq = 0;
int indiceDer = auxiliar.length() -1;
while (auxiliar.charAt(indiceIzq)== auxiliar.charAt(indiceDer)
&& indiceIzq <= indiceDer){
indiceIzq++;
indiceDer--;
}
if (indiceIzq < indiceDer) {
System.out.println("La cadena " + cadena + " NO es un palรญndromo");
}
else {
System.out.println("La cadena " + cadena + " SI es un palรญndromo");
}
}
private boolean isograma (String cadena) {
for (int i=0; i< cadena.length()-1; i++){
//colocando el -1 hacemos que no mire la รบltima con las demรกs
//ya que no nos interesa
for (int j=i+1; j< cadena.length(); j++){
// colocamos el +1 para que no lo mire con la primera letra sino
//con la segunda
if (cadena.charAt(j) == cadena.charAt(i)){
//comparamos la cadena i con la j
return false;
}
}
}
return true;
}
private void imprimeMes(int numx){
if (numx >7){
numx = 7;
}
//filtra el nรบmero para que siempre valga entre 0 y 7
int contador = 0;
//pintara tantas xx como numX sea
for (int j=1; j<numx; j++){
System.out.print("XX ");
contador = contador + 1;
}
for (int i=1; i<=31; i++){
if (contador <=7){
if (i<=9){
System.out.print("0" + i);
System.out.print(" ");
}}
if (i>9){
System.out.print(i);
System.out.print(" ");
}
contador = contador + 1;
if(contador==7){
System.out.println("");
contador = 0;
}
}
for(int x=contador; x<7; x++){
System.out.print("XX ");
}
}
private boolean esAnagrama (String palabraA, String palabraB){
palabraA = palabraA.toUpperCase();
palabraB = palabraB.toUpperCase();
// de esta forma pasa todas las letras a mayรบsculas
boolean anagrama = false; //indica si las palabras son anagramas o no
if(palabraA.length() == palabraB.length()){
// solo entra a chequear si las dos palabras tienen el mismo nรบmero de letras
for (int i=0; i<palabraA.length(); i++){
int posicion = 0;
while (posicion < palabraB.length() && palabraA.charAt(i)!= palabraB.charAt(posicion)){
//con esto comparamos la primera palabra con el otro string y no compara infinitas veces
posicion++;
//esto hace que busque si es o no igual cada letra
//en el caso de ser igual sale del bucle
}
if (posicion == palabraB.length()){
//la letra no estaba por lo que retorna falso
return false;
}
else {
palabraB = palabraB.substring(0, posicion) + palabraB.substring(posicion+1);
//para eliminar el caracter que hayamos encontrado igual
}
}
if (palabraB.length()== 0){
return true;
}
}
return anagrama;
}
private void hazAcronimo (String frase){
String acronimo= "";
acronimo = frase.substring(0,1);
for (int i=0; i< frase.length()-1; i++){
if (frase.charAt(i) == ' '){
acronimo = acronimo + frase.charAt(i+1);
}
System.out.println("El acronimo de " + frase +" es" + acronimo);
}
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
EjemploConsola ejercicios = new EjemploConsola();
/*
cuando creamos un objeto como ejercicios para poder llamar a las
propiedades del mรฉtodo
*/
/*
System.out.println(Arrays.toString(ejercicios.maximos(ejercicios.listaNumeros)));
System.out.println(Arrays.toString(ejercicios.maximos(ejercicios.listaNumeros2)));
System.out.println(Arrays.toString(ejercicios.maximos(ejercicios.listaNumeros3)));
System.out.println(Arrays.toString(ejercicios.maximos(ejercicios.listaNumeros4)));
System.out.println(ejercicios.palindromo("ACASO HUBO BUHOS ACA"));
ejercicios.palindromoV2("ACASO HUBO BUHOS ACA");
System.out.println(ejercicios.isograma("MURCIELAGO"));
System.out.println(ejercicios.isograma("MURCIELAGOO"));
for (int i=0; i<7; i++){
ejercicios.imprimeMes(i);
System.out.println();
}
*/
/*
System.out.println("roma amor " + ejercicios.esAnagrama("roma", "amor"));
System.out.println("cabron bronca " + ejercicios.esAnagrama("cabron", "bronca"));
System.out.println("jamon pepee " + ejercicios.esAnagrama("jamon", "pepee"));
System.out.println("iamlordvoldemort tommarvoloriddle " + ejercicios.esAnagrama("iamlordvoldemort", "tommarvoloriddle"));
*/
}
}
| 9,249 | 0.53449 | 0.5218 | 262 | 33.190838 | 26.317387 | 130 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false | 7 |
32dafe83f9eab80f9f181139d7fa68f3aec19dad | 23,184,233,507,697 | d645a167e4bbcb401a0e7566844fb92f5b1b712e | /app/src/main/java/org/olu/cleancode/real/LocationProvider.java | 10023d5c8aff0e0866d71d1d7f79a4f88ea7806e | [] | no_license | ovy9086/clean-code | https://github.com/ovy9086/clean-code | 05b832aa4d5461bf6d12248615916e4c37213f40 | 955e684df95a1af2fc5dc97bc140f55bdb77d51a | refs/heads/master | 2016-09-13T03:39:39.504000 | 2016-04-28T15:28:15 | 2016-04-28T15:28:15 | 57,312,083 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.olu.cleancode.real;
import android.location.Location;
public interface LocationProvider {
Location getMostRecentLocation();
}
| UTF-8 | Java | 145 | java | LocationProvider.java | Java | [] | null | [] | package org.olu.cleancode.real;
import android.location.Location;
public interface LocationProvider {
Location getMostRecentLocation();
}
| 145 | 0.793103 | 0.793103 | 8 | 17.125 | 16.951677 | 37 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.375 | false | false | 7 |
8c01ad016a4e39d9aa53e64415f87d9655156d28 | 5,849,745,470,842 | b92457e8048829ad0b9e69bc9383f2f46eb13478 | /src/backend/Tagger.java | 08542c2e769f8c87fe3f2be33ea008f71cdea680 | [] | no_license | JZ6/PhotoRenamer | https://github.com/JZ6/PhotoRenamer | 306568a3ec487dce615b89e188cdc4a31fc5bc10 | a6031bb9916565fc5f74223082786b68e052294d | refs/heads/master | 2021-04-29T11:59:09.591000 | 2018-02-16T06:06:23 | 2018-02-16T06:06:23 | 121,719,868 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package backend;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
/**
* A class for operations regarding adding and removing tags to a picture FileNode.
*/
public class Tagger {
/** The file where all tag information are stored. */
static private final File tagFile = new File("tags.txt");
/** A list of all String tags */
private List<String> tags;
/**
* A Tagger class with all past tag information retrieved from tagFile.
* If tagFile does not exist, create it.
*/
public Tagger () {
Scanner in = null;
if(tagFile.exists()){
in = Logger.read(tagFile).useDelimiter(",");
}else{
try {
tagFile.createNewFile();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
List<String> t = new ArrayList<String>(); ;
if (in != null){
while (in.hasNext()){
t.add(in.next().trim());
}
}
this.tags = t;
}
/**
* Return a string list of all available tags.
*
* @return string list all available tags
*/
public List<String> getAvailableTags() {
return this.tags;
}
/**
* Add a new tag to string list of all available tags.
*/
public void addtag(String t){
if (!this.tags.contains(t)){
this.tags.add(t);
String tagstring = String.join(",",this.tags);
Logger.write(tagFile, tagstring , false);
}
}
/**
* Remove a tag from string list of all available tags.
*/
public void removetag(String t){
if (this.tags.contains(t)){
this.tags.remove(t);
String tagstring = String.join(",",this.tags);
Logger.write(tagFile, tagstring , false);
}
}
/*public static void main(String[] args) {
Tagger t = new Tagger();
System.out.println(t.getTags());
t.addtag("6");
System.out.println(t.getTags());
t.removetag("6");
System.out.println(t.getTags());
}*/ // For testing
}
| UTF-8 | Java | 1,906 | java | Tagger.java | Java | [] | null | [] | package backend;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
/**
* A class for operations regarding adding and removing tags to a picture FileNode.
*/
public class Tagger {
/** The file where all tag information are stored. */
static private final File tagFile = new File("tags.txt");
/** A list of all String tags */
private List<String> tags;
/**
* A Tagger class with all past tag information retrieved from tagFile.
* If tagFile does not exist, create it.
*/
public Tagger () {
Scanner in = null;
if(tagFile.exists()){
in = Logger.read(tagFile).useDelimiter(",");
}else{
try {
tagFile.createNewFile();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
List<String> t = new ArrayList<String>(); ;
if (in != null){
while (in.hasNext()){
t.add(in.next().trim());
}
}
this.tags = t;
}
/**
* Return a string list of all available tags.
*
* @return string list all available tags
*/
public List<String> getAvailableTags() {
return this.tags;
}
/**
* Add a new tag to string list of all available tags.
*/
public void addtag(String t){
if (!this.tags.contains(t)){
this.tags.add(t);
String tagstring = String.join(",",this.tags);
Logger.write(tagFile, tagstring , false);
}
}
/**
* Remove a tag from string list of all available tags.
*/
public void removetag(String t){
if (this.tags.contains(t)){
this.tags.remove(t);
String tagstring = String.join(",",this.tags);
Logger.write(tagFile, tagstring , false);
}
}
/*public static void main(String[] args) {
Tagger t = new Tagger();
System.out.println(t.getTags());
t.addtag("6");
System.out.println(t.getTags());
t.removetag("6");
System.out.println(t.getTags());
}*/ // For testing
}
| 1,906 | 0.642707 | 0.641658 | 87 | 20.908047 | 19.052639 | 83 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.942529 | false | false | 7 |
27775d6e23ac3bfad4ec72aac059fb7ae033aaae | 13,400,298,025,776 | 1e161d293388ffea61a5e2020e12c21b39446956 | /src/main/java/com/library/validator/GenreValidator.java | 4878066811fc56b0752e17ba5fd658fe3b107ed7 | [] | no_license | KirillRomanchuk/library | https://github.com/KirillRomanchuk/library | b2b02471a0d9db048f4b059431ea776f217cbc87 | 166a95f1ca2a09aa201bcd51ba56c96b1a399221 | refs/heads/master | 2022-06-28T01:42:54.160000 | 2019-07-10T15:35:47 | 2019-07-10T15:35:47 | 191,980,988 | 0 | 0 | null | false | 2022-06-21T01:17:07 | 2019-06-14T17:18:52 | 2019-07-10T15:35:56 | 2022-06-21T01:17:04 | 111 | 0 | 0 | 2 | Java | false | false | package com.library.validator;
import com.library.data.model.Genre;
public class GenreValidator implements Validator<Genre> {
@Override
public ValidationResult validate(Genre genre) {
ValidationResult validationResult = new ValidationResult();
if (ValidationUtility.stringIsEmpty(genre.getName())) {
validationResult.add("name", "you must enter the name");
}
return validationResult;
}
}
| UTF-8 | Java | 446 | java | GenreValidator.java | Java | [] | null | [] | package com.library.validator;
import com.library.data.model.Genre;
public class GenreValidator implements Validator<Genre> {
@Override
public ValidationResult validate(Genre genre) {
ValidationResult validationResult = new ValidationResult();
if (ValidationUtility.stringIsEmpty(genre.getName())) {
validationResult.add("name", "you must enter the name");
}
return validationResult;
}
}
| 446 | 0.699552 | 0.699552 | 14 | 30.857143 | 25.491896 | 68 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.428571 | false | false | 8 |
2956cf0f1b54734788ee708f6999e3c848ee2094 | 7,284,264,582,251 | a0d993c0d18804180350f0d7bff9982104676131 | /src/main/java/com/sg/superherosightings/SuperHeroSightingsController.java | 09ae5b5abeb0051863e372dbb417e90a49b45238 | [] | no_license | AlRahman95/Super-Hero-Web-App | https://github.com/AlRahman95/Super-Hero-Web-App | 3c062a1636e199092d329589c45b960db894da5d | d49e606058ebac0643072ad59c173fa8c26eacb6 | refs/heads/master | 2020-03-22T16:44:18.319000 | 2018-07-09T22:25:24 | 2018-07-09T22:25:24 | 140,347,684 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* 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.sg.superherosightings;
import com.sg.superherosightings.dao.SuperHeroInMemoryDao;
import com.sg.superherosightings.dto.Organization;
import com.sg.superherosightings.dto.Sighting;
import com.sg.superherosightings.dto.SuperHuman;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.inject.Inject;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
/**
*
* @author Al Rahman
*/
@Controller
public class SuperHeroSightingsController {
private SuperHeroInMemoryDao dao;
@Inject
public SuperHeroSightingsController(SuperHeroInMemoryDao dao) {
this.dao = dao;
}
/*---------------------------------------Navigation----------------------------------------------*/
@RequestMapping(value = {"/", "home"})
public String initial() {
return "home";
}
@RequestMapping(value = "/navSighting")
public String NavigateNewSighting() {
return "newSighting";
}
@RequestMapping(value = "/navSuper")
public String NavigateNewSuper() {
return "newSuper";
}
@RequestMapping(value = "/navOrg")
public String NavigateNewOrg() {
return "newOrg";
}
@RequestMapping(value = "/searchDirectory", method = RequestMethod.GET)
public String searchDirectory(Model model, HttpServletRequest request) {
String page = request.getParameter("searchParam");
String searchPage = "search" + page;
return searchPage;
}
/*---------------------------Super Hero Sighting Methods----------------------------------------------*/
@RequestMapping(value = "/newSighting", method = RequestMethod.POST)
public String createSighting(Model model, HttpServletRequest request) {
Sighting sighting = new Sighting();
sighting.setCity(request.getParameter("city"));
sighting.setState(request.getParameter("state"));
sighting.setCountry(request.getParameter("country"));
sighting.setLatitudeCoordinates(request.getParameter("latitude"));
sighting.setLatitudeDirection(request.getParameter("latitudeDirection").charAt(0));
sighting.setLongitudeCoordinates(request.getParameter("longitude"));
sighting.setLongitudeDirection(request.getParameter("longitudeDirection").charAt(0));
sighting.setDescription(request.getParameter("description"));
sighting.setDate(java.sql.Date.valueOf(request.getParameter("date")));
List<Sighting> list = new ArrayList<>();
list.add(dao.addSighting(sighting));
model.addAttribute("sightingList", list);
return "newSighting";
}
@RequestMapping(value = "/displaySightingDetails", method = RequestMethod.GET)
public String displaySightingDetails(HttpServletRequest request, Model model) {
int sightingID = Integer.parseInt(request.getParameter("sightingID"));
Sighting sighting = dao.getSightingById(sightingID);
model.addAttribute("sighting", sighting);
return "sightingDetails";
}
@RequestMapping(value = "/deleteSighting", method = RequestMethod.GET)
public String removeSighting(HttpServletRequest request) {
int sightingID = Integer.parseInt(request.getParameter("sightingID"));
dao.removeSighting(sightingID);
return "newSighting";
}
@RequestMapping(value = "/displayEditSightingForm", method = RequestMethod.GET)
public String displayEditSightingForm(HttpServletRequest request, Model model) {
int sightingID = Integer.parseInt(request.getParameter("sightingID"));
Sighting sighting = dao.getSightingById(sightingID);
model.addAttribute("sighting", sighting);
return "editSighting";
}
@RequestMapping(value = "/editSighting", method = RequestMethod.POST)
public String editSighting(@Valid @ModelAttribute("sighting") Sighting sighting, BindingResult result, Model model) {
if (result.hasErrors()) {
return "editSighting";
}
dao.updateSighting(sighting);
List<Sighting> list = new ArrayList<>();
list.add(sighting);
model.addAttribute("sightingList", list);
return "editSighting";
}
// @RequestMapping(value = "/searchSightings", method = RequestMethod.GET)
// public String searchSightings(HttpServletRequest request, Model model) {
// Map<String, String> searchSightingsMap = new HashMap<>();
//
// final String CITY = "0";
// final String STATE = "0";
// final String COUNTRY = "0";
// final String LATITUDE_COORDINATES = "0";
// final String LATITUDE_DIRECTION = "0";
// final String LONGITUDE_COORDINATES = "0";
// final String LONGITUDE_DIRECTION = "0";
// final String DATE = "0";
//
// String city = request.getParameter("city");
// String state = request.getParameter("state");
// String country = request.getParameter("country");
// String latitudeCoordinates = request.getParameter("latitude");
// char latitudeDirection = request.getParameter("latitudeDirection").charAt(0);
// sighting.setLongitudeCoordinates(request.getParameter("longitude"));
// sighting.setLongitudeDirection(request.getParameter("longitudeDirection").charAt(0));
// sighting.setDescription(request.getParameter("description"));
// sighting.setDate(java.sql.Date.valueOf(request.getParameter("date")));
//
// if (firstName != null && !firstName.isEmpty()) {
// criteria.put(CITY, firstName);
// }
// if (lastName != null && !lastName.isEmpty()) {
// criteria.put(SearchTerm.LAST_NAME, lastName);
// }
// if (company != null && !company.isEmpty()) {
// criteria.put(SearchTerm.COMPANY, company);
// }
// if (phone != null && !phone.isEmpty()) {
// criteria.put(SearchTerm.PHONE, phone);
// }
// if (email != null && !email.isEmpty()) {
// criteria.put(SearchTerm.EMAIL, email);
// }
// List<Contact> contactSearchList = dao.searchContacts(criteria);
//
// model.addAttribute("contactSearchList", contactSearchList);
// return "searchSightings";
// }
/*---------------------------Super Hero/Villain Methods----------------------------------------------*/
@RequestMapping(value = "/newSuper", method = RequestMethod.POST)
public String createSuper(Model model, HttpServletRequest request) {
SuperHuman superHuman = new SuperHuman();
if (request.getParameter("heroVillain").equalsIgnoreCase("hero")) {
superHuman.setIsHero(true);
} else {
superHuman.setIsHero(false);
}
superHuman.setName(request.getParameter("name"));
superHuman.setHeightInFeet(Integer.parseInt(request.getParameter("heightInFeet")));
superHuman.setHeightInInches(Integer.parseInt(request.getParameter("heightInInches")));
superHuman.setWeight(Integer.parseInt(request.getParameter("weight")));
superHuman.setPower(request.getParameter("power"));
superHuman.setPowerLevel(Integer.parseInt(request.getParameter("powerLevel")));
superHuman.setDescription(request.getParameter("description"));
List<SuperHuman> list = new ArrayList<>();
list.add(dao.addSuper(superHuman));
model.addAttribute("superHumanList", list);
return "newSuper";
}
@RequestMapping(value = "/displaySuperDetails", method = RequestMethod.GET)
public String displaySuperDetails(HttpServletRequest request, Model model) {
int superID = Integer.parseInt(request.getParameter("superID"));
SuperHuman superHuman = dao.getSuperById(superID);
String heroVillain;
if (superHuman.getIsHero() == true) {
heroVillain = "Hero";
} else {
heroVillain = "Villain";
}
model.addAttribute("superHuman", superHuman);
model.addAttribute("heroVillain", heroVillain);
return "superDetails";
}
@RequestMapping(value = "/deleteSuper", method = RequestMethod.GET)
public String removeSuper(HttpServletRequest request) {
int superID = Integer.parseInt(request.getParameter("superID"));
dao.removeSighting(superID);
return "newSuper";
}
@RequestMapping(value = "/displayEditSuperForm", method = RequestMethod.GET)
public String displayEditSuperForm(HttpServletRequest request, Model model) {
int superID = Integer.parseInt(request.getParameter("superID"));
SuperHuman superHuman = dao.getSuperById(superID);
model.addAttribute("superHuman", superHuman);
return "editSuper";
}
@RequestMapping(value = "/editSuper", method = RequestMethod.POST)
public String editSuper(@Valid @ModelAttribute("superHuman") SuperHuman superHuman, BindingResult result, Model model) {
if (result.hasErrors()) {
return "editSuper";
}
dao.updateSuper(superHuman);
List<SuperHuman> list = new ArrayList<>();
list.add(superHuman);
model.addAttribute("superHumanList", list);
return "editSuper";
}
/*---------------------------Organization Methods----------------------------------------------*/
@RequestMapping(value = "/newOrg", method = RequestMethod.POST)
public String createOrg(Model model, HttpServletRequest request) {
Organization org = new Organization();
org.setName(request.getParameter("name"));
org.setRole(request.getParameter("role"));
org.setCity(request.getParameter("city"));
org.setState(request.getParameter("state"));
org.setCountry(request.getParameter("country"));
org.setPhone(request.getParameter("phone"));
org.setEmail(request.getParameter("email"));
org.setDescription(request.getParameter("description"));
List<Organization> list = new ArrayList<>();
list.add(dao.addOrg(org));
model.addAttribute("orgList", list);
return "newOrg";
}
@RequestMapping(value = "/displayOrgDetails", method = RequestMethod.GET)
public String displayOrgDetails(HttpServletRequest request, Model model) {
int organizationID = Integer.parseInt(request.getParameter("organizationID"));
Organization org = dao.getOrgById(organizationID);
model.addAttribute("org", org);
return "orgDetails";
}
@RequestMapping(value = "/deleteOrg", method = RequestMethod.GET)
public String removeOrg(HttpServletRequest request) {
int organizationID = Integer.parseInt(request.getParameter("organizationID"));
dao.removeOrg(organizationID);
return "newOrg";
}
@RequestMapping(value = "/displayEditOrgForm", method = RequestMethod.GET)
public String displayEditOrgForm(HttpServletRequest request, Model model) {
int organizationID = Integer.parseInt(request.getParameter("organizationID"));
Organization org = dao.getOrgById(organizationID);
model.addAttribute("org", org);
return "editOrg";
}
@RequestMapping(value = "/editOrg", method = RequestMethod.POST)
public String editOrg(@Valid @ModelAttribute("org") Organization org, BindingResult result, Model model) {
if (result.hasErrors()) {
return "editOrg";
}
dao.updateOrg(org);
List<Organization> list = new ArrayList<>();
list.add(org);
model.addAttribute("orgList", list);
return "editOrg";
}
}
| UTF-8 | Java | 12,262 | java | SuperHeroSightingsController.java | Java | [
{
"context": ".bind.annotation.RequestMethod;\n\n/**\n *\n * @author Al Rahman\n */\n@Controller\npublic class SuperHeroSightingsCo",
"end": 987,
"score": 0.9998258352279663,
"start": 978,
"tag": "NAME",
"value": "Al Rahman"
}
] | null | [] | /*
* 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.sg.superherosightings;
import com.sg.superherosightings.dao.SuperHeroInMemoryDao;
import com.sg.superherosightings.dto.Organization;
import com.sg.superherosightings.dto.Sighting;
import com.sg.superherosightings.dto.SuperHuman;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.inject.Inject;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
/**
*
* @author <NAME>
*/
@Controller
public class SuperHeroSightingsController {
private SuperHeroInMemoryDao dao;
@Inject
public SuperHeroSightingsController(SuperHeroInMemoryDao dao) {
this.dao = dao;
}
/*---------------------------------------Navigation----------------------------------------------*/
@RequestMapping(value = {"/", "home"})
public String initial() {
return "home";
}
@RequestMapping(value = "/navSighting")
public String NavigateNewSighting() {
return "newSighting";
}
@RequestMapping(value = "/navSuper")
public String NavigateNewSuper() {
return "newSuper";
}
@RequestMapping(value = "/navOrg")
public String NavigateNewOrg() {
return "newOrg";
}
@RequestMapping(value = "/searchDirectory", method = RequestMethod.GET)
public String searchDirectory(Model model, HttpServletRequest request) {
String page = request.getParameter("searchParam");
String searchPage = "search" + page;
return searchPage;
}
/*---------------------------Super Hero Sighting Methods----------------------------------------------*/
@RequestMapping(value = "/newSighting", method = RequestMethod.POST)
public String createSighting(Model model, HttpServletRequest request) {
Sighting sighting = new Sighting();
sighting.setCity(request.getParameter("city"));
sighting.setState(request.getParameter("state"));
sighting.setCountry(request.getParameter("country"));
sighting.setLatitudeCoordinates(request.getParameter("latitude"));
sighting.setLatitudeDirection(request.getParameter("latitudeDirection").charAt(0));
sighting.setLongitudeCoordinates(request.getParameter("longitude"));
sighting.setLongitudeDirection(request.getParameter("longitudeDirection").charAt(0));
sighting.setDescription(request.getParameter("description"));
sighting.setDate(java.sql.Date.valueOf(request.getParameter("date")));
List<Sighting> list = new ArrayList<>();
list.add(dao.addSighting(sighting));
model.addAttribute("sightingList", list);
return "newSighting";
}
@RequestMapping(value = "/displaySightingDetails", method = RequestMethod.GET)
public String displaySightingDetails(HttpServletRequest request, Model model) {
int sightingID = Integer.parseInt(request.getParameter("sightingID"));
Sighting sighting = dao.getSightingById(sightingID);
model.addAttribute("sighting", sighting);
return "sightingDetails";
}
@RequestMapping(value = "/deleteSighting", method = RequestMethod.GET)
public String removeSighting(HttpServletRequest request) {
int sightingID = Integer.parseInt(request.getParameter("sightingID"));
dao.removeSighting(sightingID);
return "newSighting";
}
@RequestMapping(value = "/displayEditSightingForm", method = RequestMethod.GET)
public String displayEditSightingForm(HttpServletRequest request, Model model) {
int sightingID = Integer.parseInt(request.getParameter("sightingID"));
Sighting sighting = dao.getSightingById(sightingID);
model.addAttribute("sighting", sighting);
return "editSighting";
}
@RequestMapping(value = "/editSighting", method = RequestMethod.POST)
public String editSighting(@Valid @ModelAttribute("sighting") Sighting sighting, BindingResult result, Model model) {
if (result.hasErrors()) {
return "editSighting";
}
dao.updateSighting(sighting);
List<Sighting> list = new ArrayList<>();
list.add(sighting);
model.addAttribute("sightingList", list);
return "editSighting";
}
// @RequestMapping(value = "/searchSightings", method = RequestMethod.GET)
// public String searchSightings(HttpServletRequest request, Model model) {
// Map<String, String> searchSightingsMap = new HashMap<>();
//
// final String CITY = "0";
// final String STATE = "0";
// final String COUNTRY = "0";
// final String LATITUDE_COORDINATES = "0";
// final String LATITUDE_DIRECTION = "0";
// final String LONGITUDE_COORDINATES = "0";
// final String LONGITUDE_DIRECTION = "0";
// final String DATE = "0";
//
// String city = request.getParameter("city");
// String state = request.getParameter("state");
// String country = request.getParameter("country");
// String latitudeCoordinates = request.getParameter("latitude");
// char latitudeDirection = request.getParameter("latitudeDirection").charAt(0);
// sighting.setLongitudeCoordinates(request.getParameter("longitude"));
// sighting.setLongitudeDirection(request.getParameter("longitudeDirection").charAt(0));
// sighting.setDescription(request.getParameter("description"));
// sighting.setDate(java.sql.Date.valueOf(request.getParameter("date")));
//
// if (firstName != null && !firstName.isEmpty()) {
// criteria.put(CITY, firstName);
// }
// if (lastName != null && !lastName.isEmpty()) {
// criteria.put(SearchTerm.LAST_NAME, lastName);
// }
// if (company != null && !company.isEmpty()) {
// criteria.put(SearchTerm.COMPANY, company);
// }
// if (phone != null && !phone.isEmpty()) {
// criteria.put(SearchTerm.PHONE, phone);
// }
// if (email != null && !email.isEmpty()) {
// criteria.put(SearchTerm.EMAIL, email);
// }
// List<Contact> contactSearchList = dao.searchContacts(criteria);
//
// model.addAttribute("contactSearchList", contactSearchList);
// return "searchSightings";
// }
/*---------------------------Super Hero/Villain Methods----------------------------------------------*/
@RequestMapping(value = "/newSuper", method = RequestMethod.POST)
public String createSuper(Model model, HttpServletRequest request) {
SuperHuman superHuman = new SuperHuman();
if (request.getParameter("heroVillain").equalsIgnoreCase("hero")) {
superHuman.setIsHero(true);
} else {
superHuman.setIsHero(false);
}
superHuman.setName(request.getParameter("name"));
superHuman.setHeightInFeet(Integer.parseInt(request.getParameter("heightInFeet")));
superHuman.setHeightInInches(Integer.parseInt(request.getParameter("heightInInches")));
superHuman.setWeight(Integer.parseInt(request.getParameter("weight")));
superHuman.setPower(request.getParameter("power"));
superHuman.setPowerLevel(Integer.parseInt(request.getParameter("powerLevel")));
superHuman.setDescription(request.getParameter("description"));
List<SuperHuman> list = new ArrayList<>();
list.add(dao.addSuper(superHuman));
model.addAttribute("superHumanList", list);
return "newSuper";
}
@RequestMapping(value = "/displaySuperDetails", method = RequestMethod.GET)
public String displaySuperDetails(HttpServletRequest request, Model model) {
int superID = Integer.parseInt(request.getParameter("superID"));
SuperHuman superHuman = dao.getSuperById(superID);
String heroVillain;
if (superHuman.getIsHero() == true) {
heroVillain = "Hero";
} else {
heroVillain = "Villain";
}
model.addAttribute("superHuman", superHuman);
model.addAttribute("heroVillain", heroVillain);
return "superDetails";
}
@RequestMapping(value = "/deleteSuper", method = RequestMethod.GET)
public String removeSuper(HttpServletRequest request) {
int superID = Integer.parseInt(request.getParameter("superID"));
dao.removeSighting(superID);
return "newSuper";
}
@RequestMapping(value = "/displayEditSuperForm", method = RequestMethod.GET)
public String displayEditSuperForm(HttpServletRequest request, Model model) {
int superID = Integer.parseInt(request.getParameter("superID"));
SuperHuman superHuman = dao.getSuperById(superID);
model.addAttribute("superHuman", superHuman);
return "editSuper";
}
@RequestMapping(value = "/editSuper", method = RequestMethod.POST)
public String editSuper(@Valid @ModelAttribute("superHuman") SuperHuman superHuman, BindingResult result, Model model) {
if (result.hasErrors()) {
return "editSuper";
}
dao.updateSuper(superHuman);
List<SuperHuman> list = new ArrayList<>();
list.add(superHuman);
model.addAttribute("superHumanList", list);
return "editSuper";
}
/*---------------------------Organization Methods----------------------------------------------*/
@RequestMapping(value = "/newOrg", method = RequestMethod.POST)
public String createOrg(Model model, HttpServletRequest request) {
Organization org = new Organization();
org.setName(request.getParameter("name"));
org.setRole(request.getParameter("role"));
org.setCity(request.getParameter("city"));
org.setState(request.getParameter("state"));
org.setCountry(request.getParameter("country"));
org.setPhone(request.getParameter("phone"));
org.setEmail(request.getParameter("email"));
org.setDescription(request.getParameter("description"));
List<Organization> list = new ArrayList<>();
list.add(dao.addOrg(org));
model.addAttribute("orgList", list);
return "newOrg";
}
@RequestMapping(value = "/displayOrgDetails", method = RequestMethod.GET)
public String displayOrgDetails(HttpServletRequest request, Model model) {
int organizationID = Integer.parseInt(request.getParameter("organizationID"));
Organization org = dao.getOrgById(organizationID);
model.addAttribute("org", org);
return "orgDetails";
}
@RequestMapping(value = "/deleteOrg", method = RequestMethod.GET)
public String removeOrg(HttpServletRequest request) {
int organizationID = Integer.parseInt(request.getParameter("organizationID"));
dao.removeOrg(organizationID);
return "newOrg";
}
@RequestMapping(value = "/displayEditOrgForm", method = RequestMethod.GET)
public String displayEditOrgForm(HttpServletRequest request, Model model) {
int organizationID = Integer.parseInt(request.getParameter("organizationID"));
Organization org = dao.getOrgById(organizationID);
model.addAttribute("org", org);
return "editOrg";
}
@RequestMapping(value = "/editOrg", method = RequestMethod.POST)
public String editOrg(@Valid @ModelAttribute("org") Organization org, BindingResult result, Model model) {
if (result.hasErrors()) {
return "editOrg";
}
dao.updateOrg(org);
List<Organization> list = new ArrayList<>();
list.add(org);
model.addAttribute("orgList", list);
return "editOrg";
}
}
| 12,259 | 0.650954 | 0.649976 | 292 | 40.993149 | 28.828733 | 124 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.708904 | false | false | 8 |
cff10f31774ace973b8a1010b2aea69df32dda0d | 4,020,089,446,827 | 818db487686d92c26413ea0b20e2aa156d30508b | /examsys/src/cn/examsys/xy/service/RoleService.java | 535c9c17033ad886d2d1fd49f870207c7a5c57a5 | [] | no_license | huajianyi/DXKS | https://github.com/huajianyi/DXKS | 03f97c8ddc9c3853533ad0bb1022b410b8c89ac9 | 3a7dd7c16fbd336dc1b11e30ab2f55754cfd443c | refs/heads/master | 2020-07-10T22:10:32.379000 | 2018-06-23T02:55:35 | 2018-06-23T02:55:35 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package cn.examsys.xy.service;
import java.util.List;
import cn.examsys.bean.Role;
import cn.examsys.bean.User;
public interface RoleService {
/*ๅๅปบ่ง่ฒ*/
boolean createRole(String type);
/*ๅ ้ค่ง่ฒ*/
boolean deleteRole(int sid);
/*่ง่ฒๅ่กจ*/
List<Role> selectRoleList(int page);
/*่ง่ฒๆปๆฐ*/
int selectRoleCount();
/*็ผ่พ่ง่ฒไฟกๆฏ*/
boolean editRole(Role role);
/*ๆพ็คบไธไธช่ง่ฒไฟกๆฏ*/
Role SelectOneRole(int sid);
}
| UTF-8 | Java | 460 | java | RoleService.java | Java | [] | null | [] | package cn.examsys.xy.service;
import java.util.List;
import cn.examsys.bean.Role;
import cn.examsys.bean.User;
public interface RoleService {
/*ๅๅปบ่ง่ฒ*/
boolean createRole(String type);
/*ๅ ้ค่ง่ฒ*/
boolean deleteRole(int sid);
/*่ง่ฒๅ่กจ*/
List<Role> selectRoleList(int page);
/*่ง่ฒๆปๆฐ*/
int selectRoleCount();
/*็ผ่พ่ง่ฒไฟกๆฏ*/
boolean editRole(Role role);
/*ๆพ็คบไธไธช่ง่ฒไฟกๆฏ*/
Role SelectOneRole(int sid);
}
| 460 | 0.72 | 0.72 | 21 | 18.047619 | 12.222057 | 37 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.047619 | false | false | 8 |
8eb33af28cf6d2ae5b87120764e7c96d8a3537b4 | 7,541,962,628,842 | e30bd2ee0e59ef56ba9fd4362346b81dcc533447 | /MyFirstJavaProject/src/algoritm/Stock.java | ecfa20a1783308e0c3211089250a55e9991fc591 | [] | no_license | IonutPorumb/MotorParameterCalculator | https://github.com/IonutPorumb/MotorParameterCalculator | 0e942f0060ae16c595e7daf43a55e8107f97c28c | df3915482834cd7a83e75964f2aa59e879c40ebd | refs/heads/master | 2023-08-23T21:16:50.043000 | 2021-11-01T18:43:01 | 2021-11-01T18:43:01 | 387,862,422 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package algoritm;
//Ex15/pg 7
public class Stock {
private String symbol;//stock symbol, e.g. "YHOO"
private int totalShares;//total shares purchased
private double totalCost;
//Creare constructor cu parametri:
public Stock (String theSymbol){
if(theSymbol==null){
throw new NullPointerException();
}
symbol=theSymbol;
totalShares=0;
totalCost=0.0;
}
public String getSymbol(){
return symbol;
}
public int getTotalShares(){
return totalShares;
}
public double getTotalCost(){
return totalCost;
}
public double getProfit(double currentPrice){
if(currentPrice<0.0){
throw new IllegalArgumentException();
}
double marketValue=totalShares*currentPrice;
return marketValue-totalCost;
}
public void purchase(int shares, double pricePerShare){
if (shares<0||pricePerShare<0.0){
throw new IllegalArgumentException();
}
totalShares+=shares;
totalCost+=shares*pricePerShare;
}
}
| UTF-8 | Java | 1,094 | java | Stock.java | Java | [] | null | [] | package algoritm;
//Ex15/pg 7
public class Stock {
private String symbol;//stock symbol, e.g. "YHOO"
private int totalShares;//total shares purchased
private double totalCost;
//Creare constructor cu parametri:
public Stock (String theSymbol){
if(theSymbol==null){
throw new NullPointerException();
}
symbol=theSymbol;
totalShares=0;
totalCost=0.0;
}
public String getSymbol(){
return symbol;
}
public int getTotalShares(){
return totalShares;
}
public double getTotalCost(){
return totalCost;
}
public double getProfit(double currentPrice){
if(currentPrice<0.0){
throw new IllegalArgumentException();
}
double marketValue=totalShares*currentPrice;
return marketValue-totalCost;
}
public void purchase(int shares, double pricePerShare){
if (shares<0||pricePerShare<0.0){
throw new IllegalArgumentException();
}
totalShares+=shares;
totalCost+=shares*pricePerShare;
}
}
| 1,094 | 0.625229 | 0.615174 | 40 | 26.35 | 16.698128 | 59 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.525 | false | false | 8 |
37421ebd697e3b504c2628d2402b96225bc07deb | 18,769,007,089,005 | fb69826dcf8c1b16416f619fde5b930532816b06 | /Pokeranch2/src/com/pokeranch/BattleActivity.java | 7f9a9b0e27800e60e978a0346383692948e9bd5a | [] | no_license | msmaromi/pokeproject | https://github.com/msmaromi/pokeproject | 29d41173f2fea64842dca05f241ab80f9d856e80 | 1f49fa5aa6b698f630809088d728a96f5484780f | refs/heads/master | 2016-09-10T12:39:09.657000 | 2013-05-17T06:20:42 | 2013-05-17T06:20:42 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.pokeranch;
//package com.hottest.pokeranch;
//
//import java.util.ArrayList;
//
//import android.app.Activity;
//import android.os.Bundle;
//import android.view.Gravity;
//import android.view.LayoutInflater;
//import android.view.Menu;
//import android.view.View;
//import android.view.ViewGroup.LayoutParams;
//import android.widget.ArrayAdapter;
//import android.widget.Button;
//import android.widget.LinearLayout;
//import android.widget.ListView;
//import android.widget.RelativeLayout;
//import android.widget.ScrollView;
//import android.widget.TextView;
//
//public class BattleActivity extends Activity {
//
// @Override
// protected void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// setContentView(R.layout.battle_general);
// }
//
// public void showBattleMenu(View v) {
//// setContentView(R.layout.battle_daftar_menu);
// RelativeLayout menuLayout = (RelativeLayout) findViewById(R.id.option_menu);
// menuLayout.removeAllViews();
//
// LayoutInflater inflater = getLayoutInflater();
// menuLayout.addView(inflater.inflate(R.layout.battle_daftar_menu, null));
// }
//
// public void doEscape(View v) {
// setContentView(R.layout.escape_submitted);
// }
//
// public void showAllMonster(View v) {
//// menghilangkan daftar menu
// RelativeLayout menuLayout = (RelativeLayout) findViewById(R.id.option_menu);
// menuLayout.removeAllViews();
// }
//
// public void showMonsterSkill(View v) {
// //menghilangkan daftar menu
// RelativeLayout menuLayout = (RelativeLayout) findViewById(R.id.option_menu);
// menuLayout.removeAllViews();
//
// ArrayList<String> skillList = new ArrayList<String>();
// skillList.add("Bunuh");
// skillList.add("Cium");
// skillList.add("Bacok");
// skillList.add("Tiup");
// skillList.add("Tiup");
// skillList.add("Tiup");
// skillList.add("Tiup");
// skillList.add("Tiup");
// skillList.add("Tiup");
// skillList.add("Tiup");
// skillList.add("Tiup");
// skillList.add("Tiup");
// skillList.add("Tiup");
// skillList.add("Tiup");
//
// ScrollView skillView = new ScrollView(this);
// LinearLayout skillLayout = new LinearLayout(this);
// skillLayout.setOrientation(LinearLayout.VERTICAL);
// skillLayout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
// skillLayout.setGravity(Gravity.CENTER);
//
// for (int i=0; i<skillList.size(); i++) {
// Button skillName = new Button(this);
// skillName.setText(skillList.get(i));
// skillName.setLayoutParams(new LayoutParams(300,LayoutParams.WRAP_CONTENT));
// skillLayout.addView(skillName);
// }
//
// skillView.addView(skillLayout);
// setContentView(skillView);
// }
//
// @Override
// public boolean onCreateOptionsMenu(Menu menu) {
// // Inflate the menu; this adds items to the action bar if it is present.
// getMenuInflater().inflate(R.menu.battle, menu);
// return true;
// }
//}
| UTF-8 | Java | 3,020 | java | BattleActivity.java | Java | [] | null | [] | package com.pokeranch;
//package com.hottest.pokeranch;
//
//import java.util.ArrayList;
//
//import android.app.Activity;
//import android.os.Bundle;
//import android.view.Gravity;
//import android.view.LayoutInflater;
//import android.view.Menu;
//import android.view.View;
//import android.view.ViewGroup.LayoutParams;
//import android.widget.ArrayAdapter;
//import android.widget.Button;
//import android.widget.LinearLayout;
//import android.widget.ListView;
//import android.widget.RelativeLayout;
//import android.widget.ScrollView;
//import android.widget.TextView;
//
//public class BattleActivity extends Activity {
//
// @Override
// protected void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// setContentView(R.layout.battle_general);
// }
//
// public void showBattleMenu(View v) {
//// setContentView(R.layout.battle_daftar_menu);
// RelativeLayout menuLayout = (RelativeLayout) findViewById(R.id.option_menu);
// menuLayout.removeAllViews();
//
// LayoutInflater inflater = getLayoutInflater();
// menuLayout.addView(inflater.inflate(R.layout.battle_daftar_menu, null));
// }
//
// public void doEscape(View v) {
// setContentView(R.layout.escape_submitted);
// }
//
// public void showAllMonster(View v) {
//// menghilangkan daftar menu
// RelativeLayout menuLayout = (RelativeLayout) findViewById(R.id.option_menu);
// menuLayout.removeAllViews();
// }
//
// public void showMonsterSkill(View v) {
// //menghilangkan daftar menu
// RelativeLayout menuLayout = (RelativeLayout) findViewById(R.id.option_menu);
// menuLayout.removeAllViews();
//
// ArrayList<String> skillList = new ArrayList<String>();
// skillList.add("Bunuh");
// skillList.add("Cium");
// skillList.add("Bacok");
// skillList.add("Tiup");
// skillList.add("Tiup");
// skillList.add("Tiup");
// skillList.add("Tiup");
// skillList.add("Tiup");
// skillList.add("Tiup");
// skillList.add("Tiup");
// skillList.add("Tiup");
// skillList.add("Tiup");
// skillList.add("Tiup");
// skillList.add("Tiup");
//
// ScrollView skillView = new ScrollView(this);
// LinearLayout skillLayout = new LinearLayout(this);
// skillLayout.setOrientation(LinearLayout.VERTICAL);
// skillLayout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
// skillLayout.setGravity(Gravity.CENTER);
//
// for (int i=0; i<skillList.size(); i++) {
// Button skillName = new Button(this);
// skillName.setText(skillList.get(i));
// skillName.setLayoutParams(new LayoutParams(300,LayoutParams.WRAP_CONTENT));
// skillLayout.addView(skillName);
// }
//
// skillView.addView(skillLayout);
// setContentView(skillView);
// }
//
// @Override
// public boolean onCreateOptionsMenu(Menu menu) {
// // Inflate the menu; this adds items to the action bar if it is present.
// getMenuInflater().inflate(R.menu.battle, menu);
// return true;
// }
//}
| 3,020 | 0.689404 | 0.688079 | 92 | 30.826086 | 21.661732 | 104 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.043478 | false | false | 8 |
9f64db4915dc10bacc355096e1a723d1f6d2cc05 | 20,521,353,746,763 | 33462e392d2b210766d27530e13ec8591a340f20 | /luguhu-news/src/com/jckjkj/service/ComplaintService.java | 77881947ab06bca78b8f949f759b3a5d137226a4 | [] | no_license | yinxd/github | https://github.com/yinxd/github | a0d6537bc72caa211dd354ab16509b73f8b14e07 | 633c12e65a5f4de3fba9e52839c1a2093815dfb3 | refs/heads/master | 2017-12-01T09:53:43.296000 | 2016-06-03T04:05:45 | 2016-06-03T04:05:45 | 60,317,445 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.jckjkj.service;
import java.util.List;
import com.jckjkj.mybatis.model.Complaint;
import com.jckjkj.system.Page;
public interface ComplaintService
{
int insertSelective(Complaint complaint);
List<Complaint> selectComplaintAll();
Complaint selectComplaintById(Integer id);
int deleteByPrimaryKey(Integer id);
List<Complaint> selectComplaintPage(Page<Complaint> page);
int updateComplaint(Complaint complaint);
List<Complaint> selectByName(String cTitle);
}
| UTF-8 | Java | 515 | java | ComplaintService.java | Java | [] | null | [] | package com.jckjkj.service;
import java.util.List;
import com.jckjkj.mybatis.model.Complaint;
import com.jckjkj.system.Page;
public interface ComplaintService
{
int insertSelective(Complaint complaint);
List<Complaint> selectComplaintAll();
Complaint selectComplaintById(Integer id);
int deleteByPrimaryKey(Integer id);
List<Complaint> selectComplaintPage(Page<Complaint> page);
int updateComplaint(Complaint complaint);
List<Complaint> selectByName(String cTitle);
}
| 515 | 0.75534 | 0.75534 | 24 | 19.458334 | 19.905985 | 59 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1 | false | false | 8 |
14d6719c1a8ff8063db61287a843748689bccacd | 23,897,198,087,814 | 9e9555f66c419f8de1166c444cc4019d14f59f3a | /src/main/java/com/rambo/excel/Animal.java | 5f88928014b6fd85530aa85e4f30837d8bd4f187 | [] | no_license | baizhanshi/utils | https://github.com/baizhanshi/utils | bb27cc9e074e3ac97e4443b019c7a9861974ae4a | 9834ab76a929ef03aff64343360a377723df6985 | refs/heads/master | 2022-07-11T22:57:02.762000 | 2022-07-01T01:54:20 | 2022-07-01T01:54:20 | 231,056,209 | 1 | 0 | null | false | 2022-06-17T02:48:44 | 2019-12-31T08:33:44 | 2021-12-31T12:12:16 | 2022-06-17T02:48:44 | 248 | 1 | 0 | 2 | Java | false | false | package com.rambo.excel;
import lombok.Data;
/**
* @author ๏ผbaizhanshi
* @date ๏ผCreated in 2021/9/13 19:39
*/
@Data
public class Animal {
private int id;
private String name;
private String sex;
public Animal() {
}
public Animal(int id, String name, String sex) {
this.id = id;
this.name = name;
this.sex = sex;
}
}
| UTF-8 | Java | 380 | java | Animal.java | Java | [
{
"context": "ambo.excel;\n\nimport lombok.Data;\n\n/**\n * @author ๏ผbaizhanshi\n * @date ๏ผCreated in 2021/9/13 19:39\n */\n@Data\npu",
"end": 73,
"score": 0.9994370937347412,
"start": 63,
"tag": "USERNAME",
"value": "baizhanshi"
}
] | null | [] | package com.rambo.excel;
import lombok.Data;
/**
* @author ๏ผbaizhanshi
* @date ๏ผCreated in 2021/9/13 19:39
*/
@Data
public class Animal {
private int id;
private String name;
private String sex;
public Animal() {
}
public Animal(int id, String name, String sex) {
this.id = id;
this.name = name;
this.sex = sex;
}
}
| 380 | 0.585106 | 0.555851 | 24 | 14.666667 | 13.37805 | 52 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.416667 | false | false | 8 |
0898da2b9cfed9074214746821bb5f637a0663f7 | 33,483,565,055,814 | a532fad5ff18b373c8f65a6984ae8e42d6a9d6e8 | /src/test/java/org/dyn4j/geometry/simplify/VisvalingamTest.java | 0631202e60b54143e6527154856980c2a8ab3836 | [
"LicenseRef-scancode-proprietary-license",
"BSD-3-Clause"
] | permissive | dyn4j/dyn4j | https://github.com/dyn4j/dyn4j | d5b4302b404c1fb81b82a9855cd0341df7b7d3d6 | ee912bf03f8c7ce70ac594b1356c51755834a61a | refs/heads/master | 2023-02-14T19:30:55.658000 | 2023-01-28T20:01:23 | 2023-01-28T20:01:23 | 32,194,746 | 389 | 69 | BSD-3-Clause | false | 2022-12-24T04:37:13 | 2015-03-14T03:49:36 | 2022-12-22T07:36:28 | 2022-12-24T04:37:13 | 11,944 | 396 | 71 | 1 | Java | false | false | /*
* Copyright (c) 2010-2021 William Bittle http://www.dyn4j.org/
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions
* and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or
* promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.dyn4j.geometry.simplify;
import java.util.ArrayList;
import java.util.List;
import org.dyn4j.geometry.Vector2;
import org.junit.Test;
import junit.framework.TestCase;
/**
* Test case for the {@link Visvalingam} class.
* @author William Bittle
* @version 4.2.0
* @since 4.2.0
*/
public class VisvalingamTest extends AbstractSimplifyTest {
/**
* Tests invalid VCR tolerance
*/
@Test(expected = IllegalArgumentException.class)
public void createInvalidTolerance() {
new Visvalingam(-1, 0);
}
/**
* Tests invalid epsilon
*/
@Test(expected = IllegalArgumentException.class)
public void createInvalidEpsilon() {
new Visvalingam(0, -1);
}
/**
* Tests invalid epsilon
*/
@Test(expected = IllegalArgumentException.class)
public void createInvalidBoth() {
new Visvalingam(-1, -1);
}
/**
* Tests no change due to configuration values.
*/
@Test
public void noChange() {
Simplifier simplifier = new Visvalingam(0, 0);
Vector2[] vertices = this.load(VisvalingamTest.class.getResourceAsStream("/org/dyn4j/data/bird.dat"));
Vector2[] simplified = simplifier.simplify(vertices);
TestCase.assertEquals(vertices.length, simplified.length);
}
/**
* Tests passing a null array.
*/
@Test
public void nullArray() {
Simplifier simplifier = new Visvalingam(0, 0);
TestCase.assertNull(simplifier.simplify((Vector2[])null));
}
/**
* Tests passing a null list.
*/
@Test
public void nullList() {
Simplifier simplifier = new Visvalingam(0, 0);
TestCase.assertNull(simplifier.simplify((List<Vector2>)null));
}
/**
* Tests passing an empty array.
*/
@Test
public void emptyArray() {
Vector2[] vertices = new Vector2[0];
Simplifier simplifier = new Visvalingam(0, 0);
vertices = simplifier.simplify(vertices);
TestCase.assertEquals(0, vertices.length);
}
/**
* Tests passing an empty array.
*/
@Test
public void emptyList() {
List<Vector2> vertices = new ArrayList<Vector2>();
Simplifier simplifier = new Visvalingam(0, 0);
vertices = simplifier.simplify(vertices);
TestCase.assertEquals(0, vertices.size());
}
/**
* Tests passing null elements
*/
@Test
public void nullElements() {
Vector2[] vertices = new Vector2[] {
null,
new Vector2(),
null
};
Simplifier simplifier = new Visvalingam(0, 0);
vertices = simplifier.simplify(vertices);
TestCase.assertEquals(1, vertices.length);
}
/**
* Tests passing identical elements.
*/
@Test
public void coincidentElements() {
Vector2[] vertices = new Vector2[] {
null,
new Vector2(),
new Vector2(),
new Vector2(1, 1),
null
};
Simplifier simplifier = new Visvalingam(0, 0);
vertices = simplifier.simplify(vertices);
TestCase.assertEquals(2, vertices.length);
}
/**
* Tests passing close elements.
*/
@Test
public void closeElements() {
Vector2[] vertices = new Vector2[] {
null,
new Vector2(1.1, 0.0),
new Vector2(1.1, 0.0),
new Vector2(1.2, 0.0),
new Vector2(1.25, 0.0),
new Vector2(1.4, 0.0),
new Vector2(1.4, 0.0),
new Vector2(1.7, 0.0),
null
};
Simplifier simplifier = new Visvalingam(0.11, 0.1);
vertices = simplifier.simplify(vertices);
TestCase.assertEquals(0, vertices.length);
}
/**
* Tests passing close elements.
*/
@Test
public void allNull() {
Vector2[] vertices = new Vector2[] {
null,
null,
null
};
Simplifier simplifier = new Visvalingam(0, 0);
vertices = simplifier.simplify(vertices);
TestCase.assertEquals(0, vertices.length);
}
/**
* Tests passing close elements - should never return less than two because
* of the split location.
*/
@Test
public void allSamePoints() {
Vector2[] vertices = new Vector2[] {
new Vector2(1.1, 0.0),
new Vector2(1.11, 0.0),
new Vector2(1.12, 0.0),
new Vector2(1.13, 0.0),
new Vector2(1.14, 0.0)
};
Simplifier simplifier = new Visvalingam(0.0, 1.0);
vertices = simplifier.simplify(vertices);
TestCase.assertEquals(0, vertices.length);
}
/**
* Tests with the bird dataset.
*/
@Test
public void successBird() {
Vector2[] vertices = this.load(VisvalingamTest.class.getResourceAsStream("/org/dyn4j/data/bird.dat"));
Simplifier simplifier = new Visvalingam(0.1, 0.5);
vertices = simplifier.simplify(vertices);
TestCase.assertEquals(35, vertices.length);
}
/**
* Tests with the tank dataset.
*/
@Test
public void successTank() {
Vector2[] vertices = this.load(VisvalingamTest.class.getResourceAsStream("/org/dyn4j/data/tank.dat"));
Simplifier simplifier = new Visvalingam(10.0, 10.0);
vertices = simplifier.simplify(vertices);
// the original shape is so optimized we can't get much more out of it
TestCase.assertEquals(40, vertices.length);
}
/**
* Tests with a dataset that would produce self-intersection if there wasn't a prevention measure in place.
*/
@Test
public void successSelfIntersection() {
Vector2[] vertices = new Vector2[] {
new Vector2(-2.058,-3.576),
new Vector2(1.066,-3.422),
new Vector2(0.626,-1.816),
new Vector2(0.758,-1.09),
new Vector2(1.946,-0.87),
new Vector2(3.134,-1.992),
new Vector2(0.802,-1.838),
new Vector2(1.11,-2.674),
new Vector2(3.442,-3.246),
new Vector2(2.364,-6.81),
new Vector2(-3.092,-5.05),
};
Simplifier simplifier = new Visvalingam(2.0, 1.0);
vertices = simplifier.simplify(vertices);
// this would generate a self-intersection, but it doesn't because we're preventing them
TestCase.assertEquals(6, vertices.length);
}
/**
* Tests with the nazca_monkey dataset.
*/
@Test
public void successNazcaMonkey() {
Vector2[] vertices = this.load(VisvalingamTest.class.getResourceAsStream("/org/dyn4j/data/nazca_monkey.dat"));
Simplifier simplifier = new Visvalingam(0.5, 0.5);
vertices = simplifier.simplify(vertices);
TestCase.assertEquals(446, vertices.length);
}
/**
* Tests with the nazca_heron dataset.
*/
@Test
public void successNazcaHeron() {
Vector2[] vertices = this.load(VisvalingamTest.class.getResourceAsStream("/org/dyn4j/data/nazca_heron.dat"));
Simplifier simplifier = new Visvalingam(0.5, 0.5);
vertices = simplifier.simplify(vertices);
TestCase.assertEquals(198, vertices.length);
}
/**
* Tests with the zoom1 dataset.
*/
@Test
public void successZoom1() {
Vector2[] vertices = this.load(VisvalingamTest.class.getResourceAsStream("/org/dyn4j/data/zoom1.dat"));
Simplifier simplifier = new Visvalingam(0.5, 0.5);
vertices = simplifier.simplify(vertices);
TestCase.assertEquals(46, vertices.length);
}
/**
* Tests with the zoom2 dataset.
*/
@Test
public void successZoom2() {
Vector2[] vertices = this.load(VisvalingamTest.class.getResourceAsStream("/org/dyn4j/data/zoom2.dat"));
Simplifier simplifier = new Visvalingam(0.5, 0.5);
vertices = simplifier.simplify(vertices);
TestCase.assertEquals(46, vertices.length);
}
/**
* Tests with the zoom3 dataset.
*/
@Test
public void successZoom3() {
Vector2[] vertices = this.load(VisvalingamTest.class.getResourceAsStream("/org/dyn4j/data/zoom3.dat"));
Simplifier simplifier = new Visvalingam(0.5, 0.5);
vertices = simplifier.simplify(vertices);
TestCase.assertEquals(46, vertices.length);
}
/**
* Tests with the zoom4 dataset.
*/
@Test
public void successZoom4() {
Vector2[] vertices = this.load(VisvalingamTest.class.getResourceAsStream("/org/dyn4j/data/zoom4.dat"));
Simplifier simplifier = new Visvalingam(0.5, 0.5);
vertices = simplifier.simplify(vertices);
TestCase.assertEquals(30, vertices.length);
}
/**
* Tests with the zoom5 dataset.
*/
@Test
public void successZoom5() {
Vector2[] vertices = this.load(VisvalingamTest.class.getResourceAsStream("/org/dyn4j/data/zoom5.dat"));
Simplifier simplifier = new Visvalingam(0.5, 0.5);
vertices = simplifier.simplify(vertices);
TestCase.assertEquals(45, vertices.length);
}
/**
* Tests with the zoom6 dataset.
*/
@Test
public void successZoom6() {
Vector2[] vertices = this.load(VisvalingamTest.class.getResourceAsStream("/org/dyn4j/data/zoom6.dat"));
Simplifier simplifier = new Visvalingam(0.5, 0.5);
vertices = simplifier.simplify(vertices);
TestCase.assertEquals(59, vertices.length);
}
/**
* Tests with the zoom7 dataset.
*/
@Test
public void successZoom7() {
Vector2[] vertices = this.load(VisvalingamTest.class.getResourceAsStream("/org/dyn4j/data/zoom7.dat"));
Simplifier simplifier = new Visvalingam(0.5, 0.5);
vertices = simplifier.simplify(vertices);
TestCase.assertEquals(21, vertices.length);
}
/**
* Tests with the tridol1 dataset.
*/
@Test
public void successTridol1() {
Vector2[] vertices = this.load(VisvalingamTest.class.getResourceAsStream("/org/dyn4j/data/tridol1.dat"));
Simplifier simplifier = new Visvalingam(1.5, 0.5);
vertices = simplifier.simplify(vertices);
TestCase.assertEquals(18, vertices.length);
}
/**
* Tests with the tridol2 dataset.
*/
@Test
public void successTridol2() {
Vector2[] vertices = this.load(VisvalingamTest.class.getResourceAsStream("/org/dyn4j/data/tridol2.dat"));
Simplifier simplifier = new Visvalingam(1.5, 0.5);
vertices = simplifier.simplify(vertices);
TestCase.assertEquals(11, vertices.length);
}
/**
* Tests with the tridol3 dataset.
*/
@Test
public void successTridol3() {
Vector2[] vertices = this.load(VisvalingamTest.class.getResourceAsStream("/org/dyn4j/data/tridol3.dat"));
Simplifier simplifier = new Visvalingam(1.5, 0.5);
vertices = simplifier.simplify(vertices);
TestCase.assertEquals(18, vertices.length);
}
/**
* Tests with the nsoft1 dataset.
*/
@Test
public void successNsoft1() {
Vector2[] vertices = this.load(VisvalingamTest.class.getResourceAsStream("/org/dyn4j/data/nsoft1.dat"));
Simplifier simplifier = new Visvalingam(0.1, 0.1);
vertices = simplifier.simplify(vertices);
TestCase.assertEquals(9, vertices.length);
}
}
| UTF-8 | Java | 11,555 | java | VisvalingamTest.java | Java | [
{
"context": "/*\n * Copyright (c) 2010-2021 William Bittle http://www.dyn4j.org/\n * All rights reserved.\n *",
"end": 44,
"score": 0.9998226761817932,
"start": 30,
"tag": "NAME",
"value": "William Bittle"
},
{
"context": "case for the {@link Visvalingam} class.\n * @author William Bittle\n * @version 4.2.0\n * @since 4.2.0\n */\npublic clas",
"end": 1874,
"score": 0.9998424053192139,
"start": 1860,
"tag": "NAME",
"value": "William Bittle"
}
] | null | [] | /*
* Copyright (c) 2010-2021 <NAME> http://www.dyn4j.org/
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions
* and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or
* promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.dyn4j.geometry.simplify;
import java.util.ArrayList;
import java.util.List;
import org.dyn4j.geometry.Vector2;
import org.junit.Test;
import junit.framework.TestCase;
/**
* Test case for the {@link Visvalingam} class.
* @author <NAME>
* @version 4.2.0
* @since 4.2.0
*/
public class VisvalingamTest extends AbstractSimplifyTest {
/**
* Tests invalid VCR tolerance
*/
@Test(expected = IllegalArgumentException.class)
public void createInvalidTolerance() {
new Visvalingam(-1, 0);
}
/**
* Tests invalid epsilon
*/
@Test(expected = IllegalArgumentException.class)
public void createInvalidEpsilon() {
new Visvalingam(0, -1);
}
/**
* Tests invalid epsilon
*/
@Test(expected = IllegalArgumentException.class)
public void createInvalidBoth() {
new Visvalingam(-1, -1);
}
/**
* Tests no change due to configuration values.
*/
@Test
public void noChange() {
Simplifier simplifier = new Visvalingam(0, 0);
Vector2[] vertices = this.load(VisvalingamTest.class.getResourceAsStream("/org/dyn4j/data/bird.dat"));
Vector2[] simplified = simplifier.simplify(vertices);
TestCase.assertEquals(vertices.length, simplified.length);
}
/**
* Tests passing a null array.
*/
@Test
public void nullArray() {
Simplifier simplifier = new Visvalingam(0, 0);
TestCase.assertNull(simplifier.simplify((Vector2[])null));
}
/**
* Tests passing a null list.
*/
@Test
public void nullList() {
Simplifier simplifier = new Visvalingam(0, 0);
TestCase.assertNull(simplifier.simplify((List<Vector2>)null));
}
/**
* Tests passing an empty array.
*/
@Test
public void emptyArray() {
Vector2[] vertices = new Vector2[0];
Simplifier simplifier = new Visvalingam(0, 0);
vertices = simplifier.simplify(vertices);
TestCase.assertEquals(0, vertices.length);
}
/**
* Tests passing an empty array.
*/
@Test
public void emptyList() {
List<Vector2> vertices = new ArrayList<Vector2>();
Simplifier simplifier = new Visvalingam(0, 0);
vertices = simplifier.simplify(vertices);
TestCase.assertEquals(0, vertices.size());
}
/**
* Tests passing null elements
*/
@Test
public void nullElements() {
Vector2[] vertices = new Vector2[] {
null,
new Vector2(),
null
};
Simplifier simplifier = new Visvalingam(0, 0);
vertices = simplifier.simplify(vertices);
TestCase.assertEquals(1, vertices.length);
}
/**
* Tests passing identical elements.
*/
@Test
public void coincidentElements() {
Vector2[] vertices = new Vector2[] {
null,
new Vector2(),
new Vector2(),
new Vector2(1, 1),
null
};
Simplifier simplifier = new Visvalingam(0, 0);
vertices = simplifier.simplify(vertices);
TestCase.assertEquals(2, vertices.length);
}
/**
* Tests passing close elements.
*/
@Test
public void closeElements() {
Vector2[] vertices = new Vector2[] {
null,
new Vector2(1.1, 0.0),
new Vector2(1.1, 0.0),
new Vector2(1.2, 0.0),
new Vector2(1.25, 0.0),
new Vector2(1.4, 0.0),
new Vector2(1.4, 0.0),
new Vector2(1.7, 0.0),
null
};
Simplifier simplifier = new Visvalingam(0.11, 0.1);
vertices = simplifier.simplify(vertices);
TestCase.assertEquals(0, vertices.length);
}
/**
* Tests passing close elements.
*/
@Test
public void allNull() {
Vector2[] vertices = new Vector2[] {
null,
null,
null
};
Simplifier simplifier = new Visvalingam(0, 0);
vertices = simplifier.simplify(vertices);
TestCase.assertEquals(0, vertices.length);
}
/**
* Tests passing close elements - should never return less than two because
* of the split location.
*/
@Test
public void allSamePoints() {
Vector2[] vertices = new Vector2[] {
new Vector2(1.1, 0.0),
new Vector2(1.11, 0.0),
new Vector2(1.12, 0.0),
new Vector2(1.13, 0.0),
new Vector2(1.14, 0.0)
};
Simplifier simplifier = new Visvalingam(0.0, 1.0);
vertices = simplifier.simplify(vertices);
TestCase.assertEquals(0, vertices.length);
}
/**
* Tests with the bird dataset.
*/
@Test
public void successBird() {
Vector2[] vertices = this.load(VisvalingamTest.class.getResourceAsStream("/org/dyn4j/data/bird.dat"));
Simplifier simplifier = new Visvalingam(0.1, 0.5);
vertices = simplifier.simplify(vertices);
TestCase.assertEquals(35, vertices.length);
}
/**
* Tests with the tank dataset.
*/
@Test
public void successTank() {
Vector2[] vertices = this.load(VisvalingamTest.class.getResourceAsStream("/org/dyn4j/data/tank.dat"));
Simplifier simplifier = new Visvalingam(10.0, 10.0);
vertices = simplifier.simplify(vertices);
// the original shape is so optimized we can't get much more out of it
TestCase.assertEquals(40, vertices.length);
}
/**
* Tests with a dataset that would produce self-intersection if there wasn't a prevention measure in place.
*/
@Test
public void successSelfIntersection() {
Vector2[] vertices = new Vector2[] {
new Vector2(-2.058,-3.576),
new Vector2(1.066,-3.422),
new Vector2(0.626,-1.816),
new Vector2(0.758,-1.09),
new Vector2(1.946,-0.87),
new Vector2(3.134,-1.992),
new Vector2(0.802,-1.838),
new Vector2(1.11,-2.674),
new Vector2(3.442,-3.246),
new Vector2(2.364,-6.81),
new Vector2(-3.092,-5.05),
};
Simplifier simplifier = new Visvalingam(2.0, 1.0);
vertices = simplifier.simplify(vertices);
// this would generate a self-intersection, but it doesn't because we're preventing them
TestCase.assertEquals(6, vertices.length);
}
/**
* Tests with the nazca_monkey dataset.
*/
@Test
public void successNazcaMonkey() {
Vector2[] vertices = this.load(VisvalingamTest.class.getResourceAsStream("/org/dyn4j/data/nazca_monkey.dat"));
Simplifier simplifier = new Visvalingam(0.5, 0.5);
vertices = simplifier.simplify(vertices);
TestCase.assertEquals(446, vertices.length);
}
/**
* Tests with the nazca_heron dataset.
*/
@Test
public void successNazcaHeron() {
Vector2[] vertices = this.load(VisvalingamTest.class.getResourceAsStream("/org/dyn4j/data/nazca_heron.dat"));
Simplifier simplifier = new Visvalingam(0.5, 0.5);
vertices = simplifier.simplify(vertices);
TestCase.assertEquals(198, vertices.length);
}
/**
* Tests with the zoom1 dataset.
*/
@Test
public void successZoom1() {
Vector2[] vertices = this.load(VisvalingamTest.class.getResourceAsStream("/org/dyn4j/data/zoom1.dat"));
Simplifier simplifier = new Visvalingam(0.5, 0.5);
vertices = simplifier.simplify(vertices);
TestCase.assertEquals(46, vertices.length);
}
/**
* Tests with the zoom2 dataset.
*/
@Test
public void successZoom2() {
Vector2[] vertices = this.load(VisvalingamTest.class.getResourceAsStream("/org/dyn4j/data/zoom2.dat"));
Simplifier simplifier = new Visvalingam(0.5, 0.5);
vertices = simplifier.simplify(vertices);
TestCase.assertEquals(46, vertices.length);
}
/**
* Tests with the zoom3 dataset.
*/
@Test
public void successZoom3() {
Vector2[] vertices = this.load(VisvalingamTest.class.getResourceAsStream("/org/dyn4j/data/zoom3.dat"));
Simplifier simplifier = new Visvalingam(0.5, 0.5);
vertices = simplifier.simplify(vertices);
TestCase.assertEquals(46, vertices.length);
}
/**
* Tests with the zoom4 dataset.
*/
@Test
public void successZoom4() {
Vector2[] vertices = this.load(VisvalingamTest.class.getResourceAsStream("/org/dyn4j/data/zoom4.dat"));
Simplifier simplifier = new Visvalingam(0.5, 0.5);
vertices = simplifier.simplify(vertices);
TestCase.assertEquals(30, vertices.length);
}
/**
* Tests with the zoom5 dataset.
*/
@Test
public void successZoom5() {
Vector2[] vertices = this.load(VisvalingamTest.class.getResourceAsStream("/org/dyn4j/data/zoom5.dat"));
Simplifier simplifier = new Visvalingam(0.5, 0.5);
vertices = simplifier.simplify(vertices);
TestCase.assertEquals(45, vertices.length);
}
/**
* Tests with the zoom6 dataset.
*/
@Test
public void successZoom6() {
Vector2[] vertices = this.load(VisvalingamTest.class.getResourceAsStream("/org/dyn4j/data/zoom6.dat"));
Simplifier simplifier = new Visvalingam(0.5, 0.5);
vertices = simplifier.simplify(vertices);
TestCase.assertEquals(59, vertices.length);
}
/**
* Tests with the zoom7 dataset.
*/
@Test
public void successZoom7() {
Vector2[] vertices = this.load(VisvalingamTest.class.getResourceAsStream("/org/dyn4j/data/zoom7.dat"));
Simplifier simplifier = new Visvalingam(0.5, 0.5);
vertices = simplifier.simplify(vertices);
TestCase.assertEquals(21, vertices.length);
}
/**
* Tests with the tridol1 dataset.
*/
@Test
public void successTridol1() {
Vector2[] vertices = this.load(VisvalingamTest.class.getResourceAsStream("/org/dyn4j/data/tridol1.dat"));
Simplifier simplifier = new Visvalingam(1.5, 0.5);
vertices = simplifier.simplify(vertices);
TestCase.assertEquals(18, vertices.length);
}
/**
* Tests with the tridol2 dataset.
*/
@Test
public void successTridol2() {
Vector2[] vertices = this.load(VisvalingamTest.class.getResourceAsStream("/org/dyn4j/data/tridol2.dat"));
Simplifier simplifier = new Visvalingam(1.5, 0.5);
vertices = simplifier.simplify(vertices);
TestCase.assertEquals(11, vertices.length);
}
/**
* Tests with the tridol3 dataset.
*/
@Test
public void successTridol3() {
Vector2[] vertices = this.load(VisvalingamTest.class.getResourceAsStream("/org/dyn4j/data/tridol3.dat"));
Simplifier simplifier = new Visvalingam(1.5, 0.5);
vertices = simplifier.simplify(vertices);
TestCase.assertEquals(18, vertices.length);
}
/**
* Tests with the nsoft1 dataset.
*/
@Test
public void successNsoft1() {
Vector2[] vertices = this.load(VisvalingamTest.class.getResourceAsStream("/org/dyn4j/data/nsoft1.dat"));
Simplifier simplifier = new Visvalingam(0.1, 0.1);
vertices = simplifier.simplify(vertices);
TestCase.assertEquals(9, vertices.length);
}
}
| 11,539 | 0.706101 | 0.671138 | 393 | 28.402035 | 28.699038 | 112 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.969466 | false | false | 8 |
6dc85fb7b456fc4965aebe2cb4cfb2f8587ba13f | 20,117,626,845,496 | fe694a3a7e55503b787bd13569e75ba31fa20b23 | /day01/test06/Zhinengshouji.java | e9ddeaecd20c1d51be9ce96fbedb161a00e263b4 | [] | no_license | Smokerxxx/j2se | https://github.com/Smokerxxx/j2se | a000319fe44e87b12ded1435edca8b018da0407c | 6172e4ce9cbbd4935b067a763d89bad60caa6af8 | refs/heads/master | 2020-06-21T19:27:54.480000 | 2019-07-18T07:32:23 | 2019-07-18T07:32:23 | 197,536,724 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package test06;
import test06.HandSet;
import test06.InternetAble;
import test06.PictureAble;
import test06.ZhiFuAble;
public abstract class Zhinengshouji extends HandSet implements InternetAble,PictureAble,ZhiFuAble {
}
| UTF-8 | Java | 236 | java | Zhinengshouji.java | Java | [] | null | [] | package test06;
import test06.HandSet;
import test06.InternetAble;
import test06.PictureAble;
import test06.ZhiFuAble;
public abstract class Zhinengshouji extends HandSet implements InternetAble,PictureAble,ZhiFuAble {
}
| 236 | 0.79661 | 0.754237 | 11 | 19.454546 | 27.516487 | 99 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.636364 | false | false | 8 |
a14d7de1d057d77a9245ffe886f859c1cef577a4 | 8,778,913,200,274 | 37ac76549283b202dc7f135738f22bbacabd4cfa | /PuntosInteres/src/main/java/utn/dds/g10/entidades/ResultadoConsulta.java | 6d07d2f2aa4fcc6d2ce56412698b09bb38f6e865 | [] | no_license | rodrib/G10 | https://github.com/rodrib/G10 | e8dd87fd38d8acd631945dd1cfe07ed220d505e6 | 7417b37ed66791fe1c8c01496628ccd53ac89051 | refs/heads/master | 2021-04-30T22:37:12.770000 | 2016-12-16T00:00:10 | 2016-12-16T00:00:10 | 60,304,728 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package utn.dds.g10.entidades;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.Access;
import javax.persistence.AccessType;
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.OneToMany;
import javax.persistence.Transient;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@JsonIgnoreProperties(ignoreUnknown=true)
@Entity
@Access(value = AccessType.FIELD)
public class ResultadoConsulta {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int rsId;
public int getRsId() {
return rsId;
}
public void setRsId(int rsId) {
this.rsId = rsId;
}
@JsonIgnoreProperties()
@Column(name = "fecha_hora")
private LocalDate fechaHora;
@Column
private int tiempoConsulta;
@Column
private String criterioBusqueda;
@Column
private int cantidadResultados;
@OneToMany(mappedBy = "poi")
private List<POI> puntos = new ArrayList<POI>();
@Transient
private List<TestEntidad> array = new ArrayList<TestEntidad>();
public List<TestEntidad> getArray() {
return array;
}
public void setArray(List<TestEntidad> array) {
this.array = array;
}
public void setCantidadResultados(int cantidadResultados) {
this.cantidadResultados = cantidadResultados;
}
@Column
private String usuario;
public String getUsuario() {
return usuario;
}
public void setUsuario(String usuario) {
this.usuario = usuario;
}
public String getCriterioBusqueda() {
return criterioBusqueda;
}
public void setCriterioBusqueda(String criterioBusqueda) {
this.criterioBusqueda = criterioBusqueda;
}
public int getTiempoConsulta() {
return tiempoConsulta;
}
public void setTiempoConsulta(int tiempoConsulta) {
this.tiempoConsulta = tiempoConsulta;
}
public int getCantidadResultados() {
return cantidadResultados;
}
public void setCantidadResultados() {
this.cantidadResultados = puntos.size();
}
public LocalDate getFechaHora() {
return fechaHora;
}
public void setFechaHora(LocalDate fechaHora) {
this.fechaHora = fechaHora;
}
public List<POI> getPuntos() {
return puntos;
}
public void setPuntos(List<POI> puntos) {
this.puntos = puntos;
}
}
| UTF-8 | Java | 2,375 | java | ResultadoConsulta.java | Java | [] | null | [] | package utn.dds.g10.entidades;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.Access;
import javax.persistence.AccessType;
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.OneToMany;
import javax.persistence.Transient;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@JsonIgnoreProperties(ignoreUnknown=true)
@Entity
@Access(value = AccessType.FIELD)
public class ResultadoConsulta {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int rsId;
public int getRsId() {
return rsId;
}
public void setRsId(int rsId) {
this.rsId = rsId;
}
@JsonIgnoreProperties()
@Column(name = "fecha_hora")
private LocalDate fechaHora;
@Column
private int tiempoConsulta;
@Column
private String criterioBusqueda;
@Column
private int cantidadResultados;
@OneToMany(mappedBy = "poi")
private List<POI> puntos = new ArrayList<POI>();
@Transient
private List<TestEntidad> array = new ArrayList<TestEntidad>();
public List<TestEntidad> getArray() {
return array;
}
public void setArray(List<TestEntidad> array) {
this.array = array;
}
public void setCantidadResultados(int cantidadResultados) {
this.cantidadResultados = cantidadResultados;
}
@Column
private String usuario;
public String getUsuario() {
return usuario;
}
public void setUsuario(String usuario) {
this.usuario = usuario;
}
public String getCriterioBusqueda() {
return criterioBusqueda;
}
public void setCriterioBusqueda(String criterioBusqueda) {
this.criterioBusqueda = criterioBusqueda;
}
public int getTiempoConsulta() {
return tiempoConsulta;
}
public void setTiempoConsulta(int tiempoConsulta) {
this.tiempoConsulta = tiempoConsulta;
}
public int getCantidadResultados() {
return cantidadResultados;
}
public void setCantidadResultados() {
this.cantidadResultados = puntos.size();
}
public LocalDate getFechaHora() {
return fechaHora;
}
public void setFechaHora(LocalDate fechaHora) {
this.fechaHora = fechaHora;
}
public List<POI> getPuntos() {
return puntos;
}
public void setPuntos(List<POI> puntos) {
this.puntos = puntos;
}
}
| 2,375 | 0.760421 | 0.759579 | 119 | 18.957983 | 18.073795 | 64 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.12605 | false | false | 8 |
efaa44627dd3c91a8b6ac3fe5c42e9854f1cc3e9 | 1,812,476,259,925 | a82f575c48880e1329140a5b0a081cac0e8dd448 | /app/src/main/java/com/lennydennis/dukayangu/ui/SignUpFragment.java | 951c91fedfd24fc89530b7569da391f668927035 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | LennyDennis/DukaYangu | https://github.com/LennyDennis/DukaYangu | c2a4075d08567448d8dafd2cb18a12cea9796c5e | 346994aaa79bb0180f2e238397337d8074ec8da1 | refs/heads/master | 2021-01-31T18:51:25.577000 | 2020-03-31T09:55:15 | 2020-03-31T09:55:15 | 243,517,738 | 1 | 0 | null | false | 2020-03-31T09:55:16 | 2020-02-27T12:47:33 | 2020-03-29T21:53:29 | 2020-03-31T09:55:16 | 39,014 | 0 | 0 | 0 | Java | false | false | package com.lennydennis.dukayangu.ui;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentTransaction;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.lennydennis.dukayangu.R;
import com.lennydennis.dukayangu.model.User;
import butterknife.BindView;
import butterknife.ButterKnife;
/**
* A simple {@link Fragment} subclass.
*/
public class SignUpFragment extends Fragment implements View.OnClickListener {
@BindView(R.id.sign_up_name) EditText signUpName;
@BindView(R.id.sign_up_email) EditText signUpEmail;
@BindView(R.id.sign_up_password) EditText signUpPassword;
@BindView(R.id.sign_up_cPassword) EditText confirmPassword;
@BindView(R.id.gender_radio_group)
RadioGroup radioGroup;
@BindView(R.id.sign_up_button) Button signUpButton;
@BindView(R.id.already_registered_text) TextView signInText;
@BindView(R.id.sign_up_phone)
EditText signUpPhone;
RadioButton genderButton;
private FirebaseAuth mAuth;
String userId;
private FirebaseDatabase firebaseDatabase;
private DatabaseReference databaseReference;
private FirebaseAuth.AuthStateListener authStateListener;
public SignUpFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_sign_up, container, false);
ButterKnife.bind(this, view);
int selectedGenderId = radioGroup.getCheckedRadioButtonId();
genderButton = view.findViewById(selectedGenderId);
mAuth = FirebaseAuth.getInstance();
signInText.setOnClickListener(this);
signUpButton.setOnClickListener(this);
// if(mAuth.getCurrentUser() != null){
// goToHomeFragment();
// }
// Inflate the layout for this fragment
return view;
}
@Override
public void onClick(View v) {
switch (v.getId()){
case R.id.already_registered_text:
FragmentTransaction transaction = getFragmentManager().beginTransaction();
SignInFragment signInFragment = new SignInFragment();
transaction.replace(R.id.fragment_container, signInFragment);
transaction.addToBackStack(null);
transaction.commit();
break;
case R.id.sign_up_button:
createNewUser();
}
}
public void createNewUser(){
final String userName = signUpName.getText().toString().trim();
final String userEmail = signUpEmail.getText().toString().trim();
String password = signUpPassword.getText().toString().trim();
String cPassword = confirmPassword.getText().toString().trim();
String gender = genderButton.getText().toString().trim();
final String phoneNumber = signUpPhone.getText().toString().trim();
if (TextUtils.isEmpty(userName)) {
Toast.makeText(getContext(),"Enter your name",Toast.LENGTH_SHORT).show();
return;
}
if (TextUtils.isEmpty(userEmail)) {
Toast.makeText(getContext(),"Email field is empty",Toast.LENGTH_SHORT).show();
return;
}
mAuth.createUserWithEmailAndPassword(userEmail, password)
.addOnCompleteListener(getActivity(), new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if(task.isSuccessful()){
Toast.makeText(getContext(),"Registration successful",Toast.LENGTH_SHORT).show();
firebaseDatabase = FirebaseDatabase.getInstance();
databaseReference = firebaseDatabase.getReference();
FirebaseUser firebaseUser = mAuth.getCurrentUser();
userId = firebaseUser.getUid();
User user = new User(userName, userEmail, phoneNumber);
databaseReference.child("Users").child(userId).setValue(user);
goToLoginFragment();
}else{
Toast.makeText(getContext(),"Registration unsuccessful",Toast.LENGTH_SHORT).show();
}
}
});
}
public void goToLoginFragment(){
FragmentTransaction transaction = getFragmentManager().beginTransaction();
SignInFragment signInFragment = new SignInFragment();
transaction.replace(R.id.fragment_container, signInFragment);
transaction.addToBackStack(null);
transaction.commit();
}
public void goToHomeFragment(){
FragmentTransaction transaction = getFragmentManager().beginTransaction();
HomeFragment homeFragment = new HomeFragment();
transaction.replace(R.id.fragment_container, homeFragment);
transaction.addToBackStack(null);
transaction.commit();
}
}
| UTF-8 | Java | 5,812 | java | SignUpFragment.java | Java | [
{
"context": "package com.lennydennis.dukayangu.ui;\n\nimport android.os.Bundle;\nimport a",
"end": 23,
"score": 0.9091327786445618,
"start": 12,
"tag": "USERNAME",
"value": "lennydennis"
},
{
"context": "le.firebase.database.FirebaseDatabase;\nimport com.lennydennis.dukayangu.R;\nimport com.lennydennis.dukayangu.mod",
"end": 873,
"score": 0.8950030207633972,
"start": 862,
"tag": "USERNAME",
"value": "lennydennis"
},
{
"context": "e;\nimport com.lennydennis.dukayangu.R;\nimport com.lennydennis.dukayangu.model.User;\n\nimport butterknife.BindVie",
"end": 909,
"score": 0.656620979309082,
"start": 898,
"tag": "USERNAME",
"value": "lennydennis"
},
{
"context": "ext().toString().trim();\n String password = signUpPassword.getText().toString().trim();\n String cPass",
"end": 3416,
"score": 0.827237606048584,
"start": 3402,
"tag": "PASSWORD",
"value": "signUpPassword"
},
{
"context": "\n User user = new User(userName, userEmail, phoneNumber);\n ",
"end": 4770,
"score": 0.9955224990844727,
"start": 4762,
"tag": "USERNAME",
"value": "userName"
}
] | null | [] | package com.lennydennis.dukayangu.ui;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentTransaction;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.lennydennis.dukayangu.R;
import com.lennydennis.dukayangu.model.User;
import butterknife.BindView;
import butterknife.ButterKnife;
/**
* A simple {@link Fragment} subclass.
*/
public class SignUpFragment extends Fragment implements View.OnClickListener {
@BindView(R.id.sign_up_name) EditText signUpName;
@BindView(R.id.sign_up_email) EditText signUpEmail;
@BindView(R.id.sign_up_password) EditText signUpPassword;
@BindView(R.id.sign_up_cPassword) EditText confirmPassword;
@BindView(R.id.gender_radio_group)
RadioGroup radioGroup;
@BindView(R.id.sign_up_button) Button signUpButton;
@BindView(R.id.already_registered_text) TextView signInText;
@BindView(R.id.sign_up_phone)
EditText signUpPhone;
RadioButton genderButton;
private FirebaseAuth mAuth;
String userId;
private FirebaseDatabase firebaseDatabase;
private DatabaseReference databaseReference;
private FirebaseAuth.AuthStateListener authStateListener;
public SignUpFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_sign_up, container, false);
ButterKnife.bind(this, view);
int selectedGenderId = radioGroup.getCheckedRadioButtonId();
genderButton = view.findViewById(selectedGenderId);
mAuth = FirebaseAuth.getInstance();
signInText.setOnClickListener(this);
signUpButton.setOnClickListener(this);
// if(mAuth.getCurrentUser() != null){
// goToHomeFragment();
// }
// Inflate the layout for this fragment
return view;
}
@Override
public void onClick(View v) {
switch (v.getId()){
case R.id.already_registered_text:
FragmentTransaction transaction = getFragmentManager().beginTransaction();
SignInFragment signInFragment = new SignInFragment();
transaction.replace(R.id.fragment_container, signInFragment);
transaction.addToBackStack(null);
transaction.commit();
break;
case R.id.sign_up_button:
createNewUser();
}
}
public void createNewUser(){
final String userName = signUpName.getText().toString().trim();
final String userEmail = signUpEmail.getText().toString().trim();
String password = <PASSWORD>.getText().toString().trim();
String cPassword = confirmPassword.getText().toString().trim();
String gender = genderButton.getText().toString().trim();
final String phoneNumber = signUpPhone.getText().toString().trim();
if (TextUtils.isEmpty(userName)) {
Toast.makeText(getContext(),"Enter your name",Toast.LENGTH_SHORT).show();
return;
}
if (TextUtils.isEmpty(userEmail)) {
Toast.makeText(getContext(),"Email field is empty",Toast.LENGTH_SHORT).show();
return;
}
mAuth.createUserWithEmailAndPassword(userEmail, password)
.addOnCompleteListener(getActivity(), new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if(task.isSuccessful()){
Toast.makeText(getContext(),"Registration successful",Toast.LENGTH_SHORT).show();
firebaseDatabase = FirebaseDatabase.getInstance();
databaseReference = firebaseDatabase.getReference();
FirebaseUser firebaseUser = mAuth.getCurrentUser();
userId = firebaseUser.getUid();
User user = new User(userName, userEmail, phoneNumber);
databaseReference.child("Users").child(userId).setValue(user);
goToLoginFragment();
}else{
Toast.makeText(getContext(),"Registration unsuccessful",Toast.LENGTH_SHORT).show();
}
}
});
}
public void goToLoginFragment(){
FragmentTransaction transaction = getFragmentManager().beginTransaction();
SignInFragment signInFragment = new SignInFragment();
transaction.replace(R.id.fragment_container, signInFragment);
transaction.addToBackStack(null);
transaction.commit();
}
public void goToHomeFragment(){
FragmentTransaction transaction = getFragmentManager().beginTransaction();
HomeFragment homeFragment = new HomeFragment();
transaction.replace(R.id.fragment_container, homeFragment);
transaction.addToBackStack(null);
transaction.commit();
}
}
| 5,808 | 0.659498 | 0.659498 | 153 | 36.986927 | 27.527048 | 111 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.69281 | false | false | 8 |
2b488707f376cd96923d4956ba98f8f3c9af683a | 24,970,939,899,255 | 4b937d2af9cd61625be33076d340c9683c0b145b | /src/com/example/hockey/Connect.java | ee0aa4d41215d44ae793e0c7584ece3afcb77d79 | [] | no_license | satellitex/hockey | https://github.com/satellitex/hockey | e0a05187bcb3fd00c9de67a66d98f8297387e416 | d74b98dd1e7f39f67227dfd6831f5935616e2a42 | refs/heads/master | 2020-04-05T23:07:17.787000 | 2014-03-24T11:43:17 | 2014-03-24T11:43:17 | 15,448,160 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.hockey;
import java.util.Scanner;
import android.bluetooth.BluetoothSocket;
import android.util.Log;
public class Connect {
private boolean Serverflag = false;
private boolean Clientflag = false;
BluetoothSocket socket = null;
private int step_count;
private ReadWriteModel read;
private ReadWriteModel write;
private Scanner rcvstr;
private String tmpRcvstr;
private String sendstr;
private boolean rcvflag;
private boolean firstflag;
private boolean send_flag;
public Connect(){
read = null;
write = null;
}
public void cansel(){
if( write != null ){
write.cansel();
}
if( read != null ){
read.cansel();
}
}
public void Init(){
Log.d("init","connect init-0");
Serverflag = false;
Clientflag = false;
socket = null;
step_count = 0;
rcvflag=false;
firstflag=true;
send_flag=false;
}
public void setSocket(BluetoothSocket socket){
this.socket = socket;
read = new ReadWriteModel(socket,this,false);
write = new ReadWriteModel(socket,this,true);
}
public void setServet(){ Serverflag = true; }
public void setClient(){ Clientflag = true; }
public boolean checkSocket(){
if( socket != null ) return true;
return false;
}
public boolean isServer(){ return Serverflag; }
public boolean isClient(){ return Clientflag; }
public void startSend(){ send_flag=true; }
public void recieveString(String str){
tmpRcvstr = str;
rcvflag = true;
}
private void recieve(){
if(rcvflag){
step_count++;
rcvflag=false;
rcvstr = new Scanner(tmpRcvstr);
int sn = rcvstr.nextInt();
if( sn == -1 ) rcvstr=null;
// if( Clientflag )Log.d("koko","koko rcvstr Client");
// if( Serverflag )Log.d("koko","koko rcvstr Server");
// Log.d("koko","koko rcvstr count : "+sn+" step_count = "+step_count);
} else {
rcvstr = null;
}
}
public void sendString(String str){
sendstr += str+" ";
}
public void StartRead(){
read.start();
write.set(new String("-1 "));
write.start();
}
//ๆๅใซๅผใณๅบใ
public Scanner FastCall(){
// Log.d("koko","koko FastCall 0 count+"+step_count);
Scanner ret = null;
if( Serverflag ){//ใตใผใใผใชใ
// Log.d("koko","koko Server");
//ๅไฟก็ตๆใ็ใซใชใใพใงๅพ
ใค ( step_count ใใ โใชใ )
recieve();
ret = rcvstr;
sendstr = String.format("%d ", step_count);
//ๅไฟก้ๅง
}
if( Clientflag ){//ใฏใฉใคใขใณใใชใ
// Log.d("koko","koko Client");
sendstr = String.format("%d ", step_count+1);
}
//Log.d("koko","koko FastCall 1 count+"+step_count);
return ret;
}
//ๆๅพใซๅผใณๅบใ
public Scanner LastCall(){
// Log.d("koko","koko LastCall 0");
Scanner ret = null;
if( Serverflag ){//ใตใผใใผใชใ
//็ถๆณใ้ไฟก
if( send_flag ) write.set(sendstr);
send_flag=false;
}
if( Clientflag ){//ใฏใฉใคใขใณใใชใ
//ๅไฟก็ตๆใ่ฆใ
//ๅไฟก็ตๆใ็ใซใชใใพใงๅพ
ใค( step_count = 0ใฎใจใใฎใฟ้ฃใฐใ )
if( firstflag == false ){
recieve();
ret = rcvstr;
} else {
step_count++;
firstflag=false;
}
//ๅไฟก้ๅง
//็ถๆณใ้ไฟก
if( send_flag ) write.set(sendstr);
send_flag=false;
}
// Log.d("koko","koko LastCall 1");
return ret;
}
}
| UTF-8 | Java | 3,279 | java | Connect.java | Java | [] | null | [] | package com.example.hockey;
import java.util.Scanner;
import android.bluetooth.BluetoothSocket;
import android.util.Log;
public class Connect {
private boolean Serverflag = false;
private boolean Clientflag = false;
BluetoothSocket socket = null;
private int step_count;
private ReadWriteModel read;
private ReadWriteModel write;
private Scanner rcvstr;
private String tmpRcvstr;
private String sendstr;
private boolean rcvflag;
private boolean firstflag;
private boolean send_flag;
public Connect(){
read = null;
write = null;
}
public void cansel(){
if( write != null ){
write.cansel();
}
if( read != null ){
read.cansel();
}
}
public void Init(){
Log.d("init","connect init-0");
Serverflag = false;
Clientflag = false;
socket = null;
step_count = 0;
rcvflag=false;
firstflag=true;
send_flag=false;
}
public void setSocket(BluetoothSocket socket){
this.socket = socket;
read = new ReadWriteModel(socket,this,false);
write = new ReadWriteModel(socket,this,true);
}
public void setServet(){ Serverflag = true; }
public void setClient(){ Clientflag = true; }
public boolean checkSocket(){
if( socket != null ) return true;
return false;
}
public boolean isServer(){ return Serverflag; }
public boolean isClient(){ return Clientflag; }
public void startSend(){ send_flag=true; }
public void recieveString(String str){
tmpRcvstr = str;
rcvflag = true;
}
private void recieve(){
if(rcvflag){
step_count++;
rcvflag=false;
rcvstr = new Scanner(tmpRcvstr);
int sn = rcvstr.nextInt();
if( sn == -1 ) rcvstr=null;
// if( Clientflag )Log.d("koko","koko rcvstr Client");
// if( Serverflag )Log.d("koko","koko rcvstr Server");
// Log.d("koko","koko rcvstr count : "+sn+" step_count = "+step_count);
} else {
rcvstr = null;
}
}
public void sendString(String str){
sendstr += str+" ";
}
public void StartRead(){
read.start();
write.set(new String("-1 "));
write.start();
}
//ๆๅใซๅผใณๅบใ
public Scanner FastCall(){
// Log.d("koko","koko FastCall 0 count+"+step_count);
Scanner ret = null;
if( Serverflag ){//ใตใผใใผใชใ
// Log.d("koko","koko Server");
//ๅไฟก็ตๆใ็ใซใชใใพใงๅพ
ใค ( step_count ใใ โใชใ )
recieve();
ret = rcvstr;
sendstr = String.format("%d ", step_count);
//ๅไฟก้ๅง
}
if( Clientflag ){//ใฏใฉใคใขใณใใชใ
// Log.d("koko","koko Client");
sendstr = String.format("%d ", step_count+1);
}
//Log.d("koko","koko FastCall 1 count+"+step_count);
return ret;
}
//ๆๅพใซๅผใณๅบใ
public Scanner LastCall(){
// Log.d("koko","koko LastCall 0");
Scanner ret = null;
if( Serverflag ){//ใตใผใใผใชใ
//็ถๆณใ้ไฟก
if( send_flag ) write.set(sendstr);
send_flag=false;
}
if( Clientflag ){//ใฏใฉใคใขใณใใชใ
//ๅไฟก็ตๆใ่ฆใ
//ๅไฟก็ตๆใ็ใซใชใใพใงๅพ
ใค( step_count = 0ใฎใจใใฎใฟ้ฃใฐใ )
if( firstflag == false ){
recieve();
ret = rcvstr;
} else {
step_count++;
firstflag=false;
}
//ๅไฟก้ๅง
//็ถๆณใ้ไฟก
if( send_flag ) write.set(sendstr);
send_flag=false;
}
// Log.d("koko","koko LastCall 1");
return ret;
}
}
| 3,279 | 0.641995 | 0.638735 | 146 | 20.006849 | 15.648316 | 73 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.39726 | false | false | 8 |
f6c058d27dcb58393b2eb25b2e36a8e11d17a0dd | 2,903,397,957,533 | 1c53cdc942bcde57c87905c5fb5d79374ad683d3 | /src/main/java/com/github/perscholas/service/CourseService.java | cc29dc65d525b365e0891002920e75e26ed3e75a | [] | no_license | julwac9225/sba.jpa_school-management-system | https://github.com/julwac9225/sba.jpa_school-management-system | d4d829c296df8535a8829447f7bded9a67b6f1f6 | 4aa90a1beee93074a10c42162b74e806cdb59a4a | refs/heads/master | 2022-12-16T11:37:59.236000 | 2020-09-11T05:24:22 | 2020-09-11T05:24:22 | 292,671,729 | 0 | 0 | null | true | 2020-09-03T20:20:28 | 2020-09-03T20:20:27 | 2020-09-01T15:03:07 | 2020-09-03T06:40:19 | 344 | 0 | 0 | 0 | null | false | false | package com.github.perscholas.service;
import com.github.perscholas.DatabaseConnection;
import com.github.perscholas.dao.CourseDao;
import com.github.perscholas.model.Course;
import com.github.perscholas.model.CourseInterface;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
// Implement Course DAO interface
public class CourseService implements CourseDao {
private final DatabaseConnection dbc;
// constructor takes dbc
public CourseService(DatabaseConnection dbc) {
this.dbc = dbc;
}
public CourseService() {
this(DatabaseConnection.UAT);
}
@Override
public List<CourseInterface> getAllCourses() {
ResultSet rs = dbc.executeQuery("SELECT * FROM course");
try {
//Parse `List<CourseInterface>` from `resultSet`
List<CourseInterface> courses = new ArrayList<>();
while (rs.next()) {
courses.add(new Course(
rs.getInt("id"),
rs.getString("name"),
rs.getString("instructor")));
}
return courses; // returns list of courses
} catch (Exception e) {
throw new Error (e);
}
}
}
| UTF-8 | Java | 1,286 | java | CourseService.java | Java | [] | null | [] | package com.github.perscholas.service;
import com.github.perscholas.DatabaseConnection;
import com.github.perscholas.dao.CourseDao;
import com.github.perscholas.model.Course;
import com.github.perscholas.model.CourseInterface;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
// Implement Course DAO interface
public class CourseService implements CourseDao {
private final DatabaseConnection dbc;
// constructor takes dbc
public CourseService(DatabaseConnection dbc) {
this.dbc = dbc;
}
public CourseService() {
this(DatabaseConnection.UAT);
}
@Override
public List<CourseInterface> getAllCourses() {
ResultSet rs = dbc.executeQuery("SELECT * FROM course");
try {
//Parse `List<CourseInterface>` from `resultSet`
List<CourseInterface> courses = new ArrayList<>();
while (rs.next()) {
courses.add(new Course(
rs.getInt("id"),
rs.getString("name"),
rs.getString("instructor")));
}
return courses; // returns list of courses
} catch (Exception e) {
throw new Error (e);
}
}
}
| 1,286 | 0.623639 | 0.623639 | 44 | 28.181818 | 19.888636 | 64 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.431818 | false | false | 8 |
61b534da1885b7ee1a22371dedd0edd40e1ae75a | 8,177,617,772,811 | 5b60b6b4dd8f9f1ba25baa26e5e2b44d02e26716 | /lab6/src/Scheduler.java | 4b4fb8635fc1f45359f48af9702fd2c9b217ebeb | [] | no_license | McDusia/MultiThreading | https://github.com/McDusia/MultiThreading | cd1805bb4ac4f9c0c82cc2ecd5e4a264d8f68fb0 | 47afd53d3189df780c007b5ed27355053176a95b | refs/heads/master | 2021-09-04T04:23:12.039000 | 2018-01-15T19:44:38 | 2018-01-15T19:44:38 | 109,760,293 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
/**
* Created by Madzia on 21.11.2017.
*/
class Scheduler implements Runnable{
//thread-safe (kolejka- Monitor)
private Queue<MethodRequest> q = new ConcurrentLinkedQueue();
public void enqueue(MethodRequest request)
{
q.add(request);
}
public void run(){
while(true)
{
MethodRequest request = q.poll();
if(request != null) {
if(request.guard())
request.execute();
else
q.add(request);
}
}
}
}
| UTF-8 | Java | 645 | java | Scheduler.java | Java | [
{
"context": "ncurrent.ConcurrentLinkedQueue;\n\n/**\n * Created by Madzia on 21.11.2017.\n */\nclass Scheduler implements Run",
"end": 100,
"score": 0.9638126492500305,
"start": 94,
"tag": "USERNAME",
"value": "Madzia"
}
] | null | [] | import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
/**
* Created by Madzia on 21.11.2017.
*/
class Scheduler implements Runnable{
//thread-safe (kolejka- Monitor)
private Queue<MethodRequest> q = new ConcurrentLinkedQueue();
public void enqueue(MethodRequest request)
{
q.add(request);
}
public void run(){
while(true)
{
MethodRequest request = q.poll();
if(request != null) {
if(request.guard())
request.execute();
else
q.add(request);
}
}
}
}
| 645 | 0.536434 | 0.524031 | 31 | 19.806452 | 18.168423 | 65 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.225806 | false | false | 8 |
99a62105cfc35c4abf535b871ef6259e275f13bc | 18,983,755,488,677 | 633a78408d4c2a6611678cfb407bb660bcd29242 | /Selenium/src/main/java/week3_day1/CR_BankOne.java | f38c9b24561d2ef686a03b5d91efa89c5f2f0fc7 | [] | no_license | jdmadhavan/workaround | https://github.com/jdmadhavan/workaround | e550e7e4e53da019891689ca113ae1ec31c4a0e4 | aab0423857a439c4feac3020683207b6af10fb19 | refs/heads/master | 2022-07-13T22:46:36.161000 | 2021-01-09T15:56:47 | 2021-01-09T15:56:47 | 180,324,716 | 0 | 0 | null | false | 2022-06-29T17:18:21 | 2019-04-09T08:49:30 | 2021-01-09T15:56:51 | 2022-06-29T17:18:20 | 32,187 | 0 | 0 | 6 | HTML | false | false | package week3_day1;
public class CR_BankOne extends CR_Bank_HeadOffice{
public void setTransactionLimits() {
//System.out.println("Limits of balance one is 5");
}
@Override
public void Loan() {
System.out.println("Loan Process from Barance bank one");
System.out.println(j=10);
}
}
| UTF-8 | Java | 307 | java | CR_BankOne.java | Java | [] | null | [] | package week3_day1;
public class CR_BankOne extends CR_Bank_HeadOffice{
public void setTransactionLimits() {
//System.out.println("Limits of balance one is 5");
}
@Override
public void Loan() {
System.out.println("Loan Process from Barance bank one");
System.out.println(j=10);
}
}
| 307 | 0.690554 | 0.674267 | 17 | 17.058823 | 20.258537 | 59 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.117647 | false | false | 8 |
971b73d3f9d812506b64975422aec7ce2b58b512 | 27,075,473,861,166 | 7c8c3d650cfdc3f2febfdb6b4d3c5404e12876f0 | /gui-driver-inspector/src/test/java/com/brentcroft/gtd/utilities/NameUtilsTest.java | 2056e5a506d635f50419827310643fc7566432f5 | [
"Apache-2.0"
] | permissive | brentcroft/test-driver | https://github.com/brentcroft/test-driver | 6a7cebc0b339a97174f5b8dd422bfb9c91b9687f | d1076e4d5c2772ae8627af0c0f911e5bc7882786 | refs/heads/master | 2021-09-28T10:15:27.462000 | 2018-11-16T19:57:34 | 2018-11-16T19:57:34 | 116,875,833 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.brentcroft.gtd.utilities;
import com.brentcroft.util.XmlUtils;
import java.util.Arrays;
import java.util.Collection;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import static java.lang.String.format;
import static org.junit.Assert.assertEquals;
@RunWith( Parameterized.class )
public class NameUtilsTest
{
@Parameterized.Parameters
public static Collection< Object[] > data()
{
return Arrays.asList( new Object[][]{
{ "a=href#url|text()", "alfredo", "alfredo" },
{ "a=href#url|text()", "/alfredo", "alfredo" },
{ "a=href#url|text()", "alfredo/", "alfredo" },
{ "a=href#url|text()", "/alfredo/", "alfredo" },
{ "a=href#url|text()", "http://brentcroft.com/alfredo", "alfredo" },
//
{ "a=href#url|text()", "https://plus.google.com/?gpsrc=ogpy0&tab=wX", "text-content" },
{ "a=href#url|text()", "https://plus.google.com/alfredo?gpsrc=ogpy0&tab=wX", "alfredo" },
{ "a=href#url|text()", "https://plus.google.com/alfredo.jsp?gpsrc=ogpy0&tab=wX", "alfredo.jsp" },
{ "a=href#url|text()", "http://www.google.co.uk/history/optout?hl=en", "optout" },
{ "a=href#url|text()", "http://www.google.co.uk/intl/en/about.html", "about.html" },
{ "a=href#url|text()", "http://www.google.co.uk/intl/en/policies/privacy/", "privacy" },
} );
}
private NameUtils nameUtils = new NameUtils();
private String tagAttributes;
private String xmlText;
private String expected;
public NameUtilsTest( String tagAttributes, String url, String expected )
{
this.tagAttributes = tagAttributes;
this.xmlText = format( "<a href=\"%s\">text-content</a>", url );
this.expected = expected;
}
@Test
public void usesNamers()
{
nameUtils.withTagAttributes( tagAttributes );
assertEquals( expected, nameUtils.buildName( XmlUtils.parse( xmlText ).getDocumentElement() ) );
}
} | UTF-8 | Java | 2,126 | java | NameUtilsTest.java | Java | [] | null | [] | package com.brentcroft.gtd.utilities;
import com.brentcroft.util.XmlUtils;
import java.util.Arrays;
import java.util.Collection;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import static java.lang.String.format;
import static org.junit.Assert.assertEquals;
@RunWith( Parameterized.class )
public class NameUtilsTest
{
@Parameterized.Parameters
public static Collection< Object[] > data()
{
return Arrays.asList( new Object[][]{
{ "a=href#url|text()", "alfredo", "alfredo" },
{ "a=href#url|text()", "/alfredo", "alfredo" },
{ "a=href#url|text()", "alfredo/", "alfredo" },
{ "a=href#url|text()", "/alfredo/", "alfredo" },
{ "a=href#url|text()", "http://brentcroft.com/alfredo", "alfredo" },
//
{ "a=href#url|text()", "https://plus.google.com/?gpsrc=ogpy0&tab=wX", "text-content" },
{ "a=href#url|text()", "https://plus.google.com/alfredo?gpsrc=ogpy0&tab=wX", "alfredo" },
{ "a=href#url|text()", "https://plus.google.com/alfredo.jsp?gpsrc=ogpy0&tab=wX", "alfredo.jsp" },
{ "a=href#url|text()", "http://www.google.co.uk/history/optout?hl=en", "optout" },
{ "a=href#url|text()", "http://www.google.co.uk/intl/en/about.html", "about.html" },
{ "a=href#url|text()", "http://www.google.co.uk/intl/en/policies/privacy/", "privacy" },
} );
}
private NameUtils nameUtils = new NameUtils();
private String tagAttributes;
private String xmlText;
private String expected;
public NameUtilsTest( String tagAttributes, String url, String expected )
{
this.tagAttributes = tagAttributes;
this.xmlText = format( "<a href=\"%s\">text-content</a>", url );
this.expected = expected;
}
@Test
public void usesNamers()
{
nameUtils.withTagAttributes( tagAttributes );
assertEquals( expected, nameUtils.buildName( XmlUtils.parse( xmlText ).getDocumentElement() ) );
}
} | 2,126 | 0.600659 | 0.599247 | 59 | 35.050846 | 34.271313 | 117 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.186441 | false | false | 8 |
f153fc496710238bb1a0c3bc2e353d5c870ec1f3 | 27,075,473,862,759 | a052fd8321576ff8eee34afe9a623bedcfdfa0f8 | /src/com/immo/xxl/pc/WebMagicSfda.java | 52664afa56f683f86d8c4ab2bf6ef5c4a4a4e18c | [] | no_license | laofan/webmagic | https://github.com/laofan/webmagic | 92172917135dcd8b9007d55b3b22a44875d38bc1 | f114dad1ecb886f53da733557b42acba07336ebb | refs/heads/master | 2021-01-23T06:50:15.019000 | 2017-03-28T02:13:28 | 2017-03-28T02:13:28 | 86,404,281 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.immo.xxl.pc;
import java.util.List;
import us.codecraft.webmagic.Page;
import us.codecraft.webmagic.Request;
import us.codecraft.webmagic.Site;
import us.codecraft.webmagic.Spider;
import us.codecraft.webmagic.processor.PageProcessor;
public class WebMagicSfda implements PageProcessor{
//ๆป้กตๆฐ
private int totalPage = 100;
//ๅฝๅ้กตๆฐ
private int currentPage = 1;
//ๆๅ็ฝ็ซ็็ธๅ
ณ้
็ฝฎ๏ผๅ
ๆฌ็ผ็ ใๆๅ้ด้ใ้่ฏๆฌกๆฐ็ญ
private Site site = Site.me().setRetryTimes(3).setSleepTime(1000).setTimeOut(20000).setCharset("utf-8");
@Override
public Site getSite() {
return site;
}
@Override
public void process(Page page) {
dealPage(page);
}
//ๆง่กๆต่ฏ
public static void main(String[] args) {
Spider.create(new WebMagicPC())
.addUrl("http://www.lookmw.cn/yc/list_64477_1.html")
//ๅผๅฏ1ไธช็บฟ็จๆๅ
.thread(10)
//ๅฏๅจ็ฌ่ซ
.run();
}
private void dealPage(Page page) {
if(isListPage(page)){
if(currentPage<totalPage){
String urlStr = "http://www.lookmw.cn/yc/list_64477_"+currentPage+".html";
Request request = new Request(urlStr);
page.addTargetRequest(request);
currentPage++;
List<String> lists = page.getHtml().xpath("//div[@class='picAtc pr']/li/div[@class='info']/p").links().all();
for(String list :lists){
System.out.println(list);
}
}
}
}
private boolean isListPage(Page page) {
String url = page.getUrl().toString();
boolean flag = url.contains("tableName=TABLE25")?true:false;
return flag;
}
}
| UTF-8 | Java | 1,656 | java | WebMagicSfda.java | Java | [] | null | [] | package com.immo.xxl.pc;
import java.util.List;
import us.codecraft.webmagic.Page;
import us.codecraft.webmagic.Request;
import us.codecraft.webmagic.Site;
import us.codecraft.webmagic.Spider;
import us.codecraft.webmagic.processor.PageProcessor;
public class WebMagicSfda implements PageProcessor{
//ๆป้กตๆฐ
private int totalPage = 100;
//ๅฝๅ้กตๆฐ
private int currentPage = 1;
//ๆๅ็ฝ็ซ็็ธๅ
ณ้
็ฝฎ๏ผๅ
ๆฌ็ผ็ ใๆๅ้ด้ใ้่ฏๆฌกๆฐ็ญ
private Site site = Site.me().setRetryTimes(3).setSleepTime(1000).setTimeOut(20000).setCharset("utf-8");
@Override
public Site getSite() {
return site;
}
@Override
public void process(Page page) {
dealPage(page);
}
//ๆง่กๆต่ฏ
public static void main(String[] args) {
Spider.create(new WebMagicPC())
.addUrl("http://www.lookmw.cn/yc/list_64477_1.html")
//ๅผๅฏ1ไธช็บฟ็จๆๅ
.thread(10)
//ๅฏๅจ็ฌ่ซ
.run();
}
private void dealPage(Page page) {
if(isListPage(page)){
if(currentPage<totalPage){
String urlStr = "http://www.lookmw.cn/yc/list_64477_"+currentPage+".html";
Request request = new Request(urlStr);
page.addTargetRequest(request);
currentPage++;
List<String> lists = page.getHtml().xpath("//div[@class='picAtc pr']/li/div[@class='info']/p").links().all();
for(String list :lists){
System.out.println(list);
}
}
}
}
private boolean isListPage(Page page) {
String url = page.getUrl().toString();
boolean flag = url.contains("tableName=TABLE25")?true:false;
return flag;
}
}
| 1,656 | 0.648528 | 0.628681 | 63 | 23.793652 | 24.333111 | 113 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.444444 | false | false | 8 |
375545cf993e5032b9dde25f530542976f7a8506 | 12,489,764,906,872 | d2e36b9a71b9652474b1a91da469d1273e6a5138 | /nyaLab2.www/SLCWithGet.java | 77bcb1dfe9191ee5860c2fa2aad224ea4f519407 | [] | no_license | flippeman/TDA416_DataStructures | https://github.com/flippeman/TDA416_DataStructures | 28d8cb079749ed4c1174046e5cf5eba8f4eef213 | f9f7cfc46081ccacd9d75dc43e45940446e284d0 | refs/heads/master | 2020-04-09T12:34:31.651000 | 2018-12-20T19:44:54 | 2018-12-20T19:44:54 | 160,355,848 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
* A class to implement the functionality of a Sorted Linked Collection with addition of a get method
* @param <E>
*/
public class SLCWithGet<E extends Comparable<? super E>> extends LinkedCollection<E> implements CollectionWithGet<E> {
/**
* Method to add an element to the linked collection
* @param element the object to add into the list
* @return True or false
*/
@Override
public boolean add(E element) {
if (element == null) {
throw new NullPointerException();
}
if (isEmpty() || element.compareTo(head.element) <= 0) {
head = new Entry(element, head);
return true;
} else {
Entry entry;
for (entry = head; entry.next != null; entry = entry.next) {
if (element.compareTo(entry.next.element) <= 0) {
entry.next = new Entry(element, entry.next);
return true;
}
}
entry.next = new Entry(element, entry.next);
return false;
}
}
/**
* Method that returns an element from the linked collection
* @param element The element to be returned
* @return Either null or the element
*/
@Override
public E get(E element) {
if (head == null) {
return null;
} else {
for (Entry entry = head; entry != null; entry = entry.next) {
if (element.compareTo(entry.element) == 0) {
return entry.element;
}
}
return null;
}
}
}
| UTF-8 | Java | 1,624 | java | SLCWithGet.java | Java | [] | null | [] | /**
* A class to implement the functionality of a Sorted Linked Collection with addition of a get method
* @param <E>
*/
public class SLCWithGet<E extends Comparable<? super E>> extends LinkedCollection<E> implements CollectionWithGet<E> {
/**
* Method to add an element to the linked collection
* @param element the object to add into the list
* @return True or false
*/
@Override
public boolean add(E element) {
if (element == null) {
throw new NullPointerException();
}
if (isEmpty() || element.compareTo(head.element) <= 0) {
head = new Entry(element, head);
return true;
} else {
Entry entry;
for (entry = head; entry.next != null; entry = entry.next) {
if (element.compareTo(entry.next.element) <= 0) {
entry.next = new Entry(element, entry.next);
return true;
}
}
entry.next = new Entry(element, entry.next);
return false;
}
}
/**
* Method that returns an element from the linked collection
* @param element The element to be returned
* @return Either null or the element
*/
@Override
public E get(E element) {
if (head == null) {
return null;
} else {
for (Entry entry = head; entry != null; entry = entry.next) {
if (element.compareTo(entry.element) == 0) {
return entry.element;
}
}
return null;
}
}
}
| 1,624 | 0.528325 | 0.526478 | 53 | 29.622641 | 26.715288 | 118 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.377358 | false | false | 8 |
69dfd05fb7dbabbd48856367ca1b7402d1db28e1 | 1,486,058,743,145 | cad57146ad00a5885d36613dc4aec84f7eeba934 | /src/main/java/Domain/RentValidator.java | 09f13a232a1fa55fb8ef513deee840f7fb3992ae | [] | no_license | Alimary28/Examen | https://github.com/Alimary28/Examen | c75af595153138c6c18cddc6270ecb861a7ec38c | 11f715792cb1ada4ce44b375aedc231deef2b4df | refs/heads/master | 2020-05-15T16:25:56.871000 | 2019-04-20T10:59:33 | 2019-04-20T10:59:33 | 182,389,531 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package Domain;
import java.util.Calendar;
public class RentValidator implements IValidator<Rent> {
public void validate(Rent rent){
String errors = "";
if (rent.getDays() < 0)
errors += "The days of rent must be greater than 0 !";
if (!errors.isEmpty())
throw new RentValidatorException("\n" + errors);
}
}
| UTF-8 | Java | 370 | java | RentValidator.java | Java | [] | null | [] | package Domain;
import java.util.Calendar;
public class RentValidator implements IValidator<Rent> {
public void validate(Rent rent){
String errors = "";
if (rent.getDays() < 0)
errors += "The days of rent must be greater than 0 !";
if (!errors.isEmpty())
throw new RentValidatorException("\n" + errors);
}
}
| 370 | 0.605405 | 0.6 | 17 | 20.764706 | 22.45919 | 66 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.294118 | false | false | 8 |
3864e8590f103f40fe771918ea25cff1c4520718 | 17,978,733,112,255 | c891c1c67a40ef8c21e139acdaee0d550573a85f | /app/src/main/java/com/it/makeapp/navcat/CategoriaInteractor.java | c509066412867331454f2b33adaadf6ade6478bd | [] | no_license | marcocahuas/MakeApp | https://github.com/marcocahuas/MakeApp | 82e30736b29cd894547333c1de64e55d7f709c7c | 947ae4bfed3cba633e85eec5b889645af47fa645 | refs/heads/master | 2018-12-27T15:23:59.090000 | 2018-10-25T00:33:09 | 2018-10-25T00:33:09 | 154,431,342 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.it.makeapp.navcat;
/**
* Created by Kelvin on 24/11/2017.
*/
public interface CategoriaInteractor {
void onLoadCategories();
}
| UTF-8 | Java | 158 | java | CategoriaInteractor.java | Java | [
{
"context": "ckage com.it.makeapp.navcat;\r\n\r\n/**\r\n * Created by Kelvin on 24/11/2017.\r\n */\r\n\r\npublic interface Categoria",
"end": 59,
"score": 0.9987777471542358,
"start": 53,
"tag": "NAME",
"value": "Kelvin"
}
] | null | [] | package com.it.makeapp.navcat;
/**
* Created by Kelvin on 24/11/2017.
*/
public interface CategoriaInteractor {
void onLoadCategories();
}
| 158 | 0.658228 | 0.607595 | 10 | 13.8 | 15.708596 | 38 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.2 | false | false | 8 |
b5a782e9e018a219328b14f6b9cfa99e2d5cbf76 | 16,535,624,125,601 | 2e807bd1927d4568d7502483f0fdcb1830a9dfc0 | /app/src/main/java/com/example/admin/bugproject/Fragments/ViewUpFragment.java | 5f08d42b5b845ca8935d9fd9f16d59729e5662f0 | [] | no_license | sontran3nd/BugProject_Many_Sample | https://github.com/sontran3nd/BugProject_Many_Sample | fe500e7a6c2512942ad2c7889ef2fdf7780d1812 | 1ebe8bc85f1aeec6297d1dfbbc3790728d316580 | refs/heads/master | 2021-05-04T19:06:01.448000 | 2017-10-11T08:34:04 | 2017-10-11T08:34:04 | 106,527,155 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.admin.bugproject.Fragments;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import com.example.admin.bugproject.Fragments.Dialog.ShowSelectionDialogFragment;
import com.example.admin.bugproject.R;
/**
* Created by Admin on 9/13/2017.
*/
public class ViewUpFragment extends Fragment{
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_view_up, container, false);
setupViews(rootView);
return rootView;
}
private void setupViews(View view)
{
Button btnShow = view.findViewById(R.id.btnshow);
btnShow.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ShowSelectionDialogFragment showSelectionDialogFragment = new ShowSelectionDialogFragment();
showSelectionDialogFragment.show(getFragmentManager(), "");
}
});
}
}
| UTF-8 | Java | 1,345 | java | ViewUpFragment.java | Java | [
{
"context": "com.example.admin.bugproject.R;\n\n/**\n * Created by Admin on 9/13/2017.\n */\n\npublic class ViewUpFragment ex",
"end": 428,
"score": 0.7688496112823486,
"start": 423,
"tag": "USERNAME",
"value": "Admin"
}
] | null | [] | package com.example.admin.bugproject.Fragments;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import com.example.admin.bugproject.Fragments.Dialog.ShowSelectionDialogFragment;
import com.example.admin.bugproject.R;
/**
* Created by Admin on 9/13/2017.
*/
public class ViewUpFragment extends Fragment{
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_view_up, container, false);
setupViews(rootView);
return rootView;
}
private void setupViews(View view)
{
Button btnShow = view.findViewById(R.id.btnshow);
btnShow.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ShowSelectionDialogFragment showSelectionDialogFragment = new ShowSelectionDialogFragment();
showSelectionDialogFragment.show(getFragmentManager(), "");
}
});
}
}
| 1,345 | 0.715242 | 0.709294 | 44 | 29.568182 | 28.904543 | 108 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.522727 | false | false | 8 |
9c0e40854cb0db3732af08522883df2310442b9f | 22,522,808,538,629 | 43aa135f1d0983b5a8a8455857931c720d8787df | /oms/web3-NewDc/plugin/web3-xbmf/java/webbroker3/mf/message/WEB3MutualOrderReferenceResponse.java | 2295dfd8ca33d9a727a6f81205937cabbb65c3a0 | [
"W3C-19980720",
"Apache-2.0",
"Apache-1.1",
"BSD-2-Clause"
] | permissive | leegine/COMS | https://github.com/leegine/COMS | d8637ee07d0d0cc83187cf216c5b423d19ce9c43 | f8d9027ca0b6f3656843d908b0c6b95600266193 | refs/heads/master | 2020-04-18T05:37:41.079000 | 2019-01-29T08:31:38 | 2019-01-29T08:31:38 | 167,285,652 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | head 1.1;
access;
symbols;
locks; strict;
comment @// @;
1.1
date 2011.03.16.03.09.27; author zhang-tengyu; state Exp;
branches;
next ;
deltatype text;
kopt kv;
permissions 666;
commitid 6004d80209d0226;
filename WEB3MutualOrderReferenceResponse.java;
desc
@@
1.1
log
@*** empty log message ***
@
text
@/**
Copyright : (ๆ ช)ๅคงๅ็ท็ ่จผๅธใฝใชใฅใผใทใงใณใทในใใ ็ฌฌไบ้จ
File Name : ๆ่ณไฟก่จๆณจๆ็
งไผใฌในใใณในใฏใฉใน(WEB3MutualOrderReferenceResponse)
Author Name : Daiwa Institute of Research
Revesion History : 2004/08/12 ้ปๅปบ (ไธญ่จ) ๆฐ่ฆไฝๆ
2004/08/23 ไบ็พ้บ (ไธญ่จ) ใฌใใฅใผ
*/
package webbroker3.mf.message;
import webbroker3.common.message.WEB3GenRequest;
import webbroker3.common.message.WEB3GenResponse;
/**
* ๆ่ณไฟก่จๆณจๆ็
งไผใฌในใใณในใฏใฉใน<BR>
*
* @@author ้ปๅปบ(ไธญ่จ)
* @@version 1.0
*/
public class WEB3MutualOrderReferenceResponse extends WEB3GenResponse
{
/**
* PTYPE
*/
public static final String PTYPE = "mutual_order_reference";
/**
* SerialVersionUID<BR>
*/
public final static long serialVersionUID = 200408121215L;
/**
* ่กจ็คบใใผใธ็ชๅท<BR>
* <BR>
* ๅฎ้ใซ่กจ็คบใใใใผใธไฝ็ฝฎใๆๅฎใ@โปๅ
้ ญใใผใธใ"1"ใจใใ<BR>
*/
public String pageIndex;
/**
* ็ทใใผใธๆฐ<BR>
*/
public String totalPages;
/**
* ็ทใฌใณใผใๆฐ<BR>
*/
public String totalRecords;
/**
* ๆณจๆๆ
ๅ ฑไธ่ฆง<BR>
*/
public WEB3MutualOrderGroup[] mutualOrderGroups;
/**
* (ๆไฟกๆณจๆ็
งไผใฌในใใณใน)<BR>
* ใใใฉใซใใณใณในใใฉใฏใฟ
* @@roseuid 40A9A62202F9
*/
public WEB3MutualOrderReferenceResponse()
{
}
/**
* ใณใณในใใฉใฏใฟใๅผๆฐใงไธใใใใใชใฏใจในใใชใใธใงใฏใใๅบใซ<BR>
* ใฌในใใณในใชใใธใงใฏใใ็ๆใใใ<BR>
*<BR>
* @@param l_request ใชใฏใจในใใชใใธใงใฏใ
*/
protected WEB3MutualOrderReferenceResponse(WEB3GenRequest l_request)
{
super(l_request);
}
}
@
| SHIFT_JIS | Java | 2,236 | java | WEB3MutualOrderReferenceResponse.java | Java | [
{
"context": "ment\t@// @;\n\n\n1.1\ndate\t2011.03.16.03.09.27;\tauthor zhang-tengyu;\tstate Exp;\nbranches;\nnext\t;\ndeltatype\ttext;\nkopt",
"end": 108,
"score": 0.9667364954948425,
"start": 96,
"tag": "USERNAME",
"value": "zhang-tengyu"
},
{
"context": "stitute of Research\nRevesion History : 2004/08/12 ้ปๅปบ (ไธญ่จ) ๆฐ่ฆไฝๆ\n 2004/08/23 ไบ็พ้บ (ไธญ่จ) ",
"end": 507,
"score": 0.9795422554016113,
"start": 505,
"tag": "NAME",
"value": "้ปๅปบ"
},
{
"context": "nse;\n\n/**\n * ๆ่ณไฟก่จๆณจๆ็
งไผใฌในใใณในใฏใฉใน<BR>\n * \n * @@author ้ปๅปบ(ไธญ่จ)\n * @@version 1.0 \n */\n\npublic class WEB3Mutua",
"end": 744,
"score": 0.9983639717102051,
"start": 742,
"tag": "NAME",
"value": "้ปๅปบ"
}
] | null | [] | head 1.1;
access;
symbols;
locks; strict;
comment @// @;
1.1
date 2011.03.16.03.09.27; author zhang-tengyu; state Exp;
branches;
next ;
deltatype text;
kopt kv;
permissions 666;
commitid 6004d80209d0226;
filename WEB3MutualOrderReferenceResponse.java;
desc
@@
1.1
log
@*** empty log message ***
@
text
@/**
Copyright : (ๆ ช)ๅคงๅ็ท็ ่จผๅธใฝใชใฅใผใทใงใณใทในใใ ็ฌฌไบ้จ
File Name : ๆ่ณไฟก่จๆณจๆ็
งไผใฌในใใณในใฏใฉใน(WEB3MutualOrderReferenceResponse)
Author Name : Daiwa Institute of Research
Revesion History : 2004/08/12 ้ปๅปบ (ไธญ่จ) ๆฐ่ฆไฝๆ
2004/08/23 ไบ็พ้บ (ไธญ่จ) ใฌใใฅใผ
*/
package webbroker3.mf.message;
import webbroker3.common.message.WEB3GenRequest;
import webbroker3.common.message.WEB3GenResponse;
/**
* ๆ่ณไฟก่จๆณจๆ็
งไผใฌในใใณในใฏใฉใน<BR>
*
* @@author ้ปๅปบ(ไธญ่จ)
* @@version 1.0
*/
public class WEB3MutualOrderReferenceResponse extends WEB3GenResponse
{
/**
* PTYPE
*/
public static final String PTYPE = "mutual_order_reference";
/**
* SerialVersionUID<BR>
*/
public final static long serialVersionUID = 200408121215L;
/**
* ่กจ็คบใใผใธ็ชๅท<BR>
* <BR>
* ๅฎ้ใซ่กจ็คบใใใใผใธไฝ็ฝฎใๆๅฎใ@โปๅ
้ ญใใผใธใ"1"ใจใใ<BR>
*/
public String pageIndex;
/**
* ็ทใใผใธๆฐ<BR>
*/
public String totalPages;
/**
* ็ทใฌใณใผใๆฐ<BR>
*/
public String totalRecords;
/**
* ๆณจๆๆ
ๅ ฑไธ่ฆง<BR>
*/
public WEB3MutualOrderGroup[] mutualOrderGroups;
/**
* (ๆไฟกๆณจๆ็
งไผใฌในใใณใน)<BR>
* ใใใฉใซใใณใณในใใฉใฏใฟ
* @@roseuid 40A9A62202F9
*/
public WEB3MutualOrderReferenceResponse()
{
}
/**
* ใณใณในใใฉใฏใฟใๅผๆฐใงไธใใใใใชใฏใจในใใชใใธใงใฏใใๅบใซ<BR>
* ใฌในใใณในใชใใธใงใฏใใ็ๆใใใ<BR>
*<BR>
* @@param l_request ใชใฏใจในใใชใใธใงใฏใ
*/
protected WEB3MutualOrderReferenceResponse(WEB3GenRequest l_request)
{
super(l_request);
}
}
@
| 2,236 | 0.618839 | 0.570099 | 103 | 16.728155 | 18.445509 | 72 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.359223 | false | false | 8 |
b5183404205c7c48cfd9f4ef2be3317645bebce9 | 29,652,454,249,169 | 0664190d32cbf20bb33aab69d23d39ef29af58af | /src/JAVACORE/threading/BasicThreadDriver.java | 3c075b6e4079bbf4a94da9222366f0bcba9dfa8e | [] | no_license | KennanObura/prep-algorithms | https://github.com/KennanObura/prep-algorithms | 930b3cdea58bc761fb56833f3a45f4025c417efa | 476d33ccc3189d9063e33d03f8b41697db741d10 | refs/heads/master | 2023-05-01T19:32:55.213000 | 2021-05-20T05:25:40 | 2021-05-20T05:25:40 | 335,482,522 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package JAVACORE.threading;
public class BasicThreadDriver {
public static void main(String[] args) throws InterruptedException {
Thread t1 = new Thread(new BasicThread("ONE"));
Thread t2 = new Thread(new BasicThread("TWO"));
Thread t3 = new Thread(new BasicThread("THREE"));
System.out.println(Thread.currentThread());
t1.start();
// t1.join();
t2.start();
t3.setPriority(Thread.MAX_PRIORITY);
// Thread.yield();
// t2.join();
System.out.println("starting two and three in any order");
t3.start();
}
}
| UTF-8 | Java | 610 | java | BasicThreadDriver.java | Java | [] | null | [] | package JAVACORE.threading;
public class BasicThreadDriver {
public static void main(String[] args) throws InterruptedException {
Thread t1 = new Thread(new BasicThread("ONE"));
Thread t2 = new Thread(new BasicThread("TWO"));
Thread t3 = new Thread(new BasicThread("THREE"));
System.out.println(Thread.currentThread());
t1.start();
// t1.join();
t2.start();
t3.setPriority(Thread.MAX_PRIORITY);
// Thread.yield();
// t2.join();
System.out.println("starting two and three in any order");
t3.start();
}
}
| 610 | 0.6 | 0.585246 | 23 | 25.52174 | 23.481482 | 72 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.565217 | false | false | 8 |
53fdf0b9440647b848a7ad6ce3fe94a25157d1a1 | 30,812,095,444,532 | 46f130dc8fa26d354517c555d52bbe0bdc8255df | /src/main/java/mekanism/common/inventory/slot/chemical/PigmentInventorySlot.java | 2b4a8d6c273d1b99efc59097aaee8157628d6562 | [
"MIT"
] | permissive | kingdevnl/Mekanism | https://github.com/kingdevnl/Mekanism | f87ae59b8b1e305e0d1057ff75701bea08962fd3 | d307eccba0533a3f7093703e446d8ce85cf03f94 | refs/heads/v10.1 | 2023-08-15T00:04:05.785000 | 2021-08-15T20:23:07 | 2021-08-15T20:23:07 | 409,283,611 | 0 | 0 | MIT | true | 2021-09-22T16:47:09 | 2021-09-22T16:47:09 | 2021-09-21T11:43:10 | 2021-09-21T21:48:20 | 104,270 | 0 | 0 | 0 | null | false | false | package mekanism.common.inventory.slot.chemical;
import java.util.Objects;
import java.util.function.Predicate;
import java.util.function.Supplier;
import javax.annotation.Nullable;
import javax.annotation.ParametersAreNonnullByDefault;
import mcp.MethodsReturnNonnullByDefault;
import mekanism.api.IContentsListener;
import mekanism.api.annotations.FieldsAreNonnullByDefault;
import mekanism.api.annotations.NonNull;
import mekanism.api.chemical.IChemicalHandler;
import mekanism.api.chemical.pigment.IPigmentHandler;
import mekanism.api.chemical.pigment.IPigmentTank;
import mekanism.api.chemical.pigment.Pigment;
import mekanism.api.chemical.pigment.PigmentStack;
import mekanism.common.capabilities.Capabilities;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
@FieldsAreNonnullByDefault
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
public class PigmentInventorySlot extends ChemicalInventorySlot<Pigment, PigmentStack> {
@Nullable
public static IPigmentHandler getCapability(ItemStack stack) {
return getCapability(stack, Capabilities.PIGMENT_HANDLER_CAPABILITY);
}
/**
* Fills the tank from this item
*/
public static PigmentInventorySlot fill(IPigmentTank pigmentTank, @Nullable IContentsListener listener, int x, int y) {
Objects.requireNonNull(pigmentTank, "Pigment tank cannot be null");
return new PigmentInventorySlot(pigmentTank, getFillExtractPredicate(pigmentTank, PigmentInventorySlot::getCapability),
stack -> fillInsertCheck(pigmentTank, getCapability(stack)), stack -> stack.getCapability(Capabilities.PIGMENT_HANDLER_CAPABILITY).isPresent(),
listener, x, y);
}
/**
* Accepts any items that can be filled with the current contents of the pigment tank, or if it is a pigment tank container and the tank is currently empty
*
* Drains the tank into this item.
*/
public static PigmentInventorySlot drain(IPigmentTank pigmentTank, @Nullable IContentsListener listener, int x, int y) {
Objects.requireNonNull(pigmentTank, "Pigment tank cannot be null");
Predicate<@NonNull ItemStack> insertPredicate = getDrainInsertPredicate(pigmentTank, PigmentInventorySlot::getCapability);
return new PigmentInventorySlot(pigmentTank, insertPredicate.negate(), insertPredicate,
stack -> stack.getCapability(Capabilities.PIGMENT_HANDLER_CAPABILITY).isPresent(), listener, x, y);
}
private PigmentInventorySlot(IPigmentTank pigmentTank, Predicate<@NonNull ItemStack> canExtract, Predicate<@NonNull ItemStack> canInsert,
Predicate<@NonNull ItemStack> validator, @Nullable IContentsListener listener, int x, int y) {
this(pigmentTank, () -> null, canExtract, canInsert, validator, listener, x, y);
}
private PigmentInventorySlot(IPigmentTank pigmentTank, Supplier<World> worldSupplier, Predicate<@NonNull ItemStack> canExtract,
Predicate<@NonNull ItemStack> canInsert, Predicate<@NonNull ItemStack> validator, @Nullable IContentsListener listener, int x, int y) {
super(pigmentTank, worldSupplier, canExtract, canInsert, validator, listener, x, y);
}
@Nullable
@Override
protected IChemicalHandler<Pigment, PigmentStack> getCapability() {
return getCapability(current);
}
} | UTF-8 | Java | 3,350 | java | PigmentInventorySlot.java | Java | [] | null | [] | package mekanism.common.inventory.slot.chemical;
import java.util.Objects;
import java.util.function.Predicate;
import java.util.function.Supplier;
import javax.annotation.Nullable;
import javax.annotation.ParametersAreNonnullByDefault;
import mcp.MethodsReturnNonnullByDefault;
import mekanism.api.IContentsListener;
import mekanism.api.annotations.FieldsAreNonnullByDefault;
import mekanism.api.annotations.NonNull;
import mekanism.api.chemical.IChemicalHandler;
import mekanism.api.chemical.pigment.IPigmentHandler;
import mekanism.api.chemical.pigment.IPigmentTank;
import mekanism.api.chemical.pigment.Pigment;
import mekanism.api.chemical.pigment.PigmentStack;
import mekanism.common.capabilities.Capabilities;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
@FieldsAreNonnullByDefault
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
public class PigmentInventorySlot extends ChemicalInventorySlot<Pigment, PigmentStack> {
@Nullable
public static IPigmentHandler getCapability(ItemStack stack) {
return getCapability(stack, Capabilities.PIGMENT_HANDLER_CAPABILITY);
}
/**
* Fills the tank from this item
*/
public static PigmentInventorySlot fill(IPigmentTank pigmentTank, @Nullable IContentsListener listener, int x, int y) {
Objects.requireNonNull(pigmentTank, "Pigment tank cannot be null");
return new PigmentInventorySlot(pigmentTank, getFillExtractPredicate(pigmentTank, PigmentInventorySlot::getCapability),
stack -> fillInsertCheck(pigmentTank, getCapability(stack)), stack -> stack.getCapability(Capabilities.PIGMENT_HANDLER_CAPABILITY).isPresent(),
listener, x, y);
}
/**
* Accepts any items that can be filled with the current contents of the pigment tank, or if it is a pigment tank container and the tank is currently empty
*
* Drains the tank into this item.
*/
public static PigmentInventorySlot drain(IPigmentTank pigmentTank, @Nullable IContentsListener listener, int x, int y) {
Objects.requireNonNull(pigmentTank, "Pigment tank cannot be null");
Predicate<@NonNull ItemStack> insertPredicate = getDrainInsertPredicate(pigmentTank, PigmentInventorySlot::getCapability);
return new PigmentInventorySlot(pigmentTank, insertPredicate.negate(), insertPredicate,
stack -> stack.getCapability(Capabilities.PIGMENT_HANDLER_CAPABILITY).isPresent(), listener, x, y);
}
private PigmentInventorySlot(IPigmentTank pigmentTank, Predicate<@NonNull ItemStack> canExtract, Predicate<@NonNull ItemStack> canInsert,
Predicate<@NonNull ItemStack> validator, @Nullable IContentsListener listener, int x, int y) {
this(pigmentTank, () -> null, canExtract, canInsert, validator, listener, x, y);
}
private PigmentInventorySlot(IPigmentTank pigmentTank, Supplier<World> worldSupplier, Predicate<@NonNull ItemStack> canExtract,
Predicate<@NonNull ItemStack> canInsert, Predicate<@NonNull ItemStack> validator, @Nullable IContentsListener listener, int x, int y) {
super(pigmentTank, worldSupplier, canExtract, canInsert, validator, listener, x, y);
}
@Nullable
@Override
protected IChemicalHandler<Pigment, PigmentStack> getCapability() {
return getCapability(current);
}
} | 3,350 | 0.769851 | 0.769851 | 68 | 48.279411 | 45.195278 | 159 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.191176 | false | false | 8 |
8499d1d3ab9bc614bd6f5b377ae37c3f14d86167 | 3,470,333,611,612 | 4a8e584fe83273e23451effb78290e7c1460ba28 | /Practice/src/java_practice/NoInputOutput.java | 21424a547ff4677bf9250fbd86541e8d6084ce5b | [] | no_license | Ritika-soni/Java-Programs | https://github.com/Ritika-soni/Java-Programs | 3922a750693046d84233aaeb97885aa4f7a9e3f7 | 3c3d00fd32502dc47b03ef9d9a02671aac59c2cb | refs/heads/main | 2023-03-05T10:46:21.875000 | 2021-02-17T19:14:22 | 2021-02-17T19:14:22 | 339,825,324 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package java_practice;
class Calculator2 {
int a,b,c;
int add() {
a=10;
b=20;
c=a+b;
return c;
}
}
public class NoInputOutput {
public static void main(String[] args) {
// TODO Auto-generated method stub
Calculator2 calc=new Calculator2();
int res=calc.add();
System.out.println(res);
}
}
| UTF-8 | Java | 314 | java | NoInputOutput.java | Java | [] | null | [] | package java_practice;
class Calculator2 {
int a,b,c;
int add() {
a=10;
b=20;
c=a+b;
return c;
}
}
public class NoInputOutput {
public static void main(String[] args) {
// TODO Auto-generated method stub
Calculator2 calc=new Calculator2();
int res=calc.add();
System.out.println(res);
}
}
| 314 | 0.652866 | 0.630573 | 22 | 13.272727 | 13.098167 | 41 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.454545 | false | false | 8 |
d31730c726b670a9982d890d6d0d1fa427bfb1f9 | 26,903,675,179,945 | 1152eaeca4fce7b4ff6c146eb8b4eeaf4093e423 | /src/org/archiviststoolkit/maintenance/utilities/SelectUtility.java | 26121e0b61eea382a40a392afe432693149ae1e9 | [] | no_license | Delux4life/AT | https://github.com/Delux4life/AT | f653a3cd3936a10465d0e2f629f3894b0cdc6762 | fd98495301403997bcb660dee63993189e0da807 | refs/heads/master | 2023-03-18T15:56:59.710000 | 2013-08-07T14:48:33 | 2013-08-07T14:48:33 | 541,844,256 | 1 | 0 | null | true | 2022-09-27T00:52:36 | 2022-09-27T00:52:36 | 2019-11-03T20:42:34 | 2013-08-07T14:49:32 | 61,224 | 0 | 0 | 0 | null | false | false | /*
* Archivists' Toolkit(TM) Copyright ยฉ 2005-2007 Regents of the University of California, New York University, & Five Colleges, Inc.
* All rights reserved.
*
* This software is free. You can redistribute it and / or modify it under the terms of the Educational Community License (ECL)
* version 1.0 (http://www.opensource.org/licenses/ecl1.php)
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ECL license for more details about permissions and limitations.
*
*
* Archivists' Toolkit(TM)
* http://www.archiviststoolkit.org
* info@archiviststoolkit.org
*
* Created by JFormDesigner on Fri May 11 13:30:03 EDT 2007
*/
package org.archiviststoolkit.maintenance.utilities;
import java.awt.event.*;
import javax.swing.*;
import com.jgoodies.forms.factories.*;
import com.jgoodies.forms.layout.*;
import org.archiviststoolkit.swing.ATBasicComponentFactory;
import org.netbeans.spi.wizard.WizardPage;
import java.util.Vector;
import java.awt.*;
public class SelectUtility extends WizardPage {
public static final String IMPORT_NOTESETC_TYPES = "Import Notes Etc. Types";
public static final String IMPORT_LOOKUP_LISTS = "Import Lookup Lists";
public static final String RESTORE_TABLE_AND_FIELD_DEFAULTS = "Restore Table and Field Defaults";
public static final String IMPORT_INLINE_TAGS = "Import Inline Tags";
public static final String ADD_NOTE_DEFAULTS_TO_REPOSITORIES = "Add Note Defaults to Repositories";
public static final String IMPORT_FIELD_EXAMPLES_AND_DEFINITIONS = "Import Field Examples and Definitions";
public static final String UPDATE_DATABASE_SCHEMA = "Update Database Schema";
public static final String RECONCILE_FIELD_DEFS_AND_EXAMPLES = "Reconcile Field Definitions and Examples";
public static final String COMPILE_JASPER_REPORT = "Compile Jasper Report";
public static final String ASSIGN_PERSISTENT_IDS = "Assign Persistent Ids";
public static final String FIX_BLANK_FIELD_LABELS = "Fix Blank Field Labels";
public SelectUtility() {
super("selUtility", "Select Utility");
initComponents();
populateUtilityList();
}
protected String validateContents(Component component, Object event) {
if (utilities.getSelectedIndex() == 0) {
return "Please select a utility to run";
}
// everything is ok
return null;
}
private void utilitiesActionPerformed() {
String selectedUtility = (String) utilities.getSelectedItem();
if (utilities.getSelectedIndex() == 0) {
utilityDescription.setText("");
} else if (selectedUtility.equals(IMPORT_NOTESETC_TYPES)) {
utilityDescription.setText("Import note types from an XML file.");
} else if (selectedUtility.equals(IMPORT_LOOKUP_LISTS)) {
utilityDescription.setText("Import lookup lists from an XML file.");
} else if (selectedUtility.equals(RESTORE_TABLE_AND_FIELD_DEFAULTS)) {
utilityDescription.setText("Restore field labels, return screen orders and search options to the AT defaults.");
} else if (selectedUtility.equals(IMPORT_INLINE_TAGS)) {
utilityDescription.setText("Import inline tag information from an XML file.");
} else if (selectedUtility.equals(ADD_NOTE_DEFAULTS_TO_REPOSITORIES)) {
utilityDescription.setText("Add any missing note defaults to repository records.");
} else if (selectedUtility.equals(IMPORT_FIELD_EXAMPLES_AND_DEFINITIONS)) {
utilityDescription.setText("Import field examples and definitions from an XML file.");
} else if (selectedUtility.equals(UPDATE_DATABASE_SCHEMA)) {
utilityDescription.setText("Update the database schema using information from the AT client.");
// } else if (selectedUtility.equals(RECONCILE_FIELD_DEFS_AND_EXAMPLES)) {
// utilityDescription.setText("Reconcile Field Definitions and Examples");
} else if (selectedUtility.equals(ASSIGN_PERSISTENT_IDS)) {
utilityDescription.setText("Assign persistent ids to resource components and notes.");
} else if (selectedUtility.equals(COMPILE_JASPER_REPORT)) {
utilityDescription.setText("Compile Jasper report definition into a .jasper file.");
} else if (selectedUtility.equals(FIX_BLANK_FIELD_LABELS)) {
utilityDescription.setText("Insert the field name as the label for all fields without labels.");
} else {
utilityDescription.setText("");
}
}
private void initComponents() {
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
// Generated using JFormDesigner non-commercial license
utilities = new JComboBox();
scrollPane1 = new JScrollPane();
utilityDescription = new JTextArea();
CellConstraints cc = new CellConstraints();
//======== this ========
setLayout(new FormLayout(
ColumnSpec.decodeSpecs("default:grow"),
new RowSpec[]{
FormFactory.DEFAULT_ROWSPEC,
FormFactory.LINE_GAP_ROWSPEC,
new RowSpec(RowSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW)
}));
//---- utilities ----
utilities.setOpaque(false);
utilities.setName("selectedUtility");
utilities.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
utilitiesActionPerformed();
}
});
add(utilities, cc.xywh(1, 1, 1, 1, CellConstraints.LEFT, CellConstraints.DEFAULT));
//======== scrollPane1 ========
{
scrollPane1.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
//---- utilityDescription ----
utilityDescription.setEditable(false);
scrollPane1.setViewportView(utilityDescription);
}
add(scrollPane1, cc.xy(1, 3));
// JFormDesigner - End of component initialization //GEN-END:initComponents
}
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
// Generated using JFormDesigner non-commercial license
private JComboBox utilities;
private JScrollPane scrollPane1;
private JTextArea utilityDescription;
// JFormDesigner - End of variables declaration //GEN-END:variables
public void populateUtilityList() {
Vector<String> returnVector = new Vector<String>();
returnVector.add("Select a utility to run");
returnVector.add(IMPORT_NOTESETC_TYPES);
returnVector.add(IMPORT_LOOKUP_LISTS);
returnVector.add(RESTORE_TABLE_AND_FIELD_DEFAULTS);
returnVector.add(IMPORT_INLINE_TAGS);
returnVector.add(ADD_NOTE_DEFAULTS_TO_REPOSITORIES);
returnVector.add(IMPORT_FIELD_EXAMPLES_AND_DEFINITIONS);
// returnVector.add(RECONCILE_FIELD_DEFS_AND_EXAMPLES);
returnVector.add(UPDATE_DATABASE_SCHEMA);
returnVector.add(FIX_BLANK_FIELD_LABELS);
// returnVector.add(ASSIGN_PERSISTENT_IDS);
returnVector.add(COMPILE_JASPER_REPORT);
utilities.setModel(new DefaultComboBoxModel(returnVector));
}
}
| WINDOWS-1252 | Java | 7,388 | java | SelectUtility.java | Java | [
{
"context": "Toolkit(TM)\n * http://www.archiviststoolkit.org\n * info@archiviststoolkit.org\n *\n * Created by JFormDesigner on Fri May 11 13:3",
"end": 712,
"score": 0.9999310374259949,
"start": 686,
"tag": "EMAIL",
"value": "info@archiviststoolkit.org"
}
] | null | [] | /*
* Archivists' Toolkit(TM) Copyright ยฉ 2005-2007 Regents of the University of California, New York University, & Five Colleges, Inc.
* All rights reserved.
*
* This software is free. You can redistribute it and / or modify it under the terms of the Educational Community License (ECL)
* version 1.0 (http://www.opensource.org/licenses/ecl1.php)
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ECL license for more details about permissions and limitations.
*
*
* Archivists' Toolkit(TM)
* http://www.archiviststoolkit.org
* <EMAIL>
*
* Created by JFormDesigner on Fri May 11 13:30:03 EDT 2007
*/
package org.archiviststoolkit.maintenance.utilities;
import java.awt.event.*;
import javax.swing.*;
import com.jgoodies.forms.factories.*;
import com.jgoodies.forms.layout.*;
import org.archiviststoolkit.swing.ATBasicComponentFactory;
import org.netbeans.spi.wizard.WizardPage;
import java.util.Vector;
import java.awt.*;
public class SelectUtility extends WizardPage {
public static final String IMPORT_NOTESETC_TYPES = "Import Notes Etc. Types";
public static final String IMPORT_LOOKUP_LISTS = "Import Lookup Lists";
public static final String RESTORE_TABLE_AND_FIELD_DEFAULTS = "Restore Table and Field Defaults";
public static final String IMPORT_INLINE_TAGS = "Import Inline Tags";
public static final String ADD_NOTE_DEFAULTS_TO_REPOSITORIES = "Add Note Defaults to Repositories";
public static final String IMPORT_FIELD_EXAMPLES_AND_DEFINITIONS = "Import Field Examples and Definitions";
public static final String UPDATE_DATABASE_SCHEMA = "Update Database Schema";
public static final String RECONCILE_FIELD_DEFS_AND_EXAMPLES = "Reconcile Field Definitions and Examples";
public static final String COMPILE_JASPER_REPORT = "Compile Jasper Report";
public static final String ASSIGN_PERSISTENT_IDS = "Assign Persistent Ids";
public static final String FIX_BLANK_FIELD_LABELS = "Fix Blank Field Labels";
public SelectUtility() {
super("selUtility", "Select Utility");
initComponents();
populateUtilityList();
}
protected String validateContents(Component component, Object event) {
if (utilities.getSelectedIndex() == 0) {
return "Please select a utility to run";
}
// everything is ok
return null;
}
private void utilitiesActionPerformed() {
String selectedUtility = (String) utilities.getSelectedItem();
if (utilities.getSelectedIndex() == 0) {
utilityDescription.setText("");
} else if (selectedUtility.equals(IMPORT_NOTESETC_TYPES)) {
utilityDescription.setText("Import note types from an XML file.");
} else if (selectedUtility.equals(IMPORT_LOOKUP_LISTS)) {
utilityDescription.setText("Import lookup lists from an XML file.");
} else if (selectedUtility.equals(RESTORE_TABLE_AND_FIELD_DEFAULTS)) {
utilityDescription.setText("Restore field labels, return screen orders and search options to the AT defaults.");
} else if (selectedUtility.equals(IMPORT_INLINE_TAGS)) {
utilityDescription.setText("Import inline tag information from an XML file.");
} else if (selectedUtility.equals(ADD_NOTE_DEFAULTS_TO_REPOSITORIES)) {
utilityDescription.setText("Add any missing note defaults to repository records.");
} else if (selectedUtility.equals(IMPORT_FIELD_EXAMPLES_AND_DEFINITIONS)) {
utilityDescription.setText("Import field examples and definitions from an XML file.");
} else if (selectedUtility.equals(UPDATE_DATABASE_SCHEMA)) {
utilityDescription.setText("Update the database schema using information from the AT client.");
// } else if (selectedUtility.equals(RECONCILE_FIELD_DEFS_AND_EXAMPLES)) {
// utilityDescription.setText("Reconcile Field Definitions and Examples");
} else if (selectedUtility.equals(ASSIGN_PERSISTENT_IDS)) {
utilityDescription.setText("Assign persistent ids to resource components and notes.");
} else if (selectedUtility.equals(COMPILE_JASPER_REPORT)) {
utilityDescription.setText("Compile Jasper report definition into a .jasper file.");
} else if (selectedUtility.equals(FIX_BLANK_FIELD_LABELS)) {
utilityDescription.setText("Insert the field name as the label for all fields without labels.");
} else {
utilityDescription.setText("");
}
}
private void initComponents() {
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
// Generated using JFormDesigner non-commercial license
utilities = new JComboBox();
scrollPane1 = new JScrollPane();
utilityDescription = new JTextArea();
CellConstraints cc = new CellConstraints();
//======== this ========
setLayout(new FormLayout(
ColumnSpec.decodeSpecs("default:grow"),
new RowSpec[]{
FormFactory.DEFAULT_ROWSPEC,
FormFactory.LINE_GAP_ROWSPEC,
new RowSpec(RowSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW)
}));
//---- utilities ----
utilities.setOpaque(false);
utilities.setName("selectedUtility");
utilities.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
utilitiesActionPerformed();
}
});
add(utilities, cc.xywh(1, 1, 1, 1, CellConstraints.LEFT, CellConstraints.DEFAULT));
//======== scrollPane1 ========
{
scrollPane1.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
//---- utilityDescription ----
utilityDescription.setEditable(false);
scrollPane1.setViewportView(utilityDescription);
}
add(scrollPane1, cc.xy(1, 3));
// JFormDesigner - End of component initialization //GEN-END:initComponents
}
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
// Generated using JFormDesigner non-commercial license
private JComboBox utilities;
private JScrollPane scrollPane1;
private JTextArea utilityDescription;
// JFormDesigner - End of variables declaration //GEN-END:variables
public void populateUtilityList() {
Vector<String> returnVector = new Vector<String>();
returnVector.add("Select a utility to run");
returnVector.add(IMPORT_NOTESETC_TYPES);
returnVector.add(IMPORT_LOOKUP_LISTS);
returnVector.add(RESTORE_TABLE_AND_FIELD_DEFAULTS);
returnVector.add(IMPORT_INLINE_TAGS);
returnVector.add(ADD_NOTE_DEFAULTS_TO_REPOSITORIES);
returnVector.add(IMPORT_FIELD_EXAMPLES_AND_DEFINITIONS);
// returnVector.add(RECONCILE_FIELD_DEFS_AND_EXAMPLES);
returnVector.add(UPDATE_DATABASE_SCHEMA);
returnVector.add(FIX_BLANK_FIELD_LABELS);
// returnVector.add(ASSIGN_PERSISTENT_IDS);
returnVector.add(COMPILE_JASPER_REPORT);
utilities.setModel(new DefaultComboBoxModel(returnVector));
}
}
| 7,369 | 0.687695 | 0.682686 | 155 | 46.658066 | 34.24625 | 132 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.645161 | false | false | 8 |
a2b6915a49301fa8f948c9f4b6d9c1f6d692cd5d | 32,641,751,517,646 | 5e1ebfac84ff6db2942860777cc4592ca1908af8 | /src/test/java/com/securepay/AppTest.java | 25d69d9df4192136ee80d896ce1d4722a41dcc02 | [] | no_license | aditissingh22/code-repository | https://github.com/aditissingh22/code-repository | de9ee69b4eb57ff52f7384b5395162230ae0d581 | a5dc9572f4702c897b4a3f459e2cfab21e5c796d | refs/heads/master | 2021-07-12T06:25:28.942000 | 2019-08-04T22:52:36 | 2019-08-04T22:52:36 | 200,102,027 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.securepay;
import java.util.ArrayList;
import java.util.Arrays;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
* Unit test for simple App.
*/
public class AppTest extends TestCase {
/**
* Create the test case
*
* @param testName
* name of the test case
*/
public AppTest(String testName) {
super(testName);
}
/**
* @return the suite of tests being tested
*/
public static Test suite() {
return new TestSuite(AppTest.class);
}
public void testApp() {
assertTrue(true);
}
@BeforeClass
public static void setUpBeforeClass() throws Exception {
System.out.println("before class");
}
@Before
public void setUp() throws Exception {
System.out.println("before");
}
@org.junit.Test
public void testLowestCostIteminEachCategory(){
System.out.println("test case lowestCostIteminEachCategory");
}
@After
public void tearDown() throws Exception {
System.out.println("after");
}
@AfterClass
public static void tearDownAfterClass() throws Exception {
System.out.println("after class");
}
}
| UTF-8 | Java | 1,417 | java | AppTest.java | Java | [] | null | [] | package com.securepay;
import java.util.ArrayList;
import java.util.Arrays;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
* Unit test for simple App.
*/
public class AppTest extends TestCase {
/**
* Create the test case
*
* @param testName
* name of the test case
*/
public AppTest(String testName) {
super(testName);
}
/**
* @return the suite of tests being tested
*/
public static Test suite() {
return new TestSuite(AppTest.class);
}
public void testApp() {
assertTrue(true);
}
@BeforeClass
public static void setUpBeforeClass() throws Exception {
System.out.println("before class");
}
@Before
public void setUp() throws Exception {
System.out.println("before");
}
@org.junit.Test
public void testLowestCostIteminEachCategory(){
System.out.println("test case lowestCostIteminEachCategory");
}
@After
public void tearDown() throws Exception {
System.out.println("after");
}
@AfterClass
public static void tearDownAfterClass() throws Exception {
System.out.println("after class");
}
}
| 1,417 | 0.619619 | 0.619619 | 66 | 19.469696 | 18.15357 | 69 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.666667 | false | false | 8 |
de8e0d0d752e09ca2dd24506504a31d7f9393cb6 | 18,614,388,283,770 | 95c49f466673952b465e19a5ee3ae6eff76bee00 | /src/main/java/com/zhihu/android/api/model/DeviceRightInfo.java | 2e365a33ca865f3c071852cc174c8169e82a30a5 | [] | no_license | Phantoms007/zhihuAPK | https://github.com/Phantoms007/zhihuAPK | 58889c399ae56b16a9160a5f48b807e02c87797e | dcdbd103436a187f9c8b4be8f71bdf7813b6d201 | refs/heads/main | 2023-01-24T01:34:18.716000 | 2020-11-25T17:14:55 | 2020-11-25T17:14:55 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.zhihu.android.api.model;
import com.fasterxml.jackson.p518a.JsonProperty;
public class DeviceRightInfo {
@JsonProperty(mo29184a = "created_at")
private int createAt;
@JsonProperty(mo29184a = "is_have_right")
private boolean isHaveRight;
public boolean isHaveRight() {
return this.isHaveRight;
}
public void setHaveRight(boolean z) {
this.isHaveRight = z;
}
public int getCreateAt() {
return this.createAt;
}
public void setCreateAt(int i) {
this.createAt = i;
}
}
| UTF-8 | Java | 562 | java | DeviceRightInfo.java | Java | [] | null | [] | package com.zhihu.android.api.model;
import com.fasterxml.jackson.p518a.JsonProperty;
public class DeviceRightInfo {
@JsonProperty(mo29184a = "created_at")
private int createAt;
@JsonProperty(mo29184a = "is_have_right")
private boolean isHaveRight;
public boolean isHaveRight() {
return this.isHaveRight;
}
public void setHaveRight(boolean z) {
this.isHaveRight = z;
}
public int getCreateAt() {
return this.createAt;
}
public void setCreateAt(int i) {
this.createAt = i;
}
}
| 562 | 0.654804 | 0.631673 | 26 | 20.615385 | 16.875282 | 48 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.307692 | false | false | 8 |
68d9f1b267214a6b127b79f92537e593c73132cd | 11,338,713,668,227 | 693a4edfa83a66d1c94b2b4472923600b9ea3615 | /src/main/java/com/github/croesch/partimana/model/filter/types/GreaterThan.java | d55d3c3af7b4f7c2e3f117f266644706eaf4218d | [] | no_license | croesch/partimana | https://github.com/croesch/partimana | b790137c9f12111e000a387deeee3b1300e72b39 | bdd1b9ec53810de0a42060e0e6b1fd9fd381c699 | refs/heads/master | 2016-09-06T14:27:07.597000 | 2014-06-29T15:17:20 | 2014-06-29T15:17:20 | 1,788,591 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.github.croesch.partimana.model.filter.types;
import com.github.croesch.partimana.i18n.Text;
/**
* Filters all integers that are greater than the given filter value.
*
* @author croesch
* @since Date: Oct 20, 2012
*/
public final class GreaterThan extends IntegerFilterType {
@Override
public String getShortDescription() {
return Text.FILTER_TYPE_GREATER_THAN.text();
}
@Override
public boolean matches(final Integer object) {
return object > getFilterValue();
}
@Override
public GreaterThan getCopy() {
final GreaterThan copy = new GreaterThan();
if (getFilterValue() != null) {
copy.setFilterValue(getFilterValue());
}
return copy;
}
}
| UTF-8 | Java | 708 | java | GreaterThan.java | Java | [
{
"context": "package com.github.croesch.partimana.model.filter.types;\n\nimport com.github.",
"end": 26,
"score": 0.9968987703323364,
"start": 19,
"tag": "USERNAME",
"value": "croesch"
},
{
"context": ".partimana.model.filter.types;\n\nimport com.github.croesch.partimana.i18n.Text;\n\n/**\n * Filters all integers",
"end": 83,
"score": 0.9964777231216431,
"start": 76,
"tag": "USERNAME",
"value": "croesch"
},
{
"context": "greater than the given filter value.\n *\n * @author croesch\n * @since Date: Oct 20, 2012\n */\npublic final cla",
"end": 201,
"score": 0.9993206858634949,
"start": 194,
"tag": "USERNAME",
"value": "croesch"
}
] | null | [] | package com.github.croesch.partimana.model.filter.types;
import com.github.croesch.partimana.i18n.Text;
/**
* Filters all integers that are greater than the given filter value.
*
* @author croesch
* @since Date: Oct 20, 2012
*/
public final class GreaterThan extends IntegerFilterType {
@Override
public String getShortDescription() {
return Text.FILTER_TYPE_GREATER_THAN.text();
}
@Override
public boolean matches(final Integer object) {
return object > getFilterValue();
}
@Override
public GreaterThan getCopy() {
final GreaterThan copy = new GreaterThan();
if (getFilterValue() != null) {
copy.setFilterValue(getFilterValue());
}
return copy;
}
}
| 708 | 0.70339 | 0.69209 | 31 | 21.838709 | 21.4673 | 69 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.258065 | false | false | 8 |
e5d7b6c7ebbcc6260e6ffcb45d52cc84e1504bd3 | 23,545,010,717,247 | bfd3b8b9f4c21803c26e367b9f1f84e8c404ec88 | /src/com/cenfotec/encryption/manager/DesEncryptionManager.java | bc6fe22ccb92988fda20b0e6a719897633bcab42 | [] | no_license | aobando123/Examen2-Encrypt | https://github.com/aobando123/Examen2-Encrypt | 2ac312fd58db9fa136178c91973fcd2b8f02fefe | 596d4312a89b3e914f3fbec801074ab40b35bd05 | refs/heads/master | 2020-03-24T12:24:45.098000 | 2018-07-29T17:05:35 | 2018-07-29T17:05:35 | 142,713,461 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.cenfotec.encryption.manager;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Base64;
import java.util.Base64.Encoder;
import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.DESKeySpec;
public class DesEncryptionManager extends EncryptionManager{
private final int KEYSIZE = 8;
public DesEncryptionManager() {
Path = "C:/encrypt/des/";
new File("C:\\encrypt\\des").mkdirs();
}
@Override
public void createKey(String name) throws Exception {
byte key[] = generatedSequenceOfBytes();
writeBytesFile(name,key,KEY_EXTENSION);
}
@Override
public void encryptMessage(String messageName, String message, String keyName) throws Exception {
byte[] key = readKeyFile(keyName);
Cipher cipher = getCipher(key, Cipher.ENCRYPT_MODE);
byte[] encryptedData = cipher.doFinal(message.getBytes(StandardCharsets.UTF_8));
Encoder oneEncoder = Base64.getEncoder();
encryptedData = oneEncoder.encode(encryptedData);
writeBytesFile(messageName,encryptedData,MESSAGE_ENCRYPT_EXTENSION);
}
@Override
public String decryptMessage(String messageName, String keyName) throws Exception {
byte[] key = readKeyFile(keyName);
byte[] encryptedMessage = readMessageFile(messageName);
Cipher cipher = getCipher(key, Cipher.DECRYPT_MODE);
byte[] DecryptedData = cipher.doFinal(encryptedMessage);
String message = new String(DecryptedData, StandardCharsets.UTF_8);
return message;
}
private Cipher getCipher(byte[] key, int cipherMode) throws Exception {
Cipher cipher = Cipher.getInstance("DES");
DESKeySpec desKey = new DESKeySpec(key);
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES");
SecretKey securekey = keyFactory.generateSecret(desKey);
cipher.init(cipherMode, securekey);
return cipher;
}
private byte[] readKeyFile(String keyName) throws FileNotFoundException, IOException {
BufferedReader br = new BufferedReader(new FileReader(Path + keyName + KEY_EXTENSION));
String everything = "";
try {
StringBuilder sb = new StringBuilder();
String line = br.readLine();
while (line != null) {
sb.append(line);
line = br.readLine();
}
everything = sb.toString();
} finally {
br.close();
}
return everything.getBytes(StandardCharsets.UTF_8);
}
private byte[] generatedSequenceOfBytes() throws Exception {
StringBuilder randomkey = new StringBuilder();
for (int i = 0;i < KEYSIZE;i++){
randomkey.append(Integer.parseInt(Double.toString((Math.random()+0.1)*1000).substring(0,2)));
}
return randomkey.toString().getBytes("UTF-8");
}
}
| UTF-8 | Java | 2,823 | java | DesEncryptionManager.java | Java | [] | null | [] | package com.cenfotec.encryption.manager;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Base64;
import java.util.Base64.Encoder;
import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.DESKeySpec;
public class DesEncryptionManager extends EncryptionManager{
private final int KEYSIZE = 8;
public DesEncryptionManager() {
Path = "C:/encrypt/des/";
new File("C:\\encrypt\\des").mkdirs();
}
@Override
public void createKey(String name) throws Exception {
byte key[] = generatedSequenceOfBytes();
writeBytesFile(name,key,KEY_EXTENSION);
}
@Override
public void encryptMessage(String messageName, String message, String keyName) throws Exception {
byte[] key = readKeyFile(keyName);
Cipher cipher = getCipher(key, Cipher.ENCRYPT_MODE);
byte[] encryptedData = cipher.doFinal(message.getBytes(StandardCharsets.UTF_8));
Encoder oneEncoder = Base64.getEncoder();
encryptedData = oneEncoder.encode(encryptedData);
writeBytesFile(messageName,encryptedData,MESSAGE_ENCRYPT_EXTENSION);
}
@Override
public String decryptMessage(String messageName, String keyName) throws Exception {
byte[] key = readKeyFile(keyName);
byte[] encryptedMessage = readMessageFile(messageName);
Cipher cipher = getCipher(key, Cipher.DECRYPT_MODE);
byte[] DecryptedData = cipher.doFinal(encryptedMessage);
String message = new String(DecryptedData, StandardCharsets.UTF_8);
return message;
}
private Cipher getCipher(byte[] key, int cipherMode) throws Exception {
Cipher cipher = Cipher.getInstance("DES");
DESKeySpec desKey = new DESKeySpec(key);
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES");
SecretKey securekey = keyFactory.generateSecret(desKey);
cipher.init(cipherMode, securekey);
return cipher;
}
private byte[] readKeyFile(String keyName) throws FileNotFoundException, IOException {
BufferedReader br = new BufferedReader(new FileReader(Path + keyName + KEY_EXTENSION));
String everything = "";
try {
StringBuilder sb = new StringBuilder();
String line = br.readLine();
while (line != null) {
sb.append(line);
line = br.readLine();
}
everything = sb.toString();
} finally {
br.close();
}
return everything.getBytes(StandardCharsets.UTF_8);
}
private byte[] generatedSequenceOfBytes() throws Exception {
StringBuilder randomkey = new StringBuilder();
for (int i = 0;i < KEYSIZE;i++){
randomkey.append(Integer.parseInt(Double.toString((Math.random()+0.1)*1000).substring(0,2)));
}
return randomkey.toString().getBytes("UTF-8");
}
}
| 2,823 | 0.736096 | 0.729012 | 92 | 29.684782 | 26.291811 | 98 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.902174 | false | false | 8 |
88960ac5e49c5fc2a16253af21d3a4eb8c25a545 | 10,299,331,625,481 | 2074cb7783f6aa1fee75e45fd0613210d0336131 | /src/main/java/com/sourcegraph/project/RepoInfo.java | e4b0875ef20c03f9cb21781d1682e9f4bd83ce66 | [
"Apache-2.0"
] | permissive | sourcegraph/sourcegraph-jetbrains | https://github.com/sourcegraph/sourcegraph-jetbrains | c04636d512b7be5627d829da5a59c8163029b49c | 854718e8cf93d7a8fac29f32917a149e5c9380c2 | refs/heads/main | 2023-07-25T00:42:51.928000 | 2023-07-18T13:59:11 | 2023-07-18T13:59:11 | 90,224,626 | 40 | 15 | Apache-2.0 | false | 2023-07-18T13:57:53 | 2017-05-04T05:23:20 | 2023-03-22T19:17:42 | 2023-07-18T13:57:52 | 273 | 35 | 14 | 9 | Java | false | false | package com.sourcegraph.project;
public class RepoInfo {
public String fileRel;
public String remoteURL;
public String branch;
public RepoInfo(String sFileRel, String sRemoteURL, String sBranch) {
fileRel = sFileRel;
remoteURL = sRemoteURL;
branch = sBranch;
}
}
| UTF-8 | Java | 309 | java | RepoInfo.java | Java | [] | null | [] | package com.sourcegraph.project;
public class RepoInfo {
public String fileRel;
public String remoteURL;
public String branch;
public RepoInfo(String sFileRel, String sRemoteURL, String sBranch) {
fileRel = sFileRel;
remoteURL = sRemoteURL;
branch = sBranch;
}
}
| 309 | 0.676375 | 0.676375 | 13 | 22.76923 | 18.745888 | 73 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.692308 | false | false | 8 |
24535024c7e1caaa407aa7db1b9523b7886906c1 | 30,073,361,075,965 | 807788d5dc951487d769d774493a3ae0b12bc7e9 | /pgenetica/src/genetica/GeneticAlgorithm.java | 5d8ab18771406d36e1a6aa1c51cd5ce39cdfa712 | [] | no_license | ealonsop/genetica | https://github.com/ealonsop/genetica | 52be9e86b610f249bd4b942ce9e7c60bc068ca49 | 3348454f26a121d35e05c5abf7efa4845ad7bf8f | refs/heads/master | 2021-01-15T09:08:47.910000 | 2016-08-05T13:06:07 | 2016-08-05T13:06:07 | 55,427,054 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* 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 genetica;
/**
*
* @author ealonso
*/
public interface GeneticAlgorithm {
public Population populate();
}
| UTF-8 | Java | 306 | java | GeneticAlgorithm.java | Java | [
{
"context": "e editor.\n */\npackage genetica;\n\n/**\n *\n * @author ealonso\n */\npublic interface GeneticAlgorithm {\n publi",
"end": 229,
"score": 0.9994351863861084,
"start": 222,
"tag": "USERNAME",
"value": "ealonso"
}
] | null | [] | /*
* 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 genetica;
/**
*
* @author ealonso
*/
public interface GeneticAlgorithm {
public Population populate();
}
| 306 | 0.718954 | 0.718954 | 14 | 20.857143 | 23.730202 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.357143 | false | false | 8 |
20c37f38a12b9ef6cf63ccd728dda09727674020 | 7,834,020,367,308 | 07efa03a2f3bdaecb69c2446a01ea386c63f26df | /eclipse_jee/Games/Solataire/src/com/idc/solataire/MovesTable.java | 8ed23fda7f43d213486950dde73d326fed0cb1a0 | [] | no_license | johnvincentio/repo-java | https://github.com/johnvincentio/repo-java | cc21e2b6e4d2bed038e2f7138bb8a269dfabeb2c | 1824797cb4e0c52e0945248850e40e20b09effdd | refs/heads/master | 2022-07-08T18:14:36.378000 | 2020-01-29T20:55:49 | 2020-01-29T20:55:49 | 84,679,095 | 0 | 0 | null | false | 2022-06-30T20:11:56 | 2017-03-11T20:51:46 | 2020-01-29T20:58:35 | 2022-06-30T20:11:55 | 172,670 | 0 | 0 | 2 | Java | false | false | package com.idc.solataire;
import com.idc.trace.Debug;
public class MovesTable {
final static int MAXMOVES = 14;
private int CurrentEntry = -1;
private Move movelist[] = new Move[MAXMOVES];
public MovesTable() {for (int i=0; i<MAXMOVES; i++) {movelist[i] = new Move();}}
private int getCurrentEntry() {return CurrentEntry;}
public boolean isFinished() {return (CurrentEntry+3 > MAXMOVES);}
java.util.Vector vBadMovesList = new java.util.Vector (2500,250);
public boolean addMove(int x1, int y1, int x2, int y2, int x3, int y3, int move) {
CurrentEntry++;
movelist[CurrentEntry].setXTo(x1);
movelist[CurrentEntry].setYTo(y1);
movelist[CurrentEntry].setXAdj(x2);
movelist[CurrentEntry].setYAdj(y2);
movelist[CurrentEntry].setXFrom(x3);
movelist[CurrentEntry].setYFrom(y3);
movelist[CurrentEntry].setMoveNumber(move);
if (isListInBadList()) {
Debug.println("Cannot Add "+getCurrentEntry()+" (F,A,T), Move: "+movelist[CurrentEntry].stringMove());
removeCurrentMove();
return false;
}
Debug.println("Adding "+getCurrentEntry()+" (From, Adj, To), Move: "+movelist[CurrentEntry].stringMove());
return true;
}
public Peg getFromPeg() {return new Peg(movelist[CurrentEntry].getXFrom(),movelist[CurrentEntry].getYFrom());}
public Peg getAdjPeg() {return new Peg(movelist[CurrentEntry].getXAdj(),movelist[CurrentEntry].getYAdj());}
public Peg getToPeg() {return new Peg(movelist[CurrentEntry].getXTo(),movelist[CurrentEntry].getYTo());}
public int getCurrentMoveNumber() {return movelist[CurrentEntry].getMoveNumber();}
public void deleteLastMove () {
Debug.println("Deleting CurrentEntry="+(CurrentEntry)+": "+movelist[CurrentEntry].stringMove());
addFailedList();
listAllFailedLists("Before delete move");
removeCurrentMove();
}
public void removeCurrentMove() {
movelist[CurrentEntry].setInit();
CurrentEntry--;
}
public boolean isOkDeleteLastMove() {return (CurrentEntry > 0);}
public void printMovesTable (String msg) {
Debug.println(">>> printMovesTable; CurrentEntry="+(CurrentEntry)+" :"+msg);
for (int i=0;i<=CurrentEntry; i++) {
Debug.println((i)+": (F,A,T): "+movelist[i].stringMove());
}
Debug.println("<<< printMovesTable");
}
private class Move {
private int xFrom;
private int yFrom;
private int xAdj;
private int yAdj;
private int xTo;
private int yTo;
private int moveNumber;
public Move() {setInit();}
public void setInit() {xFrom = yFrom = xAdj = yAdj = xTo = yTo = moveNumber = 0;}
public void setXFrom (int i) {xFrom = i;}
public void setYFrom (int i) {yFrom = i;}
public void setXAdj (int i) {xAdj = i;}
public void setYAdj (int i) {yAdj = i;}
public void setXTo (int i) {xTo = i;}
public void setYTo (int i) {yTo = i;}
private void setMoveNumber (int i) {moveNumber = i;}
public int getXFrom() {return xFrom;}
public int getYFrom() {return yFrom;}
public int getXAdj() {return xAdj;}
public int getYAdj() {return yAdj;}
public int getXTo() {return xTo;}
public int getYTo() {return yTo;}
private int getMoveNumber() {return moveNumber;}
/*
public Peg getFromPeg() {return new Peg(xFrom,yFrom);}
public Peg getAdjPeg() {return new Peg(xAdj,yAdj);}
public Peg getToPeg() {return new Peg(xTo,yTo);}
*/
public String stringMove() {
String str = "(" + xFrom + "," + yFrom + "), (" + xAdj + "," + yAdj +
") ,(" + xTo + "," + yTo + ") ,"+moveNumber;
return str;
}
}
private class ItemsTable {
private int ItemEntry;
private Item itemlist[];
private ItemsTable () {
ItemEntry = CurrentEntry;
itemlist = new Item[ItemEntry+1];
for (int i=0; i<=ItemEntry; i++) {
itemlist[i] = new Item(movelist[i].getXFrom(),movelist[i].getYFrom(),
movelist[i].getXTo(),movelist[i].getYTo(),
movelist[i].getMoveNumber());
}
}
public int getItemsEntry() {return ItemEntry;}
private class Item {
private int xFrom;
private int yFrom;
private int xTo;
private int yTo;
int move;
private Item (int xFrom, int yFrom, int xTo, int yTo, int move) {
this.xFrom = xFrom;
this.yFrom = yFrom;
this.xTo = xTo;
this.yTo = yTo;
this.move = move;
}
public int getXFrom() {return xFrom;}
public int getYFrom() {return yFrom;}
public int getXTo() {return xTo;}
public int getYTo() {return yTo;}
public int getMove() {return move;}
public String stringItem() {
String str = "(" + xFrom + "," + yFrom + ") ,(" + xTo + "," + yTo + ") ,"+move;
return str;
}
}
}
public void addFailedList () {
ItemsTable mTable;
if (CurrentEntry >= 0 && CurrentEntry < MAXMOVES) {
Debug.println("Adding to FailedList; CurrentEntry="+(CurrentEntry));
mTable = new ItemsTable();
vBadMovesList.addElement(mTable);
}
}
public void listAllFailedLists(String msg) {
ItemsTable lTable;
int nItems = vBadMovesList.size();
Debug.println(">>> Listing failed moves lists; Total = "+nItems);
Debug.println(msg);
for (int i=0; i<nItems; i++) {
lTable = (ItemsTable) vBadMovesList.elementAt(i);
Debug.println("Listing failed moves list: "+i);
for (int j=0; j<=lTable.getItemsEntry(); j++) {
Debug.println(j+": "+lTable.itemlist[j].stringItem());
}
Debug.println("Listed failed moves list");
}
Debug.println("<<<Listing failed moves lists;");
}
public boolean isListInBadList() {
boolean bFound = false;
ItemsTable lTable;
int nItems = vBadMovesList.size();
Debug.println(">>> isListInBadList; Total = "+nItems);
for (int i=0; i<nItems; i++) {
lTable = (ItemsTable) vBadMovesList.elementAt(i);
Debug.println("Checking moves set #"+i);
if (compareLists(lTable)) {
System.out.println("Found in badList");
bFound = true;
break;
}
}
Debug.println("<<< isListInBadList; Found = "+bFound);
return bFound;
}
private boolean compareLists (ItemsTable lTable) {
int nItems = lTable.getItemsEntry();
Debug.println("CompareLists: CurrentEntry "+CurrentEntry+" nItems "+nItems);
if (nItems != CurrentEntry) return false;
for (int i=0; i<=nItems; i++) {
if (lTable.itemlist[i].getXFrom() != movelist[i].getXFrom()) return false;
if (lTable.itemlist[i].getYFrom() != movelist[i].getYFrom()) return false;
if (lTable.itemlist[i].getXTo() != movelist[i].getXTo()) return false;
if (lTable.itemlist[i].getYTo() != movelist[i].getYTo()) return false;
if (lTable.itemlist[i].getMove() != movelist[i].getMoveNumber()) return false;
}
return true;
}
}
| UTF-8 | Java | 6,448 | java | MovesTable.java | Java | [] | null | [] | package com.idc.solataire;
import com.idc.trace.Debug;
public class MovesTable {
final static int MAXMOVES = 14;
private int CurrentEntry = -1;
private Move movelist[] = new Move[MAXMOVES];
public MovesTable() {for (int i=0; i<MAXMOVES; i++) {movelist[i] = new Move();}}
private int getCurrentEntry() {return CurrentEntry;}
public boolean isFinished() {return (CurrentEntry+3 > MAXMOVES);}
java.util.Vector vBadMovesList = new java.util.Vector (2500,250);
public boolean addMove(int x1, int y1, int x2, int y2, int x3, int y3, int move) {
CurrentEntry++;
movelist[CurrentEntry].setXTo(x1);
movelist[CurrentEntry].setYTo(y1);
movelist[CurrentEntry].setXAdj(x2);
movelist[CurrentEntry].setYAdj(y2);
movelist[CurrentEntry].setXFrom(x3);
movelist[CurrentEntry].setYFrom(y3);
movelist[CurrentEntry].setMoveNumber(move);
if (isListInBadList()) {
Debug.println("Cannot Add "+getCurrentEntry()+" (F,A,T), Move: "+movelist[CurrentEntry].stringMove());
removeCurrentMove();
return false;
}
Debug.println("Adding "+getCurrentEntry()+" (From, Adj, To), Move: "+movelist[CurrentEntry].stringMove());
return true;
}
public Peg getFromPeg() {return new Peg(movelist[CurrentEntry].getXFrom(),movelist[CurrentEntry].getYFrom());}
public Peg getAdjPeg() {return new Peg(movelist[CurrentEntry].getXAdj(),movelist[CurrentEntry].getYAdj());}
public Peg getToPeg() {return new Peg(movelist[CurrentEntry].getXTo(),movelist[CurrentEntry].getYTo());}
public int getCurrentMoveNumber() {return movelist[CurrentEntry].getMoveNumber();}
public void deleteLastMove () {
Debug.println("Deleting CurrentEntry="+(CurrentEntry)+": "+movelist[CurrentEntry].stringMove());
addFailedList();
listAllFailedLists("Before delete move");
removeCurrentMove();
}
public void removeCurrentMove() {
movelist[CurrentEntry].setInit();
CurrentEntry--;
}
public boolean isOkDeleteLastMove() {return (CurrentEntry > 0);}
public void printMovesTable (String msg) {
Debug.println(">>> printMovesTable; CurrentEntry="+(CurrentEntry)+" :"+msg);
for (int i=0;i<=CurrentEntry; i++) {
Debug.println((i)+": (F,A,T): "+movelist[i].stringMove());
}
Debug.println("<<< printMovesTable");
}
private class Move {
private int xFrom;
private int yFrom;
private int xAdj;
private int yAdj;
private int xTo;
private int yTo;
private int moveNumber;
public Move() {setInit();}
public void setInit() {xFrom = yFrom = xAdj = yAdj = xTo = yTo = moveNumber = 0;}
public void setXFrom (int i) {xFrom = i;}
public void setYFrom (int i) {yFrom = i;}
public void setXAdj (int i) {xAdj = i;}
public void setYAdj (int i) {yAdj = i;}
public void setXTo (int i) {xTo = i;}
public void setYTo (int i) {yTo = i;}
private void setMoveNumber (int i) {moveNumber = i;}
public int getXFrom() {return xFrom;}
public int getYFrom() {return yFrom;}
public int getXAdj() {return xAdj;}
public int getYAdj() {return yAdj;}
public int getXTo() {return xTo;}
public int getYTo() {return yTo;}
private int getMoveNumber() {return moveNumber;}
/*
public Peg getFromPeg() {return new Peg(xFrom,yFrom);}
public Peg getAdjPeg() {return new Peg(xAdj,yAdj);}
public Peg getToPeg() {return new Peg(xTo,yTo);}
*/
public String stringMove() {
String str = "(" + xFrom + "," + yFrom + "), (" + xAdj + "," + yAdj +
") ,(" + xTo + "," + yTo + ") ,"+moveNumber;
return str;
}
}
private class ItemsTable {
private int ItemEntry;
private Item itemlist[];
private ItemsTable () {
ItemEntry = CurrentEntry;
itemlist = new Item[ItemEntry+1];
for (int i=0; i<=ItemEntry; i++) {
itemlist[i] = new Item(movelist[i].getXFrom(),movelist[i].getYFrom(),
movelist[i].getXTo(),movelist[i].getYTo(),
movelist[i].getMoveNumber());
}
}
public int getItemsEntry() {return ItemEntry;}
private class Item {
private int xFrom;
private int yFrom;
private int xTo;
private int yTo;
int move;
private Item (int xFrom, int yFrom, int xTo, int yTo, int move) {
this.xFrom = xFrom;
this.yFrom = yFrom;
this.xTo = xTo;
this.yTo = yTo;
this.move = move;
}
public int getXFrom() {return xFrom;}
public int getYFrom() {return yFrom;}
public int getXTo() {return xTo;}
public int getYTo() {return yTo;}
public int getMove() {return move;}
public String stringItem() {
String str = "(" + xFrom + "," + yFrom + ") ,(" + xTo + "," + yTo + ") ,"+move;
return str;
}
}
}
public void addFailedList () {
ItemsTable mTable;
if (CurrentEntry >= 0 && CurrentEntry < MAXMOVES) {
Debug.println("Adding to FailedList; CurrentEntry="+(CurrentEntry));
mTable = new ItemsTable();
vBadMovesList.addElement(mTable);
}
}
public void listAllFailedLists(String msg) {
ItemsTable lTable;
int nItems = vBadMovesList.size();
Debug.println(">>> Listing failed moves lists; Total = "+nItems);
Debug.println(msg);
for (int i=0; i<nItems; i++) {
lTable = (ItemsTable) vBadMovesList.elementAt(i);
Debug.println("Listing failed moves list: "+i);
for (int j=0; j<=lTable.getItemsEntry(); j++) {
Debug.println(j+": "+lTable.itemlist[j].stringItem());
}
Debug.println("Listed failed moves list");
}
Debug.println("<<<Listing failed moves lists;");
}
public boolean isListInBadList() {
boolean bFound = false;
ItemsTable lTable;
int nItems = vBadMovesList.size();
Debug.println(">>> isListInBadList; Total = "+nItems);
for (int i=0; i<nItems; i++) {
lTable = (ItemsTable) vBadMovesList.elementAt(i);
Debug.println("Checking moves set #"+i);
if (compareLists(lTable)) {
System.out.println("Found in badList");
bFound = true;
break;
}
}
Debug.println("<<< isListInBadList; Found = "+bFound);
return bFound;
}
private boolean compareLists (ItemsTable lTable) {
int nItems = lTable.getItemsEntry();
Debug.println("CompareLists: CurrentEntry "+CurrentEntry+" nItems "+nItems);
if (nItems != CurrentEntry) return false;
for (int i=0; i<=nItems; i++) {
if (lTable.itemlist[i].getXFrom() != movelist[i].getXFrom()) return false;
if (lTable.itemlist[i].getYFrom() != movelist[i].getYFrom()) return false;
if (lTable.itemlist[i].getXTo() != movelist[i].getXTo()) return false;
if (lTable.itemlist[i].getYTo() != movelist[i].getYTo()) return false;
if (lTable.itemlist[i].getMove() != movelist[i].getMoveNumber()) return false;
}
return true;
}
}
| 6,448 | 0.671681 | 0.666408 | 182 | 34.42857 | 25.4436 | 111 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.06044 | false | false | 8 |
d39fde204f699e6d7c6a2e1d89477ce70f126329 | 26,869,315,421,760 | 514f16b018bb0803274cfbea54a35b8ae0089e51 | /app/src/main/java/com/raventech/antiscam/blocker/model/Setting.java | 0044d281199fd4148dceca055822e7d47fcb620d | [] | no_license | dionisior777/antiscam | https://github.com/dionisior777/antiscam | db8abc5ff44ac4fe359579b796542f3043f747e8 | 2827c488ddb58cebb3b54ec12aec18a78b35866f | refs/heads/master | 2018-02-08T06:37:46.653000 | 2017-07-08T17:53:55 | 2017-07-08T17:53:55 | 96,447,117 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.raventech.antiscam.blocker.model;
public class Setting {
}
| UTF-8 | Java | 74 | java | Setting.java | Java | [] | null | [] | package com.raventech.antiscam.blocker.model;
public class Setting {
}
| 74 | 0.77027 | 0.77027 | 6 | 11.333333 | 17.026123 | 45 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.166667 | false | false | 8 |
71d2dce2c004f92b6d2fd0aa0e86fd51945000d6 | 20,753,281,990,600 | ff61b338bb849f46322572f1cd062c0bdb7476ba | /lavoice/src/com/lavoice/service/RegistrationServiceImpl.java | 303b92517df12de8bd01724d141df88da165a5a9 | [] | no_license | srvkrk/lavoicePollDetailView | https://github.com/srvkrk/lavoicePollDetailView | df916815da77cf57b1b770c78e070ab6dead100a | a35b34f17ea9dc7050b3539ab2bdd3375a6cad5a | refs/heads/master | 2020-03-14T11:17:15.086000 | 2018-04-30T11:17:58 | 2018-04-30T11:17:58 | 131,587,582 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.lavoice.service;
import java.math.BigInteger;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.util.Base64;
import java.util.HashMap;
import java.util.Map;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.PBEKeySpec;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
import org.apache.commons.lang3.text.StrSubstitutor;
import org.json.JSONException;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.stereotype.Service;
import com.lavoice.json.response.RegistrationJsonResponse;
import com.lavoice.bean.LoginResponse;
import com.lavoice.bean.RegistrationRequest;
import com.lavoice.bean.RegistrationResponse;
import com.lavoice.dao.LoginDao;
import com.lavoice.dao.RegistrationDao;
import com.lavoice.exception.ExceptionHandeler;
@Service("regService")
public class RegistrationServiceImpl implements RegistrationService {
private static String block;
@Autowired
public ExceptionHandeler exp;
@Autowired
RegistrationDao userDao;
@Autowired
LoginDao loginDao;
@Autowired
public JavaMailSender emailSender;
@Autowired
public SimpleMailMessage template;
public String insertUser(RegistrationRequest user) {
RegistrationJsonResponse body = new RegistrationJsonResponse();
try {
LoginResponse loginResponse = loginDao.find(user.getUsername());
if(loginResponse==null) {
/*Start of password Encryption*/
String password = user.getPassword();
int iterations = getRandomInteger(9999, 99999);
char[] chars = password.toCharArray();
byte[] salt = getSalt();
PBEKeySpec spec = new PBEKeySpec(chars, salt, iterations, 64 * 8);
SecretKeyFactory skf = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1");
byte[] hash = skf.generateSecret(spec).getEncoded();
String generatedSecuredPasswordHash = iterations + ":" + toHex(salt) + ":" + toHex(hash);
user.setPassword(generatedSecuredPasswordHash);
/*End of password Encryption*/
RegistrationResponse userBack = userDao.insertUser(user);
String mailSubject ="Verify E-mail Address (LAVOICE)";
String customer_name=userBack.getFirstname()+" "+userBack.getLastname();
String verify_mailLink="{" +
"\"id\":\"" + userBack.getId() + '\"' +
",\"username\":\"" + userBack.getUsername() + '\"' +
"}";
String encodedString = Base64.getEncoder().encodeToString(verify_mailLink.getBytes());
sendSimpleMessageUsingTemplate(userBack.getUsername(), mailSubject, template, customer_name, encodedString);
body.setResponseMessage(userBack);
return body.getResponseMessage();
}
else {
body.setResponseError("Account Already Exists");
return body.getResponseMessage();
}
}catch(Exception e){
block="reg Service";
exp.checkException(e,block);
body.setResponseError(e.toString());
return body.getResponseMessage();
}
}
public String verifyMail(String mailLink) {
String response="";
byte[] decodedBytes = Base64.getDecoder().decode(mailLink);
String decodedString = new String(decodedBytes);
System.out.println(decodedString);
try {
JSONObject jsonObj = new JSONObject(decodedString);
userDao.verifyUser(jsonObj.getString("id"), jsonObj.getString("username"));
response="Success";
} catch (JSONException e) {
block="reg Service mail verify";
exp.checkException(e,block);
response=e.toString();
}
return response;
}
private static int getRandomInteger(int maximum, int minimum){
return ((int) (Math.random()*(maximum - minimum))) + minimum;
}
private void sendSimpleMessageUsingTemplate(String to,
String subject,
SimpleMailMessage template,
String customer_name, String verify_mailLink) {
System.out.println( "From Service SimpleMessageUsingTemplate are set");
try {
Map<String, String> valuesMap = new HashMap<String, String>();
valuesMap.put("customer_name", customer_name);
valuesMap.put("verify_mailLink", verify_mailLink);
StrSubstitutor sub = new StrSubstitutor(valuesMap);
String text = sub.replace(template.getText());
MimeMessage message = emailSender.createMimeMessage();
message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(to));
message.setSubject(subject);
message.setContent(text,"text/html");
emailSender.send(message);
} catch (MessagingException e) {
e.printStackTrace();
}
}
private static byte[] getSalt() throws NoSuchAlgorithmException
{
SecureRandom sr = SecureRandom.getInstance("SHA1PRNG");
byte[] salt = new byte[16];
sr.nextBytes(salt);
return salt;
}
private static String toHex(byte[] array) throws NoSuchAlgorithmException
{
BigInteger bi = new BigInteger(1, array);
String hex = bi.toString(16);
int paddingLength = (array.length * 2) - hex.length();
if(paddingLength > 0)
{
return String.format("%0" +paddingLength + "d", 0) + hex;
}else{
return hex;
}
}
}
| UTF-8 | Java | 5,648 | java | RegistrationServiceImpl.java | Java | [
{
"context": "t of password Encryption*/\r\n\t\t\t String password = user.getPassword();\r\n\t\t\t \r\n\t\t\t int iterations = getRandomInteger(9",
"end": 1794,
"score": 0.9932246804237366,
"start": 1778,
"tag": "PASSWORD",
"value": "user.getPassword"
},
{
"context": "retKeyFactory skf = SecretKeyFactory.getInstance(\"PBKDF2WithHmacSHA1\");\r\n\t\t byte[] hash = skf.generateSecret(spec)",
"end": 2104,
"score": 0.8354894518852234,
"start": 2086,
"tag": "KEY",
"value": "PBKDF2WithHmacSHA1"
},
{
"context": "lt) + \":\" + toHex(hash);\r\n\t\t user.setPassword(generatedSecuredPasswordHash);\r\n\t\t\t /*End of password Encryption*/\r\n\t\t\t \r\n\t\t\t ",
"end": 2332,
"score": 0.9424793124198914,
"start": 2304,
"tag": "PASSWORD",
"value": "generatedSecuredPasswordHash"
}
] | null | [] | package com.lavoice.service;
import java.math.BigInteger;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.util.Base64;
import java.util.HashMap;
import java.util.Map;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.PBEKeySpec;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
import org.apache.commons.lang3.text.StrSubstitutor;
import org.json.JSONException;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.stereotype.Service;
import com.lavoice.json.response.RegistrationJsonResponse;
import com.lavoice.bean.LoginResponse;
import com.lavoice.bean.RegistrationRequest;
import com.lavoice.bean.RegistrationResponse;
import com.lavoice.dao.LoginDao;
import com.lavoice.dao.RegistrationDao;
import com.lavoice.exception.ExceptionHandeler;
@Service("regService")
public class RegistrationServiceImpl implements RegistrationService {
private static String block;
@Autowired
public ExceptionHandeler exp;
@Autowired
RegistrationDao userDao;
@Autowired
LoginDao loginDao;
@Autowired
public JavaMailSender emailSender;
@Autowired
public SimpleMailMessage template;
public String insertUser(RegistrationRequest user) {
RegistrationJsonResponse body = new RegistrationJsonResponse();
try {
LoginResponse loginResponse = loginDao.find(user.getUsername());
if(loginResponse==null) {
/*Start of password Encryption*/
String password = <PASSWORD>();
int iterations = getRandomInteger(9999, 99999);
char[] chars = password.toCharArray();
byte[] salt = getSalt();
PBEKeySpec spec = new PBEKeySpec(chars, salt, iterations, 64 * 8);
SecretKeyFactory skf = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1");
byte[] hash = skf.generateSecret(spec).getEncoded();
String generatedSecuredPasswordHash = iterations + ":" + toHex(salt) + ":" + toHex(hash);
user.setPassword(<PASSWORD>);
/*End of password Encryption*/
RegistrationResponse userBack = userDao.insertUser(user);
String mailSubject ="Verify E-mail Address (LAVOICE)";
String customer_name=userBack.getFirstname()+" "+userBack.getLastname();
String verify_mailLink="{" +
"\"id\":\"" + userBack.getId() + '\"' +
",\"username\":\"" + userBack.getUsername() + '\"' +
"}";
String encodedString = Base64.getEncoder().encodeToString(verify_mailLink.getBytes());
sendSimpleMessageUsingTemplate(userBack.getUsername(), mailSubject, template, customer_name, encodedString);
body.setResponseMessage(userBack);
return body.getResponseMessage();
}
else {
body.setResponseError("Account Already Exists");
return body.getResponseMessage();
}
}catch(Exception e){
block="reg Service";
exp.checkException(e,block);
body.setResponseError(e.toString());
return body.getResponseMessage();
}
}
public String verifyMail(String mailLink) {
String response="";
byte[] decodedBytes = Base64.getDecoder().decode(mailLink);
String decodedString = new String(decodedBytes);
System.out.println(decodedString);
try {
JSONObject jsonObj = new JSONObject(decodedString);
userDao.verifyUser(jsonObj.getString("id"), jsonObj.getString("username"));
response="Success";
} catch (JSONException e) {
block="reg Service mail verify";
exp.checkException(e,block);
response=e.toString();
}
return response;
}
private static int getRandomInteger(int maximum, int minimum){
return ((int) (Math.random()*(maximum - minimum))) + minimum;
}
private void sendSimpleMessageUsingTemplate(String to,
String subject,
SimpleMailMessage template,
String customer_name, String verify_mailLink) {
System.out.println( "From Service SimpleMessageUsingTemplate are set");
try {
Map<String, String> valuesMap = new HashMap<String, String>();
valuesMap.put("customer_name", customer_name);
valuesMap.put("verify_mailLink", verify_mailLink);
StrSubstitutor sub = new StrSubstitutor(valuesMap);
String text = sub.replace(template.getText());
MimeMessage message = emailSender.createMimeMessage();
message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(to));
message.setSubject(subject);
message.setContent(text,"text/html");
emailSender.send(message);
} catch (MessagingException e) {
e.printStackTrace();
}
}
private static byte[] getSalt() throws NoSuchAlgorithmException
{
SecureRandom sr = SecureRandom.getInstance("SHA1PRNG");
byte[] salt = new byte[16];
sr.nextBytes(salt);
return salt;
}
private static String toHex(byte[] array) throws NoSuchAlgorithmException
{
BigInteger bi = new BigInteger(1, array);
String hex = bi.toString(16);
int paddingLength = (array.length * 2) - hex.length();
if(paddingLength > 0)
{
return String.format("%0" +paddingLength + "d", 0) + hex;
}else{
return hex;
}
}
}
| 5,624 | 0.680949 | 0.67546 | 163 | 32.650307 | 24.249859 | 112 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.269939 | false | false | 8 |
320f077ed4085ad4c4995d70fc573945e766bff7 | 16,054,587,772,319 | de4c073a6e88e54b36906fe18d61db855b638071 | /app/src/main/java/com/kysynth/whichpokemonareyou/model/EndingText.java | bbbba2e2c99cec33140c297009352d9d64ca37ad | [
"MIT"
] | permissive | kysynth/explorers-of-sky | https://github.com/kysynth/explorers-of-sky | 79db0c55fc0b4b76ad5dd096f6a89cab8a440841 | 250a4bbd03ffa50631e54be0eda8843a46b293c4 | refs/heads/master | 2016-09-23T02:57:56.421000 | 2016-08-26T06:35:24 | 2016-08-26T06:35:24 | 64,285,003 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.kysynth.whichpokemonareyou.model;
import android.app.Activity;
import com.kysynth.whichpokemonareyou.R;
import java.util.ArrayList;
public class EndingText {
private ArrayList<String> mStrings = new ArrayList<>();
private int mCharaIndex = 0;
public EndingText(int charaIndex) {
mCharaIndex = charaIndex;
mStrings.add("ใใใใใใใใใฆใใใฆใใใใใจใ");
mStrings.add("ใญใใฏใฉใใใโฆโฆใ" + Characteristic.getCharaInString(mCharaIndex) + "ใชใฒใจใใฟใใใ ใญ");
mStrings.add("ใใใช" + Characteristic.getCharaInString(mCharaIndex) + "ใชใใญใใฏโฆโฆ");
}
public ArrayList<String> getTexts() {
return mStrings;
}
}
| UTF-8 | Java | 747 | java | EndingText.java | Java | [] | null | [] | package com.kysynth.whichpokemonareyou.model;
import android.app.Activity;
import com.kysynth.whichpokemonareyou.R;
import java.util.ArrayList;
public class EndingText {
private ArrayList<String> mStrings = new ArrayList<>();
private int mCharaIndex = 0;
public EndingText(int charaIndex) {
mCharaIndex = charaIndex;
mStrings.add("ใใใใใใใใใฆใใใฆใใใใใจใ");
mStrings.add("ใญใใฏใฉใใใโฆโฆใ" + Characteristic.getCharaInString(mCharaIndex) + "ใชใฒใจใใฟใใใ ใญ");
mStrings.add("ใใใช" + Characteristic.getCharaInString(mCharaIndex) + "ใชใใญใใฏโฆโฆ");
}
public ArrayList<String> getTexts() {
return mStrings;
}
}
| 747 | 0.693721 | 0.69219 | 23 | 27.391304 | 26.835634 | 96 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.478261 | false | false | 8 |
611bf880428a242e694957c81362ef75394a897d | 19,550,691,152,007 | 429a12adb7b50968b8dd479499a093e0e2e9afaf | /src/main/java/com/thinkgem/jeesite/modules/heatexchange/analysis/web/energy/JobStationEnergyConsumeWeekController.java | f7d4d80e3d39805bb350ccfc8a1772f17fc0c19a | [
"Apache-2.0"
] | permissive | kdkevindeng/HeatManagement | https://github.com/kdkevindeng/HeatManagement | 6ddb422a7c9042296fb56653cb63cd08bd9258f8 | b3a1fe96b29652096e058f6decd310ab52e3c903 | refs/heads/master | 2021-05-03T05:45:09.483000 | 2018-04-12T05:42:52 | 2018-04-12T05:42:59 | 120,581,930 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
* Copyright © 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
*/
package com.thinkgem.jeesite.modules.heatexchange.analysis.web.energy;
import com.thinkgem.jeesite.common.config.Global;
import com.thinkgem.jeesite.common.persistence.Page;
import com.thinkgem.jeesite.common.utils.StringUtils;
import com.thinkgem.jeesite.common.vo.SimpleChart;
import com.thinkgem.jeesite.common.web.BaseController;
import com.thinkgem.jeesite.modules.heatexchange.admin.entity.station.JobStation;
import com.thinkgem.jeesite.modules.heatexchange.admin.service.station.JobStationService;
import com.thinkgem.jeesite.modules.heatexchange.analysis.entity.energy.JobStationEnergyConsumeMonth;
import com.thinkgem.jeesite.modules.heatexchange.analysis.service.energy.JobStationEnergyConsumeMonthService;
import com.thinkgem.jeesite.modules.heatexchange.data.entity.origin.JobStationDataOrigin;
import com.thinkgem.jeesite.modules.heatexchange.data.service.origin.JobStationDataOriginService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
/**
* ่ฝ่ๅๆ-ๅจController
* @author lizhi
* @version 2017-11-27
*/
@Controller
@RequestMapping(value = "${adminPath}/analysis/energy/jobStationEnergyConsumeWeek")
public class JobStationEnergyConsumeWeekController extends BaseController {
@Autowired
private JobStationService jobStationService;
@Autowired
private JobStationEnergyConsumeMonthService jobStationEnergyConsumeMonthService;
@Autowired
private JobStationDataOriginService jobStationDataOriginService;
@ModelAttribute
public JobStationEnergyConsumeMonth get(@RequestParam(required=false) String id) {
JobStationEnergyConsumeMonth entity = null;
if (StringUtils.isNotBlank(id)){
entity = jobStationEnergyConsumeMonthService.get(id);
}
if (entity == null){
entity = new JobStationEnergyConsumeMonth();
}
return entity;
}
@RequiresPermissions("analysis:energy:jobStationEnergyConsumeWeek:view")
@RequestMapping(value = {"list", ""})
public String list(JobStationEnergyConsumeMonth jobStationEnergyConsumeMonth, HttpServletRequest request, HttpServletResponse response, Model model) {
Page<JobStationEnergyConsumeMonth> page = jobStationEnergyConsumeMonthService.findPage(new Page<JobStationEnergyConsumeMonth>(request, response), jobStationEnergyConsumeMonth);
model.addAttribute("page", page);
model.addAttribute("stationList", this.jobStationService.findList(new JobStation()));
return "heatexchange/analysis/energy/jobStationEnergyConsumeWeekList";
}
@RequiresPermissions("analysis:energy:jobStationEnergyConsumeWeek:view")
@RequestMapping("chart")
public String chart(Model model) {
model.addAttribute("stationList", this.jobStationService.findList(new JobStation()));
return "heatexchange/analysis/energy/jobStationEnergyConsumeWeekCharts";
}
@RequiresPermissions("analysis:energy:jobStationEnergyConsumeWeek:view")
@ResponseBody
@RequestMapping("/chart/data")
public SimpleChart chart(String stationCode){
SimpleChart chartData=new SimpleChart();
JobStationEnergyConsumeMonth queryDTO=new JobStationEnergyConsumeMonth();
queryDTO.setStationId(stationCode);
List<JobStationEnergyConsumeMonth> dataList = this.jobStationEnergyConsumeMonthService.findList(queryDTO);
List<String> xAxis=new ArrayList<String>();
List<String> yAxis=new ArrayList<String>();
SimpleDateFormat sf=new SimpleDateFormat("yyyy-MM-dd");
for(JobStationEnergyConsumeMonth data:dataList){
xAxis.add(sf.format(data.getTime()));
yAxis.add(data.getEnergy());
}
chartData.setxAxis(xAxis);
chartData.setyAxis(yAxis);
return chartData;
}
@RequiresPermissions("analysis:energy:jobStationEnergyConsumeWeek:view")
@RequestMapping(value = "form")
public String form(JobStationEnergyConsumeMonth jobStationEnergyConsumeMonth, Model model) {
model.addAttribute("jobStationEnergyConsumeWeek", jobStationEnergyConsumeMonth);
return "heatexchange/analysis/energy/jobStationEnergyConsumeWeekForm";
}
@RequiresPermissions("analysis:energy:jobStationEnergyConsumeWeek:edit")
@RequestMapping(value = "save")
public String save(JobStationEnergyConsumeMonth jobStationEnergyConsumeMonth, Model model, RedirectAttributes redirectAttributes) {
if (!beanValidator(model, jobStationEnergyConsumeMonth)){
return form(jobStationEnergyConsumeMonth, model);
}
jobStationEnergyConsumeMonthService.save(jobStationEnergyConsumeMonth);
addMessage(redirectAttributes, "ไฟๅญ่ฝ่ๅๆ-ๅจๆๅ");
return "redirect:"+Global.getAdminPath()+"/analysis/energy/jobStationEnergyConsumeWeek/?repage";
}
@RequiresPermissions("analysis:energy:jobStationEnergyConsumeWeek:edit")
@RequestMapping(value = "delete")
public String delete(JobStationEnergyConsumeMonth jobStationEnergyConsumeMonth, RedirectAttributes redirectAttributes) {
jobStationEnergyConsumeMonthService.delete(jobStationEnergyConsumeMonth);
addMessage(redirectAttributes, "ๅ ้ค่ฝ่ๅๆ-ๅจๆๅ");
return "redirect:"+Global.getAdminPath()+"/analysis/energy/jobStationEnergyConsumeWeek/?repage";
}
} | UTF-8 | Java | 5,737 | java | JobStationEnergyConsumeWeekController.java | Java | [
{
"context": "ight © 2012-2016 <a href=\"https://github.com/thinkgem/jeesite\">JeeSite</a> All rights reserved.\n */\npac",
"end": 70,
"score": 0.9991731643676758,
"start": 62,
"tag": "USERNAME",
"value": "thinkgem"
},
{
"context": "ava.util.List;\n\n/**\n * ่ฝ่ๅๆ-ๅจController\n * @author lizhi\n * @version 2017-11-27\n */\n@Controller\n@RequestMa",
"end": 1776,
"score": 0.9996152520179749,
"start": 1771,
"tag": "USERNAME",
"value": "lizhi"
}
] | null | [] | /**
* Copyright © 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
*/
package com.thinkgem.jeesite.modules.heatexchange.analysis.web.energy;
import com.thinkgem.jeesite.common.config.Global;
import com.thinkgem.jeesite.common.persistence.Page;
import com.thinkgem.jeesite.common.utils.StringUtils;
import com.thinkgem.jeesite.common.vo.SimpleChart;
import com.thinkgem.jeesite.common.web.BaseController;
import com.thinkgem.jeesite.modules.heatexchange.admin.entity.station.JobStation;
import com.thinkgem.jeesite.modules.heatexchange.admin.service.station.JobStationService;
import com.thinkgem.jeesite.modules.heatexchange.analysis.entity.energy.JobStationEnergyConsumeMonth;
import com.thinkgem.jeesite.modules.heatexchange.analysis.service.energy.JobStationEnergyConsumeMonthService;
import com.thinkgem.jeesite.modules.heatexchange.data.entity.origin.JobStationDataOrigin;
import com.thinkgem.jeesite.modules.heatexchange.data.service.origin.JobStationDataOriginService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
/**
* ่ฝ่ๅๆ-ๅจController
* @author lizhi
* @version 2017-11-27
*/
@Controller
@RequestMapping(value = "${adminPath}/analysis/energy/jobStationEnergyConsumeWeek")
public class JobStationEnergyConsumeWeekController extends BaseController {
@Autowired
private JobStationService jobStationService;
@Autowired
private JobStationEnergyConsumeMonthService jobStationEnergyConsumeMonthService;
@Autowired
private JobStationDataOriginService jobStationDataOriginService;
@ModelAttribute
public JobStationEnergyConsumeMonth get(@RequestParam(required=false) String id) {
JobStationEnergyConsumeMonth entity = null;
if (StringUtils.isNotBlank(id)){
entity = jobStationEnergyConsumeMonthService.get(id);
}
if (entity == null){
entity = new JobStationEnergyConsumeMonth();
}
return entity;
}
@RequiresPermissions("analysis:energy:jobStationEnergyConsumeWeek:view")
@RequestMapping(value = {"list", ""})
public String list(JobStationEnergyConsumeMonth jobStationEnergyConsumeMonth, HttpServletRequest request, HttpServletResponse response, Model model) {
Page<JobStationEnergyConsumeMonth> page = jobStationEnergyConsumeMonthService.findPage(new Page<JobStationEnergyConsumeMonth>(request, response), jobStationEnergyConsumeMonth);
model.addAttribute("page", page);
model.addAttribute("stationList", this.jobStationService.findList(new JobStation()));
return "heatexchange/analysis/energy/jobStationEnergyConsumeWeekList";
}
@RequiresPermissions("analysis:energy:jobStationEnergyConsumeWeek:view")
@RequestMapping("chart")
public String chart(Model model) {
model.addAttribute("stationList", this.jobStationService.findList(new JobStation()));
return "heatexchange/analysis/energy/jobStationEnergyConsumeWeekCharts";
}
@RequiresPermissions("analysis:energy:jobStationEnergyConsumeWeek:view")
@ResponseBody
@RequestMapping("/chart/data")
public SimpleChart chart(String stationCode){
SimpleChart chartData=new SimpleChart();
JobStationEnergyConsumeMonth queryDTO=new JobStationEnergyConsumeMonth();
queryDTO.setStationId(stationCode);
List<JobStationEnergyConsumeMonth> dataList = this.jobStationEnergyConsumeMonthService.findList(queryDTO);
List<String> xAxis=new ArrayList<String>();
List<String> yAxis=new ArrayList<String>();
SimpleDateFormat sf=new SimpleDateFormat("yyyy-MM-dd");
for(JobStationEnergyConsumeMonth data:dataList){
xAxis.add(sf.format(data.getTime()));
yAxis.add(data.getEnergy());
}
chartData.setxAxis(xAxis);
chartData.setyAxis(yAxis);
return chartData;
}
@RequiresPermissions("analysis:energy:jobStationEnergyConsumeWeek:view")
@RequestMapping(value = "form")
public String form(JobStationEnergyConsumeMonth jobStationEnergyConsumeMonth, Model model) {
model.addAttribute("jobStationEnergyConsumeWeek", jobStationEnergyConsumeMonth);
return "heatexchange/analysis/energy/jobStationEnergyConsumeWeekForm";
}
@RequiresPermissions("analysis:energy:jobStationEnergyConsumeWeek:edit")
@RequestMapping(value = "save")
public String save(JobStationEnergyConsumeMonth jobStationEnergyConsumeMonth, Model model, RedirectAttributes redirectAttributes) {
if (!beanValidator(model, jobStationEnergyConsumeMonth)){
return form(jobStationEnergyConsumeMonth, model);
}
jobStationEnergyConsumeMonthService.save(jobStationEnergyConsumeMonth);
addMessage(redirectAttributes, "ไฟๅญ่ฝ่ๅๆ-ๅจๆๅ");
return "redirect:"+Global.getAdminPath()+"/analysis/energy/jobStationEnergyConsumeWeek/?repage";
}
@RequiresPermissions("analysis:energy:jobStationEnergyConsumeWeek:edit")
@RequestMapping(value = "delete")
public String delete(JobStationEnergyConsumeMonth jobStationEnergyConsumeMonth, RedirectAttributes redirectAttributes) {
jobStationEnergyConsumeMonthService.delete(jobStationEnergyConsumeMonth);
addMessage(redirectAttributes, "ๅ ้ค่ฝ่ๅๆ-ๅจๆๅ");
return "redirect:"+Global.getAdminPath()+"/analysis/energy/jobStationEnergyConsumeWeek/?repage";
}
} | 5,737 | 0.827095 | 0.824284 | 121 | 46.041321 | 36.321201 | 178 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.636364 | false | false | 8 |
9db867e9e1eabb9dde3cfca0566eda523dcc3925 | 32,392,643,377,682 | 49706a4c45a99021eee7025e4f4142b22356b4ca | /src/colinf/ListarTrainee.java | 628df28ccc336b2a2f16fdeb6e3089b4db9809dc | [] | no_license | pacoca51/colinf | https://github.com/pacoca51/colinf | fd0dac32fce0f5703dc0ca68ed0818eec8f8ac01 | 034b037d548e88a325655e93107fc54ca50b2b80 | refs/heads/master | 2020-07-10T08:13:06.459000 | 2019-08-25T00:01:42 | 2019-08-25T00:01:42 | 204,214,975 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package colinf;
import java.awt.EventQueue;
import javax.swing.JInternalFrame;
import javax.swing.JOptionPane;
import javax.swing.JTabbedPane;
import javax.swing.JTable;
import net.proteanit.sql.DbUtils;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JButton;
import javax.swing.ImageIcon;
import java.awt.Font;
import java.awt.FontFormatException;
import java.io.IOException;
import java.io.InputStream;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class ListarTrainee extends JInternalFrame {
ResultSet rsTrainee, rs;
ConexaoSQLite conn;
Statement st;
PreparedStatement stTrainee;
String[][] dummyData = {};
String[] columnNames = {"MATRรCULA", "NOME", "EMAIL"};
private JTable table = new JTable(dummyData, columnNames);
private static Font getFont(int style, int size) throws FontFormatException{
InputStream i;
Font font, sizedFont = null;
try {
i = Principal.class.getResourceAsStream("RobotoLight.ttf");
font = Font.createFont(Font.TRUETYPE_FONT, i);
sizedFont = font.deriveFont(style, size);
} catch (IOException e) {
e.printStackTrace();
}
return sizedFont;
}
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
ListarTrainee frame = new ListarTrainee(true);
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
* @throws SQLException
* @throws FontFormatException
*/
public ListarTrainee(boolean removeTrai) throws SQLException, FontFormatException {
setTitle("TRAINEE");
setClosable(true);
conn = new ConexaoSQLite();
stTrainee = conn.getConexaoSQLite().prepareStatement("select * from trainee;");
rsTrainee = stTrainee.executeQuery();
table.setModel(DbUtils.resultSetToTableModel(rsTrainee));
Font size12 = getFont(Font.PLAIN, 12);
table.setFont(size12);
setBounds(100, 100, 800, 440);
getContentPane().setLayout(null);
JScrollPane scrollPane = new JScrollPane(table);
scrollPane.setBounds(10, 11, 764, 333);
getContentPane().add(scrollPane);
JButton button = new JButton("REMOVER");
button.setEnabled(removeTrai);
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
try {
st = conn.getConexaoSQLite().createStatement();
st.executeUpdate("delete from funcionario where fun_matricula = '"+table.getValueAt(table.getSelectedRow(), 0).toString()+"';");
conn.closeConexao();
JOptionPane.showMessageDialog(null, "TRAINEE REMOVIDO COM SUCESSO!", "SUCESSO", JOptionPane.INFORMATION_MESSAGE);
dispose();
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "OPERAรรO MAL SUCEDIDA!", "ERRO", JOptionPane.ERROR_MESSAGE);
dispose();
}
}
});
button.setIcon(new ImageIcon(ListarEquiLab.class.getResource("/util/deleteRow.png")));
button.setFont(size12);
button.setBounds(634, 355, 140, 36);
getContentPane().add(button);
}
}
| ISO-8859-1 | Java | 3,308 | java | ListarTrainee.java | Java | [] | null | [] | package colinf;
import java.awt.EventQueue;
import javax.swing.JInternalFrame;
import javax.swing.JOptionPane;
import javax.swing.JTabbedPane;
import javax.swing.JTable;
import net.proteanit.sql.DbUtils;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JButton;
import javax.swing.ImageIcon;
import java.awt.Font;
import java.awt.FontFormatException;
import java.io.IOException;
import java.io.InputStream;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class ListarTrainee extends JInternalFrame {
ResultSet rsTrainee, rs;
ConexaoSQLite conn;
Statement st;
PreparedStatement stTrainee;
String[][] dummyData = {};
String[] columnNames = {"MATRรCULA", "NOME", "EMAIL"};
private JTable table = new JTable(dummyData, columnNames);
private static Font getFont(int style, int size) throws FontFormatException{
InputStream i;
Font font, sizedFont = null;
try {
i = Principal.class.getResourceAsStream("RobotoLight.ttf");
font = Font.createFont(Font.TRUETYPE_FONT, i);
sizedFont = font.deriveFont(style, size);
} catch (IOException e) {
e.printStackTrace();
}
return sizedFont;
}
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
ListarTrainee frame = new ListarTrainee(true);
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
* @throws SQLException
* @throws FontFormatException
*/
public ListarTrainee(boolean removeTrai) throws SQLException, FontFormatException {
setTitle("TRAINEE");
setClosable(true);
conn = new ConexaoSQLite();
stTrainee = conn.getConexaoSQLite().prepareStatement("select * from trainee;");
rsTrainee = stTrainee.executeQuery();
table.setModel(DbUtils.resultSetToTableModel(rsTrainee));
Font size12 = getFont(Font.PLAIN, 12);
table.setFont(size12);
setBounds(100, 100, 800, 440);
getContentPane().setLayout(null);
JScrollPane scrollPane = new JScrollPane(table);
scrollPane.setBounds(10, 11, 764, 333);
getContentPane().add(scrollPane);
JButton button = new JButton("REMOVER");
button.setEnabled(removeTrai);
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
try {
st = conn.getConexaoSQLite().createStatement();
st.executeUpdate("delete from funcionario where fun_matricula = '"+table.getValueAt(table.getSelectedRow(), 0).toString()+"';");
conn.closeConexao();
JOptionPane.showMessageDialog(null, "TRAINEE REMOVIDO COM SUCESSO!", "SUCESSO", JOptionPane.INFORMATION_MESSAGE);
dispose();
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "OPERAรรO MAL SUCEDIDA!", "ERRO", JOptionPane.ERROR_MESSAGE);
dispose();
}
}
});
button.setIcon(new ImageIcon(ListarEquiLab.class.getResource("/util/deleteRow.png")));
button.setFont(size12);
button.setBounds(634, 355, 140, 36);
getContentPane().add(button);
}
}
| 3,308 | 0.70348 | 0.690469 | 105 | 29.476191 | 24.426409 | 133 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.666667 | false | false | 8 |
a4a956a73df34c565d0bc36d8dd7957664769ad0 | 11,158,325,086,699 | abfcae10f292d07818a3e17622d5d13921483455 | /egov.test1/src/main/java/egovframework/example/bbs/web/EgovBBSController.java | da3b9c16503516b085f7877d66148e5e769524f9 | [] | no_license | azedi810/egov.test1 | https://github.com/azedi810/egov.test1 | 4ac224ef96b9f8fae468c8a7dbbdd05f35d5fd94 | 5200f9fbfae9cd30eb49c289f548e42a01e40ef8 | refs/heads/master | 2021-01-19T14:27:35.470000 | 2017-04-14T08:56:42 | 2017-04-14T08:56:42 | 88,164,432 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* Copyright 2008-2009 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package egovframework.example.bbs.web;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import egovframework.example.bbs.service.BBSCommand;
import egovframework.example.bbs.service.BList;
import egovframework.example.sample.service.impl.EgovSampleServiceImpl;
/**
* @Class Name : EgovSampleController.java
* @Description : EgovSample Controller Class
* @Modification Information
* @
* @ ์์ ์ผ ์์ ์ ์์ ๋ด์ฉ
* @ --------- --------- -------------------------------
* @ 2009.03.16 ์ต์ด์์ฑ
*
* @author ๊ฐ๋ฐํ๋ ์์ํฌ ์คํํ๊ฒฝ ๊ฐ๋ฐํ
* @since 2009. 03.16
* @version 1.0
* @see
*
* 10. MVC ๊ฒ์ํ
* ์ค์ต๋ฌธ์๋ช
: 20.01.spring_๊ธฐ์ด.docx
*/
@Controller
public class EgovBBSController {
private static final Logger LOGGER = LoggerFactory.getLogger(EgovBBSController.class);
BBSCommand command;
/*
* http://localhost:8080/sample/bbs/list.do
* */
@RequestMapping(value = "/bbs/list.do")
public String list(Model model) {
LOGGER.debug("EgovBBSController ๊ฒ์ํ๋ฆฌ์คํธ --> ");
command=new BList();
command.excute(model);
return "bbs/list";
}
}
| UTF-8 | Java | 2,023 | java | EgovBBSController.java | Java | [] | null | [] | /*
* Copyright 2008-2009 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package egovframework.example.bbs.web;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import egovframework.example.bbs.service.BBSCommand;
import egovframework.example.bbs.service.BList;
import egovframework.example.sample.service.impl.EgovSampleServiceImpl;
/**
* @Class Name : EgovSampleController.java
* @Description : EgovSample Controller Class
* @Modification Information
* @
* @ ์์ ์ผ ์์ ์ ์์ ๋ด์ฉ
* @ --------- --------- -------------------------------
* @ 2009.03.16 ์ต์ด์์ฑ
*
* @author ๊ฐ๋ฐํ๋ ์์ํฌ ์คํํ๊ฒฝ ๊ฐ๋ฐํ
* @since 2009. 03.16
* @version 1.0
* @see
*
* 10. MVC ๊ฒ์ํ
* ์ค์ต๋ฌธ์๋ช
: 20.01.spring_๊ธฐ์ด.docx
*/
@Controller
public class EgovBBSController {
private static final Logger LOGGER = LoggerFactory.getLogger(EgovBBSController.class);
BBSCommand command;
/*
* http://localhost:8080/sample/bbs/list.do
* */
@RequestMapping(value = "/bbs/list.do")
public String list(Model model) {
LOGGER.debug("EgovBBSController ๊ฒ์ํ๋ฆฌ์คํธ --> ");
command=new BList();
command.excute(model);
return "bbs/list";
}
}
| 2,023 | 0.673385 | 0.65168 | 70 | 25.642857 | 24.625792 | 87 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.685714 | false | false | 8 |
9a2a9ff8e575be776e5f4d29c667d9c546a543f0 | 2,147,483,656,632 | eef009758c6cd6324bfe9d2a0be4787e5548f2e7 | /src/Interface_Assignment/Airplane.java | fcbdb79ae8be331fe65bec0292b93eb4447cbea2 | [] | no_license | mkapuria12/Assignment2 | https://github.com/mkapuria12/Assignment2 | 32b8b2d92c607ae673de3ffd881c6a5514c4a770 | f079b03a7990d7b9eb28bb8afa515743f3e4205b | refs/heads/master | 2022-11-20T15:10:54.884000 | 2020-07-26T01:41:53 | 2020-07-26T01:41:53 | 282,555,460 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package Interface_Assignment;
public class Airplane {
public static void main(String[] args) {
Airbus ab=new Airbus();
Boeing bo=new Boeing();
}
}
| UTF-8 | Java | 157 | java | Airplane.java | Java | [] | null | [] | package Interface_Assignment;
public class Airplane {
public static void main(String[] args) {
Airbus ab=new Airbus();
Boeing bo=new Boeing();
}
}
| 157 | 0.694268 | 0.694268 | 11 | 13.272727 | 14.672738 | 41 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.818182 | false | false | 8 |
825b51f45932c42a748f3b01c61fe068ed741eb8 | 29,042,568,866,807 | 1a880fd76a194fd263939ae813fe39b7045b96ec | /src/main/java/genericWild/WildCardMain.java | 2ddaa8e72aa63e8c7e2b8c21bfc694d2fda25d3a | [] | no_license | lunqus/exercises | https://github.com/lunqus/exercises | 94c0787441036d88fc46755291d886e71264f048 | 3df2b2c2be84368463333b03c234f5e04a413edb | refs/heads/master | 2020-04-10T09:52:13.404000 | 2019-04-18T17:58:43 | 2019-04-18T17:58:43 | 160,943,005 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package genericWild;
public class WildCardMain {
public static void main(String[] args) {
Integer[] intArray = {23, 45, 64, 2, 90, 58};
WildCard<Integer> intArrayObject = new WildCard<>(intArray);
double intArrayAve = intArrayObject.average();
System.out.println("intArray average: " + intArrayAve);
Float[] floatArray = {1.9F, 7.9F, 6.0F, 4.8F, 8.1F};
WildCard<Float> floatArrayObject = new WildCard<>(floatArray);
double floatArrayAve = floatArrayObject.average();
System.out.println("floatArray average: " + floatArrayAve);
System.out.println("---");
if (intArrayObject.sameNumbers(floatArrayObject)) {
System.out.println(intArrayObject + " and " + "They're the same!");
} else {
System.out.println(intArrayObject + " and " + "they're diferrent!");
}
}
}
| UTF-8 | Java | 892 | java | WildCardMain.java | Java | [] | null | [] | package genericWild;
public class WildCardMain {
public static void main(String[] args) {
Integer[] intArray = {23, 45, 64, 2, 90, 58};
WildCard<Integer> intArrayObject = new WildCard<>(intArray);
double intArrayAve = intArrayObject.average();
System.out.println("intArray average: " + intArrayAve);
Float[] floatArray = {1.9F, 7.9F, 6.0F, 4.8F, 8.1F};
WildCard<Float> floatArrayObject = new WildCard<>(floatArray);
double floatArrayAve = floatArrayObject.average();
System.out.println("floatArray average: " + floatArrayAve);
System.out.println("---");
if (intArrayObject.sameNumbers(floatArrayObject)) {
System.out.println(intArrayObject + " and " + "They're the same!");
} else {
System.out.println(intArrayObject + " and " + "they're diferrent!");
}
}
}
| 892 | 0.616592 | 0.593049 | 25 | 34.68 | 29.195507 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.84 | false | false | 8 |
86cd63566a7abf436f3a0e8f85d93e84dfe15fef | 29,042,568,866,892 | e195e3273ff182467d1b92bc57890fd5a9a5208b | /4 - ILP007 POO - Programaรงรฃo Orientada a Objetos/Robson/POO-Exercicios/src/A.java | 1d57ad0cf2df6a14b4690c279687e718061e40f3 | [] | no_license | RobsonHF/fatec4SEM | https://github.com/RobsonHF/fatec4SEM | 254998c9e95c15dcf7c9aa69b5b4ae9112989f59 | 787dedba1d9fa41bb33bda205d5f1ac73faaa6b3 | refs/heads/master | 2021-02-27T19:00:07.444000 | 2020-06-18T15:59:41 | 2020-06-18T15:59:41 | 245,628,220 | 2 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
public class A {
public A (String a) {
System.out.println("A");
}
}
| UTF-8 | Java | 74 | java | A.java | Java | [] | null | [] |
public class A {
public A (String a) {
System.out.println("A");
}
}
| 74 | 0.581081 | 0.581081 | 6 | 11.166667 | 10.589565 | 26 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.833333 | false | false | 8 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.