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 list | 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 list | 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
e1c191b4d84109ba07bb7ba429c4490a66d7ab95 | 14,096,082,730,758 | 899caf9f1676785f7f1451fb0a6666980aa91f00 | /app/src/main/java/com/example/foodgame/Activities/Registration.java | 7ef42157cda68b4de0f76d06a2e6280734749640 | [] | no_license | caasig1/PhoneGame | https://github.com/caasig1/PhoneGame | cbcf5d966d5d5111d9d4fbf32fb5a48d9087820f | 0a99d910f30507e40b31bb969abe056eda4e1cc4 | refs/heads/main | 2023-02-10T21:55:21.636000 | 2021-01-08T07:00:25 | 2021-01-08T07:00:25 | 327,822,185 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.foodgame.Activities;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import com.example.foodgame.R;
/**
* Class for registration of a new user
*/
public class Registration extends AppCompatActivity {
/**
* Username of the new player
*/
private EditText username;
/**
* Password of the new player
*/
private EditText password;
/**
* Name of the new player
*/
private EditText name;
/**
* Email of the new player
*/
private EditText email;
/**
* The onCreate method that initiates the game with a statistics writer and a context.
* @param savedInstanceState The saved instance state
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_registration);
username = findViewById(R.id.tvusrname);
password = findViewById(R.id.tvpassword);
name = findViewById(R.id.tvname);
email = findViewById(R.id.tvemail);
Button register = findViewById(R.id.btnregister);
register.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String newUser = username.getText().toString();
String newName = name.getText().toString();
String newPassword = password.getText().toString();
String newEmail = email.getText().toString();
SharedPreferences preferences = getSharedPreferences("DATA", MODE_PRIVATE);
if (newName.isEmpty()) {
name.setHint("Please enter a name");
name.setHintTextColor(Color.RED);
} else if (newEmail.isEmpty()) {
email.setHint("Please enter an email");
email.setHintTextColor(Color.RED);
} else if (newPassword.isEmpty()) {
password.setHint("Please enter a password");
password.setHintTextColor(Color.RED);
} else if (newUser.isEmpty()) {
username.setHint("Please enter a Username");
username.setHintTextColor(Color.RED);
} else if (preferences.contains(newUser)) {
username.setText("");
username.setHint("Username has been taken");
username.setHintTextColor(Color.RED);
} else {
SharedPreferences.Editor editor = preferences.edit();
editor.putString(newUser, newPassword);
editor.apply();
Intent login = new Intent(Registration.this, Login.class);
startActivity(login);
}
}
});
}
}
| UTF-8 | Java | 3,071 | java | Registration.java | Java | [] | null | [] | package com.example.foodgame.Activities;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import com.example.foodgame.R;
/**
* Class for registration of a new user
*/
public class Registration extends AppCompatActivity {
/**
* Username of the new player
*/
private EditText username;
/**
* Password of the new player
*/
private EditText password;
/**
* Name of the new player
*/
private EditText name;
/**
* Email of the new player
*/
private EditText email;
/**
* The onCreate method that initiates the game with a statistics writer and a context.
* @param savedInstanceState The saved instance state
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_registration);
username = findViewById(R.id.tvusrname);
password = findViewById(R.id.tvpassword);
name = findViewById(R.id.tvname);
email = findViewById(R.id.tvemail);
Button register = findViewById(R.id.btnregister);
register.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String newUser = username.getText().toString();
String newName = name.getText().toString();
String newPassword = password.getText().toString();
String newEmail = email.getText().toString();
SharedPreferences preferences = getSharedPreferences("DATA", MODE_PRIVATE);
if (newName.isEmpty()) {
name.setHint("Please enter a name");
name.setHintTextColor(Color.RED);
} else if (newEmail.isEmpty()) {
email.setHint("Please enter an email");
email.setHintTextColor(Color.RED);
} else if (newPassword.isEmpty()) {
password.setHint("Please enter a password");
password.setHintTextColor(Color.RED);
} else if (newUser.isEmpty()) {
username.setHint("Please enter a Username");
username.setHintTextColor(Color.RED);
} else if (preferences.contains(newUser)) {
username.setText("");
username.setHint("Username has been taken");
username.setHintTextColor(Color.RED);
} else {
SharedPreferences.Editor editor = preferences.edit();
editor.putString(newUser, newPassword);
editor.apply();
Intent login = new Intent(Registration.this, Login.class);
startActivity(login);
}
}
});
}
}
| 3,071 | 0.588082 | 0.588082 | 89 | 33.505619 | 24.122871 | 91 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.516854 | false | false | 9 |
af03eef425a96ecacf39ceceafeaa729f08e39c6 | 32,830,730,063,980 | e5f02a27893549b575596851d2d13e5b3a109e74 | /src/main/java/io/paradaux/friendlybot/utils/embeds/moderation/CiteRuleEmbed.java | f1ce9ee07de471216d28a0c68058455148903b07 | [
"MIT"
] | permissive | Poke-Core/Pixelverse-DiscordBot | https://github.com/Poke-Core/Pixelverse-DiscordBot | 7cf97b47ddd0d955b5114d7929943e761bfe69aa | f3551f060c76e50e3c6ac368d6987bba38a7f732 | refs/heads/main | 2023-06-02T19:25:54.792000 | 2021-03-23T12:06:50 | 2021-03-23T12:06:50 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* MIT License
*
* Copyright (c) 2021 Rían Errity
* io.paradaux.friendlybot.utils.embeds.moderation.CiteRuleEmbed : 31/01/2021, 01:27
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package io.paradaux.friendlybot.utils.embeds.moderation;
import io.paradaux.friendlybot.utils.models.enums.EmbedColour;
import io.paradaux.friendlybot.utils.models.interfaces.Embed;
import net.dv8tion.jda.api.EmbedBuilder;
import net.dv8tion.jda.api.entities.TextChannel;
public class CiteRuleEmbed implements Embed {
final String header = "**As a member of this discord server, you are expected to have read"
+ " these rules in their entirety," + " and by continuing to make use of the discord"
+ " server you agree to follow these at all times.**";
final String rule1 = "**You are always expected to show respect to all fellow students and "
+ "Trinity Staff.**" + " Any form of name-calling, drama-stirring and spreading of "
+ "rumours will not be tolerated. Harassment and repeated targeted abuse of discord "
+ "members is unacceptable and will be met with a permanent ban.";
final String rule2 = "**Any issues regarding the server or its members must be brought up in"
+ " private. ** If you have an issue with the server or one of its members report "
+ "it to your " + "class representative or by using the [#mod-mail](https://discord.com/"
+ "channels/757903425311604786/773541543164117013/774420036920016916) channel. ";
final String rule3 = "**Political and religious discussion is prohibited.** It goes outside "
+ "of the scope of this discord server, which aims to provide academic support to our"
+ " fellow students and to facilitate " + "intercommunication in computer science "
+ "generally. These topics only cause division" + " and discourage new people from "
+ "joining in the conversation.";
final String rule4 = "**Members may not use the discord to share pornography, gore and "
+ "otherwise illicit content.**" + " Furthermore, any discussion of related material"
+ " is prohibited. This includes topics such as" + " piracy/copyright infringement.";
final String rule5 = "**Discord members are expected to conduct themselves as if they were"
+ " using an official Trinity " + "College social medium.** As such, all rules and"
+ "regulations subject to those apply here. **Please see the footnote for"
+ " more information.** This includes condoning **plagiarism**.";
final String rule6 = "**This platform is hosted on discord, as such, the discord terms of"
+ " service must always be followed.**";
final String pleasenote = "The Rules set is subject to change at any time. Staff members"
+ " may act upon something which is not" + " explicitly listed, moderators are trusted"
+ " to act on their own discretion. If you have an issue with this, please use"
+ " the [#mod-mail](https://discord.com/channels/757903425311604786/77354154316411701"
+ "3/774420036920016916) feature or contact your class representative. ";
final EmbedBuilder builder = new EmbedBuilder();
public CiteRuleEmbed(String section) {
builder.setColor(EmbedColour.INFO.getColour());
switch (section) {
case "header": {
builder.addField("Heading :: ", header, false);
break;
}
case "1": {
builder.addField("Rule 1 ::", rule1, false);
break;
}
case "2": {
builder.addField("Rule 2 ::", rule2, false);
break;
}
case "3": {
builder.addField("Rule 3 ::", rule3, false);
break;
}
case "4": {
builder.addField("Rule 4 ::", rule4, false);
break;
}
case "5": {
builder.addField("Rule 5 ::", rule5, false);
break;
}
case "6": {
builder.addField("Rule 6 ::", rule6, false);
break;
}
case "pleasenote": {
builder.addField("Please Note ::", pleasenote, false);
break;
}
default: {
builder.addField("No Section found.", "", false);
}
}
}
@Override
public void sendEmbed(TextChannel channel) {
channel.sendMessage(builder.build()).queue();
}
public EmbedBuilder getBuilder() { return builder; }
}
| UTF-8 | Java | 5,770 | java | CiteRuleEmbed.java | Java | [
{
"context": "/*\n * MIT License\n *\n * Copyright (c) 2021 Rían Errity\n * io.paradaux.friendlybot.utils.embeds.moderatio",
"end": 54,
"score": 0.9998607635498047,
"start": 43,
"tag": "NAME",
"value": "Rían Errity"
}
] | null | [] | /*
* MIT License
*
* Copyright (c) 2021 <NAME>
* io.paradaux.friendlybot.utils.embeds.moderation.CiteRuleEmbed : 31/01/2021, 01:27
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package io.paradaux.friendlybot.utils.embeds.moderation;
import io.paradaux.friendlybot.utils.models.enums.EmbedColour;
import io.paradaux.friendlybot.utils.models.interfaces.Embed;
import net.dv8tion.jda.api.EmbedBuilder;
import net.dv8tion.jda.api.entities.TextChannel;
public class CiteRuleEmbed implements Embed {
final String header = "**As a member of this discord server, you are expected to have read"
+ " these rules in their entirety," + " and by continuing to make use of the discord"
+ " server you agree to follow these at all times.**";
final String rule1 = "**You are always expected to show respect to all fellow students and "
+ "Trinity Staff.**" + " Any form of name-calling, drama-stirring and spreading of "
+ "rumours will not be tolerated. Harassment and repeated targeted abuse of discord "
+ "members is unacceptable and will be met with a permanent ban.";
final String rule2 = "**Any issues regarding the server or its members must be brought up in"
+ " private. ** If you have an issue with the server or one of its members report "
+ "it to your " + "class representative or by using the [#mod-mail](https://discord.com/"
+ "channels/757903425311604786/773541543164117013/774420036920016916) channel. ";
final String rule3 = "**Political and religious discussion is prohibited.** It goes outside "
+ "of the scope of this discord server, which aims to provide academic support to our"
+ " fellow students and to facilitate " + "intercommunication in computer science "
+ "generally. These topics only cause division" + " and discourage new people from "
+ "joining in the conversation.";
final String rule4 = "**Members may not use the discord to share pornography, gore and "
+ "otherwise illicit content.**" + " Furthermore, any discussion of related material"
+ " is prohibited. This includes topics such as" + " piracy/copyright infringement.";
final String rule5 = "**Discord members are expected to conduct themselves as if they were"
+ " using an official Trinity " + "College social medium.** As such, all rules and"
+ "regulations subject to those apply here. **Please see the footnote for"
+ " more information.** This includes condoning **plagiarism**.";
final String rule6 = "**This platform is hosted on discord, as such, the discord terms of"
+ " service must always be followed.**";
final String pleasenote = "The Rules set is subject to change at any time. Staff members"
+ " may act upon something which is not" + " explicitly listed, moderators are trusted"
+ " to act on their own discretion. If you have an issue with this, please use"
+ " the [#mod-mail](https://discord.com/channels/757903425311604786/77354154316411701"
+ "3/774420036920016916) feature or contact your class representative. ";
final EmbedBuilder builder = new EmbedBuilder();
public CiteRuleEmbed(String section) {
builder.setColor(EmbedColour.INFO.getColour());
switch (section) {
case "header": {
builder.addField("Heading :: ", header, false);
break;
}
case "1": {
builder.addField("Rule 1 ::", rule1, false);
break;
}
case "2": {
builder.addField("Rule 2 ::", rule2, false);
break;
}
case "3": {
builder.addField("Rule 3 ::", rule3, false);
break;
}
case "4": {
builder.addField("Rule 4 ::", rule4, false);
break;
}
case "5": {
builder.addField("Rule 5 ::", rule5, false);
break;
}
case "6": {
builder.addField("Rule 6 ::", rule6, false);
break;
}
case "pleasenote": {
builder.addField("Please Note ::", pleasenote, false);
break;
}
default: {
builder.addField("No Section found.", "", false);
}
}
}
@Override
public void sendEmbed(TextChannel channel) {
channel.sendMessage(builder.build()).queue();
}
public EmbedBuilder getBuilder() { return builder; }
}
| 5,764 | 0.630265 | 0.604264 | 132 | 42.704544 | 36.102283 | 101 | false | false | 0 | 0 | 0 | 0 | 65 | 0.011267 | 0.651515 | false | false | 9 |
dff91cd1ac7e72a6e143585bdd1bca2bdddb0ba5 | 3,547,642,995,451 | f0208d25a1a09a7638fb67893028970859c03f33 | /code/src/main/java/com/my/javabasic/concurrent/lock/synchronized1/NumberProducer.java | a77282b390262d38601ba67d565a412ff2bc6ede | [] | no_license | DiaosX/javaknowledge | https://github.com/DiaosX/javaknowledge | 98e3827e343e6893e01d173643e1f049addc9bea | d6fe1e25539b03d50412b3bc9f0bbe16b3451435 | refs/heads/master | 2022-06-28T13:50:37.654000 | 2021-08-30T13:11:57 | 2021-08-30T13:11:57 | 186,326,079 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.my.javabasic.concurrent.lock.synchronized1;
/*
wait()和notify()只能写在synchronized同步方法或同步块中。
wait(),线程休眠,等待唤醒,并释放对象锁(monitor)
notify(),随机唤醒一个正在等待对象锁的线程
notifyAll(),唤醒所有正在等待对象锁的线程
若没有正在等待对象锁的线程,则notify()和notifyAll()不起作用
一个线程被唤醒不代表立即获取了对象的monitor,只有等调用完notify()或者notifyAll()并退出synchronized块,释放对象锁后,其余线程才可获得锁执行
至于哪个线程接下来能够获取到对象的monitor就具体依赖于操作系统的调度了
*/
public class NumberProducer extends Thread {
private final NumberHolder holer;
public NumberProducer(NumberHolder holder) {
this.holer = holder;
}
@Override
public void run() {
for (int i = 1; i <= 10; i++) {
synchronized (this.holer) {
while (this.holer.getCurrentNumber() != 0) {
System.out.println("生产者:满了");
try {
//阻塞当前线程,释放锁
this.holer.wait();
System.out.println("NumberProducer获取锁成功,继续往下执行.");
} catch (InterruptedException ex) {
ex.printStackTrace();
}
}
this.holer.setCurrentNumber(i);
System.out.println("放入数字:" + i);
this.holer.notify();//随机唤醒一个等待线程
}
}
}
}
| UTF-8 | Java | 1,680 | java | NumberProducer.java | Java | [] | null | [] | package com.my.javabasic.concurrent.lock.synchronized1;
/*
wait()和notify()只能写在synchronized同步方法或同步块中。
wait(),线程休眠,等待唤醒,并释放对象锁(monitor)
notify(),随机唤醒一个正在等待对象锁的线程
notifyAll(),唤醒所有正在等待对象锁的线程
若没有正在等待对象锁的线程,则notify()和notifyAll()不起作用
一个线程被唤醒不代表立即获取了对象的monitor,只有等调用完notify()或者notifyAll()并退出synchronized块,释放对象锁后,其余线程才可获得锁执行
至于哪个线程接下来能够获取到对象的monitor就具体依赖于操作系统的调度了
*/
public class NumberProducer extends Thread {
private final NumberHolder holer;
public NumberProducer(NumberHolder holder) {
this.holer = holder;
}
@Override
public void run() {
for (int i = 1; i <= 10; i++) {
synchronized (this.holer) {
while (this.holer.getCurrentNumber() != 0) {
System.out.println("生产者:满了");
try {
//阻塞当前线程,释放锁
this.holer.wait();
System.out.println("NumberProducer获取锁成功,继续往下执行.");
} catch (InterruptedException ex) {
ex.printStackTrace();
}
}
this.holer.setCurrentNumber(i);
System.out.println("放入数字:" + i);
this.holer.notify();//随机唤醒一个等待线程
}
}
}
}
| 1,680 | 0.566561 | 0.562599 | 42 | 29.047619 | 22.097137 | 88 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.285714 | false | false | 9 |
50fc2cf703e494b65f5721335183d0cfb3830226 | 32,341,103,805,713 | 2a3eacb30077e1867b817037f1d980d54e2c2592 | /src/Main.java | 42bcdd96c1332759d20ad1d31f32b3a0296a0cb7 | [
"Apache-2.0"
] | permissive | culv3r/rowdyhacks | https://github.com/culv3r/rowdyhacks | e314d79cc5cf2588b6ea807c33b056c96df7cc23 | 1a2eceafc36c5360e496311c2fb3704f353d67d4 | refs/heads/master | 2021-01-19T19:02:15.343000 | 2017-04-16T15:29:05 | 2017-04-16T15:29:05 | 88,395,040 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
* Created by culv3r on 4/15/17.
*/
import java.io.DataOutput;
import java.io.File;
import java.io.FileNotFoundException;
import java.text.DecimalFormat;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.ResultSetMetaData;
public class Main {
//Constants
public static final double NUMERIC = 10.0;
public static final double LOWERCASE = 26.0;
public static final double UPPERCASE = 26.0;
public static final double SPECIAL = 32.0;
public static final double SPACE = 1.0;
public static final double CYCLES = 192848.0;
public static final double GUS_EIGHT = 7.3;
public static final double GUS_TSIX = 32.5;
public static final double GUS_FULL = 57.7;
private static HashSet<String> dictionary = null;
private static HashMap<Integer, Double> coreCost = null;
private static String framework = "embedded";
public static String driver = "org.apache.derby.jdbc.EmbeddedDriver";
private static String dbURL = "jdbc:derby:PassDict;create=true;";
private static String tableName = "password";
// jdbc Connection
private static Connection conn = null;
private static Statement stmt = null;
public static void main(String args[]) {
createConnection();
String password = "";
Scanner in = null;
String unit = "";
String aUnit = "";
Set<Integer> keys = null;
coreCost = new HashMap<Integer, Double>();
ArrayList<String> units = new ArrayList<String>();
units.add("Seconds");
units.add("Minutes");
units.add("Hours");
units.add("Days");
units.add("Years");
units.add("Decades");
units.add("Centuries");
try {
in = new Scanner(new File("passwords.txt"));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
coreCost.put(1, 0.0136);
//coreCost.put(2, 0.083);
//coreCost.put(4, 0.2015);
coreCost.put(8, 0.4035);
//coreCost.put(16, 0.862);
coreCost.put(36, 1.591);
coreCost.put(64, 3.447);
while (in.hasNext()) {
password = in.next();
int dictResult = selectWord(password);
double iPool = analyze(password);
double dEntropy = entropy(password.length(), iPool);
//System.out.println("Password: " + password + " has an entropy of " + dEntropy);
double hackTime = Math.pow(2,dEntropy)/CYCLES;
double hackGus = hackTime;
double hackAvg = hackTime/2.0;
ArrayList<Double> dList = new ArrayList<>();
dList.add(hackTime);
dList.add(hackAvg);
for (int k = 0; k< dList.size(); k++) {
int i = 0;
double dWork = dList.get(k);
for (i = 0; i < units.size(); i++) {
double[] time = {60.0, 60.0, 24.0, 365.0, 10.0, 10.0};
if (i <= 5 && dWork >= time[i]) {
dWork = dWork / time[i];
} else {
if (k == 0) {
unit = units.get(i).toString();
dList.set(k, dWork);
} else {
aUnit = units.get(i).toString();
dList.set(k, dWork);
}
break;
}
}
}
double costSingle = ((hackGus/60)/60)*coreCost.get(1);
double timeEight = 0;
String unitEight = "";
double timeTSix = 0;
String unitTSix = "";
double timeFull = 0;
String unitFull = "";
double gusCostEight = 0;
double gusCostTSix = 0;
double gusCostFull = 0;
double gusEight = (hackGus/GUS_EIGHT)/2;
gusCostEight = ((hackGus/60)/60)*coreCost.get(8);
double gusTSix = (hackGus/GUS_TSIX)/2;
gusCostTSix = ((hackGus/60)/60)*coreCost.get(36);
double gusFull = (hackGus/GUS_FULL)/2;
gusCostFull = ((hackGus/60)/60)*coreCost.get(64);
ArrayList<Double> gList = new ArrayList<>();
gList.add(gusEight);
gList.add(gusTSix);
gList.add(gusFull);
for (int m = 0; m< gList.size(); m++) {
int l = 0;
double dWork = gList.get(m);
for (l = 0; l < units.size(); l++) {
double[] time = {60.0, 60.0, 24.0, 365.0, 10.0, 10.0};
if (l <= 5 && dWork >= time[l]) {
dWork = dWork / time[l];
} else {
if (m == 0) {
unitEight = units.get(l).toString();
gList.set(m, dWork);
} else if (m == 1) {
unitTSix = units.get(l).toString();
gList.set(m, dWork);
} else if (m == 2){
unitFull = units.get(l).toString();
gList.set(m, dWork);
}
break;
}
}
}
timeEight = gList.get(0);
timeTSix = gList.get(1);
timeFull = gList.get(2);
DecimalFormat newFormat = new DecimalFormat("#.##");
double avgRes = Double.valueOf(newFormat.format(dList.get(1)));
double result = Double.valueOf(newFormat.format(dList.get(0)));
String resArr = dictResult + ";" + avgRes + ";" + aUnit + ";" + result + ";" + unit + ";" + costSingle + ";" + timeEight + ";" + unitEight + ";" + gusCostEight + ";" +
timeTSix + ";" + unitTSix + ";" + gusCostTSix + ";" + timeFull + ";" + unitFull + ";" + gusCostFull;
System.out.println(resArr);
}
shutdown();
}
private static void createConnection()
{
try
{
Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance();
//Get a connection
conn = DriverManager.getConnection(dbURL);
}
catch (Exception except)
{
except.printStackTrace();
}
}
private static int selectWord(String pword){
int retVal = 0;
try
{
stmt = conn.createStatement();
ResultSet results = stmt.executeQuery("select pass from " + tableName + " where pass='" + pword + "'");
ResultSetMetaData rsmd = results.getMetaData();
if (!results.next()){
retVal = 0;
} else {
retVal = 1;
}
results.close();
stmt.close();
}
catch (SQLException sqlExcept)
{
sqlExcept.printStackTrace();
}
return retVal;
}
private static void shutdown()
{
try
{
if (stmt != null)
{
stmt.close();
}
if (conn != null)
{
DriverManager.getConnection(dbURL + ";shutdown=true");
conn.close();
}
}
catch (SQLException sqlExcept)
{
}
}
public static double analyze(String pass) {
double pool = 0;
Pattern upper = Pattern.compile("([A-Z])");
Pattern lower = Pattern.compile("([a-z])");
Pattern num = Pattern.compile("([0-9])");
Pattern space = Pattern.compile("([ ])");
Pattern other = Pattern.compile("([^ A-Za-z0-9])");
Matcher mUpper = upper.matcher(pass);
Matcher mLower = lower.matcher(pass);
Matcher mNum = num.matcher(pass);
Matcher mSpace = space.matcher(pass);
Matcher mOther = other.matcher(pass);
if (mUpper.find() == true) {
pool += UPPERCASE;
}
if (mLower.find() == true) {
pool += LOWERCASE;
}
if (mNum.find() == true) {
pool += NUMERIC;
}
if (mSpace.find() == true) {
pool += SPACE;
}
if (mOther.find() == true) {
pool += SPECIAL;
}
return pool;
}
public static double entropy(double passLen, double pool) {
double logPool = Math.log(pool);
double logTwo = Math.log(2.0);
double dRet = passLen * (logPool/logTwo);
return dRet;
}
public static double gustaf(int cores){
double dNum = cores + (1-cores)*0.1;
System.out.println(dNum);
return dNum;
}
} | UTF-8 | Java | 9,008 | java | Main.java | Java | [
{
"context": "/**\n * Created by culv3r on 4/15/17.\n */\n\nimport java.io.DataOutput;\nimpor",
"end": 24,
"score": 0.9996922016143799,
"start": 18,
"tag": "USERNAME",
"value": "culv3r"
}
] | null | [] | /**
* Created by culv3r on 4/15/17.
*/
import java.io.DataOutput;
import java.io.File;
import java.io.FileNotFoundException;
import java.text.DecimalFormat;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.ResultSetMetaData;
public class Main {
//Constants
public static final double NUMERIC = 10.0;
public static final double LOWERCASE = 26.0;
public static final double UPPERCASE = 26.0;
public static final double SPECIAL = 32.0;
public static final double SPACE = 1.0;
public static final double CYCLES = 192848.0;
public static final double GUS_EIGHT = 7.3;
public static final double GUS_TSIX = 32.5;
public static final double GUS_FULL = 57.7;
private static HashSet<String> dictionary = null;
private static HashMap<Integer, Double> coreCost = null;
private static String framework = "embedded";
public static String driver = "org.apache.derby.jdbc.EmbeddedDriver";
private static String dbURL = "jdbc:derby:PassDict;create=true;";
private static String tableName = "password";
// jdbc Connection
private static Connection conn = null;
private static Statement stmt = null;
public static void main(String args[]) {
createConnection();
String password = "";
Scanner in = null;
String unit = "";
String aUnit = "";
Set<Integer> keys = null;
coreCost = new HashMap<Integer, Double>();
ArrayList<String> units = new ArrayList<String>();
units.add("Seconds");
units.add("Minutes");
units.add("Hours");
units.add("Days");
units.add("Years");
units.add("Decades");
units.add("Centuries");
try {
in = new Scanner(new File("passwords.txt"));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
coreCost.put(1, 0.0136);
//coreCost.put(2, 0.083);
//coreCost.put(4, 0.2015);
coreCost.put(8, 0.4035);
//coreCost.put(16, 0.862);
coreCost.put(36, 1.591);
coreCost.put(64, 3.447);
while (in.hasNext()) {
password = in.next();
int dictResult = selectWord(password);
double iPool = analyze(password);
double dEntropy = entropy(password.length(), iPool);
//System.out.println("Password: " + password + " has an entropy of " + dEntropy);
double hackTime = Math.pow(2,dEntropy)/CYCLES;
double hackGus = hackTime;
double hackAvg = hackTime/2.0;
ArrayList<Double> dList = new ArrayList<>();
dList.add(hackTime);
dList.add(hackAvg);
for (int k = 0; k< dList.size(); k++) {
int i = 0;
double dWork = dList.get(k);
for (i = 0; i < units.size(); i++) {
double[] time = {60.0, 60.0, 24.0, 365.0, 10.0, 10.0};
if (i <= 5 && dWork >= time[i]) {
dWork = dWork / time[i];
} else {
if (k == 0) {
unit = units.get(i).toString();
dList.set(k, dWork);
} else {
aUnit = units.get(i).toString();
dList.set(k, dWork);
}
break;
}
}
}
double costSingle = ((hackGus/60)/60)*coreCost.get(1);
double timeEight = 0;
String unitEight = "";
double timeTSix = 0;
String unitTSix = "";
double timeFull = 0;
String unitFull = "";
double gusCostEight = 0;
double gusCostTSix = 0;
double gusCostFull = 0;
double gusEight = (hackGus/GUS_EIGHT)/2;
gusCostEight = ((hackGus/60)/60)*coreCost.get(8);
double gusTSix = (hackGus/GUS_TSIX)/2;
gusCostTSix = ((hackGus/60)/60)*coreCost.get(36);
double gusFull = (hackGus/GUS_FULL)/2;
gusCostFull = ((hackGus/60)/60)*coreCost.get(64);
ArrayList<Double> gList = new ArrayList<>();
gList.add(gusEight);
gList.add(gusTSix);
gList.add(gusFull);
for (int m = 0; m< gList.size(); m++) {
int l = 0;
double dWork = gList.get(m);
for (l = 0; l < units.size(); l++) {
double[] time = {60.0, 60.0, 24.0, 365.0, 10.0, 10.0};
if (l <= 5 && dWork >= time[l]) {
dWork = dWork / time[l];
} else {
if (m == 0) {
unitEight = units.get(l).toString();
gList.set(m, dWork);
} else if (m == 1) {
unitTSix = units.get(l).toString();
gList.set(m, dWork);
} else if (m == 2){
unitFull = units.get(l).toString();
gList.set(m, dWork);
}
break;
}
}
}
timeEight = gList.get(0);
timeTSix = gList.get(1);
timeFull = gList.get(2);
DecimalFormat newFormat = new DecimalFormat("#.##");
double avgRes = Double.valueOf(newFormat.format(dList.get(1)));
double result = Double.valueOf(newFormat.format(dList.get(0)));
String resArr = dictResult + ";" + avgRes + ";" + aUnit + ";" + result + ";" + unit + ";" + costSingle + ";" + timeEight + ";" + unitEight + ";" + gusCostEight + ";" +
timeTSix + ";" + unitTSix + ";" + gusCostTSix + ";" + timeFull + ";" + unitFull + ";" + gusCostFull;
System.out.println(resArr);
}
shutdown();
}
private static void createConnection()
{
try
{
Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance();
//Get a connection
conn = DriverManager.getConnection(dbURL);
}
catch (Exception except)
{
except.printStackTrace();
}
}
private static int selectWord(String pword){
int retVal = 0;
try
{
stmt = conn.createStatement();
ResultSet results = stmt.executeQuery("select pass from " + tableName + " where pass='" + pword + "'");
ResultSetMetaData rsmd = results.getMetaData();
if (!results.next()){
retVal = 0;
} else {
retVal = 1;
}
results.close();
stmt.close();
}
catch (SQLException sqlExcept)
{
sqlExcept.printStackTrace();
}
return retVal;
}
private static void shutdown()
{
try
{
if (stmt != null)
{
stmt.close();
}
if (conn != null)
{
DriverManager.getConnection(dbURL + ";shutdown=true");
conn.close();
}
}
catch (SQLException sqlExcept)
{
}
}
public static double analyze(String pass) {
double pool = 0;
Pattern upper = Pattern.compile("([A-Z])");
Pattern lower = Pattern.compile("([a-z])");
Pattern num = Pattern.compile("([0-9])");
Pattern space = Pattern.compile("([ ])");
Pattern other = Pattern.compile("([^ A-Za-z0-9])");
Matcher mUpper = upper.matcher(pass);
Matcher mLower = lower.matcher(pass);
Matcher mNum = num.matcher(pass);
Matcher mSpace = space.matcher(pass);
Matcher mOther = other.matcher(pass);
if (mUpper.find() == true) {
pool += UPPERCASE;
}
if (mLower.find() == true) {
pool += LOWERCASE;
}
if (mNum.find() == true) {
pool += NUMERIC;
}
if (mSpace.find() == true) {
pool += SPACE;
}
if (mOther.find() == true) {
pool += SPECIAL;
}
return pool;
}
public static double entropy(double passLen, double pool) {
double logPool = Math.log(pool);
double logTwo = Math.log(2.0);
double dRet = passLen * (logPool/logTwo);
return dRet;
}
public static double gustaf(int cores){
double dNum = cores + (1-cores)*0.1;
System.out.println(dNum);
return dNum;
}
} | 9,008 | 0.485679 | 0.465919 | 270 | 32.366665 | 22.991842 | 179 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.762963 | false | false | 9 |
7409475d0a7848b1298d6e9bba510bdf547ced5b | 901,943,150,152 | 20a747c8982ec30258cb45ab3846cc2e03e9556e | /DataSturcDemo/src/dsd/TestArray.java | 821385859b0e7cccefa4850b4b844f51b2ed7056 | [] | no_license | liukx08/DataStructDemo | https://github.com/liukx08/DataStructDemo | 95e1014e10321debe8fcfad7423731dd347a2197 | 1257d827be40e931d0d6df5cbb1e25be85b2d4c4 | refs/heads/master | 2021-01-22T22:21:15.849000 | 2017-03-21T21:48:36 | 2017-03-21T21:48:36 | 85,535,885 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package dsd;
public class TestArray {
int[] arr;
TestArray(int[] arr){
this.arr=arr;
}
public void printArr(){
for(int i=0;i<arr.length;i++){
System.out.print(arr[i]+" ");
}
System.out.println("");
return;
}
public void printArrk(int k){ // locate k th element
System.out.println(arr[k]);
return;
}
public void insertEle(int newEle, int k){ // insert newEle at k th entry
if(0<=k && k<this.arr.length){
int[] inserted=new int[this.arr.length+1];
for(int i=0;i<k;i++)inserted[i]=this.arr[i];
inserted[k]=newEle;
for(int i=k+1;i<=this.arr.length;i++)inserted[i]=this.arr[i-1];
this.arr=inserted;
}
}
class NameCard{ // local class for compareCopy test
String name;
NameCard(String name){
this.name=name;
}
NameCard copyOf(){
NameCard copyCard=new NameCard(this.name);
return copyCard;
}
}
public void compareCopy(){
NameCard[] name1=new NameCard[1];
NameCard[] name2=new NameCard[1];
name1[0]=new NameCard("Bit");
name2[0]=name1[0];
name1[0].name="Tiger"; // shallow copy
System.out.println(name1[0].name);
System.out.println(name2[0].name);
name2[0]=name1[0].copyOf(); // deep copy
name1[0].name="Bittiger";
System.out.println(name1[0].name);
System.out.println(name2[0].name);
}
}
| UTF-8 | Java | 1,369 | java | TestArray.java | Java | [] | null | [] | package dsd;
public class TestArray {
int[] arr;
TestArray(int[] arr){
this.arr=arr;
}
public void printArr(){
for(int i=0;i<arr.length;i++){
System.out.print(arr[i]+" ");
}
System.out.println("");
return;
}
public void printArrk(int k){ // locate k th element
System.out.println(arr[k]);
return;
}
public void insertEle(int newEle, int k){ // insert newEle at k th entry
if(0<=k && k<this.arr.length){
int[] inserted=new int[this.arr.length+1];
for(int i=0;i<k;i++)inserted[i]=this.arr[i];
inserted[k]=newEle;
for(int i=k+1;i<=this.arr.length;i++)inserted[i]=this.arr[i-1];
this.arr=inserted;
}
}
class NameCard{ // local class for compareCopy test
String name;
NameCard(String name){
this.name=name;
}
NameCard copyOf(){
NameCard copyCard=new NameCard(this.name);
return copyCard;
}
}
public void compareCopy(){
NameCard[] name1=new NameCard[1];
NameCard[] name2=new NameCard[1];
name1[0]=new NameCard("Bit");
name2[0]=name1[0];
name1[0].name="Tiger"; // shallow copy
System.out.println(name1[0].name);
System.out.println(name2[0].name);
name2[0]=name1[0].copyOf(); // deep copy
name1[0].name="Bittiger";
System.out.println(name1[0].name);
System.out.println(name2[0].name);
}
}
| 1,369 | 0.604091 | 0.580716 | 59 | 21.20339 | 18.598141 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.711864 | false | false | 9 |
409f3f898995c82bc322eb0fbe2eed52d69e8a8c | 901,943,149,216 | e1e1f5cca7afee6efe591f487c0d07412f9d55ee | /Android/app/src/main/java/com/matriot/cbin/MessagingService.java | 773fcb2b64aac6f160750c3581bbdaa0dbdeb043 | [] | no_license | samasys-software/montecito | https://github.com/samasys-software/montecito | c7f3f3a79cdf7f2275f6b1eb8bd4b8c96b0b16fa | 254fae02651300c557c892f9a273c6d5e32da075 | refs/heads/master | 2018-10-30T02:43:22.668000 | 2018-08-27T16:32:19 | 2018-08-27T16:32:19 | 117,394,590 | 0 | 0 | null | false | 2018-08-27T16:32:20 | 2018-01-14T02:11:34 | 2018-08-23T11:17:55 | 2018-08-27T16:32:20 | 7,570 | 0 | 0 | 0 | Java | false | null | package com.matriot.cbin;
import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.util.Log;
import com.google.firebase.messaging.FirebaseMessagingService;
import com.google.firebase.messaging.RemoteMessage;
public class MessagingService extends FirebaseMessagingService {
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
Log.d("FireBase Message", "From: " + remoteMessage.getFrom());
if(remoteMessage.getData().size()>0) {
Log.d("FireBase Message", "Notification Message Body: " + remoteMessage.getData());
}
}
}
| UTF-8 | Java | 634 | java | MessagingService.java | Java | [] | null | [] | package com.matriot.cbin;
import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.util.Log;
import com.google.firebase.messaging.FirebaseMessagingService;
import com.google.firebase.messaging.RemoteMessage;
public class MessagingService extends FirebaseMessagingService {
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
Log.d("FireBase Message", "From: " + remoteMessage.getFrom());
if(remoteMessage.getData().size()>0) {
Log.d("FireBase Message", "Notification Message Body: " + remoteMessage.getData());
}
}
}
| 634 | 0.731861 | 0.730284 | 22 | 27.818182 | 28.151596 | 95 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false | 9 |
8fd95ae66e8f2b4435796fece898bcf2a7945c4a | 34,763,465,341,468 | e0858b7bafd3133d09d66a1eb8ec463692fee80e | /JACP.API/src/main/java/org/jacp/api/component/IDeclarative.java | 6608ba6e2908a352a857fbb8dc97018c99b589bf | [
"Apache-2.0"
] | permissive | ovikassingho/jacp | https://github.com/ovikassingho/jacp | a200262a2dfd1917f164bfbd22a807a9cd02e5c5 | f3f365d0161030e7d894844a1a7ff9cbb8d4b0e6 | refs/heads/master | 2020-03-30T10:15:06.556000 | 2013-02-21T20:19:43 | 2013-02-21T20:19:43 | 37,445,958 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /************************************************************************
*
* Copyright (C) 2010 - 2012
*
* [IVComponent.java]
* AHCP Project (http://jacp.googlecode.com)
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an "AS IS"
* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*
*
************************************************************************/
package org.jacp.api.component;
import java.net.URL;
import java.util.ResourceBundle;
import org.jacp.api.util.UIType;
/**
* Declarative Components always have a document URL and should have an resourceBundle.
*
* @author Andy Moncsek
*/
public interface IDeclarative {
/**
* Contains the document url describing the UI.
*
* @return the document url
*/
String getViewLocation();
/**
* Set the viewLocation location on component start.
*
* @param documentURL , the url of the FXML document
*/
void setViewLocation(String documentURL);
/**
* The document URL describing the UI.
*
* @return the document url
*/
URL getDocumentURL();
/**
* Contains locale-specific objects.
*
* @return the resource bundle for the UI document
*/
ResourceBundle getResourceBundle();
/**
* Distinguish component types.
* @return the type of the component.
*/
UIType getType();
/**
* Represents the Locale ID, see: http://www.oracle.com/technetwork/java/javase/locales-137662.html.
* @return the locale id
*/
String getLocaleID();
/**
* Represents the location of your resource bundle file.
* @return the url of resource bundle
*/
String getResourceBundleLocation();
}
| UTF-8 | Java | 2,072 | java | IDeclarative.java | Java | [
{
"context": " and should have an resourceBundle.\n * \n * @author Andy Moncsek\n */\npublic interface IDeclarative {\n\t/**\n\t * Cont",
"end": 1084,
"score": 0.9997849464416504,
"start": 1072,
"tag": "NAME",
"value": "Andy Moncsek"
}
] | null | [] | /************************************************************************
*
* Copyright (C) 2010 - 2012
*
* [IVComponent.java]
* AHCP Project (http://jacp.googlecode.com)
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an "AS IS"
* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*
*
************************************************************************/
package org.jacp.api.component;
import java.net.URL;
import java.util.ResourceBundle;
import org.jacp.api.util.UIType;
/**
* Declarative Components always have a document URL and should have an resourceBundle.
*
* @author <NAME>
*/
public interface IDeclarative {
/**
* Contains the document url describing the UI.
*
* @return the document url
*/
String getViewLocation();
/**
* Set the viewLocation location on component start.
*
* @param documentURL , the url of the FXML document
*/
void setViewLocation(String documentURL);
/**
* The document URL describing the UI.
*
* @return the document url
*/
URL getDocumentURL();
/**
* Contains locale-specific objects.
*
* @return the resource bundle for the UI document
*/
ResourceBundle getResourceBundle();
/**
* Distinguish component types.
* @return the type of the component.
*/
UIType getType();
/**
* Represents the Locale ID, see: http://www.oracle.com/technetwork/java/javase/locales-137662.html.
* @return the locale id
*/
String getLocaleID();
/**
* Represents the location of your resource bundle file.
* @return the url of resource bundle
*/
String getResourceBundleLocation();
}
| 2,066 | 0.652027 | 0.64334 | 80 | 24.9 | 25.091633 | 101 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.75 | false | false | 9 |
462ace150a921b0d9b55988ec5a7c7ccd45ff8d7 | 3,221,225,521,678 | 55198905555db7de06a5ed6e743b9087560ee82e | /Business/AnimBusiness/src/main/java/com/yc/animbusiness/AnimationActiviy.java | 1388cc4ef1d5ea7a521efd27c551104d87f500fd | [
"Apache-2.0"
] | permissive | Mario0o/LifeHelper | https://github.com/Mario0o/LifeHelper | c68ebe76e50283403587558dfdfdddd418667943 | 83c22ffbd61186aa86d29a325755e5f796d1e117 | refs/heads/master | 2023-08-17T05:49:25.116000 | 2023-08-14T23:51:17 | 2023-08-14T23:51:17 | 190,854,495 | 0 | 0 | null | true | 2023-08-15T08:02:23 | 2019-06-08T06:37:35 | 2022-10-06T09:53:10 | 2023-08-15T08:02:19 | 183,591 | 0 | 0 | 0 | Java | false | false | package com.yc.animbusiness;
import android.app.ActivityOptions;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.transition.Fade;
import android.view.View;
import android.view.Window;
import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import com.yc.animbusiness.reveal.RevealAnimationActivity;
import com.yc.animbusiness.transition.TransitionActivity;
public class AnimationActiviy extends AppCompatActivity {
private TextView tvAnim1;
private TextView tvAnim2;
private TextView tvAnim3;
private TextView tvAnim4;
private TextView tvAnim5;
private TextView tvAnim6;
private TextView tvAnim7;
private TextView tvAnim8;
/**
* 开启页面
*
* @param context 上下文
*/
public static void startActivity(Context context) {
try {
Intent target = new Intent();
target.setClass(context, AnimationActiviy.class);
context.startActivity(target);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
AnimationActiviy.this.getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
getWindow().setExitTransition(new Fade());
}
setContentView(R.layout.activity_anim_main);
tvAnim1 = findViewById(R.id.tv_anim_1);
tvAnim2 = findViewById(R.id.tv_anim_2);
tvAnim3 = findViewById(R.id.tv_anim_3);
tvAnim4 = findViewById(R.id.tv_anim_4);
tvAnim5 = findViewById(R.id.tv_anim_5);
tvAnim6 = findViewById(R.id.tv_anim_6);
tvAnim7 = findViewById(R.id.tv_anim_7);
tvAnim8 = findViewById(R.id.tv_anim_8);
tvAnim1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(AnimationActiviy.this,FrameAnimation.class));
}
});
tvAnim2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(AnimationActiviy.this,TweenAnimation.class));
}
});
tvAnim3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(AnimationActiviy.this,ValueAnimatorAct.class));
}
});
tvAnim4.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(AnimationActiviy.this, ActivityAnimation.class);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
startActivity(intent, ActivityOptions.makeSceneTransitionAnimation(AnimationActiviy.this).toBundle());
}
}
});
tvAnim5.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(AnimationActiviy.this, TransitionActivity.class));
}
});
tvAnim6.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(AnimationActiviy.this,AnimMainActivity.class));
}
});
tvAnim7.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(AnimationActiviy.this,PropertyAnimatorAct.class));
}
});
tvAnim8.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(AnimationActiviy.this, RevealAnimationActivity.class));
}
});
}
}
| UTF-8 | Java | 4,155 | java | AnimationActiviy.java | Java | [] | null | [] | package com.yc.animbusiness;
import android.app.ActivityOptions;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.transition.Fade;
import android.view.View;
import android.view.Window;
import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import com.yc.animbusiness.reveal.RevealAnimationActivity;
import com.yc.animbusiness.transition.TransitionActivity;
public class AnimationActiviy extends AppCompatActivity {
private TextView tvAnim1;
private TextView tvAnim2;
private TextView tvAnim3;
private TextView tvAnim4;
private TextView tvAnim5;
private TextView tvAnim6;
private TextView tvAnim7;
private TextView tvAnim8;
/**
* 开启页面
*
* @param context 上下文
*/
public static void startActivity(Context context) {
try {
Intent target = new Intent();
target.setClass(context, AnimationActiviy.class);
context.startActivity(target);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
AnimationActiviy.this.getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
getWindow().setExitTransition(new Fade());
}
setContentView(R.layout.activity_anim_main);
tvAnim1 = findViewById(R.id.tv_anim_1);
tvAnim2 = findViewById(R.id.tv_anim_2);
tvAnim3 = findViewById(R.id.tv_anim_3);
tvAnim4 = findViewById(R.id.tv_anim_4);
tvAnim5 = findViewById(R.id.tv_anim_5);
tvAnim6 = findViewById(R.id.tv_anim_6);
tvAnim7 = findViewById(R.id.tv_anim_7);
tvAnim8 = findViewById(R.id.tv_anim_8);
tvAnim1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(AnimationActiviy.this,FrameAnimation.class));
}
});
tvAnim2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(AnimationActiviy.this,TweenAnimation.class));
}
});
tvAnim3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(AnimationActiviy.this,ValueAnimatorAct.class));
}
});
tvAnim4.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(AnimationActiviy.this, ActivityAnimation.class);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
startActivity(intent, ActivityOptions.makeSceneTransitionAnimation(AnimationActiviy.this).toBundle());
}
}
});
tvAnim5.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(AnimationActiviy.this, TransitionActivity.class));
}
});
tvAnim6.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(AnimationActiviy.this,AnimMainActivity.class));
}
});
tvAnim7.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(AnimationActiviy.this,PropertyAnimatorAct.class));
}
});
tvAnim8.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(AnimationActiviy.this, RevealAnimationActivity.class));
}
});
}
}
| 4,155 | 0.631007 | 0.623279 | 117 | 34.393162 | 26.610825 | 122 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.555556 | false | false | 9 |
60520a6a42418465c571421b9a85fd52116b04f5 | 36,962,488,577,197 | 074439e6276249b937ce1e52c1cde286461d822d | /chapter_002/src/main/java/ru/job4j/inheritance/Teacher.java | 16f0391d314de3b156f15b180121b9fdfa59c790 | [
"Apache-2.0"
] | permissive | Andreip760/job4j | https://github.com/Andreip760/job4j | 7876782589e973052d62654bc22f7d107090c2ff | 9b339fed994f876e1960bc831181d56b8bec0c9c | refs/heads/master | 2020-04-20T20:56:33.328000 | 2019-03-25T10:37:35 | 2019-03-25T10:37:35 | 169,092,565 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ru.job4j.inheritance;
/**
* Class teacher
* @author Andrei Pashchenko.
* @version 1
* @since 15.02.2019
*/
public class Teacher extends Profession {
/**
* Teach the student
* @param student Student.
*/
public void teach(Student student) {
}
}
| UTF-8 | Java | 284 | java | Teacher.java | Java | [
{
"context": "job4j.inheritance;\n/**\n * Class teacher\n * @author Andrei Pashchenko.\n * @version 1\n * @since 15.02.2019\n */\npublic cl",
"end": 79,
"score": 0.9997034072875977,
"start": 62,
"tag": "NAME",
"value": "Andrei Pashchenko"
}
] | null | [] | package ru.job4j.inheritance;
/**
* Class teacher
* @author <NAME>.
* @version 1
* @since 15.02.2019
*/
public class Teacher extends Profession {
/**
* Teach the student
* @param student Student.
*/
public void teach(Student student) {
}
}
| 273 | 0.626761 | 0.591549 | 16 | 16.75 | 13.502315 | 41 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.0625 | false | false | 9 |
c830aaa255e204a94d2d6a5cc232bc5dfe9c4e8e | 35,888,746,768,768 | e912af291e1457c61606642f1c7700e678c77a27 | /833_find_and_replace_in_string.java | 7ce3e62dd9e705792f270b4195eeeb034d34d5e4 | [] | no_license | MakrisHuang/LeetCode | https://github.com/MakrisHuang/LeetCode | 325be680f8f67b0f34527914c6bd0a5a9e62e9c9 | 7609fbd164e3dbedc11308fdc24b57b5097ade81 | refs/heads/master | 2022-08-13T12:13:35.003000 | 2022-07-31T23:03:03 | 2022-07-31T23:03:03 | 128,767,837 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | class Solution {
class Segment {
int start;
int end;
String str;
Segment(int start, int end, String str) {
this.start = start;
this.end = end;
this.str = str;
}
}
// Time Complexity: O(nlogn)
// Space Complexity: O(n)
public String findReplaceString(String S, int[] indexes, String[] sources, String[] targets) {
List<Segment> replaced = new ArrayList<>();
for (int i = 0; i < indexes.length; i++) {
int idx = indexes[i];
String src = sources[i];
String tar = targets[i];
if (S.substring(idx, idx + src.length()).equals(src)) {
Segment seg = new Segment(idx, idx + src.length(), tar);
replaced.add(seg);
}
}
replaced.sort((s1, s2) -> s1.start - s2.start);
StringBuilder sb = new StringBuilder();
int prev = 0;
for (Segment seg: replaced) {
sb.append(S.substring(prev, seg.start));
sb.append(seg.str);
prev = seg.end;
}
sb.append(S.substring(prev, S.length()));
return sb.toString();
}
}
| UTF-8 | Java | 1,197 | java | 833_find_and_replace_in_string.java | Java | [] | null | [] | class Solution {
class Segment {
int start;
int end;
String str;
Segment(int start, int end, String str) {
this.start = start;
this.end = end;
this.str = str;
}
}
// Time Complexity: O(nlogn)
// Space Complexity: O(n)
public String findReplaceString(String S, int[] indexes, String[] sources, String[] targets) {
List<Segment> replaced = new ArrayList<>();
for (int i = 0; i < indexes.length; i++) {
int idx = indexes[i];
String src = sources[i];
String tar = targets[i];
if (S.substring(idx, idx + src.length()).equals(src)) {
Segment seg = new Segment(idx, idx + src.length(), tar);
replaced.add(seg);
}
}
replaced.sort((s1, s2) -> s1.start - s2.start);
StringBuilder sb = new StringBuilder();
int prev = 0;
for (Segment seg: replaced) {
sb.append(S.substring(prev, seg.start));
sb.append(seg.str);
prev = seg.end;
}
sb.append(S.substring(prev, S.length()));
return sb.toString();
}
}
| 1,197 | 0.501253 | 0.496241 | 38 | 30.5 | 21.306967 | 98 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.868421 | false | false | 9 |
d26c2389ddb852466322e36e306bb4ac5822efec | 36,318,243,497,686 | 8fefffce6c94f52a647fc0414ae758c711f6d754 | /src/main/java/tuzhms/gui/ErrorDialog.java | 6950714707bd1a14ab4a593bf806e58fd95c4b3e | [] | no_license | tuzhms/saimaachat | https://github.com/tuzhms/saimaachat | bc0032c3a96992edbd12805dfdd9e4a7c6f224c5 | ce4b7f3f8f057af4ee1ac9637d95ee327da784de | refs/heads/master | 2021-06-24T10:46:42.439000 | 2018-05-25T23:27:36 | 2018-05-25T23:27:36 | 142,587,096 | 0 | 0 | null | false | 2020-10-13T02:15:40 | 2018-07-27T14:25:41 | 2018-07-27T14:31:36 | 2020-10-13T02:15:39 | 48 | 0 | 0 | 1 | Java | false | false | package tuzhms.gui;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JFrame;
import java.awt.FlowLayout;
import java.awt.Frame;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
/**
* Модальное диалоговое окно с текстом ошибки
*
* @author Tuzhilkin Michael
* @version 1.0.0
* @since 1.0.0
* @see JFrame
*/
public class ErrorDialog extends JFrame{
/**
* Создание окна ошибки при некорректном событии
*
* @param frame родительское окно
* @param text сообщение ошибки
* @see Frame
* @see JDialog
*/
public ErrorDialog(Frame frame, String text) {
final JDialog dialog = new JDialog(frame, "Ошибка", true);
dialog.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
JPanel flow = new JPanel(new FlowLayout(FlowLayout.CENTER));
flow.add(new JLabel(text));
JButton button = new JButton("Ок");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dialog.dispose();
}
});
flow.add(button);
dialog.getContentPane().add(flow);
dialog.setSize(155, 80);
dialog.setLocationRelativeTo(null);
dialog.setVisible(true);
}
} | UTF-8 | Java | 1,309 | java | ErrorDialog.java | Java | [
{
"context": "льное диалоговое окно с текстом ошибки\n*\n* @author Tuzhilkin Michael\n* @version 1.0.0\n* @since 1.0.0\n* @see JFrame\n*/\n",
"end": 362,
"score": 0.9997863173484802,
"start": 345,
"tag": "NAME",
"value": "Tuzhilkin Michael"
}
] | null | [] | package tuzhms.gui;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JFrame;
import java.awt.FlowLayout;
import java.awt.Frame;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
/**
* Модальное диалоговое окно с текстом ошибки
*
* @author <NAME>
* @version 1.0.0
* @since 1.0.0
* @see JFrame
*/
public class ErrorDialog extends JFrame{
/**
* Создание окна ошибки при некорректном событии
*
* @param frame родительское окно
* @param text сообщение ошибки
* @see Frame
* @see JDialog
*/
public ErrorDialog(Frame frame, String text) {
final JDialog dialog = new JDialog(frame, "Ошибка", true);
dialog.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
JPanel flow = new JPanel(new FlowLayout(FlowLayout.CENTER));
flow.add(new JLabel(text));
JButton button = new JButton("Ок");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dialog.dispose();
}
});
flow.add(button);
dialog.getContentPane().add(flow);
dialog.setSize(155, 80);
dialog.setLocationRelativeTo(null);
dialog.setVisible(true);
}
} | 1,298 | 0.733445 | 0.724225 | 53 | 21.528301 | 17.772783 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.339623 | false | false | 9 |
125c19b5bdc6491f7b6bcab998aebaad7830c79e | 6,236,292,537,329 | 741bc96a941174370097f017946084ca3c921e13 | /app/src/main/java/com/eron/android/expenseapp/Adapter/SpinnerExpAdapter.java | 55fbe57fed1989f96532a638e2844883b065cd2c | [] | no_license | Prakash-ap/ExpenseApp | https://github.com/Prakash-ap/ExpenseApp | 668652864ab6025bbb23fbe25135cfcf7960aef4 | ab56ddbe7dd8db541e240d34eea37e165f85b12e | refs/heads/master | 2020-06-21T08:54:58.657000 | 2019-08-13T15:24:11 | 2019-08-13T15:24:11 | 197,400,547 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.eron.android.expenseapp.Adapter;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.eron.android.expenseapp.Model.CatItemData;
import com.eron.android.expenseapp.Model.ExpenseItemData;
import com.eron.android.expenseapp.R;
import java.util.ArrayList;
public class SpinnerExpAdapter extends ArrayAdapter<ExpenseItemData>{
int groupid;
Context context;
ArrayList<ExpenseItemData>expenseItemDataArrayList;
LayoutInflater layoutInflater;
public SpinnerExpAdapter(Context context, int groupid, int id, ArrayList<ExpenseItemData> expenseItemDataArrayList) {
super(context,id,expenseItemDataArrayList);
this.groupid = groupid;
this.context = context;
this.expenseItemDataArrayList = expenseItemDataArrayList;
layoutInflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
@NonNull
@Override
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
View itemview=layoutInflater.inflate(R.layout.child_expenselayout,parent,false);
TextView imageView=(TextView) itemview.findViewById(R.id.exp_cat_img);
imageView.setText(expenseItemDataArrayList.get(position).getImageId());
TextView textView=(TextView)itemview.findViewById(R.id.exp_cat_text);
textView.setText(expenseItemDataArrayList.get(position).getText());
return itemview;
}
@Override
public View getDropDownView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
return getView(position,convertView,parent);
}
}
| UTF-8 | Java | 1,885 | java | SpinnerExpAdapter.java | Java | [] | null | [] | package com.eron.android.expenseapp.Adapter;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.eron.android.expenseapp.Model.CatItemData;
import com.eron.android.expenseapp.Model.ExpenseItemData;
import com.eron.android.expenseapp.R;
import java.util.ArrayList;
public class SpinnerExpAdapter extends ArrayAdapter<ExpenseItemData>{
int groupid;
Context context;
ArrayList<ExpenseItemData>expenseItemDataArrayList;
LayoutInflater layoutInflater;
public SpinnerExpAdapter(Context context, int groupid, int id, ArrayList<ExpenseItemData> expenseItemDataArrayList) {
super(context,id,expenseItemDataArrayList);
this.groupid = groupid;
this.context = context;
this.expenseItemDataArrayList = expenseItemDataArrayList;
layoutInflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
@NonNull
@Override
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
View itemview=layoutInflater.inflate(R.layout.child_expenselayout,parent,false);
TextView imageView=(TextView) itemview.findViewById(R.id.exp_cat_img);
imageView.setText(expenseItemDataArrayList.get(position).getImageId());
TextView textView=(TextView)itemview.findViewById(R.id.exp_cat_text);
textView.setText(expenseItemDataArrayList.get(position).getText());
return itemview;
}
@Override
public View getDropDownView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
return getView(position,convertView,parent);
}
}
| 1,885 | 0.769761 | 0.769761 | 50 | 36.700001 | 31.742243 | 121 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.86 | false | false | 9 |
1f30c6aee1c3a286dc13b6c306bcf9715196a8c1 | 26,697,516,760,409 | 17c0bc12d7ef1917d2e707331b518fab5f1340f1 | /nc-side-impl/nc-side/src/main/java/com/netcracker/rss/ruleengine/operations/IpPlannerOperations.java | 87158122b58cd99a225fb62d8df5501922173ab4 | [] | no_license | navitskyd/complex-cfg | https://github.com/navitskyd/complex-cfg | 4b2f8e81b123b2e0a8c89fb7cc477380b42900a9 | e34f16c94056f6fb570585dbf1b79d0107b0516d | refs/heads/master | 2016-09-15T00:21:14.856000 | 2016-08-18T18:08:42 | 2016-08-18T18:08:42 | 64,027,062 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.netcracker.rss.ruleengine.operations;
import com.netcracker.applications.ruleengine.Result;
import com.netcracker.applications.ruleengine.RuleContext;
import com.netcracker.applications.ruleengine.exceptions.RuleEngineException;
import com.netcracker.applications.spfpp.opf.decomposition.operations.DecompositionRuleUtils;
import com.netcracker.ejb.core.NCCoreInternals;
import com.netcracker.ejb.framework.HomeInterfaceHelper;
import com.netcracker.ejb.ipplanner.*;
import com.netcracker.framework.jdbc.JDBCTypeConverters;
import com.netcracker.rss.ruleengine.operations.dao.DAOUtils;
import org.apache.commons.lang.math.NumberUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import javax.ejb.CreateException;
import javax.ejb.FinderException;
import java.math.BigInteger;
import java.rmi.RemoteException;
import java.util.Collection;
import java.util.Map;
public class IpPlannerOperations {
private static final Log log = LogFactory.getLog(IpPlannerOperations.class);
private IpPlannerOperations() {
// prevents object creation
}
public static Result allocateIPAddress(RuleContext context, Collection targets, Collection sources)
throws RuleEngineException, RemoteException, FinderException, CreateException, IPPlannerException {
Object order = Utils.getOrder(context);
log.debug("order: " + Utils.getLogString(order));
//noinspection unchecked
Map<String, String> targetMap = DecompositionRuleUtils.getTargetOperationParametersMap(context);
log.debug("targetMap: " + targetMap);
IPManager manager = HomeInterfaceHelper.getInstance().lookupHome(
"com.netcracker.ejb.ipplanner.IPManagerHome", IPManagerHome.class).create();
Object range = DAOUtils.getValue(context, order, targetMap, "FROM_", "");
if (range == null) {
log.error("Range is empty");
return new Result(false);
}
log.debug("range: " + Utils.getLogString(range));
BigInteger rangeId;
if (range instanceof String && !NumberUtils.isDigits((String) range)) {
//noinspection unchecked
BigInteger topRangeId = (BigInteger) NCCoreInternals.jdbcInstance().selectForObjectOrNull("" +
"select t_o.object_id\n" +
" from nc_references i\n" +
" join nc_references t\n" +
" on t.object_id = i.reference\n" +
" and t.attr_id = 703 /* Reference to Top Sites */\n" +
" join nc_objects t_o\n" +
" on t_o.object_id = t.reference\n" +
" and t_o.object_type_id = 5042946185013963560 /* Top Range */\n" +
" where i.object_id = 9138058010013049163 /* Top */\n" +
" and i.attr_id = 9138058010013049239 /* Inventory Project */",
JDBCTypeConverters.NUMBER_CONVERTER, new Object[][]{}
);
log.debug("topRangeId: " + topRangeId);
rangeId = manager.lookupRangeIdByString(topRangeId, (String) range);
if (rangeId == null) {
rangeId = manager.createRangeByString(topRangeId, (String) range);
log.debug("created rangeId: " + rangeId);
}
} else {
rangeId = Utils.getId(range);
}
log.debug("rangeId: " + rangeId);
IPAddress ipAddress;
try {
ipAddress = manager.nextAvailableAddressFromRange(rangeId);
} catch (NotEnoughIPsException e) {
log.error("Not Enough IPs", e);
return new Result(false);
}
log.debug("ipAddress: " + Utils.getLogString(ipAddress));
ipAddress.prepareForAssignment();
DAOUtils.setValue(context, order, targetMap, "TO_", "", ipAddress.getID());
return new Result(true);
}
public static Result allocateIPAddressFromPool(RuleContext context, Collection targets, Collection sources)
throws RuleEngineException, RemoteException, FinderException, CreateException, IPPlannerException {
Object order = Utils.getOrder(context);
log.debug("order: " + Utils.getLogString(order));
//noinspection unchecked
Map<String, String> targetMap = DecompositionRuleUtils.getTargetOperationParametersMap(context);
log.debug("targetMap: " + targetMap);
IPManager manager = HomeInterfaceHelper.getInstance().lookupHome(
"com.netcracker.ejb.ipplanner.IPManagerHome", IPManagerHome.class).create();
Object pool = DAOUtils.getValue(context, order, targetMap, "FROM_", "");
if (pool == null) {
log.error("Pool is empty");
return new Result(false);
}
log.debug("pool: " + Utils.getLogString(pool));
BigInteger poolId;
if (pool instanceof String && !NumberUtils.isDigits((String) pool)) {
//noinspection unchecked
poolId = (BigInteger) NCCoreInternals.jdbcInstance().selectForObjectOrNull("" +
"select p.object_id\n" +
" from nc_references i\n" +
" join nc_references t\n" +
" on t.object_id = i.reference\n" +
" and t.attr_id = 703 /* Reference to Top Sites */\n" +
" join nc_objects t_o\n" +
" on t_o.object_id = t.reference\n" +
" and t_o.object_type_id = 5042946185013963560 /* Top Range */\n" +
" join nc_objects p\n" +
" on p.parent_id = t_o.object_id\n" +
" and p.object_type_id = 7080365065013898296 /* IP Pool */\n" +
" and p.name = ?\n" +
" where i.object_id = 9138058010013049163 /* Top */\n" +
" and i.attr_id = 9138058010013049239 /* Inventory Project */",
JDBCTypeConverters.NUMBER_CONVERTER, new Object[][]{{pool}}
);
} else {
poolId = Utils.getId(pool);
}
log.debug("poolId: " + poolId);
IPAddress ipAddress;
try {
ipAddress = manager.nextAvailableAddressFromPool(poolId);
} catch (NotEnoughIPsException e) {
log.error("Not Enough IPs", e);
return new Result(false);
}
log.debug("ipAddress: " + Utils.getLogString(ipAddress));
ipAddress.prepareForAssignment();
DAOUtils.setValue(context, order, targetMap, "TO_", "", ipAddress.getID());
return new Result(true);
}
public static Result allocateIPRange(RuleContext context, Collection targets, Collection sources)
throws RuleEngineException, RemoteException, FinderException, CreateException, IPPlannerException {
Object order = Utils.getOrder(context);
log.debug("order: " + Utils.getLogString(order));
//noinspection unchecked
Map<String, String> targetMap = DecompositionRuleUtils.getTargetOperationParametersMap(context);
log.debug("targetMap: " + targetMap);
IPManager manager = HomeInterfaceHelper.getInstance().lookupHome(
"com.netcracker.ejb.ipplanner.IPManagerHome", IPManagerHome.class).create();
Object pool = DAOUtils.getValue(context, order, targetMap, "FROM_", "");
if (pool == null) {
log.error("Pool is empty");
return new Result(false);
}
log.debug("pool: " + Utils.getLogString(pool));
int prefix = 0;
Object prefixObj = DAOUtils.getValue(context, order, targetMap, "PREFIX_", "");
if (prefixObj != null && NumberUtils.isNumber(prefixObj.toString())) {
prefix = Integer.parseInt(prefixObj.toString());
}
log.debug("prefix: " + prefix);
BigInteger poolId;
if (pool instanceof String && !NumberUtils.isDigits((String) pool)) {
//noinspection unchecked
poolId = (BigInteger) NCCoreInternals.jdbcInstance().selectForObjectOrNull("" +
"select p.object_id\n" +
" from nc_references i\n" +
" join nc_references t\n" +
" on t.object_id = i.reference\n" +
" and t.attr_id = 703 /* Reference to Top Sites */\n" +
" join nc_objects t_o\n" +
" on t_o.object_id = t.reference\n" +
" and t_o.object_type_id = 5042946185013963560 /* Top Range */\n" +
" join nc_objects p\n" +
" on p.parent_id = t_o.object_id\n" +
" and p.object_type_id = 7080365065013898296 /* IP Pool */\n" +
" and p.name = ?\n" +
" where i.object_id = 9138058010013049163 /* Top */\n" +
" and i.attr_id = 9138058010013049239 /* Inventory Project */",
JDBCTypeConverters.NUMBER_CONVERTER, new Object[][]{{pool}}
);
} else {
poolId = Utils.getId(pool);
}
log.debug("poolId: " + poolId);
IPRange ipRange = null;
if (prefix > 0) {
ipRange = manager.nextAvailableRangeFromPool(poolId, prefix);
} else {
for (int i = 32; i >= 8; i--) {
try {
ipRange = manager.nextAvailableRangeFromPool(poolId, i);
break;
} catch (NotEnoughIPsException ignore) {
}
}
}
log.debug("ipRange: " + Utils.getLogString(ipRange));
if (ipRange == null) {
log.debug("IP Range not found");
return new Result(false);
}
DAOUtils.setValue(context, order, targetMap, "TO_", "", ipRange);
return new Result(true);
}
}
| UTF-8 | Java | 10,270 | java | IpPlannerOperations.java | Java | [] | null | [] | package com.netcracker.rss.ruleengine.operations;
import com.netcracker.applications.ruleengine.Result;
import com.netcracker.applications.ruleengine.RuleContext;
import com.netcracker.applications.ruleengine.exceptions.RuleEngineException;
import com.netcracker.applications.spfpp.opf.decomposition.operations.DecompositionRuleUtils;
import com.netcracker.ejb.core.NCCoreInternals;
import com.netcracker.ejb.framework.HomeInterfaceHelper;
import com.netcracker.ejb.ipplanner.*;
import com.netcracker.framework.jdbc.JDBCTypeConverters;
import com.netcracker.rss.ruleengine.operations.dao.DAOUtils;
import org.apache.commons.lang.math.NumberUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import javax.ejb.CreateException;
import javax.ejb.FinderException;
import java.math.BigInteger;
import java.rmi.RemoteException;
import java.util.Collection;
import java.util.Map;
public class IpPlannerOperations {
private static final Log log = LogFactory.getLog(IpPlannerOperations.class);
private IpPlannerOperations() {
// prevents object creation
}
public static Result allocateIPAddress(RuleContext context, Collection targets, Collection sources)
throws RuleEngineException, RemoteException, FinderException, CreateException, IPPlannerException {
Object order = Utils.getOrder(context);
log.debug("order: " + Utils.getLogString(order));
//noinspection unchecked
Map<String, String> targetMap = DecompositionRuleUtils.getTargetOperationParametersMap(context);
log.debug("targetMap: " + targetMap);
IPManager manager = HomeInterfaceHelper.getInstance().lookupHome(
"com.netcracker.ejb.ipplanner.IPManagerHome", IPManagerHome.class).create();
Object range = DAOUtils.getValue(context, order, targetMap, "FROM_", "");
if (range == null) {
log.error("Range is empty");
return new Result(false);
}
log.debug("range: " + Utils.getLogString(range));
BigInteger rangeId;
if (range instanceof String && !NumberUtils.isDigits((String) range)) {
//noinspection unchecked
BigInteger topRangeId = (BigInteger) NCCoreInternals.jdbcInstance().selectForObjectOrNull("" +
"select t_o.object_id\n" +
" from nc_references i\n" +
" join nc_references t\n" +
" on t.object_id = i.reference\n" +
" and t.attr_id = 703 /* Reference to Top Sites */\n" +
" join nc_objects t_o\n" +
" on t_o.object_id = t.reference\n" +
" and t_o.object_type_id = 5042946185013963560 /* Top Range */\n" +
" where i.object_id = 9138058010013049163 /* Top */\n" +
" and i.attr_id = 9138058010013049239 /* Inventory Project */",
JDBCTypeConverters.NUMBER_CONVERTER, new Object[][]{}
);
log.debug("topRangeId: " + topRangeId);
rangeId = manager.lookupRangeIdByString(topRangeId, (String) range);
if (rangeId == null) {
rangeId = manager.createRangeByString(topRangeId, (String) range);
log.debug("created rangeId: " + rangeId);
}
} else {
rangeId = Utils.getId(range);
}
log.debug("rangeId: " + rangeId);
IPAddress ipAddress;
try {
ipAddress = manager.nextAvailableAddressFromRange(rangeId);
} catch (NotEnoughIPsException e) {
log.error("Not Enough IPs", e);
return new Result(false);
}
log.debug("ipAddress: " + Utils.getLogString(ipAddress));
ipAddress.prepareForAssignment();
DAOUtils.setValue(context, order, targetMap, "TO_", "", ipAddress.getID());
return new Result(true);
}
public static Result allocateIPAddressFromPool(RuleContext context, Collection targets, Collection sources)
throws RuleEngineException, RemoteException, FinderException, CreateException, IPPlannerException {
Object order = Utils.getOrder(context);
log.debug("order: " + Utils.getLogString(order));
//noinspection unchecked
Map<String, String> targetMap = DecompositionRuleUtils.getTargetOperationParametersMap(context);
log.debug("targetMap: " + targetMap);
IPManager manager = HomeInterfaceHelper.getInstance().lookupHome(
"com.netcracker.ejb.ipplanner.IPManagerHome", IPManagerHome.class).create();
Object pool = DAOUtils.getValue(context, order, targetMap, "FROM_", "");
if (pool == null) {
log.error("Pool is empty");
return new Result(false);
}
log.debug("pool: " + Utils.getLogString(pool));
BigInteger poolId;
if (pool instanceof String && !NumberUtils.isDigits((String) pool)) {
//noinspection unchecked
poolId = (BigInteger) NCCoreInternals.jdbcInstance().selectForObjectOrNull("" +
"select p.object_id\n" +
" from nc_references i\n" +
" join nc_references t\n" +
" on t.object_id = i.reference\n" +
" and t.attr_id = 703 /* Reference to Top Sites */\n" +
" join nc_objects t_o\n" +
" on t_o.object_id = t.reference\n" +
" and t_o.object_type_id = 5042946185013963560 /* Top Range */\n" +
" join nc_objects p\n" +
" on p.parent_id = t_o.object_id\n" +
" and p.object_type_id = 7080365065013898296 /* IP Pool */\n" +
" and p.name = ?\n" +
" where i.object_id = 9138058010013049163 /* Top */\n" +
" and i.attr_id = 9138058010013049239 /* Inventory Project */",
JDBCTypeConverters.NUMBER_CONVERTER, new Object[][]{{pool}}
);
} else {
poolId = Utils.getId(pool);
}
log.debug("poolId: " + poolId);
IPAddress ipAddress;
try {
ipAddress = manager.nextAvailableAddressFromPool(poolId);
} catch (NotEnoughIPsException e) {
log.error("Not Enough IPs", e);
return new Result(false);
}
log.debug("ipAddress: " + Utils.getLogString(ipAddress));
ipAddress.prepareForAssignment();
DAOUtils.setValue(context, order, targetMap, "TO_", "", ipAddress.getID());
return new Result(true);
}
public static Result allocateIPRange(RuleContext context, Collection targets, Collection sources)
throws RuleEngineException, RemoteException, FinderException, CreateException, IPPlannerException {
Object order = Utils.getOrder(context);
log.debug("order: " + Utils.getLogString(order));
//noinspection unchecked
Map<String, String> targetMap = DecompositionRuleUtils.getTargetOperationParametersMap(context);
log.debug("targetMap: " + targetMap);
IPManager manager = HomeInterfaceHelper.getInstance().lookupHome(
"com.netcracker.ejb.ipplanner.IPManagerHome", IPManagerHome.class).create();
Object pool = DAOUtils.getValue(context, order, targetMap, "FROM_", "");
if (pool == null) {
log.error("Pool is empty");
return new Result(false);
}
log.debug("pool: " + Utils.getLogString(pool));
int prefix = 0;
Object prefixObj = DAOUtils.getValue(context, order, targetMap, "PREFIX_", "");
if (prefixObj != null && NumberUtils.isNumber(prefixObj.toString())) {
prefix = Integer.parseInt(prefixObj.toString());
}
log.debug("prefix: " + prefix);
BigInteger poolId;
if (pool instanceof String && !NumberUtils.isDigits((String) pool)) {
//noinspection unchecked
poolId = (BigInteger) NCCoreInternals.jdbcInstance().selectForObjectOrNull("" +
"select p.object_id\n" +
" from nc_references i\n" +
" join nc_references t\n" +
" on t.object_id = i.reference\n" +
" and t.attr_id = 703 /* Reference to Top Sites */\n" +
" join nc_objects t_o\n" +
" on t_o.object_id = t.reference\n" +
" and t_o.object_type_id = 5042946185013963560 /* Top Range */\n" +
" join nc_objects p\n" +
" on p.parent_id = t_o.object_id\n" +
" and p.object_type_id = 7080365065013898296 /* IP Pool */\n" +
" and p.name = ?\n" +
" where i.object_id = 9138058010013049163 /* Top */\n" +
" and i.attr_id = 9138058010013049239 /* Inventory Project */",
JDBCTypeConverters.NUMBER_CONVERTER, new Object[][]{{pool}}
);
} else {
poolId = Utils.getId(pool);
}
log.debug("poolId: " + poolId);
IPRange ipRange = null;
if (prefix > 0) {
ipRange = manager.nextAvailableRangeFromPool(poolId, prefix);
} else {
for (int i = 32; i >= 8; i--) {
try {
ipRange = manager.nextAvailableRangeFromPool(poolId, i);
break;
} catch (NotEnoughIPsException ignore) {
}
}
}
log.debug("ipRange: " + Utils.getLogString(ipRange));
if (ipRange == null) {
log.debug("IP Range not found");
return new Result(false);
}
DAOUtils.setValue(context, order, targetMap, "TO_", "", ipRange);
return new Result(true);
}
}
| 10,270 | 0.56592 | 0.544206 | 232 | 43.267242 | 31.788731 | 111 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.693965 | false | false | 9 |
edb66086ca49d1f2fa7fc7118e46f8b79d54b8d3 | 26,697,516,764,274 | 57bfc18b9f955b2ac470ae44e9b1c2875179ce23 | /src/main/resources/HuntTheWumpus/Model/Room.java | f03d45413d82bbd9bdabc19b9ab21478c2b9e6e3 | [] | no_license | KrbAlmryde/cs474-Hw2 | https://github.com/KrbAlmryde/cs474-Hw2 | e373171a567665709b5ce30d1db8f59fec8f860b | b769249b941a50c9950483537c1b41028e4bce95 | refs/heads/master | 2021-05-08T09:50:55.589000 | 2016-10-09T22:56:25 | 2016-10-09T22:56:25 | 76,094,212 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
* A room which holds items and characters and knows
* which land has been placed in. It can interact with
* the <code>Server</code> through the
* <code>ClientThreadConnection</code>
*
* @author Kyle Almryde
* @author Jimmy Chav
* @author Josh Fry
* @author Vikrant Singhal
*/
package Model;
import java.io.Serializable;
import java.util.ArrayList;
import Characters.Character;
import Characters.Warrior;
import Items.Item;
import Items.ItemInventory;
public class Room implements Serializable {
/**
*
*/
private static final long serialVersionUID = -6033000182551368958L;
private String land;
private int landNumber;
private String gameOutput;
private int northRoom;
private int eastRoom;
private int southRoom;
private int westRoom;
private String roomText;
protected ItemInventory roomInventory;
private ArrayList<Character> roomCharacters;
private boolean hasButton = false;
private boolean hasSwitch = false;
private boolean hasBed = false;
public Room(String l, int i, int north, int east, int south, int west) {
land = l;
landNumber = i;
northRoom = north;
eastRoom = east;
southRoom = south;
westRoom = west;
roomText = "";
setGameOutput("");
roomInventory = new ItemInventory();
roomCharacters = new ArrayList<Character>();
}
public boolean hasButton() {
return hasButton;
}
public boolean hasSwitch() {
return hasSwitch;
}
public boolean hasBed() {
return hasBed;
}
public void setButton(boolean b) {
hasButton = b;
}
public void setSwitch(boolean s) {
hasSwitch = s;
}
public void setBed(boolean d) {
hasBed = d;
}
public int getLandNumber() {
return landNumber;
}
public String getLand() {
return land;
}
public void setGameText(String entry) {
roomText = entry;
setGameOutput(entry + "\n" + this.inventory() + this.roomCharacters());
}
public void updateGameText() {
setGameOutput(roomText + "\n" + this.inventory()
+ this.roomCharacters());
}
public String toString() {
return getGameOutput();
}
public int northRoom() {
return northRoom;
}
public int eastRoom() {
return eastRoom;
}
public int southRoom() {
return southRoom;
}
public int westRoom() {
return westRoom;
}
public void addItem(Item i) {
roomInventory.add(i);
}
public Item removeItem(String s) {
return roomInventory.give(s);
}
public String inventory() {
String result = "";
result += "\t+================================+\n";
result += "\t+ Items in the room +\n";
result += "\t+================================+\n";
result += roomInventory.displayItems();
return result;
}
public String roomCharacters() {
String result = "";
result += "\t**********************************\n";
result += "\t* Characters in the room *\n";
result += "\t**********************************\n";
for (Character actor : roomCharacters) {
if (actor instanceof Warrior) {
// do not show the warrior in the room
} else {
result += "\t*\t" + actor.getName() + "[HP: "
+ actor.getHealth() + "/" + actor.getMaxHealth() + "]";
if (!actor.isAlive()) {
result += "-(Dead)-\n";
} else
result += "\n";
}
}
// result += "**********************************\n\n";
return result;
}
public ArrayList<Character> getRoomCharacters() {
return roomCharacters;
}
public void addCharacterToRoom(Character ch) {
roomCharacters.add(ch);
}
public void removeCharacter(Character ch) {
roomCharacters.remove(ch);
}
public void sendCharactersMsgs(String message) {
if (!roomCharacters.isEmpty()) {
for (Character ch : roomCharacters) {
ch.sendMessage(message);
}
}
}
public ItemInventory roomInventory() {
return roomInventory;
}
public Character getCharacter(String character) {
Character charac = null;
for (int i = 0; i < roomCharacters.size(); i++) {
if (roomCharacters.get(i).getName().equalsIgnoreCase(character)) {
charac = roomCharacters.get(i);
}
}
return charac;
}
public String getGameOutput() {
return gameOutput;
}
public void setGameOutput(String gameOutput) {
this.gameOutput = gameOutput;
}
}
| UTF-8 | Java | 4,157 | java | Room.java | Java | [
{
"context": " <code>ClientThreadConnection</code>\n *\n * @author Kyle Almryde\n * @author Jimmy Chav\n * @author Josh Fry\n * @aut",
"end": 216,
"score": 0.9998924136161804,
"start": 204,
"tag": "NAME",
"value": "Kyle Almryde"
},
{
"context": "ction</code>\n *\n * @author Kyle Almr... | null | [] | /**
* A room which holds items and characters and knows
* which land has been placed in. It can interact with
* the <code>Server</code> through the
* <code>ClientThreadConnection</code>
*
* @author <NAME>
* @author <NAME>
* @author <NAME>
* @author <NAME>
*/
package Model;
import java.io.Serializable;
import java.util.ArrayList;
import Characters.Character;
import Characters.Warrior;
import Items.Item;
import Items.ItemInventory;
public class Room implements Serializable {
/**
*
*/
private static final long serialVersionUID = -6033000182551368958L;
private String land;
private int landNumber;
private String gameOutput;
private int northRoom;
private int eastRoom;
private int southRoom;
private int westRoom;
private String roomText;
protected ItemInventory roomInventory;
private ArrayList<Character> roomCharacters;
private boolean hasButton = false;
private boolean hasSwitch = false;
private boolean hasBed = false;
public Room(String l, int i, int north, int east, int south, int west) {
land = l;
landNumber = i;
northRoom = north;
eastRoom = east;
southRoom = south;
westRoom = west;
roomText = "";
setGameOutput("");
roomInventory = new ItemInventory();
roomCharacters = new ArrayList<Character>();
}
public boolean hasButton() {
return hasButton;
}
public boolean hasSwitch() {
return hasSwitch;
}
public boolean hasBed() {
return hasBed;
}
public void setButton(boolean b) {
hasButton = b;
}
public void setSwitch(boolean s) {
hasSwitch = s;
}
public void setBed(boolean d) {
hasBed = d;
}
public int getLandNumber() {
return landNumber;
}
public String getLand() {
return land;
}
public void setGameText(String entry) {
roomText = entry;
setGameOutput(entry + "\n" + this.inventory() + this.roomCharacters());
}
public void updateGameText() {
setGameOutput(roomText + "\n" + this.inventory()
+ this.roomCharacters());
}
public String toString() {
return getGameOutput();
}
public int northRoom() {
return northRoom;
}
public int eastRoom() {
return eastRoom;
}
public int southRoom() {
return southRoom;
}
public int westRoom() {
return westRoom;
}
public void addItem(Item i) {
roomInventory.add(i);
}
public Item removeItem(String s) {
return roomInventory.give(s);
}
public String inventory() {
String result = "";
result += "\t+================================+\n";
result += "\t+ Items in the room +\n";
result += "\t+================================+\n";
result += roomInventory.displayItems();
return result;
}
public String roomCharacters() {
String result = "";
result += "\t**********************************\n";
result += "\t* Characters in the room *\n";
result += "\t**********************************\n";
for (Character actor : roomCharacters) {
if (actor instanceof Warrior) {
// do not show the warrior in the room
} else {
result += "\t*\t" + actor.getName() + "[HP: "
+ actor.getHealth() + "/" + actor.getMaxHealth() + "]";
if (!actor.isAlive()) {
result += "-(Dead)-\n";
} else
result += "\n";
}
}
// result += "**********************************\n\n";
return result;
}
public ArrayList<Character> getRoomCharacters() {
return roomCharacters;
}
public void addCharacterToRoom(Character ch) {
roomCharacters.add(ch);
}
public void removeCharacter(Character ch) {
roomCharacters.remove(ch);
}
public void sendCharactersMsgs(String message) {
if (!roomCharacters.isEmpty()) {
for (Character ch : roomCharacters) {
ch.sendMessage(message);
}
}
}
public ItemInventory roomInventory() {
return roomInventory;
}
public Character getCharacter(String character) {
Character charac = null;
for (int i = 0; i < roomCharacters.size(); i++) {
if (roomCharacters.get(i).getName().equalsIgnoreCase(character)) {
charac = roomCharacters.get(i);
}
}
return charac;
}
public String getGameOutput() {
return gameOutput;
}
public void setGameOutput(String gameOutput) {
this.gameOutput = gameOutput;
}
}
| 4,136 | 0.643974 | 0.639163 | 199 | 19.889448 | 18.29512 | 73 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.643216 | false | false | 9 |
0754a72f7f21d24f25292bc6e09e7d68e386a64d | 9,921,374,495,995 | b7567fa02982c3547c6d8c45bd2a92b2e1b71c7f | /Lunar_Rover.java | f9660dd74ef6188f7e77ed8a9ea54121be626fa1 | [] | no_license | ajmadrid3/Lunar_Rover_State_Diagram | https://github.com/ajmadrid3/Lunar_Rover_State_Diagram | 1ea1041afa559ab4b92bbe7fb8dcd78fbfa66edc | 78990c66cc51fe7ac7b8facd9b9c2f58398f7add | refs/heads/master | 2021-04-26T16:52:43.976000 | 2017-10-13T20:23:51 | 2017-10-13T20:23:51 | 106,869,816 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* Andrew Madrid
* CS 3331 - Advanced Object-Oriented Programming
* Assignment 4 - UML State Machine
* Fall 2017
* Purpose:
* This program is used to replicate the state machine for the Lunar Rover.
* It contains all of the states the machine can be in, as well as the acitons
* that can be performed and the jumps from one state to another.
*/
import java.util.Scanner;
public class Lunar_Rover
{
// ENUM Motion_State holds all of the states that are listed in the State Diagram
public enum Motion_State {
IDLE, MOVE_FORWARD_ACCELERATE, MOVE_FORWARD_CONSTANT, DECELERATE, MOVE_BACKWARD_ACCELERATE, MOVE_BACKWARD_CONSTANT
}
// Based on the user input, the state will either change to a certain state or
// remain in the same one. Tells the user what action is being performed.
public static Motion_State change_State(Motion_State current, int choice)
{
switch(current) {
case IDLE:
if(choice == 1) {
System.out.println("Pressing Right Pedal Once.");
current = Motion_State.MOVE_FORWARD_ACCELERATE;
} else if(choice == 3) {
System.out.println("Holding Right Pedal Down for 6 Seconds.");
current = Motion_State.MOVE_FORWARD_CONSTANT;
} else if(choice == 5) {
System.out.println("Holding Left Pedal Down for 6 Seconds.");
current = Motion_State.MOVE_BACKWARD_ACCELERATE;
} else {
System.out.println("Nothing Happened.");
current = Motion_State.IDLE;
}
break;
case MOVE_FORWARD_ACCELERATE:
if(choice == 2) {
System.out.println("Pressing Right Pedal Twice");
current = Motion_State.DECELERATE;
} else if(choice == 3) {
System.out.println("Holding Right Pedal Down for 6 Seconds.");
current = Motion_State.MOVE_FORWARD_CONSTANT;
} else if(choice == 4) {
System.out.println("Pressing Left Pedal Once.");
current = Motion_State.MOVE_FORWARD_CONSTANT;
} else {
System.out.println("Nothing Happened.");
current = Motion_State.MOVE_FORWARD_ACCELERATE;
}
break;
case MOVE_FORWARD_CONSTANT:
if(choice == 1) {
System.out.println("Pressing Right Pedal Once.");
current = Motion_State.MOVE_FORWARD_ACCELERATE;
} else if(choice == 2) {
System.out.println("Pressing Right Pedal Twice.");
current = Motion_State.DECELERATE;
} else {
System.out.println("Nothing Happened.");
current = Motion_State.MOVE_FORWARD_CONSTANT;
}
break;
case DECELERATE:
if(choice == 6) {
System.out.println("Slowing Down to Speed 0.");
current = Motion_State.IDLE;
} else {
System.out.println("Nothing Happened.");
current = Motion_State.DECELERATE;
}
break;
case MOVE_BACKWARD_ACCELERATE:
if(choice == 1) {
System.out.println("Pressing Right Pedal Once.");
current = Motion_State.DECELERATE;
} else if(choice == 4) {
System.out.println("Pressing Left Pedal Once.");
current = Motion_State.MOVE_BACKWARD_CONSTANT;
} else {
System.out.println("Nothing Happened.");
current = Motion_State.MOVE_BACKWARD_ACCELERATE;
}
break;
case MOVE_BACKWARD_CONSTANT:
if(choice == 1) {
System.out.println("Pressing Right Pedal Once.");
current = Motion_State.DECELERATE;
} else {
System.out.println("Nothing Happened.");
current = Motion_State.MOVE_BACKWARD_CONSTANT;
}
default:
System.out.println();
}
return current;
}
// Prints the current state that the user is in
public static void print_State(Motion_State current)
{
System.out.println("You are currently in the " + current + " state.\n");
}
public static void main(String args[])
{
Motion_State current_State = Motion_State.IDLE;
Scanner scnr = new Scanner(System.in);
int action = 0;
System.out.println("Welcome to the Lunar Rover\n");
print_State(current_State);
while(action != 7)
{
System.out.println("What would you like to do?\n");
System.out.println("1: Press Right Pedal Once");
System.out.println("2: Press Right Pedal Twice");
System.out.println("3: Hold Right Pedal Down for 6 Seconds");
System.out.println("4: Press Left Pedal Once");
System.out.println("5: Hold Left Pedal Down for 6 Seconds");
System.out.println("6: Let Speed Reach 0");
System.out.println("7: Exit Program\n");
System.out.print("Action: ");
action = scnr.nextInt();
if(action == 7)
{
break;
}
else if(action < 1 || action > 7)
{
System.out.println("ERROR: Incorrect value entered.\n");
}
else
{
System.out.println("Performing action.");
current_State = change_State(current_State, action);
print_State(current_State);
}
}
System.out.println("Exiting Program");
}
}
| UTF-8 | Java | 4,717 | java | Lunar_Rover.java | Java | [
{
"context": "/*\n * Andrew Madrid\n * CS 3331 - Advanced Object-Oriented Programming",
"end": 19,
"score": 0.999859631061554,
"start": 6,
"tag": "NAME",
"value": "Andrew Madrid"
}
] | null | [] | /*
* <NAME>
* CS 3331 - Advanced Object-Oriented Programming
* Assignment 4 - UML State Machine
* Fall 2017
* Purpose:
* This program is used to replicate the state machine for the Lunar Rover.
* It contains all of the states the machine can be in, as well as the acitons
* that can be performed and the jumps from one state to another.
*/
import java.util.Scanner;
public class Lunar_Rover
{
// ENUM Motion_State holds all of the states that are listed in the State Diagram
public enum Motion_State {
IDLE, MOVE_FORWARD_ACCELERATE, MOVE_FORWARD_CONSTANT, DECELERATE, MOVE_BACKWARD_ACCELERATE, MOVE_BACKWARD_CONSTANT
}
// Based on the user input, the state will either change to a certain state or
// remain in the same one. Tells the user what action is being performed.
public static Motion_State change_State(Motion_State current, int choice)
{
switch(current) {
case IDLE:
if(choice == 1) {
System.out.println("Pressing Right Pedal Once.");
current = Motion_State.MOVE_FORWARD_ACCELERATE;
} else if(choice == 3) {
System.out.println("Holding Right Pedal Down for 6 Seconds.");
current = Motion_State.MOVE_FORWARD_CONSTANT;
} else if(choice == 5) {
System.out.println("Holding Left Pedal Down for 6 Seconds.");
current = Motion_State.MOVE_BACKWARD_ACCELERATE;
} else {
System.out.println("Nothing Happened.");
current = Motion_State.IDLE;
}
break;
case MOVE_FORWARD_ACCELERATE:
if(choice == 2) {
System.out.println("Pressing Right Pedal Twice");
current = Motion_State.DECELERATE;
} else if(choice == 3) {
System.out.println("Holding Right Pedal Down for 6 Seconds.");
current = Motion_State.MOVE_FORWARD_CONSTANT;
} else if(choice == 4) {
System.out.println("Pressing Left Pedal Once.");
current = Motion_State.MOVE_FORWARD_CONSTANT;
} else {
System.out.println("Nothing Happened.");
current = Motion_State.MOVE_FORWARD_ACCELERATE;
}
break;
case MOVE_FORWARD_CONSTANT:
if(choice == 1) {
System.out.println("Pressing Right Pedal Once.");
current = Motion_State.MOVE_FORWARD_ACCELERATE;
} else if(choice == 2) {
System.out.println("Pressing Right Pedal Twice.");
current = Motion_State.DECELERATE;
} else {
System.out.println("Nothing Happened.");
current = Motion_State.MOVE_FORWARD_CONSTANT;
}
break;
case DECELERATE:
if(choice == 6) {
System.out.println("Slowing Down to Speed 0.");
current = Motion_State.IDLE;
} else {
System.out.println("Nothing Happened.");
current = Motion_State.DECELERATE;
}
break;
case MOVE_BACKWARD_ACCELERATE:
if(choice == 1) {
System.out.println("Pressing Right Pedal Once.");
current = Motion_State.DECELERATE;
} else if(choice == 4) {
System.out.println("Pressing Left Pedal Once.");
current = Motion_State.MOVE_BACKWARD_CONSTANT;
} else {
System.out.println("Nothing Happened.");
current = Motion_State.MOVE_BACKWARD_ACCELERATE;
}
break;
case MOVE_BACKWARD_CONSTANT:
if(choice == 1) {
System.out.println("Pressing Right Pedal Once.");
current = Motion_State.DECELERATE;
} else {
System.out.println("Nothing Happened.");
current = Motion_State.MOVE_BACKWARD_CONSTANT;
}
default:
System.out.println();
}
return current;
}
// Prints the current state that the user is in
public static void print_State(Motion_State current)
{
System.out.println("You are currently in the " + current + " state.\n");
}
public static void main(String args[])
{
Motion_State current_State = Motion_State.IDLE;
Scanner scnr = new Scanner(System.in);
int action = 0;
System.out.println("Welcome to the Lunar Rover\n");
print_State(current_State);
while(action != 7)
{
System.out.println("What would you like to do?\n");
System.out.println("1: Press Right Pedal Once");
System.out.println("2: Press Right Pedal Twice");
System.out.println("3: Hold Right Pedal Down for 6 Seconds");
System.out.println("4: Press Left Pedal Once");
System.out.println("5: Hold Left Pedal Down for 6 Seconds");
System.out.println("6: Let Speed Reach 0");
System.out.println("7: Exit Program\n");
System.out.print("Action: ");
action = scnr.nextInt();
if(action == 7)
{
break;
}
else if(action < 1 || action > 7)
{
System.out.println("ERROR: Incorrect value entered.\n");
}
else
{
System.out.println("Performing action.");
current_State = change_State(current_State, action);
print_State(current_State);
}
}
System.out.println("Exiting Program");
}
}
| 4,710 | 0.663769 | 0.655289 | 145 | 31.531034 | 23.344513 | 116 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.648276 | false | false | 9 |
7ca63f0935d5c7f2ec83030bcc31a8429f822c38 | 19,980,187,901,256 | 972da12ba8db1851c6548e9bd5f9c35177f16986 | /EdSoftMate/src/AprendiendoMatematicas/OptionpaneMensaje.java | 3633be180d56adf2cce5ff6a942b46a5ed49ee66 | [] | no_license | yober25/TrabajodeSoftwareII | https://github.com/yober25/TrabajodeSoftwareII | fab4fc20d19a67320424e67ea8de90498999e40d | 78e3f2b36061e287772ceaa9d650790f687c9eff | refs/heads/master | 2016-09-05T09:00:45.133000 | 2014-07-29T03:01:58 | 2014-07-29T03:01:58 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package AprendiendoMatematicas;
import com.sun.awt.AWTUtilities;
import java.awt.Polygon;
import java.awt.Shape;
import java.util.Timer;
import java.util.TimerTask;
import javax.swing.ImageIcon;
import javax.swing.JLayeredPane;
import javax.swing.JPanel;
public final class OptionpaneMensaje extends javax.swing.JFrame {
String icono;
public OptionpaneMensaje( String p, int d,int control) {
initComponents();
this.setLocationRelativeTo(null);
this.duracion=d;
Comenzar_a_contar();
if(control==0){icono="/Iconos/no.png";}
if(control==1){icono="/Iconos/si.png";}
if(control==2){icono="/Iconos/fin.png";}
// Fondo de JOption
((JPanel)getContentPane()).setOpaque(false);
ImageIcon uno=new ImageIcon(this.getClass().getResource(icono));
desktop.setIcon(uno);
getLayeredPane().add(desktop,JLayeredPane.FRAME_CONTENT_LAYER);
desktop.setBounds(0,0,uno.getIconWidth(),uno.getIconHeight());
//--------------------------------------------------------------------
int[] puntos_x = {5 ,14,30,50,75,95,115,130,148,165,170,166,171,162,204,241,277,282,282,278,223,184,152,134,107,83 ,57 ,45 ,26 ,14 ,12 ,16 ,8 ,4 ,5};
int[] puntos_y = {85,64,46,33,29,28,35 ,22 ,14 ,19 ,25 ,33 ,41 ,52 ,44 ,33 ,19 ,22 ,92 ,97 ,119,130,135,154,167,170,168,161,163,159,148,139,120,100,85};
Shape forma = new Polygon(puntos_x, puntos_y,35);
AWTUtilities.setWindowShape(this, forma);
}
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
desktop = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setAlwaysOnTop(true);
setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
setUndecorated(true);
desktop.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
desktopMouseClicked(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(desktop, javax.swing.GroupLayout.PREFERRED_SIZE, 282, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 1, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(desktop, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void desktopMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_desktopMouseClicked
this.dispose();
}//GEN-LAST:event_desktopMouseClicked
public void time_is_over(){
this.respuesta="Se acabo el tiempo, mala suerte";
actualizar();//actualiza controles
this.dispose();//cierra ventana
}
public void actualizar(){
//se añade la respuesta al objeto label de miframe
// miframe.lbRes.setText("Respuesta: " + this.respuesta);
// miframe.lbtiempo.setText("0");
// miframe.lbRes.repaint();
}
public void Comenzar_a_contar() {
tiempo = new Timer();
task = new TimerTask() {
int contador=0;
@Override
public void run() {
contador++;
//System.out.println("tiempo transcurrido: " + contador);
// miframe.lbtiempo.setText(String.valueOf(contador));
if(contador == duracion){
//System.out.println("Se acabo el tiempo, mala suerte");
time_is_over();
detener();
}
}
};
tiempo.schedule(task,0,1000);
}
//detiene la animacion
public void detener() {
tiempo.cancel();
task.cancel();
}
private Timer tiempo ;
private TimerTask task;
private String respuesta="Se acabo el tiempo, mala suerte";
private int duracion=3;
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel desktop;
// End of variables declaration//GEN-END:variables
}
| UTF-8 | Java | 4,889 | java | OptionpaneMensaje.java | Java | [] | null | [] | package AprendiendoMatematicas;
import com.sun.awt.AWTUtilities;
import java.awt.Polygon;
import java.awt.Shape;
import java.util.Timer;
import java.util.TimerTask;
import javax.swing.ImageIcon;
import javax.swing.JLayeredPane;
import javax.swing.JPanel;
public final class OptionpaneMensaje extends javax.swing.JFrame {
String icono;
public OptionpaneMensaje( String p, int d,int control) {
initComponents();
this.setLocationRelativeTo(null);
this.duracion=d;
Comenzar_a_contar();
if(control==0){icono="/Iconos/no.png";}
if(control==1){icono="/Iconos/si.png";}
if(control==2){icono="/Iconos/fin.png";}
// Fondo de JOption
((JPanel)getContentPane()).setOpaque(false);
ImageIcon uno=new ImageIcon(this.getClass().getResource(icono));
desktop.setIcon(uno);
getLayeredPane().add(desktop,JLayeredPane.FRAME_CONTENT_LAYER);
desktop.setBounds(0,0,uno.getIconWidth(),uno.getIconHeight());
//--------------------------------------------------------------------
int[] puntos_x = {5 ,14,30,50,75,95,115,130,148,165,170,166,171,162,204,241,277,282,282,278,223,184,152,134,107,83 ,57 ,45 ,26 ,14 ,12 ,16 ,8 ,4 ,5};
int[] puntos_y = {85,64,46,33,29,28,35 ,22 ,14 ,19 ,25 ,33 ,41 ,52 ,44 ,33 ,19 ,22 ,92 ,97 ,119,130,135,154,167,170,168,161,163,159,148,139,120,100,85};
Shape forma = new Polygon(puntos_x, puntos_y,35);
AWTUtilities.setWindowShape(this, forma);
}
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
desktop = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setAlwaysOnTop(true);
setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
setUndecorated(true);
desktop.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
desktopMouseClicked(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(desktop, javax.swing.GroupLayout.PREFERRED_SIZE, 282, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 1, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(desktop, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void desktopMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_desktopMouseClicked
this.dispose();
}//GEN-LAST:event_desktopMouseClicked
public void time_is_over(){
this.respuesta="Se acabo el tiempo, mala suerte";
actualizar();//actualiza controles
this.dispose();//cierra ventana
}
public void actualizar(){
//se añade la respuesta al objeto label de miframe
// miframe.lbRes.setText("Respuesta: " + this.respuesta);
// miframe.lbtiempo.setText("0");
// miframe.lbRes.repaint();
}
public void Comenzar_a_contar() {
tiempo = new Timer();
task = new TimerTask() {
int contador=0;
@Override
public void run() {
contador++;
//System.out.println("tiempo transcurrido: " + contador);
// miframe.lbtiempo.setText(String.valueOf(contador));
if(contador == duracion){
//System.out.println("Se acabo el tiempo, mala suerte");
time_is_over();
detener();
}
}
};
tiempo.schedule(task,0,1000);
}
//detiene la animacion
public void detener() {
tiempo.cancel();
task.cancel();
}
private Timer tiempo ;
private TimerTask task;
private String respuesta="Se acabo el tiempo, mala suerte";
private int duracion=3;
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel desktop;
// End of variables declaration//GEN-END:variables
}
| 4,889 | 0.586334 | 0.546645 | 113 | 42.256638 | 30.247293 | 160 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.362832 | false | false | 9 |
54c5646aa1ce6dec4091580838b69247ba8531e1 | 30,743,375,936,048 | e05ba109899657d76888afb00bd3c3854bf0fb76 | /myBabyTao-common/src/main/java/com/baby/common/utils/wechat/CheckUtil.java | 9fc0bce880bb42093d31f7d31d53ef052f087600 | [] | no_license | yiRenJiaoJiao/MyBabyTao | https://github.com/yiRenJiaoJiao/MyBabyTao | a85c4677ecbe2bbfd7e55dfe7485a3de84668950 | 12ed502bd87ccb1673501b0f62de5c8aa14b4219 | refs/heads/master | 2021-04-26T23:29:18.266000 | 2018-03-06T02:03:29 | 2018-03-06T02:03:32 | 124,003,521 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.baby.common.utils.wechat;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.util.Arrays;
/**
* Created by Administrator on 2018/1/26.
*/
@Component("checkUtil")
public class CheckUtil {
//配置微信公众号时填写的Token
// private static final String token = "chenggaowei";
public static boolean checkSignature(String signature, String timestamp, String nonce,String token) {
// 拼接字符串
String[] arr = new String[] { token, timestamp, nonce };
// 排序
Arrays.sort(arr);
// 生成字符串
StringBuffer content = new StringBuffer();
for (int i = 0; i < arr.length; i++) {
content.append(arr[i]);
}
// SHA1加密
String tmp = DecriptUtil.SHA1(content.toString());
return tmp.equals(signature);
}
}
| UTF-8 | Java | 917 | java | CheckUtil.java | Java | [
{
"context": "nent;\n\nimport java.util.Arrays;\n\n/**\n * Created by Administrator on 2018/1/26.\n */\n@Component(\"checkUtil\")\npublic ",
"end": 205,
"score": 0.555756151676178,
"start": 192,
"tag": "USERNAME",
"value": "Administrator"
},
{
"context": "的Token\n // private static... | null | [] | package com.baby.common.utils.wechat;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.util.Arrays;
/**
* Created by Administrator on 2018/1/26.
*/
@Component("checkUtil")
public class CheckUtil {
//配置微信公众号时填写的Token
// private static final String token = "<PASSWORD>";
public static boolean checkSignature(String signature, String timestamp, String nonce,String token) {
// 拼接字符串
String[] arr = new String[] { token, timestamp, nonce };
// 排序
Arrays.sort(arr);
// 生成字符串
StringBuffer content = new StringBuffer();
for (int i = 0; i < arr.length; i++) {
content.append(arr[i]);
}
// SHA1加密
String tmp = DecriptUtil.SHA1(content.toString());
return tmp.equals(signature);
}
}
| 916 | 0.641292 | 0.629758 | 31 | 26.967741 | 24.684439 | 105 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.580645 | false | false | 9 |
1bf790c70234b5bbff6a6dad9c3599d09c5d7bb7 | 25,675,314,533,395 | f00b04e7425273372313108bb9d7be8bffb2b3ed | /TicketPrizeCalculator/src/main/java/calculation/lotteries/tickets/validation/ChainedNumberSetValidation.java | e29ed0c1b4e0b272160f726dc541cfb6c8c27220 | [] | no_license | Milesjpool/lotto-kata | https://github.com/Milesjpool/lotto-kata | 50be12b2f5bc9ab62b9e81b5f6b48a11451abc30 | 95ed7ee281e6a53f2e7ddda67d8ff866a00b9c01 | refs/heads/master | 2020-03-07T02:02:13.475000 | 2018-04-14T13:01:27 | 2018-04-14T13:01:27 | 127,199,226 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package calculation.lotteries.tickets.validation;
public class ChainedNumberSetValidation implements NumberSetValidation {
private NumberSetValidation[] validations;
public ChainedNumberSetValidation(NumberSetValidation... validations) {
this.validations = validations;
}
public boolean isValid(int[] numbers) {
for ( NumberSetValidation validation : validations) {
if (!validation.isValid(numbers))
return false;
}
return true;
}
} | UTF-8 | Java | 517 | java | ChainedNumberSetValidation.java | Java | [] | null | [] | package calculation.lotteries.tickets.validation;
public class ChainedNumberSetValidation implements NumberSetValidation {
private NumberSetValidation[] validations;
public ChainedNumberSetValidation(NumberSetValidation... validations) {
this.validations = validations;
}
public boolean isValid(int[] numbers) {
for ( NumberSetValidation validation : validations) {
if (!validation.isValid(numbers))
return false;
}
return true;
}
} | 517 | 0.686654 | 0.686654 | 19 | 26.263159 | 25.863695 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.263158 | false | false | 9 |
a28b9ce0e0f966d7f63036884a1cb5ebd9d0b589 | 30,855,045,110,957 | d345df36c0cc9f81af4a55f7df476b73505a56cd | /src/be/vdab/jpfhfdst18/TryWithResources.java | c8ace9928f27fa7a6610066d56ba80dd7a06bb37 | [] | no_license | xhianto/JavaPF | https://github.com/xhianto/JavaPF | e72fdf98aecdb4876e478489b0679a9b2878840a | 3d87cba69016954c826c7bddd0f7914104aba6a8 | refs/heads/master | 2022-12-31T15:50:33.176000 | 2020-10-16T18:21:12 | 2020-10-16T18:21:12 | 302,296,130 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package be.vdab.jpfhfdst18;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
public class TryWithResources {
public static void main(String[] args) {
try (var reader = Files.newBufferedReader(
Path.of("data/insecten1.csv"))){
for (String regel ; (regel = reader.readLine()) != null;) {
System.out.println(regel);
}
}
catch (IOException ex){
System.out.println(ex);
}
}
}
| UTF-8 | Java | 515 | java | TryWithResources.java | Java | [] | null | [] | package be.vdab.jpfhfdst18;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
public class TryWithResources {
public static void main(String[] args) {
try (var reader = Files.newBufferedReader(
Path.of("data/insecten1.csv"))){
for (String regel ; (regel = reader.readLine()) != null;) {
System.out.println(regel);
}
}
catch (IOException ex){
System.out.println(ex);
}
}
}
| 515 | 0.574757 | 0.568932 | 19 | 26.105263 | 19.144588 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.421053 | false | false | 9 |
a3619c40dceec99989f30cb4bf97be9bedc7dcf0 | 23,390,391,901,924 | a4e2fcf2da52f479c2c25164599bbdb2628a1ffa | /soft/sextante_lib/sextante_gui/src/es/unex/sextante/gui/saga/SagaAlgorithm.java | 8dfa9796ce569e5b118cf84940d1cc849db2900d | [] | no_license | GRSEB9S/sextante | https://github.com/GRSEB9S/sextante | 126ffc222a2bed9918bae3b59f87f30158b9bbfe | 8ea12c6c40712df01e2e87b02d722d51adb912ea | refs/heads/master | 2021-05-28T19:24:23.306000 | 2013-03-04T15:21:30 | 2013-03-04T15:21:30 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package es.unex.sextante.gui.saga;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import es.unex.sextante.additionalInfo.AdditionalInfoMultipleInput;
import es.unex.sextante.additionalInfo.AdditionalInfoNumericalValue;
import es.unex.sextante.additionalInfo.AdditionalInfoVectorLayer;
import es.unex.sextante.core.GeoAlgorithm;
import es.unex.sextante.core.Sextante;
import es.unex.sextante.dataObjects.IDataObject;
import es.unex.sextante.dataObjects.IRasterLayer;
import es.unex.sextante.dataObjects.ITable;
import es.unex.sextante.dataObjects.IVectorLayer;
import es.unex.sextante.exceptions.GeoAlgorithmExecutionException;
import es.unex.sextante.exceptions.UnsupportedOutputChannelException;
import es.unex.sextante.gui.core.SextanteGUI;
import es.unex.sextante.outputs.FileOutputChannel;
import es.unex.sextante.outputs.IOutputChannel;
import es.unex.sextante.outputs.NullOutputChannel;
import es.unex.sextante.outputs.Output;
import es.unex.sextante.outputs.OutputRasterLayer;
import es.unex.sextante.outputs.OutputTable;
import es.unex.sextante.outputs.OutputVectorLayer;
import es.unex.sextante.parameters.Parameter;
import es.unex.sextante.parameters.ParameterBoolean;
import es.unex.sextante.parameters.ParameterMultipleInput;
import es.unex.sextante.parameters.ParameterRasterLayer;
import es.unex.sextante.parameters.ParameterSelection;
import es.unex.sextante.parameters.ParameterTable;
import es.unex.sextante.parameters.ParameterVectorLayer;
public class SagaAlgorithm
extends
GeoAlgorithm {
private String m_sDescriptionFile;
private int m_iExportedLayers;
private HashMap<String, String> m_ExportedLayers;
private String m_sLibraryName;
public void initialize(final String sDescriptionFile) throws UnwrappableSagaAlgorithmException {
m_sDescriptionFile = sDescriptionFile;
setIsDeterminatedProcess(true);
setUserCanDefineAnalysisExtent(false);
defineCharacteristicsFromDescriptionFile();
}
private void defineCharacteristicsFromDescriptionFile() throws UnwrappableSagaAlgorithmException {
try {
String sLastParentParameterName = null;
final BufferedReader input = new BufferedReader(new FileReader(m_sDescriptionFile));
String sLine = input.readLine().trim();
while (sLine != null) {
sLine = sLine.trim();
boolean bReadLine = true;
if (sLine.startsWith("library name")) {
m_sLibraryName = sLine.split("\t")[1];
setGroup(SagaLibraryNames.getDecoratedLibraryName(m_sLibraryName));
}
if (sLine.startsWith("module name")) {
setName(sLine.split("\t")[1]);
}
if (sLine.contains("Olaya")) { //exclude my own algorithms. They are all in SEXTANTE and have been improved and further tested
throw new UnwrappableSagaAlgorithmException();
}
if (sLine.startsWith("-")) {
String sName, sDescription;
try {
sName = sLine.substring(1, sLine.indexOf(":"));
sDescription = sLine.substring(sLine.indexOf(">") + 1).trim();
}
catch (final Exception e) {//for some reason boolean params have a different syntax
sName = sLine.substring(1, sLine.indexOf("\t"));
sDescription = sLine.substring(sLine.indexOf("\t") + 1).trim();
}
if (SagaBlackList.isInBlackList(sName, getGroup())) {
throw new UnwrappableSagaAlgorithmException();
}
sLine = input.readLine();
if (sLine.contains("Data object") && sLine.contains("File")) {
throw new UnwrappableSagaAlgorithmException();
}
if (sLine.contains("Table")) {
if (sLine.contains("input")) {
m_Parameters.addInputTable(sName, sDescription, !sLine.contains("optional"));
sLastParentParameterName = sName;
}
else if (sLine.contains("Static")) {
sLine = input.readLine().trim();
final String sNumber = sLine.split(" ")[0];
final int iNumber = Integer.parseInt(sNumber);
final String[] sColNames = new String[iNumber];
for (int i = 0; i < sColNames.length; i++) {
sLine = input.readLine();
sColNames[i] = sLine.split("]")[1];
}
//can't get info about rows from description
m_Parameters.addFixedTable(sName, sDescription, sColNames, 3, false);
}
else if (sLine.contains("field")) {
if (sLastParentParameterName == null) {
throw new UnwrappableSagaAlgorithmException();
}
m_Parameters.addTableField(sName, sDescription, sLastParentParameterName);
}
else {
addOutputTable(sName, sDescription);
}
}
if (sLine.contains("Grid")) {
if (sLine.contains("input")) {
if (sLine.contains("list")) {
m_Parameters.addMultipleInput(sName, sDescription, AdditionalInfoMultipleInput.DATA_TYPE_RASTER,
!sLine.contains("optional"));
}
else {
m_Parameters.addInputRasterLayer(sName, sDescription, !sLine.contains("optional"));
}
}
else {
addOutputRasterLayer(sName, sDescription);
}
}
else if (sLine.contains("Shapes")) {
if (sLine.contains("input")) {
if (sLine.contains("list")) {
m_Parameters.addMultipleInput(sName, sDescription, AdditionalInfoMultipleInput.DATA_TYPE_VECTOR_ANY,
!sLine.contains("optional"));
}
else {
m_Parameters.addInputVectorLayer(sName, sDescription, AdditionalInfoVectorLayer.SHAPE_TYPE_ANY,
!sLine.contains("optional"));
sLastParentParameterName = sName;
}
}
else {
addOutputVectorLayer(sName, sDescription, OutputVectorLayer.SHAPE_TYPE_UNDEFINED);
}
}
else if (sLine.contains("Floating")) {
m_Parameters.addNumericalValue(sName, sDescription, 0, AdditionalInfoNumericalValue.NUMERICAL_VALUE_DOUBLE);
}
else if (sLine.contains("Integer")) {
m_Parameters.addNumericalValue(sName, sDescription, 0, AdditionalInfoNumericalValue.NUMERICAL_VALUE_INTEGER);
}
else if (sLine.contains("Boolean")) {
m_Parameters.addBoolean(sName, sDescription, true);
}
else if (sLine.contains("Text")) {
m_Parameters.addString(sName, sDescription);
}
else if (sLine.contains("Choice")) {
input.readLine();
final ArrayList<String> options = new ArrayList<String>();
sLine = input.readLine().trim();
while ((sLine != null) && !(sLine.trim().startsWith("-"))) {
options.add(sLine);
sLine = input.readLine();
}
m_Parameters.addSelection(sName, sDescription, options.toArray(new String[0]));
if (sLine == null) {
break;
}
else {
bReadLine = false;
}
}
}
if (bReadLine) {
sLine = input.readLine();
}
}
input.close();
}
catch (final Exception e) {
//SagaAlgorithmProvider.getSagaLogHandler().addMessage(e.getMessage());
throw new UnwrappableSagaAlgorithmException();
}
}
@Override
public void defineCharacteristics() {
}
@Override
public boolean processAlgorithm() throws GeoAlgorithmExecutionException {
final ArrayList<String> commands = new ArrayList<String>();
m_ExportedLayers = new HashMap<String, String>();
//resolve temporary output files
for (int i = 0; i < m_OutputObjects.getOutputDataObjectsCount(); i++) {
final Output out = m_OutputObjects.getOutput(i);
out.setOutputChannel(this.getOutputChannel(out.getName()));
}
//1: Export rasters to sgrd. only ASC and TIF are supported.
// Vector layers must be in shapefile format and tables in dbf format. We check that.
for (int i = 0; i < m_Parameters.getNumberOfParameters(); i++) {
final Parameter param = m_Parameters.getParameter(i);
if (param instanceof ParameterRasterLayer) {
final ParameterRasterLayer raster = (ParameterRasterLayer) param;
final IRasterLayer layer = raster.getParameterValueAsRasterLayer();
if (layer == null) {
continue;
}
commands.add(exportRasterLayer(layer));
}
if (param instanceof ParameterVectorLayer) {
final ParameterVectorLayer vector = (ParameterVectorLayer) param;
final IVectorLayer layer = vector.getParameterValueAsVectorLayer();
if (layer == null) {
continue;
}
final IOutputChannel channel = layer.getOutputChannel();
if (channel instanceof FileOutputChannel) {
final String sFilename = ((FileOutputChannel) channel).getFilename();
if (!sFilename.toLowerCase().endsWith("shp")) {
throw new SagaExecutionException(Sextante.getText("unsupported_file_format"));
}
}
else {
throw new SagaExecutionException(Sextante.getText("error_non_file_based_input"));
}
}
if (param instanceof ParameterTable) {
final ParameterTable paramTable = (ParameterTable) param;
final ITable table = paramTable.getParameterValueAsTable();
final IOutputChannel channel = table.getOutputChannel();
if (channel instanceof FileOutputChannel) {
final String sFilename = ((FileOutputChannel) channel).getFilename();
if (!sFilename.toLowerCase().endsWith("dbf")) {
throw new SagaExecutionException(Sextante.getText("unsupported_file_format"));
}
}
else {
throw new SagaExecutionException(Sextante.getText("error_non_file_based_input"));
}
}
if (param instanceof ParameterMultipleInput) {
final ArrayList list = (ArrayList) param.getParameterValueAsObject();
if ((list == null) || (list.size() == 0)) {
continue;
}
final AdditionalInfoMultipleInput aimi = (AdditionalInfoMultipleInput) ((ParameterMultipleInput) param).getParameterAdditionalInfo();
if (aimi.getDataType() == AdditionalInfoMultipleInput.DATA_TYPE_RASTER) {
for (int j = 0; j < list.size(); j++) {
commands.add(exportRasterLayer((IRasterLayer) list.get(j)));
}
}
else if (aimi.getDataType() == AdditionalInfoMultipleInput.DATA_TYPE_VECTOR_ANY) {
for (int j = 0; j < list.size(); j++) {
final IVectorLayer layer = (IVectorLayer) list.get(j);
if (layer == null) {
continue;
}
final IOutputChannel channel = layer.getOutputChannel();
if (channel instanceof FileOutputChannel) {
final String sFilename = ((FileOutputChannel) channel).getFilename();
if (!sFilename.toLowerCase().endsWith("shp")) {
throw new SagaExecutionException(Sextante.getText("unsupported_file_format"));
}
}
else {
throw new SagaExecutionException(Sextante.getText("error_non_file_based_input"));
}
}
}
}
}
//2: set parameters and outputs
final StringBuffer sCommand = new StringBuffer(m_sLibraryName + " \"" + getName() + "\"");
for (int i = 0; i < m_Parameters.getNumberOfParameters(); i++) {
final Parameter param = m_Parameters.getParameter(i);
final Object paramObj = param.getParameterValueAsObject();
if (param instanceof ParameterRasterLayer) {
if (paramObj == null) {
continue;
}
final String sFilename = ((FileOutputChannel) ((IRasterLayer) paramObj).getOutputChannel()).getFilename();
sCommand.append(" -" + param.getParameterName() + " " + m_ExportedLayers.get(sFilename));
}
else if ((param instanceof ParameterVectorLayer) || (param instanceof ParameterTable)) {
if (paramObj == null) {
continue;
}
final String sFilename = ((FileOutputChannel) ((IDataObject) paramObj).getOutputChannel()).getFilename();
sCommand.append(" -" + param.getParameterName() + " " + sFilename);
}
else if (param instanceof ParameterMultipleInput) {
if (paramObj == null) {
continue;
}
final ArrayList list = (ArrayList) paramObj;
if (list.size() == 0) {
continue;
}
sCommand.append(" -" + param.getParameterName() + " ");
final AdditionalInfoMultipleInput aimi = (AdditionalInfoMultipleInput) ((ParameterMultipleInput) param).getParameterAdditionalInfo();
if (aimi.getDataType() == AdditionalInfoMultipleInput.DATA_TYPE_RASTER) {
for (int j = 0; j < list.size(); j++) {
final IDataObject dataObject = (IDataObject) list.get(j);
final String sFilename = ((FileOutputChannel) dataObject.getOutputChannel()).getFilename();
sCommand.append(m_ExportedLayers.get(sFilename));
if (j < list.size() - 1) {
sCommand.append(";");
}
}
}
else {
for (int j = 0; j < list.size(); j++) {
final IDataObject dataObject = (IDataObject) list.get(j);
sCommand.append(((FileOutputChannel) dataObject.getOutputChannel()).getFilename());
if (j < list.size() - 1) {
sCommand.append(";");
}
}
}
}
else if (param instanceof ParameterSelection) {
sCommand.append(" -" + param.getParameterName() + " " + Integer.toString(param.getParameterValueAsInt()));
}
else if (param instanceof ParameterBoolean) {
if (param.getParameterValueAsBoolean()) {
sCommand.append(" -" + param.getParameterName());
}
}
else {
sCommand.append(" -" + param.getParameterName() + " " + param.getParameterValueAsString());
}
}
for (int i = 0; i < m_OutputObjects.getOutputObjectsCount(); i++) {
final Output out = m_OutputObjects.getOutput(i);
if (out instanceof OutputRasterLayer) {
final IOutputChannel channel = getOutputChannel(out.getName());
if (channel instanceof FileOutputChannel) {
final FileOutputChannel foc = (FileOutputChannel) channel;
String sFilename = foc.getFilename();
if (!sFilename.endsWith("asc") && !sFilename.endsWith("tif")) {
sFilename = sFilename + ".tif";
}
foc.setFilename(sFilename);
out.setOutputChannel(foc);
sFilename = SextanteGUI.getOutputFactory().getTempFolder() + File.separator + new File(sFilename).getName()
+ ".sgrd";
sCommand.append(" -" + out.getName() + " " + sFilename);
}
else if (channel instanceof NullOutputChannel) {
final String sFilename = SextanteGUI.getOutputFactory().getTempRasterLayerFilename();
sCommand.append(" -" + out.getName() + " " + sFilename + ".sgrd");
}
else {
throw new UnsupportedOutputChannelException();
}
}
else if (out instanceof OutputVectorLayer) {
final IOutputChannel channel = getOutputChannel(out.getName());
if (channel instanceof FileOutputChannel) {
final FileOutputChannel foc = (FileOutputChannel) channel;
String sFilename = foc.getFilename();
if (!sFilename.endsWith("shp")) {
sFilename = sFilename + ".shp";
}
foc.setFilename(sFilename);
out.setOutputChannel(foc);
sCommand.append(" -" + out.getName() + " " + sFilename);
}
else if (channel instanceof NullOutputChannel) {
final String sFilename = SextanteGUI.getOutputFactory().getTempVectorLayerFilename();
sCommand.append(" -" + out.getName() + " " + sFilename);
}
else {
throw new UnsupportedOutputChannelException();
}
}
else if (out instanceof OutputTable) {
final IOutputChannel channel = getOutputChannel(out.getName());
if (channel instanceof FileOutputChannel) {
final FileOutputChannel foc = (FileOutputChannel) channel;
String sFilename = foc.getFilename();
if (!sFilename.endsWith("dbf")) {
sFilename = sFilename + ".dbf";
}
foc.setFilename(sFilename);
out.setOutputChannel(foc);
sCommand.append(" -" + out.getName() + " " + sFilename);
}
else if (channel instanceof NullOutputChannel) {
final String sFilename = SextanteGUI.getOutputFactory().getTempTableFilename();
sCommand.append(" -" + out.getName() + " " + sFilename);
}
else {
throw new UnsupportedOutputChannelException();
}
}
}
commands.add(sCommand.toString());
//3:Export resulting raster layers
for (int i = 0; i < m_OutputObjects.getOutputObjectsCount(); i++) {
final Output out = m_OutputObjects.getOutput(i);
if (out instanceof OutputRasterLayer) {
final IOutputChannel channel = getOutputChannel(out.getName());
if (!(channel instanceof FileOutputChannel)) {
if (channel instanceof NullOutputChannel) {
continue;
}
else {
throw new UnsupportedOutputChannelException();
}
}
final FileOutputChannel foc = (FileOutputChannel) channel;
String sFilename = foc.getFilename();
if (!sFilename.endsWith("asc") && !sFilename.endsWith("tif")) {
sFilename = sFilename + ".tif";
}
final String sFilename2 = SextanteGUI.getOutputFactory().getTempFolder() + File.separator
+ new File(sFilename).getName() + ".sgrd";
if (sFilename.endsWith("asc")) {
commands.add("io_grid 0 -GRID " + sFilename2 + " -FORMAT 1 -FILE " + sFilename);
}
else {
commands.add("io_gdal 1 -GRIDS " + sFilename2 + " -FORMAT 1 -FILE " + sFilename);
}
}
}
//4 Run SAGA
SagaUtils.createSagaBatchJobFileFromSagaCommands(commands.toArray(new String[0]));
SagaUtils.executeSaga(this);
return !m_Task.isCanceled();
}
private String exportRasterLayer(final IRasterLayer layer) throws SagaExecutionException {
String sFilename;
final IOutputChannel channel = layer.getOutputChannel();
if (channel instanceof FileOutputChannel) {
sFilename = ((FileOutputChannel) channel).getFilename();
if (!sFilename.toLowerCase().endsWith("tif") && !sFilename.toLowerCase().endsWith("asc")) {
throw new SagaExecutionException(Sextante.getText("unsupported_file_format"));
}
}
else {
throw new SagaExecutionException(Sextante.getText("error_non_file_based_input"));
}
final String sExt = sFilename.substring(sFilename.lastIndexOf(".") + 1);
final String sDestFilename = getTempFilename();
m_ExportedLayers.put(((FileOutputChannel) channel).getFilename(), sDestFilename);
if (sExt.toLowerCase().equals("tif")) {
return "io_grid_image 1 -OUT_GRID " + sDestFilename + " -FILE " + sFilename + " -METHOD 0";
}
else {
return "io_grid 1 -GRID " + sDestFilename + " -FILE " + sFilename;
}
}
private String getTempFilename() {
m_iExportedLayers++;
final String sPath = SextanteGUI.getOutputFactory().getTempFolder();
final String sFilename = sPath + File.separator + Long.toString(Calendar.getInstance().getTimeInMillis())
+ Integer.toString(m_iExportedLayers) + ".sgrd";
return sFilename;
}
@Override
public String getCommandLineName() {
final String sName = "saga:" + getName().toLowerCase().replace(" ", "");
return sName;
}
@Override
public GeoAlgorithm getNewInstance() throws InstantiationException, IllegalAccessException {
final SagaAlgorithm alg = this.getClass().newInstance();
alg.setOutputObjects(m_OutputObjects.getNewInstance());
alg.setName(this.getName());
alg.setGroup(this.getGroup());
alg.setParameters(m_Parameters.getNewInstance());
alg.setIsDeterminatedProcess(true);
alg.setUserCanDefineAnalysisExtent(getUserCanDefineAnalysisExtent());
alg.m_sDescriptionFile = m_sDescriptionFile;
alg.m_sLibraryName = m_sLibraryName;
return alg;
}
public void updateProgress(final int iPartial,
final int iTotal) {
setProgress(iPartial, iTotal);
}
}
| UTF-8 | Java | 23,559 | java | SagaAlgorithm.java | Java | [] | null | [] |
package es.unex.sextante.gui.saga;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import es.unex.sextante.additionalInfo.AdditionalInfoMultipleInput;
import es.unex.sextante.additionalInfo.AdditionalInfoNumericalValue;
import es.unex.sextante.additionalInfo.AdditionalInfoVectorLayer;
import es.unex.sextante.core.GeoAlgorithm;
import es.unex.sextante.core.Sextante;
import es.unex.sextante.dataObjects.IDataObject;
import es.unex.sextante.dataObjects.IRasterLayer;
import es.unex.sextante.dataObjects.ITable;
import es.unex.sextante.dataObjects.IVectorLayer;
import es.unex.sextante.exceptions.GeoAlgorithmExecutionException;
import es.unex.sextante.exceptions.UnsupportedOutputChannelException;
import es.unex.sextante.gui.core.SextanteGUI;
import es.unex.sextante.outputs.FileOutputChannel;
import es.unex.sextante.outputs.IOutputChannel;
import es.unex.sextante.outputs.NullOutputChannel;
import es.unex.sextante.outputs.Output;
import es.unex.sextante.outputs.OutputRasterLayer;
import es.unex.sextante.outputs.OutputTable;
import es.unex.sextante.outputs.OutputVectorLayer;
import es.unex.sextante.parameters.Parameter;
import es.unex.sextante.parameters.ParameterBoolean;
import es.unex.sextante.parameters.ParameterMultipleInput;
import es.unex.sextante.parameters.ParameterRasterLayer;
import es.unex.sextante.parameters.ParameterSelection;
import es.unex.sextante.parameters.ParameterTable;
import es.unex.sextante.parameters.ParameterVectorLayer;
public class SagaAlgorithm
extends
GeoAlgorithm {
private String m_sDescriptionFile;
private int m_iExportedLayers;
private HashMap<String, String> m_ExportedLayers;
private String m_sLibraryName;
public void initialize(final String sDescriptionFile) throws UnwrappableSagaAlgorithmException {
m_sDescriptionFile = sDescriptionFile;
setIsDeterminatedProcess(true);
setUserCanDefineAnalysisExtent(false);
defineCharacteristicsFromDescriptionFile();
}
private void defineCharacteristicsFromDescriptionFile() throws UnwrappableSagaAlgorithmException {
try {
String sLastParentParameterName = null;
final BufferedReader input = new BufferedReader(new FileReader(m_sDescriptionFile));
String sLine = input.readLine().trim();
while (sLine != null) {
sLine = sLine.trim();
boolean bReadLine = true;
if (sLine.startsWith("library name")) {
m_sLibraryName = sLine.split("\t")[1];
setGroup(SagaLibraryNames.getDecoratedLibraryName(m_sLibraryName));
}
if (sLine.startsWith("module name")) {
setName(sLine.split("\t")[1]);
}
if (sLine.contains("Olaya")) { //exclude my own algorithms. They are all in SEXTANTE and have been improved and further tested
throw new UnwrappableSagaAlgorithmException();
}
if (sLine.startsWith("-")) {
String sName, sDescription;
try {
sName = sLine.substring(1, sLine.indexOf(":"));
sDescription = sLine.substring(sLine.indexOf(">") + 1).trim();
}
catch (final Exception e) {//for some reason boolean params have a different syntax
sName = sLine.substring(1, sLine.indexOf("\t"));
sDescription = sLine.substring(sLine.indexOf("\t") + 1).trim();
}
if (SagaBlackList.isInBlackList(sName, getGroup())) {
throw new UnwrappableSagaAlgorithmException();
}
sLine = input.readLine();
if (sLine.contains("Data object") && sLine.contains("File")) {
throw new UnwrappableSagaAlgorithmException();
}
if (sLine.contains("Table")) {
if (sLine.contains("input")) {
m_Parameters.addInputTable(sName, sDescription, !sLine.contains("optional"));
sLastParentParameterName = sName;
}
else if (sLine.contains("Static")) {
sLine = input.readLine().trim();
final String sNumber = sLine.split(" ")[0];
final int iNumber = Integer.parseInt(sNumber);
final String[] sColNames = new String[iNumber];
for (int i = 0; i < sColNames.length; i++) {
sLine = input.readLine();
sColNames[i] = sLine.split("]")[1];
}
//can't get info about rows from description
m_Parameters.addFixedTable(sName, sDescription, sColNames, 3, false);
}
else if (sLine.contains("field")) {
if (sLastParentParameterName == null) {
throw new UnwrappableSagaAlgorithmException();
}
m_Parameters.addTableField(sName, sDescription, sLastParentParameterName);
}
else {
addOutputTable(sName, sDescription);
}
}
if (sLine.contains("Grid")) {
if (sLine.contains("input")) {
if (sLine.contains("list")) {
m_Parameters.addMultipleInput(sName, sDescription, AdditionalInfoMultipleInput.DATA_TYPE_RASTER,
!sLine.contains("optional"));
}
else {
m_Parameters.addInputRasterLayer(sName, sDescription, !sLine.contains("optional"));
}
}
else {
addOutputRasterLayer(sName, sDescription);
}
}
else if (sLine.contains("Shapes")) {
if (sLine.contains("input")) {
if (sLine.contains("list")) {
m_Parameters.addMultipleInput(sName, sDescription, AdditionalInfoMultipleInput.DATA_TYPE_VECTOR_ANY,
!sLine.contains("optional"));
}
else {
m_Parameters.addInputVectorLayer(sName, sDescription, AdditionalInfoVectorLayer.SHAPE_TYPE_ANY,
!sLine.contains("optional"));
sLastParentParameterName = sName;
}
}
else {
addOutputVectorLayer(sName, sDescription, OutputVectorLayer.SHAPE_TYPE_UNDEFINED);
}
}
else if (sLine.contains("Floating")) {
m_Parameters.addNumericalValue(sName, sDescription, 0, AdditionalInfoNumericalValue.NUMERICAL_VALUE_DOUBLE);
}
else if (sLine.contains("Integer")) {
m_Parameters.addNumericalValue(sName, sDescription, 0, AdditionalInfoNumericalValue.NUMERICAL_VALUE_INTEGER);
}
else if (sLine.contains("Boolean")) {
m_Parameters.addBoolean(sName, sDescription, true);
}
else if (sLine.contains("Text")) {
m_Parameters.addString(sName, sDescription);
}
else if (sLine.contains("Choice")) {
input.readLine();
final ArrayList<String> options = new ArrayList<String>();
sLine = input.readLine().trim();
while ((sLine != null) && !(sLine.trim().startsWith("-"))) {
options.add(sLine);
sLine = input.readLine();
}
m_Parameters.addSelection(sName, sDescription, options.toArray(new String[0]));
if (sLine == null) {
break;
}
else {
bReadLine = false;
}
}
}
if (bReadLine) {
sLine = input.readLine();
}
}
input.close();
}
catch (final Exception e) {
//SagaAlgorithmProvider.getSagaLogHandler().addMessage(e.getMessage());
throw new UnwrappableSagaAlgorithmException();
}
}
@Override
public void defineCharacteristics() {
}
@Override
public boolean processAlgorithm() throws GeoAlgorithmExecutionException {
final ArrayList<String> commands = new ArrayList<String>();
m_ExportedLayers = new HashMap<String, String>();
//resolve temporary output files
for (int i = 0; i < m_OutputObjects.getOutputDataObjectsCount(); i++) {
final Output out = m_OutputObjects.getOutput(i);
out.setOutputChannel(this.getOutputChannel(out.getName()));
}
//1: Export rasters to sgrd. only ASC and TIF are supported.
// Vector layers must be in shapefile format and tables in dbf format. We check that.
for (int i = 0; i < m_Parameters.getNumberOfParameters(); i++) {
final Parameter param = m_Parameters.getParameter(i);
if (param instanceof ParameterRasterLayer) {
final ParameterRasterLayer raster = (ParameterRasterLayer) param;
final IRasterLayer layer = raster.getParameterValueAsRasterLayer();
if (layer == null) {
continue;
}
commands.add(exportRasterLayer(layer));
}
if (param instanceof ParameterVectorLayer) {
final ParameterVectorLayer vector = (ParameterVectorLayer) param;
final IVectorLayer layer = vector.getParameterValueAsVectorLayer();
if (layer == null) {
continue;
}
final IOutputChannel channel = layer.getOutputChannel();
if (channel instanceof FileOutputChannel) {
final String sFilename = ((FileOutputChannel) channel).getFilename();
if (!sFilename.toLowerCase().endsWith("shp")) {
throw new SagaExecutionException(Sextante.getText("unsupported_file_format"));
}
}
else {
throw new SagaExecutionException(Sextante.getText("error_non_file_based_input"));
}
}
if (param instanceof ParameterTable) {
final ParameterTable paramTable = (ParameterTable) param;
final ITable table = paramTable.getParameterValueAsTable();
final IOutputChannel channel = table.getOutputChannel();
if (channel instanceof FileOutputChannel) {
final String sFilename = ((FileOutputChannel) channel).getFilename();
if (!sFilename.toLowerCase().endsWith("dbf")) {
throw new SagaExecutionException(Sextante.getText("unsupported_file_format"));
}
}
else {
throw new SagaExecutionException(Sextante.getText("error_non_file_based_input"));
}
}
if (param instanceof ParameterMultipleInput) {
final ArrayList list = (ArrayList) param.getParameterValueAsObject();
if ((list == null) || (list.size() == 0)) {
continue;
}
final AdditionalInfoMultipleInput aimi = (AdditionalInfoMultipleInput) ((ParameterMultipleInput) param).getParameterAdditionalInfo();
if (aimi.getDataType() == AdditionalInfoMultipleInput.DATA_TYPE_RASTER) {
for (int j = 0; j < list.size(); j++) {
commands.add(exportRasterLayer((IRasterLayer) list.get(j)));
}
}
else if (aimi.getDataType() == AdditionalInfoMultipleInput.DATA_TYPE_VECTOR_ANY) {
for (int j = 0; j < list.size(); j++) {
final IVectorLayer layer = (IVectorLayer) list.get(j);
if (layer == null) {
continue;
}
final IOutputChannel channel = layer.getOutputChannel();
if (channel instanceof FileOutputChannel) {
final String sFilename = ((FileOutputChannel) channel).getFilename();
if (!sFilename.toLowerCase().endsWith("shp")) {
throw new SagaExecutionException(Sextante.getText("unsupported_file_format"));
}
}
else {
throw new SagaExecutionException(Sextante.getText("error_non_file_based_input"));
}
}
}
}
}
//2: set parameters and outputs
final StringBuffer sCommand = new StringBuffer(m_sLibraryName + " \"" + getName() + "\"");
for (int i = 0; i < m_Parameters.getNumberOfParameters(); i++) {
final Parameter param = m_Parameters.getParameter(i);
final Object paramObj = param.getParameterValueAsObject();
if (param instanceof ParameterRasterLayer) {
if (paramObj == null) {
continue;
}
final String sFilename = ((FileOutputChannel) ((IRasterLayer) paramObj).getOutputChannel()).getFilename();
sCommand.append(" -" + param.getParameterName() + " " + m_ExportedLayers.get(sFilename));
}
else if ((param instanceof ParameterVectorLayer) || (param instanceof ParameterTable)) {
if (paramObj == null) {
continue;
}
final String sFilename = ((FileOutputChannel) ((IDataObject) paramObj).getOutputChannel()).getFilename();
sCommand.append(" -" + param.getParameterName() + " " + sFilename);
}
else if (param instanceof ParameterMultipleInput) {
if (paramObj == null) {
continue;
}
final ArrayList list = (ArrayList) paramObj;
if (list.size() == 0) {
continue;
}
sCommand.append(" -" + param.getParameterName() + " ");
final AdditionalInfoMultipleInput aimi = (AdditionalInfoMultipleInput) ((ParameterMultipleInput) param).getParameterAdditionalInfo();
if (aimi.getDataType() == AdditionalInfoMultipleInput.DATA_TYPE_RASTER) {
for (int j = 0; j < list.size(); j++) {
final IDataObject dataObject = (IDataObject) list.get(j);
final String sFilename = ((FileOutputChannel) dataObject.getOutputChannel()).getFilename();
sCommand.append(m_ExportedLayers.get(sFilename));
if (j < list.size() - 1) {
sCommand.append(";");
}
}
}
else {
for (int j = 0; j < list.size(); j++) {
final IDataObject dataObject = (IDataObject) list.get(j);
sCommand.append(((FileOutputChannel) dataObject.getOutputChannel()).getFilename());
if (j < list.size() - 1) {
sCommand.append(";");
}
}
}
}
else if (param instanceof ParameterSelection) {
sCommand.append(" -" + param.getParameterName() + " " + Integer.toString(param.getParameterValueAsInt()));
}
else if (param instanceof ParameterBoolean) {
if (param.getParameterValueAsBoolean()) {
sCommand.append(" -" + param.getParameterName());
}
}
else {
sCommand.append(" -" + param.getParameterName() + " " + param.getParameterValueAsString());
}
}
for (int i = 0; i < m_OutputObjects.getOutputObjectsCount(); i++) {
final Output out = m_OutputObjects.getOutput(i);
if (out instanceof OutputRasterLayer) {
final IOutputChannel channel = getOutputChannel(out.getName());
if (channel instanceof FileOutputChannel) {
final FileOutputChannel foc = (FileOutputChannel) channel;
String sFilename = foc.getFilename();
if (!sFilename.endsWith("asc") && !sFilename.endsWith("tif")) {
sFilename = sFilename + ".tif";
}
foc.setFilename(sFilename);
out.setOutputChannel(foc);
sFilename = SextanteGUI.getOutputFactory().getTempFolder() + File.separator + new File(sFilename).getName()
+ ".sgrd";
sCommand.append(" -" + out.getName() + " " + sFilename);
}
else if (channel instanceof NullOutputChannel) {
final String sFilename = SextanteGUI.getOutputFactory().getTempRasterLayerFilename();
sCommand.append(" -" + out.getName() + " " + sFilename + ".sgrd");
}
else {
throw new UnsupportedOutputChannelException();
}
}
else if (out instanceof OutputVectorLayer) {
final IOutputChannel channel = getOutputChannel(out.getName());
if (channel instanceof FileOutputChannel) {
final FileOutputChannel foc = (FileOutputChannel) channel;
String sFilename = foc.getFilename();
if (!sFilename.endsWith("shp")) {
sFilename = sFilename + ".shp";
}
foc.setFilename(sFilename);
out.setOutputChannel(foc);
sCommand.append(" -" + out.getName() + " " + sFilename);
}
else if (channel instanceof NullOutputChannel) {
final String sFilename = SextanteGUI.getOutputFactory().getTempVectorLayerFilename();
sCommand.append(" -" + out.getName() + " " + sFilename);
}
else {
throw new UnsupportedOutputChannelException();
}
}
else if (out instanceof OutputTable) {
final IOutputChannel channel = getOutputChannel(out.getName());
if (channel instanceof FileOutputChannel) {
final FileOutputChannel foc = (FileOutputChannel) channel;
String sFilename = foc.getFilename();
if (!sFilename.endsWith("dbf")) {
sFilename = sFilename + ".dbf";
}
foc.setFilename(sFilename);
out.setOutputChannel(foc);
sCommand.append(" -" + out.getName() + " " + sFilename);
}
else if (channel instanceof NullOutputChannel) {
final String sFilename = SextanteGUI.getOutputFactory().getTempTableFilename();
sCommand.append(" -" + out.getName() + " " + sFilename);
}
else {
throw new UnsupportedOutputChannelException();
}
}
}
commands.add(sCommand.toString());
//3:Export resulting raster layers
for (int i = 0; i < m_OutputObjects.getOutputObjectsCount(); i++) {
final Output out = m_OutputObjects.getOutput(i);
if (out instanceof OutputRasterLayer) {
final IOutputChannel channel = getOutputChannel(out.getName());
if (!(channel instanceof FileOutputChannel)) {
if (channel instanceof NullOutputChannel) {
continue;
}
else {
throw new UnsupportedOutputChannelException();
}
}
final FileOutputChannel foc = (FileOutputChannel) channel;
String sFilename = foc.getFilename();
if (!sFilename.endsWith("asc") && !sFilename.endsWith("tif")) {
sFilename = sFilename + ".tif";
}
final String sFilename2 = SextanteGUI.getOutputFactory().getTempFolder() + File.separator
+ new File(sFilename).getName() + ".sgrd";
if (sFilename.endsWith("asc")) {
commands.add("io_grid 0 -GRID " + sFilename2 + " -FORMAT 1 -FILE " + sFilename);
}
else {
commands.add("io_gdal 1 -GRIDS " + sFilename2 + " -FORMAT 1 -FILE " + sFilename);
}
}
}
//4 Run SAGA
SagaUtils.createSagaBatchJobFileFromSagaCommands(commands.toArray(new String[0]));
SagaUtils.executeSaga(this);
return !m_Task.isCanceled();
}
private String exportRasterLayer(final IRasterLayer layer) throws SagaExecutionException {
String sFilename;
final IOutputChannel channel = layer.getOutputChannel();
if (channel instanceof FileOutputChannel) {
sFilename = ((FileOutputChannel) channel).getFilename();
if (!sFilename.toLowerCase().endsWith("tif") && !sFilename.toLowerCase().endsWith("asc")) {
throw new SagaExecutionException(Sextante.getText("unsupported_file_format"));
}
}
else {
throw new SagaExecutionException(Sextante.getText("error_non_file_based_input"));
}
final String sExt = sFilename.substring(sFilename.lastIndexOf(".") + 1);
final String sDestFilename = getTempFilename();
m_ExportedLayers.put(((FileOutputChannel) channel).getFilename(), sDestFilename);
if (sExt.toLowerCase().equals("tif")) {
return "io_grid_image 1 -OUT_GRID " + sDestFilename + " -FILE " + sFilename + " -METHOD 0";
}
else {
return "io_grid 1 -GRID " + sDestFilename + " -FILE " + sFilename;
}
}
private String getTempFilename() {
m_iExportedLayers++;
final String sPath = SextanteGUI.getOutputFactory().getTempFolder();
final String sFilename = sPath + File.separator + Long.toString(Calendar.getInstance().getTimeInMillis())
+ Integer.toString(m_iExportedLayers) + ".sgrd";
return sFilename;
}
@Override
public String getCommandLineName() {
final String sName = "saga:" + getName().toLowerCase().replace(" ", "");
return sName;
}
@Override
public GeoAlgorithm getNewInstance() throws InstantiationException, IllegalAccessException {
final SagaAlgorithm alg = this.getClass().newInstance();
alg.setOutputObjects(m_OutputObjects.getNewInstance());
alg.setName(this.getName());
alg.setGroup(this.getGroup());
alg.setParameters(m_Parameters.getNewInstance());
alg.setIsDeterminatedProcess(true);
alg.setUserCanDefineAnalysisExtent(getUserCanDefineAnalysisExtent());
alg.m_sDescriptionFile = m_sDescriptionFile;
alg.m_sLibraryName = m_sLibraryName;
return alg;
}
public void updateProgress(final int iPartial,
final int iTotal) {
setProgress(iPartial, iTotal);
}
}
| 23,559 | 0.555202 | 0.553419 | 533 | 42.193245 | 31.646057 | 145 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.549719 | false | false | 9 |
0847d89038457cb2134a381a4096129e616c81cf | 18,365,280,191,215 | c047a807ec087633eb1032658eefc087fc7cce35 | /src/flipkart/Model/ProductInfo.java | f633a16f56a9d6a0162412be90eb08aa148bbd8a | [] | no_license | Shweta-Mishra/ooadproject | https://github.com/Shweta-Mishra/ooadproject | 1033a98d253b9cab2ac5e08db9b9801c99c89a24 | 46b90549166981602f9053d5d6292273681bdaae | refs/heads/master | 2021-01-17T07:01:32.376000 | 2016-05-03T22:09:52 | 2016-05-03T22:09:52 | 32,462,033 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package flipkart.Model;
import java.util.ArrayList;
public class ProductInfo {
String product_name;
String product_id,Avg_Rating,SP_ID;
public String getSP_ID() {
return SP_ID;
}
public void setSP_ID(String sP_ID) {
SP_ID = sP_ID;
}
public String getAvg_Rating() {
return Avg_Rating;
}
public void setAvg_Rating(String avg_Rating) {
Avg_Rating = avg_Rating;
}
String product_description;
int stock;
int price;
String brand;
String image;
boolean f,t;
int count;
String destpath;
public String getDestpath() {
return destpath;
}
public void setDestpath(String destpath) {
this.destpath = destpath;
}
public int getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
public boolean isF() {
return f;
}
public void setF(boolean f) {
this.f = f;
}
public boolean isT() {
return t;
}
public void setT(boolean t) {
this.t = t;
}
ArrayList<String> subcategory=new ArrayList<String>();
ArrayList<String> lastcategory=new ArrayList<String>();
public String getImage() {
return image;
}
public void setImage(String image) {
this.image = image;
}
public String getProduct_id() {
return product_id;
}
public void setProduct_id(String product_id) {
this.product_id = product_id;
}
public ArrayList<String> getSubcategory() {
return subcategory;
}
public void setSubcategory(ArrayList<String> subcategory) {
this.subcategory = subcategory;
}
public ArrayList<String> getLastcategory() {
return lastcategory;
}
public void setLastcategory(ArrayList<String> lastcategory) {
this.lastcategory = lastcategory;
}
public String getProduct_name() {
return product_name;
}
public void setProduct_name(String product_name) {
this.product_name = product_name;
}
public String getProduct_description() {
return product_description;
}
public void setProduct_description(String product_description) {
this.product_description = product_description;
}
public int getStock() {
return stock;
}
public void setStock(int stock) {
this.stock = stock;
}
public int getPrice() {
return price;
}
public void setPrice(int price) {
this.price = price;
}
public String getBrand() {
return brand;
}
public void setBrand(String brand) {
this.brand = brand;
}
}
| UTF-8 | Java | 2,291 | java | ProductInfo.java | Java | [] | null | [] | package flipkart.Model;
import java.util.ArrayList;
public class ProductInfo {
String product_name;
String product_id,Avg_Rating,SP_ID;
public String getSP_ID() {
return SP_ID;
}
public void setSP_ID(String sP_ID) {
SP_ID = sP_ID;
}
public String getAvg_Rating() {
return Avg_Rating;
}
public void setAvg_Rating(String avg_Rating) {
Avg_Rating = avg_Rating;
}
String product_description;
int stock;
int price;
String brand;
String image;
boolean f,t;
int count;
String destpath;
public String getDestpath() {
return destpath;
}
public void setDestpath(String destpath) {
this.destpath = destpath;
}
public int getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
public boolean isF() {
return f;
}
public void setF(boolean f) {
this.f = f;
}
public boolean isT() {
return t;
}
public void setT(boolean t) {
this.t = t;
}
ArrayList<String> subcategory=new ArrayList<String>();
ArrayList<String> lastcategory=new ArrayList<String>();
public String getImage() {
return image;
}
public void setImage(String image) {
this.image = image;
}
public String getProduct_id() {
return product_id;
}
public void setProduct_id(String product_id) {
this.product_id = product_id;
}
public ArrayList<String> getSubcategory() {
return subcategory;
}
public void setSubcategory(ArrayList<String> subcategory) {
this.subcategory = subcategory;
}
public ArrayList<String> getLastcategory() {
return lastcategory;
}
public void setLastcategory(ArrayList<String> lastcategory) {
this.lastcategory = lastcategory;
}
public String getProduct_name() {
return product_name;
}
public void setProduct_name(String product_name) {
this.product_name = product_name;
}
public String getProduct_description() {
return product_description;
}
public void setProduct_description(String product_description) {
this.product_description = product_description;
}
public int getStock() {
return stock;
}
public void setStock(int stock) {
this.stock = stock;
}
public int getPrice() {
return price;
}
public void setPrice(int price) {
this.price = price;
}
public String getBrand() {
return brand;
}
public void setBrand(String brand) {
this.brand = brand;
}
}
| 2,291 | 0.706242 | 0.706242 | 126 | 17.182539 | 16.678282 | 65 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.325397 | false | false | 9 |
b4d55db52ff72cfffc50141a95c4c01dc67c184f | 1,520,418,450,832 | 54030e4762c59c931228acc31c136e9bedc09057 | /Algorithms/Warmup/Birthday Cake Candles/Solution.java | ac961c3e380eb74b35640b753dadbb3e21ae9d10 | [
"MIT"
] | permissive | rasik210/HackerRank | https://github.com/rasik210/HackerRank | ed19ff19357adc77a11c1a7a33d3d4599722126f | 9934fb8a8f666f3822365ffdc76db2e59ab64aec | refs/heads/master | 2021-07-09T16:30:47.497000 | 2018-05-29T10:46:06 | 2018-05-29T10:46:06 | 98,078,638 | 2 | 0 | MIT | true | 2018-05-29T10:46:07 | 2017-07-23T06:15:22 | 2017-07-26T10:15:21 | 2018-05-29T10:46:06 | 838 | 1 | 0 | 0 | Java | false | null | //Problem: https://www.hackerrank.com/challenges/birthday-cake-candles
//Java 8
/*
Initial Thoughts:
We can keep a running max and update it if we
find something larger, if we find something smaller
we just keep looking and if we find something equal
then we increment a counter variable
Time Complexity: O(n) //We must check the height of every candle
Space Complexity: O(1) //We only store a max and a frequency
*/
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Solution {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int tallest = 0;
int frequency = 0;
for(int i=0; i < n; i++){
int height = in.nextInt();
if(height > tallest){
tallest = height;
frequency = 1;
}
else if(height == tallest) frequency++;
}
System.out.println(frequency);
}
} | UTF-8 | Java | 1,046 | java | Solution.java | Java | [] | null | [] | //Problem: https://www.hackerrank.com/challenges/birthday-cake-candles
//Java 8
/*
Initial Thoughts:
We can keep a running max and update it if we
find something larger, if we find something smaller
we just keep looking and if we find something equal
then we increment a counter variable
Time Complexity: O(n) //We must check the height of every candle
Space Complexity: O(1) //We only store a max and a frequency
*/
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Solution {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int tallest = 0;
int frequency = 0;
for(int i=0; i < n; i++){
int height = in.nextInt();
if(height > tallest){
tallest = height;
frequency = 1;
}
else if(height == tallest) frequency++;
}
System.out.println(frequency);
}
} | 1,046 | 0.600382 | 0.594646 | 39 | 25.846153 | 19.05261 | 70 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.435897 | false | false | 9 |
d0e07e13c439cf23721a8ddd627fdc76844799cf | 9,921,374,518,613 | 14751bfa8688f510f08341622515d81f5e6ca638 | /src/edu/columbia/cumc/omoputils/UtilsDemoClass.java | f85dbc2ff8346d9bfae5e60b0b3cd98a1d2af747 | [] | no_license | evillalonNY/i2b2ToOHDSI | https://github.com/evillalonNY/i2b2ToOHDSI | aae13395d87b5ce47e1f812aee3a7cbb5bd8a07b | 451fb7dee066a32dfc736dae4c1572127ac2a3ba | refs/heads/main | 2023-04-12T21:17:57.020000 | 2021-05-06T15:04:21 | 2021-05-06T15:04:21 | 340,184,320 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package edu.columbia.cumc.omoputils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.ohdsi.circe.cohortdefinition.NumericRange;
import edu.columbia.cumc.i2b2.DemographicConsts;
import edu.columbia.cumc.i2b2.PanelClass;
public class UtilsDemoClass {
List<PanelClass>arrayOfPanels;
String conceptAgeItemKey=DemographicConsts.conceptAgeItemKey;
String conceptRaceItemKey=DemographicConsts.conceptRaceItemKey;
String conceptGenderItemKey=DemographicConsts.conceptGenderItemKey;
String conceptEthnicItemKey=DemographicConsts.conceptEthnicItemKey;
private boolean debug;//=true;
public UtilsDemoClass(){};
public UtilsDemoClass(List<PanelClass>arrayOfPanels){this.arrayOfPanels= arrayOfPanels;};
public List<NumericRange> getConceptAge(){
List<NumericRange> num= new ArrayList<NumericRange>();
for(int n=0; n< arrayOfPanels.size();++n)
{
PanelClass p=arrayOfPanels.get(n);
Map<String, List<List<String[]>>> mapdemo=p.getDemographicGroup();
if(!mapdemo.containsKey("AGE")) {
if(debug) System.out.println("UtilsDemoClass panel no="+p.getPanel_number()+" no age");
continue;
}
List<List<String[]>> lstall= mapdemo.get("AGE");
if(lstall==null || lstall.isEmpty()) continue;
NumericRange range = new NumericRange();
for(int nn=0;nn<lstall.size();nn++)
{
List<String[]> lst=lstall.get(nn);
for(String []s:lst){
if(s[0].contains("Op")) range.op=s[1];
if(debug)
System.out.println("UtilsDemoClass s[] "+ s[0]+";"+s[1]);
if(s[0].contains("From")) {
if(debug)
System.out.println("UtilsDemoClass "+s[1]);
if(s[1]!=null)
range.value=Integer.parseInt(s[1]);
else
range.value=null;
}
if(s[0].contains("To") && s[1]!=null ) range.extent=Integer.parseInt(s[1]);
}//end looping lst for each NumericRange
if(range.op!=null ) num.add(range);
}//end looping lstall for all of List<NumericRange>
}//end looping arrayOfPanels
return num;
}
public Map<String, List<NumericRange>> findConceptDemographictDetails(int panel_no){
return findConceptDemographictDetails(panel_no,true);
}
public Map<String, List<NumericRange>> findConceptDemographictDetails( int panel_no, boolean pc){
Map<String, List<NumericRange>> toret = new HashMap<String, List<NumericRange>>();
List<NumericRange> alst = new ArrayList<NumericRange>();
if(arrayOfPanels.isEmpty()) {System.err.println("UtilsDemoClass arrayOfPanels is empty");return toret;}
alst= this.getConceptAge();
Boolean bisconcept= isConceptRestricted(panel_no);
if(!bisconcept) return toret;
PanelClass p= findPanel(panel_no);
if(p==null) { return toret;}
if(debug) System.out.println("UtilsDemoClass p not null "+p.getPanel_number()+"; no="+panel_no+"; demo sz="
+ p.getDemographicGroup().containsKey("AGE"));
List<PanelClass> pagerest= new UtilsDemoRestricted(arrayOfPanels).findAgeSamevisit();
if(!alst.isEmpty() && alst.size()>0 && pc ) toret.put("AGE", alst);
System.err.println("UtilsDemoClass alst "+toret.size());
return toret;
}
private PanelClass findPanel(int panel_no) {
for(int n=0; n< arrayOfPanels.size();++n){
PanelClass pp=arrayOfPanels.get(n);
if(Integer.parseInt(pp.getPanel_number())!=panel_no-1) continue;
return pp;
}
return null;
}
public Boolean isConceptRestricted(int no){
PanelClass p=arrayOfPanels.get(no-1);
Boolean restrictConcept = (p.getPanel_timing().contains("SAMEVISIT") || p.getPanel_timing().contains("SAME"))?true:false;
if(debug) System.out.println( "UtilsDemoClass panel no="+no+"; restricted ="+restrictConcept);
return restrictConcept;
}
public NumericRange AgeRange(List<NumericRange> alst){
Integer minage=100;
Integer maxage=0;
for(NumericRange nr:alst){
if((Integer) nr.value!=null && (Integer) nr.value <minage )minage=(Integer) nr.value;
if((Integer) nr.extent!=null &&(Integer) nr.extent>maxage)maxage=(Integer) nr.extent;
}
NumericRange onenr= new NumericRange();
if(minage<maxage){onenr.value=minage;onenr.op="bt"; onenr.extent=maxage;}
if(minage>maxage){onenr.value=maxage;onenr.op="bt"; onenr.extent=minage;}
if(minage==maxage){onenr.value=maxage;onenr.op="eq";}
return onenr;
}
public static void main(String[] args) {
// TODO Auto-generated method stub
}
}
| UTF-8 | Java | 4,561 | java | UtilsDemoClass.java | Java | [] | null | [] | package edu.columbia.cumc.omoputils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.ohdsi.circe.cohortdefinition.NumericRange;
import edu.columbia.cumc.i2b2.DemographicConsts;
import edu.columbia.cumc.i2b2.PanelClass;
public class UtilsDemoClass {
List<PanelClass>arrayOfPanels;
String conceptAgeItemKey=DemographicConsts.conceptAgeItemKey;
String conceptRaceItemKey=DemographicConsts.conceptRaceItemKey;
String conceptGenderItemKey=DemographicConsts.conceptGenderItemKey;
String conceptEthnicItemKey=DemographicConsts.conceptEthnicItemKey;
private boolean debug;//=true;
public UtilsDemoClass(){};
public UtilsDemoClass(List<PanelClass>arrayOfPanels){this.arrayOfPanels= arrayOfPanels;};
public List<NumericRange> getConceptAge(){
List<NumericRange> num= new ArrayList<NumericRange>();
for(int n=0; n< arrayOfPanels.size();++n)
{
PanelClass p=arrayOfPanels.get(n);
Map<String, List<List<String[]>>> mapdemo=p.getDemographicGroup();
if(!mapdemo.containsKey("AGE")) {
if(debug) System.out.println("UtilsDemoClass panel no="+p.getPanel_number()+" no age");
continue;
}
List<List<String[]>> lstall= mapdemo.get("AGE");
if(lstall==null || lstall.isEmpty()) continue;
NumericRange range = new NumericRange();
for(int nn=0;nn<lstall.size();nn++)
{
List<String[]> lst=lstall.get(nn);
for(String []s:lst){
if(s[0].contains("Op")) range.op=s[1];
if(debug)
System.out.println("UtilsDemoClass s[] "+ s[0]+";"+s[1]);
if(s[0].contains("From")) {
if(debug)
System.out.println("UtilsDemoClass "+s[1]);
if(s[1]!=null)
range.value=Integer.parseInt(s[1]);
else
range.value=null;
}
if(s[0].contains("To") && s[1]!=null ) range.extent=Integer.parseInt(s[1]);
}//end looping lst for each NumericRange
if(range.op!=null ) num.add(range);
}//end looping lstall for all of List<NumericRange>
}//end looping arrayOfPanels
return num;
}
public Map<String, List<NumericRange>> findConceptDemographictDetails(int panel_no){
return findConceptDemographictDetails(panel_no,true);
}
public Map<String, List<NumericRange>> findConceptDemographictDetails( int panel_no, boolean pc){
Map<String, List<NumericRange>> toret = new HashMap<String, List<NumericRange>>();
List<NumericRange> alst = new ArrayList<NumericRange>();
if(arrayOfPanels.isEmpty()) {System.err.println("UtilsDemoClass arrayOfPanels is empty");return toret;}
alst= this.getConceptAge();
Boolean bisconcept= isConceptRestricted(panel_no);
if(!bisconcept) return toret;
PanelClass p= findPanel(panel_no);
if(p==null) { return toret;}
if(debug) System.out.println("UtilsDemoClass p not null "+p.getPanel_number()+"; no="+panel_no+"; demo sz="
+ p.getDemographicGroup().containsKey("AGE"));
List<PanelClass> pagerest= new UtilsDemoRestricted(arrayOfPanels).findAgeSamevisit();
if(!alst.isEmpty() && alst.size()>0 && pc ) toret.put("AGE", alst);
System.err.println("UtilsDemoClass alst "+toret.size());
return toret;
}
private PanelClass findPanel(int panel_no) {
for(int n=0; n< arrayOfPanels.size();++n){
PanelClass pp=arrayOfPanels.get(n);
if(Integer.parseInt(pp.getPanel_number())!=panel_no-1) continue;
return pp;
}
return null;
}
public Boolean isConceptRestricted(int no){
PanelClass p=arrayOfPanels.get(no-1);
Boolean restrictConcept = (p.getPanel_timing().contains("SAMEVISIT") || p.getPanel_timing().contains("SAME"))?true:false;
if(debug) System.out.println( "UtilsDemoClass panel no="+no+"; restricted ="+restrictConcept);
return restrictConcept;
}
public NumericRange AgeRange(List<NumericRange> alst){
Integer minage=100;
Integer maxage=0;
for(NumericRange nr:alst){
if((Integer) nr.value!=null && (Integer) nr.value <minage )minage=(Integer) nr.value;
if((Integer) nr.extent!=null &&(Integer) nr.extent>maxage)maxage=(Integer) nr.extent;
}
NumericRange onenr= new NumericRange();
if(minage<maxage){onenr.value=minage;onenr.op="bt"; onenr.extent=maxage;}
if(minage>maxage){onenr.value=maxage;onenr.op="bt"; onenr.extent=minage;}
if(minage==maxage){onenr.value=maxage;onenr.op="eq";}
return onenr;
}
public static void main(String[] args) {
// TODO Auto-generated method stub
}
}
| 4,561 | 0.680991 | 0.67551 | 134 | 33.037312 | 29.975464 | 124 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.067164 | false | false | 9 |
b85ea7dbb067c020ea0d2b9a24fa1c8ef2407266 | 26,285,199,897,845 | 1d1fe831c6d24d4b37ca05097b73d9d39dd736be | /src/com/xk/player/ole/IOleComponent.java | 742a077a81c2f41283acb9d6f2bfc973d7a8a1f2 | [] | no_license | smokingrain/KPlayer | https://github.com/smokingrain/KPlayer | c4c665a5148521bec8a23fafd3fe046ef332d6f0 | 4e5560463e92068bcaee763b1bd44ec7c7eb7ba9 | refs/heads/master | 2021-06-22T11:01:18.582000 | 2020-11-30T11:09:54 | 2020-11-30T11:09:54 | 63,334,394 | 9 | 5 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.xk.player.ole;
public interface IOleComponent {
public void invokeOleFunction( String[] functionPath, Object[] args );
public Object invokeOleFunctionWithResult( String[] functionPath,
Object[] args );
public boolean setOleProperty( String[] propertyPath, Object[] args );
public Object getOleProperty( String[] propertyPath, Object[] args );
}
| UTF-8 | Java | 382 | java | IOleComponent.java | Java | [] | null | [] | package com.xk.player.ole;
public interface IOleComponent {
public void invokeOleFunction( String[] functionPath, Object[] args );
public Object invokeOleFunctionWithResult( String[] functionPath,
Object[] args );
public boolean setOleProperty( String[] propertyPath, Object[] args );
public Object getOleProperty( String[] propertyPath, Object[] args );
}
| 382 | 0.732984 | 0.732984 | 13 | 27.384615 | 29.937212 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.230769 | false | false | 9 |
afff39359b5c40a22ad311a878a16c85d9e9486a | 7,791,070,711,858 | 1986aed95c3b12092ed712a84a2e049b76d3d545 | /etouchcare/src/test/java/com/app/etouchcare/TestJUnit.java | c84b92f2be514e7d443735fd1c2d2c795fa82168 | [] | no_license | gtmorais/EtouchCare | https://github.com/gtmorais/EtouchCare | c0ac880725756890dd60e103cffee07042cacfd1 | eabee9752b3112d83ce9eb283e45c491a65e1a0a | refs/heads/master | 2021-01-13T08:25:54.659000 | 2017-02-21T00:24:41 | 2017-02-21T00:24:41 | 71,846,463 | 0 | 2 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
* TeamOne
*/
package com.app.etouchcare;
/**
* Created by wenzhongzheng on 2016-11-25.
*/
import com.app.etouchcare.activity.AddPatient;
import com.app.etouchcare.callbacks.PatientLoadedListener;
import com.app.etouchcare.datamodel.Patients;
import com.app.etouchcare.extra.PatientUtils;
import org.junit.Test;
import java.util.ArrayList;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
public class TestJUnit implements PatientLoadedListener.PatientListLoadedListener{
@Override
public void onPatientListLoaded(ArrayList<Patients> patientList) {
assertNotNull(patientList);
}
@Test
public void loadPatientList(){
PatientUtils patientUtils = new PatientUtils();
patientUtils.loadPatientList(this);
}
}
| UTF-8 | Java | 814 | java | TestJUnit.java | Java | [
{
"context": " */\npackage com.app.etouchcare;\n\n/**\n * Created by wenzhongzheng on 2016-11-25.\n */\nimport com.app.etouchcare.acti",
"end": 79,
"score": 0.9982392191886902,
"start": 66,
"tag": "USERNAME",
"value": "wenzhongzheng"
}
] | null | [] | /**
* TeamOne
*/
package com.app.etouchcare;
/**
* Created by wenzhongzheng on 2016-11-25.
*/
import com.app.etouchcare.activity.AddPatient;
import com.app.etouchcare.callbacks.PatientLoadedListener;
import com.app.etouchcare.datamodel.Patients;
import com.app.etouchcare.extra.PatientUtils;
import org.junit.Test;
import java.util.ArrayList;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
public class TestJUnit implements PatientLoadedListener.PatientListLoadedListener{
@Override
public void onPatientListLoaded(ArrayList<Patients> patientList) {
assertNotNull(patientList);
}
@Test
public void loadPatientList(){
PatientUtils patientUtils = new PatientUtils();
patientUtils.loadPatientList(this);
}
}
| 814 | 0.7543 | 0.744472 | 39 | 19.871796 | 23.266769 | 82 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.307692 | false | false | 9 |
2831e21eb3486ffef1cee887290873186d2520e8 | 9,964,324,155,973 | bc8c45c3a67ea39a19dae76e06a3d272a244b84b | /src/main/java/controllers/SzamlaController.java | d8c29601f7074c105fd2a7588c1f99bf96bf74c4 | [] | no_license | KissZsolt89/konyvelo | https://github.com/KissZsolt89/konyvelo | 7a26a3137686278778930f4c56c15652d5add83d | 262cd43fa2681a59dd2e7ea18309e71ab01654b7 | refs/heads/master | 2023-05-06T03:35:46.987000 | 2021-05-29T14:46:30 | 2021-05-29T14:46:30 | 369,364,877 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package controllers;
import javafx.beans.binding.StringBinding;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Node;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.stage.Stage;
import model.szamla.UgyfelSzamla;
import model.szamla.UgyfelSzamlaDao;
import model.ugyfel.Ugyfel;
import model.ugyfel.UgyfelDao;
import java.io.IOException;
import java.util.List;
public class SzamlaController {
private static Ugyfel aktualisUgyfel;
private static UgyfelSzamla modositandoUgyfelSzamla;
private UgyfelDao ugyfelDao;
private UgyfelSzamlaDao ugyfelSzamlaDao;
@FXML
private Label ugyfelLabel;
@FXML
private RadioButton bejovoRadioButton;
@FXML
private RadioButton kimenoRadioButton;
@FXML
private TextField bizonylatszamTextField;
@FXML
private DatePicker kelteDatePicker;
@FXML
private DatePicker teljesitesDatePicker;
@FXML
private DatePicker esedekessegDatePicker;
@FXML
private ChoiceBox partnerChoiceBox;
@FXML
private ChoiceBox fizetesiModChoiceBox;
@FXML
private TextField megjegyzesTextField;
@FXML
private ChoiceBox fokonyviSzamChoiceBox;
@FXML
private TextField megnevezesTextField;
@FXML
private ChoiceBox afaChoiceBox;
@FXML
private TextField nettoTextField;
@FXML
private TextField afaTextField;
@FXML
private TextField bruttoTextField;
@FXML
private Label hibasAdatLabel;
public void initdata(Ugyfel ugyfel) {
aktualisUgyfel = ugyfel;
ugyfelLabel.setText(aktualisUgyfel.getNev());
}
public void initdata(UgyfelSzamla ugyfelSzamla) {
modositandoUgyfelSzamla = ugyfelSzamla;
ugyfelLabel.setText("Módosítás");
if (modositandoUgyfelSzamla.getIrany().equals("bejövő")) {
bejovoRadioButton.setSelected(true);
kimenoRadioButton.setSelected(false);
}
else {
bejovoRadioButton.setSelected(false);
kimenoRadioButton.setSelected(true);
}
bizonylatszamTextField.setText(modositandoUgyfelSzamla.getBizonylatszam());
kelteDatePicker.setValue(modositandoUgyfelSzamla.getKelte());
teljesitesDatePicker.setValue(modositandoUgyfelSzamla.getTeljesites());
esedekessegDatePicker.setValue(modositandoUgyfelSzamla.getEsedekesseg());
partnerChoiceBox.setValue(modositandoUgyfelSzamla.getPartner());
fizetesiModChoiceBox.setValue(modositandoUgyfelSzamla.getFizetesiMod());
megjegyzesTextField.setText(modositandoUgyfelSzamla.getMegjegyzes());
fokonyviSzamChoiceBox.setValue(modositandoUgyfelSzamla.getFokonyviSzam());
megnevezesTextField.setText(modositandoUgyfelSzamla.getMegnevezes());
afaChoiceBox.setValue(modositandoUgyfelSzamla.getAfaTipus());
nettoTextField.setText(Integer.toString(modositandoUgyfelSzamla.getNetto()));
}
@FXML
public void initialize() {
ugyfelDao = UgyfelDao.getInstance();
ugyfelSzamlaDao = UgyfelSzamlaDao.getInstance();
if (aktualisUgyfel != null) {
ugyfelLabel.setText(aktualisUgyfel.getNev());
}
hibasAdatLabel.setText("");
ObservableList<String> fizetesiModLista =
FXCollections.observableArrayList("átutalás", "készpénz");
fizetesiModChoiceBox.setItems(fizetesiModLista);
fizetesiModChoiceBox.setValue(fizetesiModLista.get(0));
ObservableList<String> afaLista =
FXCollections.observableArrayList("27%", "18%", "5%", "AM");
afaChoiceBox.setItems(afaLista);
afaChoiceBox.setValue(afaLista.get(0));
ObservableList<String> fokonyvLista =
FXCollections.observableArrayList(
"1 – Befektetett eszközök",
"2 - Készletek",
"3 - Követelések, pénzügyi eszközök",
"4 - Források",
"5 - Költségnemek",
"6 - Költséghelyek, általános költségek",
"7 - Tevékenységek költségei",
"8 - Értékesítés elszámolt önköltsége és ráfordítások",
"9 - Értékesítés árbevétele és bevételek");
fokonyviSzamChoiceBox.setItems(fokonyvLista);
fokonyviSzamChoiceBox.setValue(fokonyvLista.get(0));
List<String> ugyfelLista = ugyfelDao.findAllNev();
if (ugyfelLista.size() > 0) {
ObservableList<String> observableUgyfelLista = FXCollections.observableArrayList();
observableUgyfelLista.addAll(ugyfelLista);
partnerChoiceBox.setItems(observableUgyfelLista);
partnerChoiceBox.setValue(observableUgyfelLista.get(0));
}
afaTextField.textProperty().bind(
new StringBinding() {
{
super.bind(nettoTextField.textProperty(), afaChoiceBox.valueProperty());
}
@Override
protected String computeValue() {
try {
String s = afaChoiceBox.getValue().toString();
s = Integer.toString((int) (Double.parseDouble(nettoTextField.getText())
* (s.equals("AM") ? 0 : Double.parseDouble(s.substring(0, s.length() - 1)) / 100)));
return s;
} catch (NumberFormatException e) {
return "Hibás nettó!";
}
}
});
bruttoTextField.textProperty().bind(
new StringBinding() {
{
super.bind(nettoTextField.textProperty(), afaTextField.textProperty());
}
@Override
protected String computeValue() {
try {
return Integer.toString(Integer.parseInt(nettoTextField.getText())
+ Integer.parseInt(afaTextField.getText()));
} catch (NumberFormatException e) {
return "Hibás nettó!";
}
}
});
}
public void visszaAction(ActionEvent actionEvent) throws IOException {
Parent root = FXMLLoader.load(getClass().getResource("/fxml/szamlak.fxml"));
Stage stage = (Stage) ((Node) actionEvent.getSource()).getScene().getWindow();
stage.setScene(new Scene(root));
stage.show();
}
public void mentesAction(ActionEvent actionEvent) throws IOException {
if (bizonylatszamTextField.getText().isEmpty()
|| kelteDatePicker.getValue() == null
|| teljesitesDatePicker.getValue() == null
|| esedekessegDatePicker.getValue() == null
|| partnerChoiceBox.getValue() == null
|| fizetesiModChoiceBox.getValue() == null
|| fokonyviSzamChoiceBox.getValue() == null
|| megnevezesTextField.getText().isEmpty()
|| afaChoiceBox.getValue() == null
|| bruttoTextField.getText().equals("Hibás nettó!")) {
hibasAdatLabel.setText("Hiányzó adat!");
}
else {
if (!ugyfelLabel.getText().equals("Módosítás")) {
UgyfelSzamla ugyfelSzamla = UgyfelSzamla.builder()
.ugyfel(aktualisUgyfel)
.irany(bejovoRadioButton.isSelected() ? "bejövő" : "kimenő")
.bizonylatszam(bizonylatszamTextField.getText())
.kelte(kelteDatePicker.getValue())
.teljesites(teljesitesDatePicker.getValue())
.esedekesseg(esedekessegDatePicker.getValue())
.partner(partnerChoiceBox.getValue().toString())
.fizetesiMod(fizetesiModChoiceBox.getValue().toString())
.megjegyzes(megjegyzesTextField.getText())
.fokonyviSzam(fokonyviSzamChoiceBox.getValue().toString())
.megnevezes(megnevezesTextField.getText())
.afaTipus(afaChoiceBox.getValue().toString())
.netto(Integer.parseInt(nettoTextField.getText()))
.afa(Integer.parseInt(afaTextField.getText()))
.brutto(Integer.parseInt(bruttoTextField.getText()))
.build();
ugyfelSzamlaDao.persist(ugyfelSzamla);
}
else {
modositandoUgyfelSzamla.setIrany(bejovoRadioButton.isSelected() ? "bejövő" : "kimenő");
modositandoUgyfelSzamla.setBizonylatszam(bizonylatszamTextField.getText());
modositandoUgyfelSzamla.setKelte(kelteDatePicker.getValue());
modositandoUgyfelSzamla.setTeljesites(teljesitesDatePicker.getValue());
modositandoUgyfelSzamla.setEsedekesseg(esedekessegDatePicker.getValue());
modositandoUgyfelSzamla.setPartner(partnerChoiceBox.getValue().toString());
modositandoUgyfelSzamla.setFizetesiMod(fizetesiModChoiceBox.getValue().toString());
modositandoUgyfelSzamla.setMegjegyzes(megjegyzesTextField.getText());
modositandoUgyfelSzamla.setFokonyviSzam(fokonyviSzamChoiceBox.getValue().toString());
modositandoUgyfelSzamla.setMegnevezes(megnevezesTextField.getText());
modositandoUgyfelSzamla.setAfaTipus(afaChoiceBox.getValue().toString());
modositandoUgyfelSzamla.setNetto(Integer.parseInt(nettoTextField.getText()));
modositandoUgyfelSzamla.setAfa(Integer.parseInt(afaTextField.getText()));
modositandoUgyfelSzamla.setBrutto(Integer.parseInt(bruttoTextField.getText()));
ugyfelSzamlaDao.update(modositandoUgyfelSzamla);
}
Parent root = FXMLLoader.load(getClass().getResource("/fxml/szamlak.fxml"));
Stage stage = (Stage) ((Node) actionEvent.getSource()).getScene().getWindow();
stage.setScene(new Scene(root));
stage.show();
}
}
public void partnerAction(ActionEvent actionEvent) throws IOException {
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/fxml/ugyfelek.fxml"));
Parent root = fxmlLoader.load();
fxmlLoader.<UgyfelekController>getController().initdata("szamla");
Stage stage = (Stage) ((Node) actionEvent.getSource()).getScene().getWindow();
stage.setScene(new Scene(root));
stage.show();
}
public void bejovoAction(ActionEvent actionEvent) {
bejovoRadioButton.setSelected(true);
kimenoRadioButton.setSelected(false);
}
public void kimenoAction(ActionEvent actionEvent) {
kimenoRadioButton.setSelected(true);
bejovoRadioButton.setSelected(false);
}
}
| UTF-8 | Java | 11,348 | java | SzamlaController.java | Java | [] | null | [] | package controllers;
import javafx.beans.binding.StringBinding;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Node;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.stage.Stage;
import model.szamla.UgyfelSzamla;
import model.szamla.UgyfelSzamlaDao;
import model.ugyfel.Ugyfel;
import model.ugyfel.UgyfelDao;
import java.io.IOException;
import java.util.List;
public class SzamlaController {
private static Ugyfel aktualisUgyfel;
private static UgyfelSzamla modositandoUgyfelSzamla;
private UgyfelDao ugyfelDao;
private UgyfelSzamlaDao ugyfelSzamlaDao;
@FXML
private Label ugyfelLabel;
@FXML
private RadioButton bejovoRadioButton;
@FXML
private RadioButton kimenoRadioButton;
@FXML
private TextField bizonylatszamTextField;
@FXML
private DatePicker kelteDatePicker;
@FXML
private DatePicker teljesitesDatePicker;
@FXML
private DatePicker esedekessegDatePicker;
@FXML
private ChoiceBox partnerChoiceBox;
@FXML
private ChoiceBox fizetesiModChoiceBox;
@FXML
private TextField megjegyzesTextField;
@FXML
private ChoiceBox fokonyviSzamChoiceBox;
@FXML
private TextField megnevezesTextField;
@FXML
private ChoiceBox afaChoiceBox;
@FXML
private TextField nettoTextField;
@FXML
private TextField afaTextField;
@FXML
private TextField bruttoTextField;
@FXML
private Label hibasAdatLabel;
public void initdata(Ugyfel ugyfel) {
aktualisUgyfel = ugyfel;
ugyfelLabel.setText(aktualisUgyfel.getNev());
}
public void initdata(UgyfelSzamla ugyfelSzamla) {
modositandoUgyfelSzamla = ugyfelSzamla;
ugyfelLabel.setText("Módosítás");
if (modositandoUgyfelSzamla.getIrany().equals("bejövő")) {
bejovoRadioButton.setSelected(true);
kimenoRadioButton.setSelected(false);
}
else {
bejovoRadioButton.setSelected(false);
kimenoRadioButton.setSelected(true);
}
bizonylatszamTextField.setText(modositandoUgyfelSzamla.getBizonylatszam());
kelteDatePicker.setValue(modositandoUgyfelSzamla.getKelte());
teljesitesDatePicker.setValue(modositandoUgyfelSzamla.getTeljesites());
esedekessegDatePicker.setValue(modositandoUgyfelSzamla.getEsedekesseg());
partnerChoiceBox.setValue(modositandoUgyfelSzamla.getPartner());
fizetesiModChoiceBox.setValue(modositandoUgyfelSzamla.getFizetesiMod());
megjegyzesTextField.setText(modositandoUgyfelSzamla.getMegjegyzes());
fokonyviSzamChoiceBox.setValue(modositandoUgyfelSzamla.getFokonyviSzam());
megnevezesTextField.setText(modositandoUgyfelSzamla.getMegnevezes());
afaChoiceBox.setValue(modositandoUgyfelSzamla.getAfaTipus());
nettoTextField.setText(Integer.toString(modositandoUgyfelSzamla.getNetto()));
}
@FXML
public void initialize() {
ugyfelDao = UgyfelDao.getInstance();
ugyfelSzamlaDao = UgyfelSzamlaDao.getInstance();
if (aktualisUgyfel != null) {
ugyfelLabel.setText(aktualisUgyfel.getNev());
}
hibasAdatLabel.setText("");
ObservableList<String> fizetesiModLista =
FXCollections.observableArrayList("átutalás", "készpénz");
fizetesiModChoiceBox.setItems(fizetesiModLista);
fizetesiModChoiceBox.setValue(fizetesiModLista.get(0));
ObservableList<String> afaLista =
FXCollections.observableArrayList("27%", "18%", "5%", "AM");
afaChoiceBox.setItems(afaLista);
afaChoiceBox.setValue(afaLista.get(0));
ObservableList<String> fokonyvLista =
FXCollections.observableArrayList(
"1 – Befektetett eszközök",
"2 - Készletek",
"3 - Követelések, pénzügyi eszközök",
"4 - Források",
"5 - Költségnemek",
"6 - Költséghelyek, általános költségek",
"7 - Tevékenységek költségei",
"8 - Értékesítés elszámolt önköltsége és ráfordítások",
"9 - Értékesítés árbevétele és bevételek");
fokonyviSzamChoiceBox.setItems(fokonyvLista);
fokonyviSzamChoiceBox.setValue(fokonyvLista.get(0));
List<String> ugyfelLista = ugyfelDao.findAllNev();
if (ugyfelLista.size() > 0) {
ObservableList<String> observableUgyfelLista = FXCollections.observableArrayList();
observableUgyfelLista.addAll(ugyfelLista);
partnerChoiceBox.setItems(observableUgyfelLista);
partnerChoiceBox.setValue(observableUgyfelLista.get(0));
}
afaTextField.textProperty().bind(
new StringBinding() {
{
super.bind(nettoTextField.textProperty(), afaChoiceBox.valueProperty());
}
@Override
protected String computeValue() {
try {
String s = afaChoiceBox.getValue().toString();
s = Integer.toString((int) (Double.parseDouble(nettoTextField.getText())
* (s.equals("AM") ? 0 : Double.parseDouble(s.substring(0, s.length() - 1)) / 100)));
return s;
} catch (NumberFormatException e) {
return "Hibás nettó!";
}
}
});
bruttoTextField.textProperty().bind(
new StringBinding() {
{
super.bind(nettoTextField.textProperty(), afaTextField.textProperty());
}
@Override
protected String computeValue() {
try {
return Integer.toString(Integer.parseInt(nettoTextField.getText())
+ Integer.parseInt(afaTextField.getText()));
} catch (NumberFormatException e) {
return "Hibás nettó!";
}
}
});
}
public void visszaAction(ActionEvent actionEvent) throws IOException {
Parent root = FXMLLoader.load(getClass().getResource("/fxml/szamlak.fxml"));
Stage stage = (Stage) ((Node) actionEvent.getSource()).getScene().getWindow();
stage.setScene(new Scene(root));
stage.show();
}
public void mentesAction(ActionEvent actionEvent) throws IOException {
if (bizonylatszamTextField.getText().isEmpty()
|| kelteDatePicker.getValue() == null
|| teljesitesDatePicker.getValue() == null
|| esedekessegDatePicker.getValue() == null
|| partnerChoiceBox.getValue() == null
|| fizetesiModChoiceBox.getValue() == null
|| fokonyviSzamChoiceBox.getValue() == null
|| megnevezesTextField.getText().isEmpty()
|| afaChoiceBox.getValue() == null
|| bruttoTextField.getText().equals("Hibás nettó!")) {
hibasAdatLabel.setText("Hiányzó adat!");
}
else {
if (!ugyfelLabel.getText().equals("Módosítás")) {
UgyfelSzamla ugyfelSzamla = UgyfelSzamla.builder()
.ugyfel(aktualisUgyfel)
.irany(bejovoRadioButton.isSelected() ? "bejövő" : "kimenő")
.bizonylatszam(bizonylatszamTextField.getText())
.kelte(kelteDatePicker.getValue())
.teljesites(teljesitesDatePicker.getValue())
.esedekesseg(esedekessegDatePicker.getValue())
.partner(partnerChoiceBox.getValue().toString())
.fizetesiMod(fizetesiModChoiceBox.getValue().toString())
.megjegyzes(megjegyzesTextField.getText())
.fokonyviSzam(fokonyviSzamChoiceBox.getValue().toString())
.megnevezes(megnevezesTextField.getText())
.afaTipus(afaChoiceBox.getValue().toString())
.netto(Integer.parseInt(nettoTextField.getText()))
.afa(Integer.parseInt(afaTextField.getText()))
.brutto(Integer.parseInt(bruttoTextField.getText()))
.build();
ugyfelSzamlaDao.persist(ugyfelSzamla);
}
else {
modositandoUgyfelSzamla.setIrany(bejovoRadioButton.isSelected() ? "bejövő" : "kimenő");
modositandoUgyfelSzamla.setBizonylatszam(bizonylatszamTextField.getText());
modositandoUgyfelSzamla.setKelte(kelteDatePicker.getValue());
modositandoUgyfelSzamla.setTeljesites(teljesitesDatePicker.getValue());
modositandoUgyfelSzamla.setEsedekesseg(esedekessegDatePicker.getValue());
modositandoUgyfelSzamla.setPartner(partnerChoiceBox.getValue().toString());
modositandoUgyfelSzamla.setFizetesiMod(fizetesiModChoiceBox.getValue().toString());
modositandoUgyfelSzamla.setMegjegyzes(megjegyzesTextField.getText());
modositandoUgyfelSzamla.setFokonyviSzam(fokonyviSzamChoiceBox.getValue().toString());
modositandoUgyfelSzamla.setMegnevezes(megnevezesTextField.getText());
modositandoUgyfelSzamla.setAfaTipus(afaChoiceBox.getValue().toString());
modositandoUgyfelSzamla.setNetto(Integer.parseInt(nettoTextField.getText()));
modositandoUgyfelSzamla.setAfa(Integer.parseInt(afaTextField.getText()));
modositandoUgyfelSzamla.setBrutto(Integer.parseInt(bruttoTextField.getText()));
ugyfelSzamlaDao.update(modositandoUgyfelSzamla);
}
Parent root = FXMLLoader.load(getClass().getResource("/fxml/szamlak.fxml"));
Stage stage = (Stage) ((Node) actionEvent.getSource()).getScene().getWindow();
stage.setScene(new Scene(root));
stage.show();
}
}
public void partnerAction(ActionEvent actionEvent) throws IOException {
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/fxml/ugyfelek.fxml"));
Parent root = fxmlLoader.load();
fxmlLoader.<UgyfelekController>getController().initdata("szamla");
Stage stage = (Stage) ((Node) actionEvent.getSource()).getScene().getWindow();
stage.setScene(new Scene(root));
stage.show();
}
public void bejovoAction(ActionEvent actionEvent) {
bejovoRadioButton.setSelected(true);
kimenoRadioButton.setSelected(false);
}
public void kimenoAction(ActionEvent actionEvent) {
kimenoRadioButton.setSelected(true);
bejovoRadioButton.setSelected(false);
}
}
| 11,348 | 0.618815 | 0.616599 | 283 | 38.851589 | 30.046358 | 120 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.55477 | false | false | 9 |
645e4f467e0ab551e516e9cf50df3f44c9114f8a | 6,107,443,554,387 | 8c9e56076ec59a8d1fbca733410b974ea2c41bb9 | /nifi-nar-bundles/nifi-rules-action-handler-bundle/nifi-rules-action-handler-service/src/test/java/org/apache/nifi/rules/handlers/TestRecordSinkHandler.java | fb5f342200ed342ba0361afd824f30f90f301133 | [
"CC0-1.0",
"Apache-2.0",
"MIT",
"LicenseRef-scancode-unknown"
] | permissive | apache/nifi | https://github.com/apache/nifi | 70329dca21ce61a643d5fac263ab101ae9313f5a | 2b330d9feea82764721e6190f7320d49c73986b0 | refs/heads/main | 2023-09-04T00:50:15.639000 | 2023-08-31T16:41:08 | 2023-08-31T16:41:08 | 27,911,088 | 4,182 | 3,345 | Apache-2.0 | false | 2023-09-14T20:56:07 | 2014-12-12T08:00:05 | 2023-09-14T10:07:16 | 2023-09-14T20:56:07 | 236,539 | 3,988 | 2,530 | 30 | Java | false | false | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.nifi.rules.handlers;
import org.apache.commons.lang3.StringUtils;
import org.apache.nifi.components.AbstractConfigurableComponent;
import org.apache.nifi.controller.ControllerServiceInitializationContext;
import org.apache.nifi.logging.ComponentLog;
import org.apache.nifi.record.sink.RecordSinkService;
import org.apache.nifi.reporting.InitializationException;
import org.apache.nifi.rules.Action;
import org.apache.nifi.serialization.WriteResult;
import org.apache.nifi.serialization.record.Record;
import org.apache.nifi.serialization.record.RecordSchema;
import org.apache.nifi.serialization.record.RecordSet;
import org.apache.nifi.util.TestRunner;
import org.apache.nifi.util.TestRunners;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.IsInstanceOf.instanceOf;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
public class TestRecordSinkHandler {
private TestRunner runner;
private MockComponentLog mockComponentLog;
private RecordSinkHandler recordSinkHandler;
private MockRecordSinkService recordSinkService;
@BeforeEach
public void setup() throws InitializationException {
runner = TestRunners.newTestRunner(TestProcessor.class);
mockComponentLog = new MockComponentLog();
RecordSinkHandler handler = new MockRecordSinkHandler(mockComponentLog);
recordSinkService = new MockRecordSinkService();
runner.addControllerService("MockRecordSinkService", recordSinkService);
runner.enableControllerService(recordSinkService);
runner.addControllerService("MockRecordSinkHandler", handler);
runner.setProperty(handler, MockRecordSinkHandler.RECORD_SINK_SERVICE,"MockRecordSinkService");
runner.enableControllerService(handler);
recordSinkHandler = (RecordSinkHandler) runner.getProcessContext()
.getControllerServiceLookup()
.getControllerService("MockRecordSinkHandler");
}
@Test
public void testValidService() {
runner.assertValid(recordSinkHandler);
assertThat(recordSinkHandler, instanceOf(RecordSinkHandler.class));
}
@Test
public void testRecordSendViaSink() throws InitializationException, IOException {
final Map<String,String> attributes = new HashMap<>();
final Map<String,Object> metrics = new HashMap<>();
final String expectedMessage = "Records written to sink service:";
final BigDecimal bigDecimalValue = new BigDecimal(String.join("", Collections.nCopies(400, "1")) + ".2");
attributes.put("sendZeroResults","false");
metrics.put("jvmHeap","1000000");
metrics.put("cpu","90");
metrics.put("custom", bigDecimalValue);
final Action action = new Action();
action.setType("SEND");
action.setAttributes(attributes);
recordSinkHandler.execute(action, metrics);
String logMessage = mockComponentLog.getDebugMessage();
List<Map<String, Object>> rows = recordSinkService.getRows();
assertTrue(StringUtils.isNotEmpty(logMessage));
assertTrue(logMessage.startsWith(expectedMessage));
assertFalse(rows.isEmpty());
Map<String,Object> record = rows.get(0);
assertEquals("90", (record.get("cpu")));
assertEquals("1000000", (record.get("jvmHeap")));
assertEquals(bigDecimalValue, (record.get("custom")));
}
private static class MockRecordSinkHandler extends RecordSinkHandler {
private ComponentLog testLogger;
public MockRecordSinkHandler(ComponentLog testLogger) {
this.testLogger = testLogger;
}
@Override
protected ComponentLog getLogger() {
return testLogger;
}
}
private static class MockRecordSinkService extends AbstractConfigurableComponent implements RecordSinkService {
private List<Map<String, Object>> rows = new ArrayList<>();
@Override
public WriteResult sendData(RecordSet recordSet, Map<String,String> attributes, boolean sendZeroResults) throws IOException {
int numRecordsWritten = 0;
RecordSchema recordSchema = recordSet.getSchema();
Record record;
while ((record = recordSet.next()) != null) {
Map<String, Object> row = new HashMap<>();
final Record finalRecord = record;
recordSchema.getFieldNames().forEach((fieldName) -> row.put(fieldName, finalRecord.getValue(fieldName)));
rows.add(row);
numRecordsWritten++;
}
return WriteResult.of(numRecordsWritten, Collections.emptyMap());
}
@Override
public String getIdentifier() {
return "MockRecordSinkService";
}
@Override
public void initialize(ControllerServiceInitializationContext context) throws InitializationException {
}
public List<Map<String, Object>> getRows() {
return rows;
}
}
}
| UTF-8 | Java | 6,243 | java | TestRecordSinkHandler.java | Java | [] | null | [] | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.nifi.rules.handlers;
import org.apache.commons.lang3.StringUtils;
import org.apache.nifi.components.AbstractConfigurableComponent;
import org.apache.nifi.controller.ControllerServiceInitializationContext;
import org.apache.nifi.logging.ComponentLog;
import org.apache.nifi.record.sink.RecordSinkService;
import org.apache.nifi.reporting.InitializationException;
import org.apache.nifi.rules.Action;
import org.apache.nifi.serialization.WriteResult;
import org.apache.nifi.serialization.record.Record;
import org.apache.nifi.serialization.record.RecordSchema;
import org.apache.nifi.serialization.record.RecordSet;
import org.apache.nifi.util.TestRunner;
import org.apache.nifi.util.TestRunners;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.IsInstanceOf.instanceOf;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
public class TestRecordSinkHandler {
private TestRunner runner;
private MockComponentLog mockComponentLog;
private RecordSinkHandler recordSinkHandler;
private MockRecordSinkService recordSinkService;
@BeforeEach
public void setup() throws InitializationException {
runner = TestRunners.newTestRunner(TestProcessor.class);
mockComponentLog = new MockComponentLog();
RecordSinkHandler handler = new MockRecordSinkHandler(mockComponentLog);
recordSinkService = new MockRecordSinkService();
runner.addControllerService("MockRecordSinkService", recordSinkService);
runner.enableControllerService(recordSinkService);
runner.addControllerService("MockRecordSinkHandler", handler);
runner.setProperty(handler, MockRecordSinkHandler.RECORD_SINK_SERVICE,"MockRecordSinkService");
runner.enableControllerService(handler);
recordSinkHandler = (RecordSinkHandler) runner.getProcessContext()
.getControllerServiceLookup()
.getControllerService("MockRecordSinkHandler");
}
@Test
public void testValidService() {
runner.assertValid(recordSinkHandler);
assertThat(recordSinkHandler, instanceOf(RecordSinkHandler.class));
}
@Test
public void testRecordSendViaSink() throws InitializationException, IOException {
final Map<String,String> attributes = new HashMap<>();
final Map<String,Object> metrics = new HashMap<>();
final String expectedMessage = "Records written to sink service:";
final BigDecimal bigDecimalValue = new BigDecimal(String.join("", Collections.nCopies(400, "1")) + ".2");
attributes.put("sendZeroResults","false");
metrics.put("jvmHeap","1000000");
metrics.put("cpu","90");
metrics.put("custom", bigDecimalValue);
final Action action = new Action();
action.setType("SEND");
action.setAttributes(attributes);
recordSinkHandler.execute(action, metrics);
String logMessage = mockComponentLog.getDebugMessage();
List<Map<String, Object>> rows = recordSinkService.getRows();
assertTrue(StringUtils.isNotEmpty(logMessage));
assertTrue(logMessage.startsWith(expectedMessage));
assertFalse(rows.isEmpty());
Map<String,Object> record = rows.get(0);
assertEquals("90", (record.get("cpu")));
assertEquals("1000000", (record.get("jvmHeap")));
assertEquals(bigDecimalValue, (record.get("custom")));
}
private static class MockRecordSinkHandler extends RecordSinkHandler {
private ComponentLog testLogger;
public MockRecordSinkHandler(ComponentLog testLogger) {
this.testLogger = testLogger;
}
@Override
protected ComponentLog getLogger() {
return testLogger;
}
}
private static class MockRecordSinkService extends AbstractConfigurableComponent implements RecordSinkService {
private List<Map<String, Object>> rows = new ArrayList<>();
@Override
public WriteResult sendData(RecordSet recordSet, Map<String,String> attributes, boolean sendZeroResults) throws IOException {
int numRecordsWritten = 0;
RecordSchema recordSchema = recordSet.getSchema();
Record record;
while ((record = recordSet.next()) != null) {
Map<String, Object> row = new HashMap<>();
final Record finalRecord = record;
recordSchema.getFieldNames().forEach((fieldName) -> row.put(fieldName, finalRecord.getValue(fieldName)));
rows.add(row);
numRecordsWritten++;
}
return WriteResult.of(numRecordsWritten, Collections.emptyMap());
}
@Override
public String getIdentifier() {
return "MockRecordSinkService";
}
@Override
public void initialize(ControllerServiceInitializationContext context) throws InitializationException {
}
public List<Map<String, Object>> getRows() {
return rows;
}
}
}
| 6,243 | 0.715361 | 0.710556 | 152 | 40.072369 | 29.292109 | 133 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.743421 | false | false | 9 |
eb86b11c4e9a77855aec5432affa2d79101da0ca | 16,810,502,057,246 | da6eecc6bb7270e526d41c0203e0580922adb3f1 | /CanYouDebate/CanYouDebate/src/com/canyoudebate/dao/OracleDAO.java | ca6ce399fe115d3e6678abac44b76b5b4c0894db | [] | no_license | dexlock/CanYouDebate | https://github.com/dexlock/CanYouDebate | 4324bb35b3c4328bfcc4d1938594f3152c3d8358 | b316847b0783985093e4c78cff33a0d8745994f4 | refs/heads/master | 2020-06-26T18:16:51.817000 | 2015-01-10T06:18:55 | 2015-01-10T06:18:55 | 29,049,300 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.canyoudebate.dao;
import java.sql.*;
public abstract class OracleDAO
{
/*
* Oracle Connection details
*/
private String DB_NAME = "ORCL";
private final String DB_USERID = "C##DEXLOCKED";
private final String DB_PASSWD = "ItsLocked";
private final String DB_DRIVER = "oracle.jdbc.OracleDriver" ;
private final String DB_URL = "jdbc:oracle:thin:@localhost:1521:"+DB_NAME;
/**
* To establish/open a connection to the Oracle database
* It will open a database connection with the help
* of the JDBC driver, and return back a Connection object
*/
public Connection openConnection()
{
Connection conn = null;
try
{
//load the Oracle JDBC driver from the ojdbc6.jar
Class.forName(DB_DRIVER);
//initialize the connection
conn = DriverManager.getConnection(DB_URL, DB_USERID, DB_PASSWD);
}
catch(ClassNotFoundException c){c.printStackTrace();}
catch(SQLException s){s.printStackTrace();}
return conn;
}
}
| UTF-8 | Java | 990 | java | OracleDAO.java | Java | [
{
"context": "#DEXLOCKED\";\n\t\n\tprivate final String DB_PASSWD = \"ItsLocked\";\n\t\n\tprivate final String DB_DRIVER = \"oracle.jdb",
"end": 260,
"score": 0.9991190433502197,
"start": 251,
"tag": "PASSWORD",
"value": "ItsLocked"
}
] | null | [] | package com.canyoudebate.dao;
import java.sql.*;
public abstract class OracleDAO
{
/*
* Oracle Connection details
*/
private String DB_NAME = "ORCL";
private final String DB_USERID = "C##DEXLOCKED";
private final String DB_PASSWD = "<PASSWORD>";
private final String DB_DRIVER = "oracle.jdbc.OracleDriver" ;
private final String DB_URL = "jdbc:oracle:thin:@localhost:1521:"+DB_NAME;
/**
* To establish/open a connection to the Oracle database
* It will open a database connection with the help
* of the JDBC driver, and return back a Connection object
*/
public Connection openConnection()
{
Connection conn = null;
try
{
//load the Oracle JDBC driver from the ojdbc6.jar
Class.forName(DB_DRIVER);
//initialize the connection
conn = DriverManager.getConnection(DB_URL, DB_USERID, DB_PASSWD);
}
catch(ClassNotFoundException c){c.printStackTrace();}
catch(SQLException s){s.printStackTrace();}
return conn;
}
}
| 991 | 0.69596 | 0.690909 | 47 | 20.063829 | 23.083941 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.574468 | false | false | 9 |
127dd53b64af62d80f57963613666e0cc5ca4688 | 38,963,943,348,449 | 38b430cb8abba6a190e4d7fbeaf44f5e97f9f65f | /server/src/main/java/com/duality/server/openfirePlugin/dataTier/Location.java | b6c037ef2987711946683ff99d6c754462137882 | [] | no_license | yhlam/duality | https://github.com/yhlam/duality | 5d6592d66d889d36b7f4caadbf5656c9a827cb7d | 0eb0d2dbd0ac179fd79c3ed6d1fef5dc175a90ed | refs/heads/master | 2020-12-24T14:26:31.766000 | 2013-05-13T19:12:25 | 2013-05-13T19:12:25 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.duality.server.openfirePlugin.dataTier;
public class Location {
private final double latitude;
private final double longtitude;
public Location(double latitude, double longtitude) {
this.latitude = latitude;
this.longtitude = longtitude;
}
public double getLatitude() {
return latitude;
}
public double getLongtitude() {
return longtitude;
}
@Override
public String toString() {
return "(lat:" + latitude + ", long:" + longtitude + ")";
}
}
| UTF-8 | Java | 479 | java | Location.java | Java | [] | null | [] | package com.duality.server.openfirePlugin.dataTier;
public class Location {
private final double latitude;
private final double longtitude;
public Location(double latitude, double longtitude) {
this.latitude = latitude;
this.longtitude = longtitude;
}
public double getLatitude() {
return latitude;
}
public double getLongtitude() {
return longtitude;
}
@Override
public String toString() {
return "(lat:" + latitude + ", long:" + longtitude + ")";
}
}
| 479 | 0.716075 | 0.716075 | 24 | 18.958334 | 18.410774 | 59 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.291667 | false | false | 9 |
c65283a361d85f82471660b1782ceca01f679caa | 39,548,058,886,937 | a345fbf4d072cdb931236c73e144b308dcd08014 | /src/main/java/Game/Command.java | b710a842b3fb50f68c3d2a4c4dd350f5f997c6a7 | [] | no_license | hasanissa25/RISK-Global-Domination | https://github.com/hasanissa25/RISK-Global-Domination | 5353ed18ac217d4d518e81a60405c140184e41b3 | a7d1569a3f9e8c6b5604bdf7e9a160155cf73166 | refs/heads/master | 2023-03-01T05:48:13.654000 | 2021-02-11T19:15:05 | 2021-02-11T19:15:05 | 303,560,067 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package Game;
/**
* @author Hasan Issa
*
* This class takes a string of 4 words, and coverts it into a command.
*
*/
public class Command
{
private String commandWord;
private String secondWord;
private String thirdWord;
private String fourthWord;
public Command(String firstWord, String secondWord, String thirdWord,String fourthWord)
{
commandWord = firstWord;
this.secondWord = secondWord;
this.thirdWord = thirdWord;
this.fourthWord = fourthWord;
}
public Command(String firstWord)
{
commandWord = firstWord;
this.secondWord = null;
this.thirdWord = null;
this.fourthWord = null;
}
public String getCommandWord() {
/**
* @author Hasan Issa
*
* @param commandWord This is the word that dictates what type of action will be taken due to this command.
* commandWords include Attack,Map,Quit, and Pass
*
*/
return commandWord;
}
public void setCommandWord(String commandWord) {
this.commandWord = commandWord;
}
public boolean isUnknown() {
return (commandWord == null);
}
public String getSecondWord() {return secondWord; }
public String getThirdWord() {
return thirdWord;
}
public int getFourthWord() {
return Integer.valueOf(fourthWord);
}
public boolean hasSecondWord() {
return (secondWord != null);
}
public boolean hasThirdWord() {
return (thirdWord != null);
}
public boolean hasFourthWord() { return (fourthWord != null); }
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("Command{");
sb.append("commandWord='").append(commandWord).append('\'');
sb.append(", secondWord='").append(secondWord).append('\'');
sb.append(", thirdWord='").append(thirdWord).append('\'');
sb.append(", fourthWord='").append(fourthWord).append('\'');
sb.append('}');
return sb.toString();
}}
| UTF-8 | Java | 1,829 | java | Command.java | Java | [
{
"context": "package Game;\n\n/**\n * @author Hasan Issa\n *\n * This class takes a string of 4 words, and c",
"end": 45,
"score": 0.999870240688324,
"start": 35,
"tag": "NAME",
"value": "Hasan Issa"
},
{
"context": "blic String getCommandWord() {\n/**\n * @author Hasan Is... | null | [] | package Game;
/**
* @author <NAME>
*
* This class takes a string of 4 words, and coverts it into a command.
*
*/
public class Command
{
private String commandWord;
private String secondWord;
private String thirdWord;
private String fourthWord;
public Command(String firstWord, String secondWord, String thirdWord,String fourthWord)
{
commandWord = firstWord;
this.secondWord = secondWord;
this.thirdWord = thirdWord;
this.fourthWord = fourthWord;
}
public Command(String firstWord)
{
commandWord = firstWord;
this.secondWord = null;
this.thirdWord = null;
this.fourthWord = null;
}
public String getCommandWord() {
/**
* @author <NAME>
*
* @param commandWord This is the word that dictates what type of action will be taken due to this command.
* commandWords include Attack,Map,Quit, and Pass
*
*/
return commandWord;
}
public void setCommandWord(String commandWord) {
this.commandWord = commandWord;
}
public boolean isUnknown() {
return (commandWord == null);
}
public String getSecondWord() {return secondWord; }
public String getThirdWord() {
return thirdWord;
}
public int getFourthWord() {
return Integer.valueOf(fourthWord);
}
public boolean hasSecondWord() {
return (secondWord != null);
}
public boolean hasThirdWord() {
return (thirdWord != null);
}
public boolean hasFourthWord() { return (fourthWord != null); }
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("Command{");
sb.append("commandWord='").append(commandWord).append('\'');
sb.append(", secondWord='").append(secondWord).append('\'');
sb.append(", thirdWord='").append(thirdWord).append('\'');
sb.append(", fourthWord='").append(fourthWord).append('\'');
sb.append('}');
return sb.toString();
}}
| 1,821 | 0.693822 | 0.693275 | 73 | 24.041096 | 23.313492 | 107 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.534247 | false | false | 9 |
19cef9f546ba643e80fc073733aecd84074c31e3 | 24,893,630,503,041 | f87f951ec97ce2081521bb74740f4bb130f1dfb6 | /src/main/java/com/blackthief/meetapp/checkin/CheckInService.java | 6a710c0ac7de4e63ec3ecf4ab800bc3077defdaf | [] | no_license | fergsilva/meetapp | https://github.com/fergsilva/meetapp | 58260ee7605ef4e92329ceace3c8bb6ea10b2d62 | 48618b7b093b7043dcb188e154e38f22da6bcf2f | refs/heads/master | 2022-04-12T02:59:38.739000 | 2020-03-16T02:54:14 | 2020-03-16T02:54:14 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.blackthief.meetapp.checkin;
public interface CheckInService {
CheckIn update(CheckIn weather);
} | UTF-8 | Java | 112 | java | CheckInService.java | Java | [] | null | [] | package com.blackthief.meetapp.checkin;
public interface CheckInService {
CheckIn update(CheckIn weather);
} | 112 | 0.803571 | 0.803571 | 6 | 17.833334 | 17.285994 | 39 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.666667 | false | false | 9 |
cea207da48b730d59d3d93ae779f4d697f593a71 | 24,893,630,506,378 | 73267be654cd1fd76cf2cb9ea3a75630d9f58a41 | /services/waf/src/main/java/com/huaweicloud/sdk/waf/v1/model/UpdatePolicyProtectHostRequest.java | f003cc4cbe15cff3ecd48527a74c65e8327215d9 | [
"Apache-2.0"
] | permissive | huaweicloud/huaweicloud-sdk-java-v3 | https://github.com/huaweicloud/huaweicloud-sdk-java-v3 | 51b32a451fac321a0affe2176663fed8a9cd8042 | 2f8543d0d037b35c2664298ba39a89cc9d8ed9a3 | refs/heads/master | 2023-08-29T06:50:15.642000 | 2023-08-24T08:34:48 | 2023-08-24T08:34:48 | 262,207,545 | 91 | 57 | NOASSERTION | false | 2023-09-08T12:24:55 | 2020-05-08T02:27:00 | 2023-09-04T08:26:00 | 2023-09-08T12:24:54 | 82,686 | 80 | 51 | 9 | Java | false | false | package com.huaweicloud.sdk.waf.v1.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Objects;
/**
* Request Object
*/
public class UpdatePolicyProtectHostRequest {
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "enterprise_project_id")
private String enterpriseProjectId;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "policy_id")
private String policyId;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "hosts")
private String hosts;
public UpdatePolicyProtectHostRequest withEnterpriseProjectId(String enterpriseProjectId) {
this.enterpriseProjectId = enterpriseProjectId;
return this;
}
/**
* 您可以通过调用企业项目管理服务(EPS)的查询企业项目列表接口(ListEnterpriseProject)查询企业项目id
* @return enterpriseProjectId
*/
public String getEnterpriseProjectId() {
return enterpriseProjectId;
}
public void setEnterpriseProjectId(String enterpriseProjectId) {
this.enterpriseProjectId = enterpriseProjectId;
}
public UpdatePolicyProtectHostRequest withPolicyId(String policyId) {
this.policyId = policyId;
return this;
}
/**
* 防护策略id,您可以通过调用查询防护策略列表(ListPolicy)获取策略id
* @return policyId
*/
public String getPolicyId() {
return policyId;
}
public void setPolicyId(String policyId) {
this.policyId = policyId;
}
public UpdatePolicyProtectHostRequest withHosts(String hosts) {
this.hosts = hosts;
return this;
}
/**
* 域名id,您可以通过调用查询云模式防护域名列表(ListHost)获取域名id
* @return hosts
*/
public String getHosts() {
return hosts;
}
public void setHosts(String hosts) {
this.hosts = hosts;
}
@Override
public boolean equals(java.lang.Object obj) {
if (this == obj) {
return true;
}
if (obj == null || getClass() != obj.getClass()) {
return false;
}
UpdatePolicyProtectHostRequest that = (UpdatePolicyProtectHostRequest) obj;
return Objects.equals(this.enterpriseProjectId, that.enterpriseProjectId)
&& Objects.equals(this.policyId, that.policyId) && Objects.equals(this.hosts, that.hosts);
}
@Override
public int hashCode() {
return Objects.hash(enterpriseProjectId, policyId, hosts);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class UpdatePolicyProtectHostRequest {\n");
sb.append(" enterpriseProjectId: ").append(toIndentedString(enterpriseProjectId)).append("\n");
sb.append(" policyId: ").append(toIndentedString(policyId)).append("\n");
sb.append(" hosts: ").append(toIndentedString(hosts)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
| UTF-8 | Java | 3,448 | java | UpdatePolicyProtectHostRequest.java | Java | [] | null | [] | package com.huaweicloud.sdk.waf.v1.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Objects;
/**
* Request Object
*/
public class UpdatePolicyProtectHostRequest {
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "enterprise_project_id")
private String enterpriseProjectId;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "policy_id")
private String policyId;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "hosts")
private String hosts;
public UpdatePolicyProtectHostRequest withEnterpriseProjectId(String enterpriseProjectId) {
this.enterpriseProjectId = enterpriseProjectId;
return this;
}
/**
* 您可以通过调用企业项目管理服务(EPS)的查询企业项目列表接口(ListEnterpriseProject)查询企业项目id
* @return enterpriseProjectId
*/
public String getEnterpriseProjectId() {
return enterpriseProjectId;
}
public void setEnterpriseProjectId(String enterpriseProjectId) {
this.enterpriseProjectId = enterpriseProjectId;
}
public UpdatePolicyProtectHostRequest withPolicyId(String policyId) {
this.policyId = policyId;
return this;
}
/**
* 防护策略id,您可以通过调用查询防护策略列表(ListPolicy)获取策略id
* @return policyId
*/
public String getPolicyId() {
return policyId;
}
public void setPolicyId(String policyId) {
this.policyId = policyId;
}
public UpdatePolicyProtectHostRequest withHosts(String hosts) {
this.hosts = hosts;
return this;
}
/**
* 域名id,您可以通过调用查询云模式防护域名列表(ListHost)获取域名id
* @return hosts
*/
public String getHosts() {
return hosts;
}
public void setHosts(String hosts) {
this.hosts = hosts;
}
@Override
public boolean equals(java.lang.Object obj) {
if (this == obj) {
return true;
}
if (obj == null || getClass() != obj.getClass()) {
return false;
}
UpdatePolicyProtectHostRequest that = (UpdatePolicyProtectHostRequest) obj;
return Objects.equals(this.enterpriseProjectId, that.enterpriseProjectId)
&& Objects.equals(this.policyId, that.policyId) && Objects.equals(this.hosts, that.hosts);
}
@Override
public int hashCode() {
return Objects.hash(enterpriseProjectId, policyId, hosts);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class UpdatePolicyProtectHostRequest {\n");
sb.append(" enterpriseProjectId: ").append(toIndentedString(enterpriseProjectId)).append("\n");
sb.append(" policyId: ").append(toIndentedString(policyId)).append("\n");
sb.append(" hosts: ").append(toIndentedString(hosts)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
| 3,448 | 0.647095 | 0.646483 | 119 | 26.478992 | 26.144989 | 106 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.344538 | false | false | 9 |
c36c915975a89a8dd771620e80175a82eec593b3 | 15,788,299,825,000 | d8c64a24649cd33d3163eda5697b882bfc29f586 | /src/test/java/leetcode/graph/FloodFillTest.java | fac60a4c3f36dfe7d2f8d38fffe1c5d22f1af049 | [] | no_license | chethan/code_contests | https://github.com/chethan/code_contests | 2ab0e87f2e095b942fb08bf56158fa820447f78e | 3f0a720e5884df57f7989e22c0f5141af8336612 | refs/heads/master | 2022-04-28T04:59:14.671000 | 2022-03-16T21:20:46 | 2022-03-16T21:20:46 | 41,237,107 | 0 | 3 | null | false | 2021-03-05T18:10:03 | 2015-08-23T05:29:14 | 2019-02-22T16:19:26 | 2021-03-05T18:10:03 | 978 | 0 | 3 | 1 | Java | false | false | package leetcode.graph;
import static org.assertj.core.api.Assertions.assertThat;
import org.testng.annotations.Test;
public class FloodFillTest {
@Test
public void testFloodFill() {
FloodFill floodFill = new FloodFill();
assertThat(floodFill.floodFill(new int[][]{{1, 1, 1}, {1, 1, 0}, {1, 0, 1}}, 1, 1, 2))
.isEqualTo(new int[][]{{2, 2, 2}, {2, 2, 0}, {2, 0, 1}});
assertThat(floodFill.floodFill(new int[][]{{1, 1, 1}, {1, 1, 0}, {1, 0, 1}}, 1, 1, 1))
.isEqualTo(new int[][]{{1, 1, 1}, {1, 1, 0}, {1, 0, 1}});
}
} | UTF-8 | Java | 579 | java | FloodFillTest.java | Java | [] | null | [] | package leetcode.graph;
import static org.assertj.core.api.Assertions.assertThat;
import org.testng.annotations.Test;
public class FloodFillTest {
@Test
public void testFloodFill() {
FloodFill floodFill = new FloodFill();
assertThat(floodFill.floodFill(new int[][]{{1, 1, 1}, {1, 1, 0}, {1, 0, 1}}, 1, 1, 2))
.isEqualTo(new int[][]{{2, 2, 2}, {2, 2, 0}, {2, 0, 1}});
assertThat(floodFill.floodFill(new int[][]{{1, 1, 1}, {1, 1, 0}, {1, 0, 1}}, 1, 1, 1))
.isEqualTo(new int[][]{{1, 1, 1}, {1, 1, 0}, {1, 0, 1}});
}
} | 579 | 0.552677 | 0.480138 | 17 | 33.117645 | 32.21962 | 94 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.588235 | false | false | 9 |
1e695fd089335ea9448a607527ce2c3050eb5266 | 33,028,298,565,174 | 1bff48bdf8a0d0e1ce350013da64bb28826f0398 | /src/com/gc/x43_moreclickevent/MainActivity.java | 6fa6d9c83ec7db8c6f374baa45437be8b36d5590 | [] | no_license | xiphodon/x43_moreClickEvent | https://github.com/xiphodon/x43_moreClickEvent | cad1ace6ebeda6273bb6c24a7a158ebe5d765605 | 694901ce8231b9cd3569600935d68a4615ec7dac | refs/heads/master | 2021-01-20T19:13:06.507000 | 2016-06-07T00:26:00 | 2016-06-07T00:26:00 | 60,569,612 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.gc.x43_moreclickevent;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.SystemClock;
import android.util.Log;
import android.view.View;
import android.widget.Toast;
/**
* 多击事件
* @author guochang
*
*/
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
//数组长度就是点击次数
long[] mHits = new long[3];
public void onClick(View view){
System.arraycopy(mHits, 1, mHits, 0, mHits.length-1);
//在最后一个位置设置当前已开机时间
mHits[mHits.length-1] = SystemClock.uptimeMillis();
if (mHits[0] >= (SystemClock.uptimeMillis()-500)) {
Toast.makeText(this, "多击事件", Toast.LENGTH_SHORT).show();
}
}
}
| GB18030 | Java | 945 | java | MainActivity.java | Java | [
{
"context": "port android.widget.Toast;\n\n/**\n * 多击事件\n * @author guochang\n *\n */\npublic class MainActivity extends Activity",
"end": 265,
"score": 0.9995121955871582,
"start": 257,
"tag": "USERNAME",
"value": "guochang"
}
] | null | [] | package com.gc.x43_moreclickevent;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.SystemClock;
import android.util.Log;
import android.view.View;
import android.widget.Toast;
/**
* 多击事件
* @author guochang
*
*/
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
//数组长度就是点击次数
long[] mHits = new long[3];
public void onClick(View view){
System.arraycopy(mHits, 1, mHits, 0, mHits.length-1);
//在最后一个位置设置当前已开机时间
mHits[mHits.length-1] = SystemClock.uptimeMillis();
if (mHits[0] >= (SystemClock.uptimeMillis()-500)) {
Toast.makeText(this, "多击事件", Toast.LENGTH_SHORT).show();
}
}
}
| 945 | 0.668187 | 0.655644 | 39 | 21.487179 | 19.704056 | 64 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.589744 | false | false | 9 |
4f41afc2d44dec8348f8012554f2c51ffe3e9fea | 15,040,975,472,999 | 575d5c5b1c989f843b34f4c5a4a609e4b728c74c | /src/test/java/org/security_awareness/config/RepositoryTests.java | eb3fbb55d437b6f1c9d16a5e2c280eafcf44261c | [] | no_license | davidalonsobadia/security_awareness | https://github.com/davidalonsobadia/security_awareness | b81f153d82a52cb632a87a90ec46e6e101316884 | adfd47c680270ac0497e12cb61d8a196e052b238 | refs/heads/master | 2021-01-21T10:20:07.496000 | 2017-04-04T11:30:22 | 2017-04-04T11:30:22 | 83,413,001 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.security_awareness.config;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.security_awareness.repositories.ActivityRepositoryTest;
import org.security_awareness.repositories.NotificationStatusRepositoryTest;
import org.security_awareness.repositories.ResourceRepositoryTest;
import org.security_awareness.repositories.UserRepositoryTest;
@RunWith(Suite.class)
@Suite.SuiteClasses({UserRepositoryTest.class,
ActivityRepositoryTest.class,
NotificationStatusRepositoryTest.class,
ResourceRepositoryTest.class})
public class RepositoryTests {
}
| UTF-8 | Java | 588 | java | RepositoryTests.java | Java | [] | null | [] | package org.security_awareness.config;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.security_awareness.repositories.ActivityRepositoryTest;
import org.security_awareness.repositories.NotificationStatusRepositoryTest;
import org.security_awareness.repositories.ResourceRepositoryTest;
import org.security_awareness.repositories.UserRepositoryTest;
@RunWith(Suite.class)
@Suite.SuiteClasses({UserRepositoryTest.class,
ActivityRepositoryTest.class,
NotificationStatusRepositoryTest.class,
ResourceRepositoryTest.class})
public class RepositoryTests {
}
| 588 | 0.860544 | 0.860544 | 17 | 33.588234 | 23.75626 | 76 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.764706 | false | false | 9 |
0d7a713789028313f9acb64330395142feb1ec27 | 11,974,368,849,718 | 2cbb173a9e1330fca0bec5ae107555e256c961ac | /src/main/java/name/codemax/mininject/resolvers/BeanProviderResolver.java | 0f4c7fe97b379600c623216afd90eb331122eee4 | [
"MIT"
] | permissive | codemaximus/mininject | https://github.com/codemaximus/mininject | 758110127b60fe842027d24bb2af9e579513ec5f | 617d0b5c20c0ec16c6b25059c0add01f9c25a7ff | refs/heads/master | 2021-06-21T13:12:32.397000 | 2017-08-17T16:12:29 | 2017-08-17T16:12:29 | 100,616,544 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package name.codemax.mininject.resolvers;
import name.codemax.mininject.container.ListableBeanContainer;
import name.codemax.mininject.util.TypeUtils;
import javax.inject.Provider;
import java.lang.reflect.Type;
/**
* @author Maksim Osipov
*/
public class BeanProviderResolver implements BeanResolver {
@SuppressWarnings("unchecked")
@Override
public <T> T resolveBean(Type type, ListableBeanContainer container) {
if (!Provider.class.getName().equals(TypeUtils.getRawClass(type).getName()) ||
1 != TypeUtils.getGenericParametersCount(type)) {
return null;
}
final Class<?> beanClass = TypeUtils.getFirstGeneric(type);
return (T) (Provider<Object>) () -> container.get(beanClass);
}
}
| UTF-8 | Java | 766 | java | BeanProviderResolver.java | Java | [
{
"context": "er;\nimport java.lang.reflect.Type;\n\n/**\n * @author Maksim Osipov\n */\npublic class BeanProviderResolver implements ",
"end": 243,
"score": 0.999833881855011,
"start": 230,
"tag": "NAME",
"value": "Maksim Osipov"
}
] | null | [] | package name.codemax.mininject.resolvers;
import name.codemax.mininject.container.ListableBeanContainer;
import name.codemax.mininject.util.TypeUtils;
import javax.inject.Provider;
import java.lang.reflect.Type;
/**
* @author <NAME>
*/
public class BeanProviderResolver implements BeanResolver {
@SuppressWarnings("unchecked")
@Override
public <T> T resolveBean(Type type, ListableBeanContainer container) {
if (!Provider.class.getName().equals(TypeUtils.getRawClass(type).getName()) ||
1 != TypeUtils.getGenericParametersCount(type)) {
return null;
}
final Class<?> beanClass = TypeUtils.getFirstGeneric(type);
return (T) (Provider<Object>) () -> container.get(beanClass);
}
}
| 759 | 0.703655 | 0.70235 | 23 | 32.304348 | 27.755821 | 86 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.478261 | false | false | 9 |
bbbb938976148bf94ccba87ebc040212ca7de4d6 | 11,974,368,852,938 | d65b112bddfdfeb5e287f9d992494ded1694ed12 | /src/rutebaga/game/testing/Gary.java | 45f43e4781803f6f2d7b4b540c81f4a1367987d0 | [] | no_license | gloshuertos/rutebaga | https://github.com/gloshuertos/rutebaga | 28861a654ecee4b0274d9e70ad1fd8eeba457e2d | fb2a9801aca0e95f8bf10d890f711f89e4b736c1 | refs/heads/master | 2016-08-04T05:01:50.620000 | 2008-04-24T22:40:35 | 2008-04-24T22:40:35 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package rutebaga.game.testing;
import java.util.Random;
import rutebaga.scaffold.MasterScaffold;
import rutebaga.commons.math.Vector2D;
import rutebaga.model.entity.Entity;
import rutebaga.model.environment.DecalType;
import rutebaga.model.environment.Environment;
import rutebaga.model.environment.Instance;
public class Gary
{
static DecalType fire;
static Environment environment;
static Entity avatar;
static Random random = new Random();
public static void run(Environment environment, MasterScaffold scaffold,
Entity avatar)
{
Gary.environment = environment;
Gary.avatar = avatar;
fire = (DecalType) scaffold.get("decFire");
for (int x = 0; x < 40; x++)
for (int y = 0; y < 40; y++)
environment.add(fire.makeInstance(), new Vector2D(x, y));
/* new Thread()
{
@Override
public void run()
{
try
{
Thread.sleep(10000);
while (true)
{
Thread.sleep(1000);
//System.out.println("something flag: " + Gary.avatar.getFlag("something"));
}
}
catch (InterruptedException e)
{
e.printStackTrace();
}
}
}.start();*/
}
}
| UTF-8 | Java | 1,181 | java | Gary.java | Java | [] | null | [] | package rutebaga.game.testing;
import java.util.Random;
import rutebaga.scaffold.MasterScaffold;
import rutebaga.commons.math.Vector2D;
import rutebaga.model.entity.Entity;
import rutebaga.model.environment.DecalType;
import rutebaga.model.environment.Environment;
import rutebaga.model.environment.Instance;
public class Gary
{
static DecalType fire;
static Environment environment;
static Entity avatar;
static Random random = new Random();
public static void run(Environment environment, MasterScaffold scaffold,
Entity avatar)
{
Gary.environment = environment;
Gary.avatar = avatar;
fire = (DecalType) scaffold.get("decFire");
for (int x = 0; x < 40; x++)
for (int y = 0; y < 40; y++)
environment.add(fire.makeInstance(), new Vector2D(x, y));
/* new Thread()
{
@Override
public void run()
{
try
{
Thread.sleep(10000);
while (true)
{
Thread.sleep(1000);
//System.out.println("something flag: " + Gary.avatar.getFlag("something"));
}
}
catch (InterruptedException e)
{
e.printStackTrace();
}
}
}.start();*/
}
}
| 1,181 | 0.644369 | 0.629975 | 55 | 19.472727 | 19.405581 | 82 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.418182 | false | false | 9 |
988b8fb6dd2ece8770100bfcdbddfd65629e5c04 | 6,854,767,836,343 | 7b25ff521df420853f6df9ef0f0cc8ad94b3e300 | /src/com/corso/policysystem/Controller.java | e1eba02c85d666e4b40de4aec4ec4da2931b536f | [] | no_license | DizzyWasTaken/assignment3 | https://github.com/DizzyWasTaken/assignment3 | 021312938f5153600b167a127359b43afb91f1bf | cd16bdea202d7d3f74dff1f4a0f473b1b6672198 | refs/heads/master | 2021-09-04T14:02:24.980000 | 2018-01-16T15:46:36 | 2018-01-16T15:46:36 | 114,048,269 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.corso.policysystem;
public class Controller {
private Company company;
private Database db;
private User currentlyLoggedUser;
public Controller(Company company, Database database){
this.company = company;
this.db = database;
this.currentlyLoggedUser = null;
}
//User management
public void registerUser(String email, String password){
User user = new User(email, password);
//After registering the user is logged in and redirected on the homepage
if(db.getUserByEmail(email) == null) {
user = db.createAccount(user);
setCurrentlyLoggedUser(user);
}
else{
System.out.println("Email already in use");
}
}
public void setCurrentlyLoggedUser(User user){
currentlyLoggedUser = user;
}
public User getCurrentlyLoggedUser(){
return currentlyLoggedUser;
}
//Policy management
public void insertPolicy(String description, long cost){
db.insertPolicy(description, cost);
}
public Policy getPolicyById(int id){
return db.getPolicyById(id);
}
public void updatePolicy(Policy policy){
db.updatePolicy(policy);
}
public void removePolicy(int id){
if(db.removePolicy(id) == null){
System.out.println("There is no policy with this id in the database");
return;
}
System.out.println("The policy has been removed");
}
public void buyPolicy(Policy policy){
//Buy policy logic
db.printAllUsers();
currentlyLoggedUser.setPolicyId(policy.getId());
db.updateUser(currentlyLoggedUser);
db.printAllUsers();
Notification.prepare()
.setSender(currentlyLoggedUser)
.setTitle("New policy purchase")
.setContent("Policy id: "+policy.getId()+"\nPolicy description: "+policy.getDescription())
.sendTo(company);
}
public void renewPolicy(Policy policy){
//Policy renewal logic
Notification.prepare()
.setSender(currentlyLoggedUser)
.setTitle("New policy renewal application")
.setContent("Policy id: "+policy.getId()+"\nPolicy description: "+policy.getDescription())
.sendTo(company);
}
public void showAllPolicies(){
db.printAllPolicies();
}
}
| UTF-8 | Java | 2,488 | java | Controller.java | Java | [] | null | [] | package com.corso.policysystem;
public class Controller {
private Company company;
private Database db;
private User currentlyLoggedUser;
public Controller(Company company, Database database){
this.company = company;
this.db = database;
this.currentlyLoggedUser = null;
}
//User management
public void registerUser(String email, String password){
User user = new User(email, password);
//After registering the user is logged in and redirected on the homepage
if(db.getUserByEmail(email) == null) {
user = db.createAccount(user);
setCurrentlyLoggedUser(user);
}
else{
System.out.println("Email already in use");
}
}
public void setCurrentlyLoggedUser(User user){
currentlyLoggedUser = user;
}
public User getCurrentlyLoggedUser(){
return currentlyLoggedUser;
}
//Policy management
public void insertPolicy(String description, long cost){
db.insertPolicy(description, cost);
}
public Policy getPolicyById(int id){
return db.getPolicyById(id);
}
public void updatePolicy(Policy policy){
db.updatePolicy(policy);
}
public void removePolicy(int id){
if(db.removePolicy(id) == null){
System.out.println("There is no policy with this id in the database");
return;
}
System.out.println("The policy has been removed");
}
public void buyPolicy(Policy policy){
//Buy policy logic
db.printAllUsers();
currentlyLoggedUser.setPolicyId(policy.getId());
db.updateUser(currentlyLoggedUser);
db.printAllUsers();
Notification.prepare()
.setSender(currentlyLoggedUser)
.setTitle("New policy purchase")
.setContent("Policy id: "+policy.getId()+"\nPolicy description: "+policy.getDescription())
.sendTo(company);
}
public void renewPolicy(Policy policy){
//Policy renewal logic
Notification.prepare()
.setSender(currentlyLoggedUser)
.setTitle("New policy renewal application")
.setContent("Policy id: "+policy.getId()+"\nPolicy description: "+policy.getDescription())
.sendTo(company);
}
public void showAllPolicies(){
db.printAllPolicies();
}
}
| 2,488 | 0.604502 | 0.604502 | 91 | 26.34066 | 24.514278 | 106 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.340659 | false | false | 9 |
ac028b3986b0b72b1e6501aa847f0065d7e45e0b | 32,074,815,785,068 | b8e9f71f41901f3eda9c91aac13464834563d6a1 | /app/src/main/java/com/example/florian/Fitness_Calculator/DataCollection.java | 1dc02a89db0a8843a3f24a17f961e0063130e2eb | [] | no_license | Flodermaus/FitnessApp | https://github.com/Flodermaus/FitnessApp | 536cafa228685005ab6fbc55e353acbf3a8ba1e1 | a23d3d92177b91bf2e00e1e66bb157004f83178e | refs/heads/master | 2016-09-12T22:39:14.404000 | 2016-05-20T10:14:40 | 2016-05-20T10:14:40 | 58,804,125 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.florian.Fitness_Calculator;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.os.Environment;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Button;
import android.widget.TextView;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorManager;
import android.hardware.SensorEventListener;
import android.widget.Toast;
import com.jjoe64.graphview.GraphView;
import com.jjoe64.graphview.Viewport;
import com.jjoe64.graphview.series.DataPoint;
import com.jjoe64.graphview.series.LineGraphSeries;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.InputStreamReader;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
public class DataCollection extends AppCompatActivity {
long start = 0, current;
Button showGraph, restartDataCollection, save, end;
TextView xAccData, yAccData, zAccData, xRotData, yRotData, zRotData;
double[] xAccDataArray = new double[0];
double[] yAccDataArray = new double[0];
double[] zAccDataArray = new double[0];
double[] xRotDataArray = new double[0];
double[] yRotDataArray = new double[0];
double[] zRotDataArray = new double[0];
//double[] time = new double[0];
double[] accRotData = new double[0];
private SensorManager sm;
private SensorEventListener listener;
GraphView graph;
private LineGraphSeries<DataPoint> seriesAccX, seriesAccY, seriesAccZ, seriesRotX, seriesRotY, seriesRotZ;
private int count = 0;
private boolean graphSwitch = false;
private boolean collect = true;
String data, data4Reading = "", dataTime = "";
String exercise;
Calendar cal;
SimpleDateFormat sdf;
String t;
ArrayList<String> time = new ArrayList<String>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.data_collection_screen);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
exercise = getIntent().getStringExtra("Exercise");
showGraph = (Button) findViewById(R.id.showGraph);
restartDataCollection = (Button) findViewById(R.id.restartDataCollection);
save = (Button) findViewById(R.id.save);
end = (Button) findViewById(R.id.end);
xAccData = (TextView) findViewById(R.id.xAccData);
yAccData = (TextView) findViewById(R.id.yAccData);
zAccData = (TextView) findViewById(R.id.zAccData);
/*xRotData = (TextView) findViewById(R.id.xRotData);
yRotData = (TextView) findViewById(R.id.yRotData);
zRotData = (TextView) findViewById(R.id.zRotData);*/
save.setVisibility(View.INVISIBLE);
sm = (SensorManager) this.getSystemService(Context.SENSOR_SERVICE);
listener = new SensorEventListener() {
@Override
public void onSensorChanged(SensorEvent event) {
Sensor sensor = event.sensor;
if (collect && sensor.getType() == sensor.TYPE_LINEAR_ACCELERATION) {
xAccData.setText("X-Acceleration: " + event.values[0]);
yAccData.setText("Y-Acceleration: " + event.values[1]);
zAccData.setText("Z-Acceleration: " + event.values[2]);
xAccDataArray = addData(xAccDataArray, event.values[0]);
yAccDataArray = addData(yAccDataArray, event.values[1]);
zAccDataArray = addData(zAccDataArray, event.values[2]);
cal = Calendar.getInstance();
sdf = new SimpleDateFormat("S");
t = sdf.format(cal.getTime());
time.add(t);
System.out.println(t);
}
/* if (collect && sensor.getType() == sensor.TYPE_GYROSCOPE) {
xRotData.setText("X-Rotation: " + event.values[0]);
yRotData.setText("Y-Rotation: " + event.values[1]);
zRotData.setText("Z-Rotation: " + event.values[2]);
xRotDataArray = addData(xRotDataArray, event.values[0]);
yRotDataArray = addData(yRotDataArray, event.values[1]);
zRotDataArray = addData(zRotDataArray, event.values[2]);
}*/
}
@Override
public void onAccuracyChanged(Sensor sensor, int accuracy) {
}
};
sm.registerListener(listener, sm.getDefaultSensor(Sensor.TYPE_LINEAR_ACCELERATION), SensorManager.SENSOR_DELAY_NORMAL);
sm.registerListener(listener, sm.getDefaultSensor(Sensor.TYPE_GYROSCOPE), SensorManager.SENSOR_DELAY_NORMAL);
graph = (GraphView) findViewById(R.id.graph);
showGraph.setOnClickListener(
new Button.OnClickListener() {
public void onClick(View v) {
graph.removeAllSeries();
count = 0;
collect = false;
showGraph.setText("Switch Graph");
restartDataCollection.setVisibility(View.VISIBLE);
end.setVisibility(View.VISIBLE);
if(!graphSwitch){
graphSwitch = true;
}else if(graphSwitch){
graphSwitch = false;
}
initiateGraph();
startGraph();
for(int i = 0; i<time.size(); i++){
dataTime += time.get(i) + "\n";
}
save.setVisibility(View.VISIBLE);
}
}
);
restartDataCollection.setOnClickListener(
new Button.OnClickListener() {
public void onClick(View v) {
finish();
startActivity(new Intent(getApplicationContext(), MainActivity.class));
}
}
);
save.setOnClickListener(
new Button.OnClickListener() {
public void onClick(View v) {
saveFile();
}
}
);
end.setOnClickListener(
new Button.OnClickListener() {
public void onClick(View v) {
finish();
}
}
);
Toast.makeText(getApplicationContext(), "Exercise: " + exercise , Toast.LENGTH_SHORT).show();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
static double[] addData (double[] array, double elem) {
array = Arrays.copyOf(array, array.length + 1);
array[array.length - 1] = elem;
return array;
}
private void initiateGraph() {
seriesAccX = new LineGraphSeries<DataPoint>();
seriesAccY = new LineGraphSeries<DataPoint>();
seriesAccZ = new LineGraphSeries<DataPoint>();
/*seriesRotX = new LineGraphSeries<DataPoint>();
seriesRotY = new LineGraphSeries<DataPoint>();
seriesRotZ = new LineGraphSeries<DataPoint>();*/
if(graphSwitch) {
graph.addSeries(seriesAccX);
graph.addSeries(seriesAccY);
graph.addSeries(seriesAccZ);
}else if(!graphSwitch) {
/*graph.addSeries(seriesRotX);
graph.addSeries(seriesRotY);
graph.addSeries(seriesRotZ);*/
}
Viewport viewport = graph.getViewport();
viewport.setYAxisBoundsManual(true);
viewport.setMinY(-11);
viewport.setMaxY(11);
graph.getViewport().setXAxisBoundsManual(true);
graph.getViewport().setMinX(0);
graph.getViewport().setMaxX(xAccDataArray.length);
seriesAccX.setColor(Color.RED);
seriesAccY.setColor(Color.GREEN);
seriesAccZ.setColor(Color.BLUE);
/*seriesRotX.setColor(Color.YELLOW);
seriesRotY.setColor(Color.BLACK);
seriesRotZ.setColor(Color.DKGRAY);*/
//graph.getViewport().setScrollable(true);
//graph.getViewport().setScalable(true);
}
protected void startGraph() {
new Thread(new Runnable() {
@Override
public void run() {
for (int i = 0; i < xAccDataArray.length; i++) {
runOnUiThread(new Runnable() {
@Override
public void run() {
addEntryInDataArray();
}
});
try {
Thread.sleep(5);
} catch (InterruptedException e) {
}
}
}
}).start();
}
private void addEntryInDataArray() {
seriesAccX.appendData(new DataPoint(count, xAccDataArray[count]), true, xAccDataArray.length);
seriesAccY.appendData(new DataPoint(count, yAccDataArray[count]), true, yAccDataArray.length);
seriesAccZ.appendData(new DataPoint(count, zAccDataArray[count]), true, zAccDataArray.length);
/* seriesRotX.appendData(new DataPoint(count, xRotDataArray[count]), true, xRotDataArray.length);
seriesRotY.appendData(new DataPoint(count, yRotDataArray[count]), true, yRotDataArray.length);
seriesRotZ.appendData(new DataPoint(count, zRotDataArray[count]), true, zRotDataArray.length);*/
count++;
}
public void saveFile(){
data = "@RELATION fittness \n" +
" \n" +
"@ATTRIBUTE translate_xAxis REAL \n" +
"@ATTRIBUTE translate_yAxis REAL \n" +
"@ATTRIBUTE translate_zAxis REAL \n" +
"@ATTRIBUTE rotate_xAxis REAL \n" +
"@ATTRIBUTE rotate_yAxis REAL \n" +
"@ATTRIBUTE rotate_zAxis REAL \n" +
"@ATTRIBUTE class {PushUp, PullUp, Crunch, Squat} \n" +
" \n" +
"@data \n";
for(int i = 0; i < xAccDataArray.length; i++){
data += xAccDataArray[i] + ", ";
data += yAccDataArray[i] + ", ";
data += zAccDataArray[i] + ", ";
/* data += xRotDataArray[i] + ", ";
data += yRotDataArray[i] + ", ";
data += zRotDataArray[i] + ", ";*/
data += exercise + " \n";
}
for(int i = 0; i < xAccDataArray.length; i++){
data4Reading += xAccDataArray[i] + "\n";
data4Reading += yAccDataArray[i] + "\n";
data4Reading += zAccDataArray[i] + "\n";
/*data4Reading += xRotDataArray[i] + "\n";
data4Reading += yRotDataArray[i] + "\n";
data4Reading += zRotDataArray[i] + "\n";*/
}
try
{
FileOutputStream fos = openFileOutput("Exercise.arff", Context.MODE_PRIVATE);
fos.write(data.getBytes());
fos.close();
FileOutputStream fosTime = openFileOutput("time" + exercise + ".txt", Context.MODE_PRIVATE);
fosTime.write(dataTime.getBytes());
fosTime.close();
FileOutputStream fosAccRotData = openFileOutput("AccRotData" + exercise + ".txt", Context.MODE_PRIVATE);
fosAccRotData.write(data4Reading.getBytes());
fosAccRotData.close();
String storageState = Environment.getExternalStorageState();
if (storageState.equals(Environment.MEDIA_MOUNTED)){
File file = new File(getExternalFilesDir(null), "Exercise.arff");
File fileTime = new File(getExternalFilesDir(null), "time" + exercise + ".txt");
File fileAccRotData = new File(getExternalFilesDir(null), "AccRotData" + exercise + ".txt");
if (fileTime.exists()){
BufferedReader inputReader = new BufferedReader(
new InputStreamReader(new FileInputStream(file)));
String inputString;
StringBuffer stringBuffer = new StringBuffer();
while((inputString = inputReader.readLine()) != null){
stringBuffer.append(inputString + "\n");
}
BufferedReader inputReaderAccRot = new BufferedReader(
new InputStreamReader(new FileInputStream(fileAccRotData)));
String inputStringAccRot;
StringBuffer stringBufferAccRot = new StringBuffer();
while((inputStringAccRot = inputReaderAccRot.readLine()) != null){
stringBufferAccRot.append(inputStringAccRot + "\n");
}
BufferedReader inputReaderTime = new BufferedReader(
new InputStreamReader(new FileInputStream(fileTime)));
String inputStringTime;
StringBuffer stringBufferTime = new StringBuffer();
while((inputStringTime = inputReaderTime.readLine()) != null){
stringBufferTime.append(inputStringTime + "\n");
}
String data = "";
for(int i = 0; i < xAccDataArray.length; i++){
data += xAccDataArray[i] + ", ";
data += yAccDataArray[i] + ", ";
data += zAccDataArray[i] + ", ";
/* data += xRotDataArray[i] + ", ";
data += yRotDataArray[i] + ", ";
data += zRotDataArray[i] + ", ";*/
data += exercise + " \n";
}
String data4Reading = "";
for(int i = 0; i < xAccDataArray.length; i++){
data4Reading += xAccDataArray[i] + "\n";
data4Reading += yAccDataArray[i] + "\n";
data4Reading += zAccDataArray[i] + "\n";
/* data4Reading += xRotDataArray[i] + "\n";
data4Reading += yRotDataArray[i] + "\n";
data4Reading += zRotDataArray[i] + "\n";*/
}
inputString = stringBuffer.toString() + data;
inputStringAccRot = stringBufferAccRot.toString() + data4Reading;
inputStringTime = stringBufferTime.toString() + dataTime;
FileOutputStream fos2 = new FileOutputStream(file);
fos2.write(inputString.getBytes());
fos2.close();
FileOutputStream fosTime2 = new FileOutputStream(fileTime);
fosTime2.write(inputStringTime.getBytes());
fosTime2.close();
FileOutputStream fosAccRotData2 = new FileOutputStream(fileAccRotData);
fosAccRotData2.write(inputStringAccRot.getBytes());
fosAccRotData2.close();
Toast.makeText(getApplicationContext(), "Data was appended", Toast.LENGTH_SHORT).show();
}else if(file.exists()){
BufferedReader inputReader = new BufferedReader(
new InputStreamReader(new FileInputStream(file)));
String inputString;
StringBuffer stringBuffer = new StringBuffer();
while((inputString = inputReader.readLine()) != null){
stringBuffer.append(inputString + "\n");
}
String data = "";
for(int i = 0; i < xAccDataArray.length; i++){
data += xAccDataArray[i] + ", ";
data += yAccDataArray[i] + ", ";
data += zAccDataArray[i] + ", ";
/* data += xRotDataArray[i] + ", ";
data += yRotDataArray[i] + ", ";
data += zRotDataArray[i] + ", ";*/
data += exercise + " \n";
}
inputString = stringBuffer.toString() + data;
FileOutputStream fos2 = new FileOutputStream(file);
fos2.write(inputString.getBytes());
fos2.close();
FileOutputStream fosTime2 = new FileOutputStream(fileTime);
fosTime2.write(dataTime.getBytes());
fosTime2.close();
FileOutputStream fosAccRotData2 = new FileOutputStream(fileAccRotData);
fosAccRotData2.write(data4Reading.getBytes());
fosAccRotData2.close();
Toast.makeText(getApplicationContext(), "Data was appended", Toast.LENGTH_SHORT).show();
}else {
FileOutputStream fos2 = new FileOutputStream(file);
fos2.write(data.getBytes());
fos2.close();
FileOutputStream fosTime2 = new FileOutputStream(fileTime);
fosTime2.write(dataTime.getBytes());
fosTime2.close();
FileOutputStream fosAccRotData2 = new FileOutputStream(fileAccRotData);
fosAccRotData2.write(data4Reading.getBytes());
fosAccRotData2.close();
Toast.makeText(getApplicationContext(), "File saved", Toast.LENGTH_SHORT).show();
}
}
}catch(Exception e)
{
e.printStackTrace();
}
}
}
| UTF-8 | Java | 18,879 | java | DataCollection.java | Java | [
{
"context": "package com.example.florian.Fitness_Calculator;\n\nimport android.content.Conte",
"end": 27,
"score": 0.9730497002601624,
"start": 20,
"tag": "USERNAME",
"value": "florian"
}
] | null | [] | package com.example.florian.Fitness_Calculator;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.os.Environment;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Button;
import android.widget.TextView;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorManager;
import android.hardware.SensorEventListener;
import android.widget.Toast;
import com.jjoe64.graphview.GraphView;
import com.jjoe64.graphview.Viewport;
import com.jjoe64.graphview.series.DataPoint;
import com.jjoe64.graphview.series.LineGraphSeries;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.InputStreamReader;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
public class DataCollection extends AppCompatActivity {
long start = 0, current;
Button showGraph, restartDataCollection, save, end;
TextView xAccData, yAccData, zAccData, xRotData, yRotData, zRotData;
double[] xAccDataArray = new double[0];
double[] yAccDataArray = new double[0];
double[] zAccDataArray = new double[0];
double[] xRotDataArray = new double[0];
double[] yRotDataArray = new double[0];
double[] zRotDataArray = new double[0];
//double[] time = new double[0];
double[] accRotData = new double[0];
private SensorManager sm;
private SensorEventListener listener;
GraphView graph;
private LineGraphSeries<DataPoint> seriesAccX, seriesAccY, seriesAccZ, seriesRotX, seriesRotY, seriesRotZ;
private int count = 0;
private boolean graphSwitch = false;
private boolean collect = true;
String data, data4Reading = "", dataTime = "";
String exercise;
Calendar cal;
SimpleDateFormat sdf;
String t;
ArrayList<String> time = new ArrayList<String>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.data_collection_screen);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
exercise = getIntent().getStringExtra("Exercise");
showGraph = (Button) findViewById(R.id.showGraph);
restartDataCollection = (Button) findViewById(R.id.restartDataCollection);
save = (Button) findViewById(R.id.save);
end = (Button) findViewById(R.id.end);
xAccData = (TextView) findViewById(R.id.xAccData);
yAccData = (TextView) findViewById(R.id.yAccData);
zAccData = (TextView) findViewById(R.id.zAccData);
/*xRotData = (TextView) findViewById(R.id.xRotData);
yRotData = (TextView) findViewById(R.id.yRotData);
zRotData = (TextView) findViewById(R.id.zRotData);*/
save.setVisibility(View.INVISIBLE);
sm = (SensorManager) this.getSystemService(Context.SENSOR_SERVICE);
listener = new SensorEventListener() {
@Override
public void onSensorChanged(SensorEvent event) {
Sensor sensor = event.sensor;
if (collect && sensor.getType() == sensor.TYPE_LINEAR_ACCELERATION) {
xAccData.setText("X-Acceleration: " + event.values[0]);
yAccData.setText("Y-Acceleration: " + event.values[1]);
zAccData.setText("Z-Acceleration: " + event.values[2]);
xAccDataArray = addData(xAccDataArray, event.values[0]);
yAccDataArray = addData(yAccDataArray, event.values[1]);
zAccDataArray = addData(zAccDataArray, event.values[2]);
cal = Calendar.getInstance();
sdf = new SimpleDateFormat("S");
t = sdf.format(cal.getTime());
time.add(t);
System.out.println(t);
}
/* if (collect && sensor.getType() == sensor.TYPE_GYROSCOPE) {
xRotData.setText("X-Rotation: " + event.values[0]);
yRotData.setText("Y-Rotation: " + event.values[1]);
zRotData.setText("Z-Rotation: " + event.values[2]);
xRotDataArray = addData(xRotDataArray, event.values[0]);
yRotDataArray = addData(yRotDataArray, event.values[1]);
zRotDataArray = addData(zRotDataArray, event.values[2]);
}*/
}
@Override
public void onAccuracyChanged(Sensor sensor, int accuracy) {
}
};
sm.registerListener(listener, sm.getDefaultSensor(Sensor.TYPE_LINEAR_ACCELERATION), SensorManager.SENSOR_DELAY_NORMAL);
sm.registerListener(listener, sm.getDefaultSensor(Sensor.TYPE_GYROSCOPE), SensorManager.SENSOR_DELAY_NORMAL);
graph = (GraphView) findViewById(R.id.graph);
showGraph.setOnClickListener(
new Button.OnClickListener() {
public void onClick(View v) {
graph.removeAllSeries();
count = 0;
collect = false;
showGraph.setText("Switch Graph");
restartDataCollection.setVisibility(View.VISIBLE);
end.setVisibility(View.VISIBLE);
if(!graphSwitch){
graphSwitch = true;
}else if(graphSwitch){
graphSwitch = false;
}
initiateGraph();
startGraph();
for(int i = 0; i<time.size(); i++){
dataTime += time.get(i) + "\n";
}
save.setVisibility(View.VISIBLE);
}
}
);
restartDataCollection.setOnClickListener(
new Button.OnClickListener() {
public void onClick(View v) {
finish();
startActivity(new Intent(getApplicationContext(), MainActivity.class));
}
}
);
save.setOnClickListener(
new Button.OnClickListener() {
public void onClick(View v) {
saveFile();
}
}
);
end.setOnClickListener(
new Button.OnClickListener() {
public void onClick(View v) {
finish();
}
}
);
Toast.makeText(getApplicationContext(), "Exercise: " + exercise , Toast.LENGTH_SHORT).show();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
static double[] addData (double[] array, double elem) {
array = Arrays.copyOf(array, array.length + 1);
array[array.length - 1] = elem;
return array;
}
private void initiateGraph() {
seriesAccX = new LineGraphSeries<DataPoint>();
seriesAccY = new LineGraphSeries<DataPoint>();
seriesAccZ = new LineGraphSeries<DataPoint>();
/*seriesRotX = new LineGraphSeries<DataPoint>();
seriesRotY = new LineGraphSeries<DataPoint>();
seriesRotZ = new LineGraphSeries<DataPoint>();*/
if(graphSwitch) {
graph.addSeries(seriesAccX);
graph.addSeries(seriesAccY);
graph.addSeries(seriesAccZ);
}else if(!graphSwitch) {
/*graph.addSeries(seriesRotX);
graph.addSeries(seriesRotY);
graph.addSeries(seriesRotZ);*/
}
Viewport viewport = graph.getViewport();
viewport.setYAxisBoundsManual(true);
viewport.setMinY(-11);
viewport.setMaxY(11);
graph.getViewport().setXAxisBoundsManual(true);
graph.getViewport().setMinX(0);
graph.getViewport().setMaxX(xAccDataArray.length);
seriesAccX.setColor(Color.RED);
seriesAccY.setColor(Color.GREEN);
seriesAccZ.setColor(Color.BLUE);
/*seriesRotX.setColor(Color.YELLOW);
seriesRotY.setColor(Color.BLACK);
seriesRotZ.setColor(Color.DKGRAY);*/
//graph.getViewport().setScrollable(true);
//graph.getViewport().setScalable(true);
}
protected void startGraph() {
new Thread(new Runnable() {
@Override
public void run() {
for (int i = 0; i < xAccDataArray.length; i++) {
runOnUiThread(new Runnable() {
@Override
public void run() {
addEntryInDataArray();
}
});
try {
Thread.sleep(5);
} catch (InterruptedException e) {
}
}
}
}).start();
}
private void addEntryInDataArray() {
seriesAccX.appendData(new DataPoint(count, xAccDataArray[count]), true, xAccDataArray.length);
seriesAccY.appendData(new DataPoint(count, yAccDataArray[count]), true, yAccDataArray.length);
seriesAccZ.appendData(new DataPoint(count, zAccDataArray[count]), true, zAccDataArray.length);
/* seriesRotX.appendData(new DataPoint(count, xRotDataArray[count]), true, xRotDataArray.length);
seriesRotY.appendData(new DataPoint(count, yRotDataArray[count]), true, yRotDataArray.length);
seriesRotZ.appendData(new DataPoint(count, zRotDataArray[count]), true, zRotDataArray.length);*/
count++;
}
public void saveFile(){
data = "@RELATION fittness \n" +
" \n" +
"@ATTRIBUTE translate_xAxis REAL \n" +
"@ATTRIBUTE translate_yAxis REAL \n" +
"@ATTRIBUTE translate_zAxis REAL \n" +
"@ATTRIBUTE rotate_xAxis REAL \n" +
"@ATTRIBUTE rotate_yAxis REAL \n" +
"@ATTRIBUTE rotate_zAxis REAL \n" +
"@ATTRIBUTE class {PushUp, PullUp, Crunch, Squat} \n" +
" \n" +
"@data \n";
for(int i = 0; i < xAccDataArray.length; i++){
data += xAccDataArray[i] + ", ";
data += yAccDataArray[i] + ", ";
data += zAccDataArray[i] + ", ";
/* data += xRotDataArray[i] + ", ";
data += yRotDataArray[i] + ", ";
data += zRotDataArray[i] + ", ";*/
data += exercise + " \n";
}
for(int i = 0; i < xAccDataArray.length; i++){
data4Reading += xAccDataArray[i] + "\n";
data4Reading += yAccDataArray[i] + "\n";
data4Reading += zAccDataArray[i] + "\n";
/*data4Reading += xRotDataArray[i] + "\n";
data4Reading += yRotDataArray[i] + "\n";
data4Reading += zRotDataArray[i] + "\n";*/
}
try
{
FileOutputStream fos = openFileOutput("Exercise.arff", Context.MODE_PRIVATE);
fos.write(data.getBytes());
fos.close();
FileOutputStream fosTime = openFileOutput("time" + exercise + ".txt", Context.MODE_PRIVATE);
fosTime.write(dataTime.getBytes());
fosTime.close();
FileOutputStream fosAccRotData = openFileOutput("AccRotData" + exercise + ".txt", Context.MODE_PRIVATE);
fosAccRotData.write(data4Reading.getBytes());
fosAccRotData.close();
String storageState = Environment.getExternalStorageState();
if (storageState.equals(Environment.MEDIA_MOUNTED)){
File file = new File(getExternalFilesDir(null), "Exercise.arff");
File fileTime = new File(getExternalFilesDir(null), "time" + exercise + ".txt");
File fileAccRotData = new File(getExternalFilesDir(null), "AccRotData" + exercise + ".txt");
if (fileTime.exists()){
BufferedReader inputReader = new BufferedReader(
new InputStreamReader(new FileInputStream(file)));
String inputString;
StringBuffer stringBuffer = new StringBuffer();
while((inputString = inputReader.readLine()) != null){
stringBuffer.append(inputString + "\n");
}
BufferedReader inputReaderAccRot = new BufferedReader(
new InputStreamReader(new FileInputStream(fileAccRotData)));
String inputStringAccRot;
StringBuffer stringBufferAccRot = new StringBuffer();
while((inputStringAccRot = inputReaderAccRot.readLine()) != null){
stringBufferAccRot.append(inputStringAccRot + "\n");
}
BufferedReader inputReaderTime = new BufferedReader(
new InputStreamReader(new FileInputStream(fileTime)));
String inputStringTime;
StringBuffer stringBufferTime = new StringBuffer();
while((inputStringTime = inputReaderTime.readLine()) != null){
stringBufferTime.append(inputStringTime + "\n");
}
String data = "";
for(int i = 0; i < xAccDataArray.length; i++){
data += xAccDataArray[i] + ", ";
data += yAccDataArray[i] + ", ";
data += zAccDataArray[i] + ", ";
/* data += xRotDataArray[i] + ", ";
data += yRotDataArray[i] + ", ";
data += zRotDataArray[i] + ", ";*/
data += exercise + " \n";
}
String data4Reading = "";
for(int i = 0; i < xAccDataArray.length; i++){
data4Reading += xAccDataArray[i] + "\n";
data4Reading += yAccDataArray[i] + "\n";
data4Reading += zAccDataArray[i] + "\n";
/* data4Reading += xRotDataArray[i] + "\n";
data4Reading += yRotDataArray[i] + "\n";
data4Reading += zRotDataArray[i] + "\n";*/
}
inputString = stringBuffer.toString() + data;
inputStringAccRot = stringBufferAccRot.toString() + data4Reading;
inputStringTime = stringBufferTime.toString() + dataTime;
FileOutputStream fos2 = new FileOutputStream(file);
fos2.write(inputString.getBytes());
fos2.close();
FileOutputStream fosTime2 = new FileOutputStream(fileTime);
fosTime2.write(inputStringTime.getBytes());
fosTime2.close();
FileOutputStream fosAccRotData2 = new FileOutputStream(fileAccRotData);
fosAccRotData2.write(inputStringAccRot.getBytes());
fosAccRotData2.close();
Toast.makeText(getApplicationContext(), "Data was appended", Toast.LENGTH_SHORT).show();
}else if(file.exists()){
BufferedReader inputReader = new BufferedReader(
new InputStreamReader(new FileInputStream(file)));
String inputString;
StringBuffer stringBuffer = new StringBuffer();
while((inputString = inputReader.readLine()) != null){
stringBuffer.append(inputString + "\n");
}
String data = "";
for(int i = 0; i < xAccDataArray.length; i++){
data += xAccDataArray[i] + ", ";
data += yAccDataArray[i] + ", ";
data += zAccDataArray[i] + ", ";
/* data += xRotDataArray[i] + ", ";
data += yRotDataArray[i] + ", ";
data += zRotDataArray[i] + ", ";*/
data += exercise + " \n";
}
inputString = stringBuffer.toString() + data;
FileOutputStream fos2 = new FileOutputStream(file);
fos2.write(inputString.getBytes());
fos2.close();
FileOutputStream fosTime2 = new FileOutputStream(fileTime);
fosTime2.write(dataTime.getBytes());
fosTime2.close();
FileOutputStream fosAccRotData2 = new FileOutputStream(fileAccRotData);
fosAccRotData2.write(data4Reading.getBytes());
fosAccRotData2.close();
Toast.makeText(getApplicationContext(), "Data was appended", Toast.LENGTH_SHORT).show();
}else {
FileOutputStream fos2 = new FileOutputStream(file);
fos2.write(data.getBytes());
fos2.close();
FileOutputStream fosTime2 = new FileOutputStream(fileTime);
fosTime2.write(dataTime.getBytes());
fosTime2.close();
FileOutputStream fosAccRotData2 = new FileOutputStream(fileAccRotData);
fosAccRotData2.write(data4Reading.getBytes());
fosAccRotData2.close();
Toast.makeText(getApplicationContext(), "File saved", Toast.LENGTH_SHORT).show();
}
}
}catch(Exception e)
{
e.printStackTrace();
}
}
}
| 18,879 | 0.543302 | 0.538376 | 487 | 37.765915 | 28.513166 | 127 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.74538 | false | false | 9 |
6fcb026feda3f5168f6f5d69c2adeba7bfa9e4d0 | 18,253,611,055,774 | 8680eda3b30fd6f7308f5878305fdd12b1e4fd3f | /version configuration/parqueteam/Master/src/com/parqueteam/utils/MximoViewUtils.java | ba0ab0228944b6a9b1521851ad72d89b7fe3399c | [] | no_license | shayamximo/AndroidUtils | https://github.com/shayamximo/AndroidUtils | 53e848bfbdf05c92a36a6c6c96fb59f8d04c9291 | ef8e7a4a561f20259f77d72431043f613b9afb60 | refs/heads/master | 2020-05-16T21:57:37.129000 | 2014-09-07T08:34:11 | 2014-09-07T08:34:11 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.parqueteam.utils;
import java.io.File;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.content.IntentCompat;
import android.util.Log;
import com.parqueteam.App;
import com.parqueteam.Splash;
import com.parqueteam.json.stores.InitInfoStore;
import com.parqueteam.json.stores.PromotionsStore;
import com.parqueteam.json.stores.TaxonomiesStore;
public class MximoViewUtils {
/**
* 1. set the correct address in config file 2. delete all stores 3. delete
* 4. remove user details (for UserInfoViewController) database
*/
public static void restartApp(int address, Activity activity) {
ConfigurationFile.getInstance().restartAppInfoWithNewAddress(address);
InitInfoStore.getInstance().restartStore();
TaxonomiesStore.getInstance().restartStore();
PromotionsStore.getInstance().restartStore();
App.getApp().restartCountriesAndCitiesStore();
App.getApp().restartShopStore();
App.getApp().restartSaleStore();
App.getApp().getFavorite().removeAllCartItems();
App.getApp().getCart().removeAllCartItems();
SharedPreferencesController.clearUserDetail(App.getApp());
SharedPreferencesController.clearRegistration(App.getApp());
Intent intent = new Intent(activity, Splash.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
| IntentCompat.FLAG_ACTIVITY_CLEAR_TASK);
activity.startActivity(intent);
}
public static boolean giveStagingOption() {
File file = new File("/sdcard/mximo_qa");
return file.exists();
}
}
| UTF-8 | Java | 1,587 | java | MximoViewUtils.java | Java | [] | null | [] | package com.parqueteam.utils;
import java.io.File;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.content.IntentCompat;
import android.util.Log;
import com.parqueteam.App;
import com.parqueteam.Splash;
import com.parqueteam.json.stores.InitInfoStore;
import com.parqueteam.json.stores.PromotionsStore;
import com.parqueteam.json.stores.TaxonomiesStore;
public class MximoViewUtils {
/**
* 1. set the correct address in config file 2. delete all stores 3. delete
* 4. remove user details (for UserInfoViewController) database
*/
public static void restartApp(int address, Activity activity) {
ConfigurationFile.getInstance().restartAppInfoWithNewAddress(address);
InitInfoStore.getInstance().restartStore();
TaxonomiesStore.getInstance().restartStore();
PromotionsStore.getInstance().restartStore();
App.getApp().restartCountriesAndCitiesStore();
App.getApp().restartShopStore();
App.getApp().restartSaleStore();
App.getApp().getFavorite().removeAllCartItems();
App.getApp().getCart().removeAllCartItems();
SharedPreferencesController.clearUserDetail(App.getApp());
SharedPreferencesController.clearRegistration(App.getApp());
Intent intent = new Intent(activity, Splash.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
| IntentCompat.FLAG_ACTIVITY_CLEAR_TASK);
activity.startActivity(intent);
}
public static boolean giveStagingOption() {
File file = new File("/sdcard/mximo_qa");
return file.exists();
}
}
| 1,587 | 0.751733 | 0.748582 | 51 | 29.117647 | 23.227474 | 76 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.470588 | false | false | 9 |
4765c64448258725edc7efde34e24bc42c678bd0 | 18,253,611,055,019 | 1b295860b771d9d19e9b9656587a02d0d9d38b59 | /innerClassesAndLambdas/task5/src/Task.java | a36aef9f45bd52114c6f0bb4e15ee252531f8844 | [] | no_license | bboss29/cs420-lambdas | https://github.com/bboss29/cs420-lambdas | 87b5e5233e9fada9f93cdbfbf8c2caf2008e4eea | d1970f7a3d7766ec138fc8f8c45a2c710270d753 | refs/heads/master | 2023-04-21T09:46:56.011000 | 2021-04-30T04:25:12 | 2021-04-30T04:25:12 | 363,022,610 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.util.ArrayList;
import java.util.List;
public class Task {
/* TODO
Create a public static inner class called Triplet with generics for a first, second and third element. All variables should be publec.*/
public static class Triplet<T> {
public T e1;
public T e2;
public T e3;
public Triplet(T p1, T p2, T p3){
e1 = p1;
e2 = p2;
e3 = p3;
}
}
public static String result;
public static void main(String[] args){
Calculator c = new Calculator();
// List<Triplet<Double,Double,String>> t = new ArrayList<>();
// t.add(new Triplet<>(3.4,5.2,"+"));
// t.add(new Triplet<>(2.3,1.23,"-"));
///* TODO
//Add the code to add a multiplication of 4.5 x 5.4, a division by zero, and divide 56.0/28.0*/
//
// t.forEach(/* TODO
//Utilizing a lambda expression, use the calculator to compute the operation specified in each Triplet with the corresponding numbers.);*/
// System.out.println(result);
}
} | UTF-8 | Java | 1,047 | java | Task.java | Java | [] | null | [] | import java.util.ArrayList;
import java.util.List;
public class Task {
/* TODO
Create a public static inner class called Triplet with generics for a first, second and third element. All variables should be publec.*/
public static class Triplet<T> {
public T e1;
public T e2;
public T e3;
public Triplet(T p1, T p2, T p3){
e1 = p1;
e2 = p2;
e3 = p3;
}
}
public static String result;
public static void main(String[] args){
Calculator c = new Calculator();
// List<Triplet<Double,Double,String>> t = new ArrayList<>();
// t.add(new Triplet<>(3.4,5.2,"+"));
// t.add(new Triplet<>(2.3,1.23,"-"));
///* TODO
//Add the code to add a multiplication of 4.5 x 5.4, a division by zero, and divide 56.0/28.0*/
//
// t.forEach(/* TODO
//Utilizing a lambda expression, use the calculator to compute the operation specified in each Triplet with the corresponding numbers.);*/
// System.out.println(result);
}
} | 1,047 | 0.601719 | 0.572111 | 32 | 31.75 | 34.394768 | 140 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.84375 | false | false | 9 |
67577bc84f73086fdd4d5ccf11d4cf051ba43014 | 18,511,309,068,131 | e38e685b8bce0f1df3b749879f2b8a0891c9a546 | /p0527/src/pack01/Product.java | 00b987c5649c3f06fbbb6c238d7cd1fb851f8e7e | [] | no_license | onulee/vc3_java | https://github.com/onulee/vc3_java | 26a0cdff6d64adf585894da52955fd83baa86d08 | 85e5bee6753c255711dd19b8b1a021352c537db2 | refs/heads/master | 2023-06-25T10:45:17.323000 | 2021-07-26T03:46:57 | 2021-07-26T03:46:57 | 366,269,179 | 1 | 3 | null | null | null | null | null | null | null | null | null | null | null | null | null | package pack01;
public class Product {
private String pro_name; //인스턴스 변수
private int price;
private int bonusPoint;
Product(){ }
Product(String pro_name,int price,int bonusPoint){
this.pro_name = pro_name;
this.price = price;
this.bonusPoint = bonusPoint;
}
public String getPro_name() {
return pro_name;
}
public void setPro_name(String pro_name) {
this.pro_name = pro_name;
}
public int getPrice() {
return price;
}
public void setPrice(int price) {
this.price = price;
}
public int getBonusPoint() {
return bonusPoint;
}
public void setBonusPoint(int bonusPoint) {
this.bonusPoint = bonusPoint;
}
}
| UTF-8 | Java | 700 | java | Product.java | Java | [] | null | [] | package pack01;
public class Product {
private String pro_name; //인스턴스 변수
private int price;
private int bonusPoint;
Product(){ }
Product(String pro_name,int price,int bonusPoint){
this.pro_name = pro_name;
this.price = price;
this.bonusPoint = bonusPoint;
}
public String getPro_name() {
return pro_name;
}
public void setPro_name(String pro_name) {
this.pro_name = pro_name;
}
public int getPrice() {
return price;
}
public void setPrice(int price) {
this.price = price;
}
public int getBonusPoint() {
return bonusPoint;
}
public void setBonusPoint(int bonusPoint) {
this.bonusPoint = bonusPoint;
}
}
| 700 | 0.651163 | 0.648256 | 37 | 16.594595 | 14.662804 | 51 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.513514 | false | false | 9 |
60605316133e835aff6984117196b495d7724150 | 18,580,028,542,077 | f25464a77cce431a401a727ddb0efaa01ab42242 | /WeatherAppTest3/app/src/main/java/nikitin/weatherapp/com/weatherapptest3/DataSharer.java | 5f1f2a21c9104d3a55af9bf61c6d99586c699843 | [] | no_license | IstrajI/Weather-App | https://github.com/IstrajI/Weather-App | 575b207b9417725271bbea6adee613eabaff118e | a36c0c7d2058a9689936b4d4735bd771b82e42db | refs/heads/master | 2022-05-22T08:27:15.674000 | 2022-05-03T20:33:09 | 2022-05-03T20:33:09 | 72,773,038 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package nikitin.weatherapp.com.weatherapptest3;
import java.util.ArrayList;
import java.util.List;
import nikitin.weatherapp.com.weatherapptest3.Model.Database.City;
import nikitin.weatherapp.com.weatherapptest3.Model.Database.Forecast;
import nikitin.weatherapp.com.weatherapptest3.Model.Database.GeoStorm;
/**
* Created by Uladzislau_Nikitsin on 1/13/2017.
*/
public interface DataSharer {
void shareForecast(ArrayList<Forecast> forecast);
void shareCity(City city);
void shareGeoStormForecast(List<GeoStorm> forecast);
}
| UTF-8 | Java | 542 | java | DataSharer.java | Java | [
{
"context": "ptest3.Model.Database.GeoStorm;\n\n/**\n * Created by Uladzislau_Nikitsin on 1/13/2017.\n */\n\npublic inter",
"end": 330,
"score": 0.6705667972564697,
"start": 329,
"tag": "USERNAME",
"value": "U"
},
{
"context": "est3.Model.Database.GeoStorm;\n\n/**\n * Created by Ula... | null | [] | package nikitin.weatherapp.com.weatherapptest3;
import java.util.ArrayList;
import java.util.List;
import nikitin.weatherapp.com.weatherapptest3.Model.Database.City;
import nikitin.weatherapp.com.weatherapptest3.Model.Database.Forecast;
import nikitin.weatherapp.com.weatherapptest3.Model.Database.GeoStorm;
/**
* Created by Uladzislau_Nikitsin on 1/13/2017.
*/
public interface DataSharer {
void shareForecast(ArrayList<Forecast> forecast);
void shareCity(City city);
void shareGeoStormForecast(List<GeoStorm> forecast);
}
| 542 | 0.800738 | 0.780443 | 18 | 29.111111 | 26.074442 | 70 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false | 9 |
fdfa888b8cf4dc1fb64d613714d2c3a8baa54e54 | 33,406,255,661,164 | 1cbf3c1246a18bf2bfa72e45185a645b3ba0a6f3 | /Crapix/app/src/main/java/com/example/android/crapix/data/CrapixProvider.java | 22d3064a442e65053c64d312b824760de7659239 | [] | no_license | cgt507/Crapix | https://github.com/cgt507/Crapix | 7e481fb4ab817d996f54a9686cb69fdb48bb0666 | 5db8c46559646a71b756fa1f0056e8cf50ee59b6 | refs/heads/master | 2016-09-11T10:56:45.996000 | 2015-08-14T21:38:18 | 2015-08-14T21:38:18 | 40,580,525 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.android.crapix.data;
import android.annotation.TargetApi;
import android.content.ContentProvider;
import android.content.ContentValues;
import android.content.UriMatcher;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteQueryBuilder;
import android.net.Uri;
import com.example.android.crapix.data.CrapixContract.CrapixEntry;
/**
* Created by Cody on 8/11/2015.
*/
public class CrapixProvider extends ContentProvider {
// The URI Matcher used by this content provider.
private static final UriMatcher sUriMatcher = buildUriMatcher();
private CrapixDbHelper mOpenHelper;
static final int CRAPIX = 100;
static final int ById = 101;
public static long mCountryID;
private static final String[] CRAPIX_COLUMNS = {
CrapixContract.CrapixEntry.TABLE_NAME + "." + CrapixContract.CrapixEntry._ID,
CrapixContract.CrapixEntry.COLUMN_Money,
CrapixContract.CrapixEntry.COLUMN_Housing,
CrapixContract.CrapixEntry.COLUMN_Metal,
CrapixContract.CrapixEntry.COLUMN_MetalMine,
CrapixContract.CrapixEntry.COLUMN_Minerals,
CrapixContract.CrapixEntry.COLUMN_MineralPlant,
CrapixContract.CrapixEntry.COLUMN_Oil,
CrapixContract.CrapixEntry.COLUMN_OilRefinery,
CrapixContract.CrapixEntry.COLUMN_Uranium,
CrapixContract.CrapixEntry.COLUMN_UraniumEnrichment
};
private static final int COL_CRAPIX_ID = 0;
private static final int COL_CRAPIX_MONEY = 1;
private static final int COL_CRAPIX_HOUSING = 2;
private static final int COL_CRAPIX_METAL = 3;
private static final int COL_CRAPIX_METALMINE = 4;
private static final int COL_CRAPIX_MINERALS = 5;
private static final int COL_CRAPIX_MINERALPLANT = 6;
private static final int COL_CRAPIX_OIL = 7;
private static final int COL_CRAPIX_OILREFINERY = 8;
private static final int COL_CRAPIX_URANIUM = 9;
private static final int COL_CRAPIX_URANIUMENRICHMENT = 10;
private static final int MONEY_MULT = 10;
private static final int METAL_MULT = 10;
private static final int MINERALS_MULT = 10;
private static final int OIL_MULT = 10;
private static final int URANIUM_MULT = 10;
//Money, metal, minerals, oil, uranium
private int[] tickChange= {0, 0, 0, 0, 0};
//For use with calculator to do iterative magic
//DOUBLE ARRAYS!!!!! YAY!!!!!
//First layer is the resource
//Second layer is the resource, building, and multiplier in that order
int[][] resources = { {COL_CRAPIX_MONEY, COL_CRAPIX_HOUSING, MONEY_MULT},
{COL_CRAPIX_METAL, COL_CRAPIX_METALMINE, METAL_MULT},
{COL_CRAPIX_MINERALS, COL_CRAPIX_MINERALPLANT, MINERALS_MULT},
{COL_CRAPIX_OIL, COL_CRAPIX_OILREFINERY, OIL_MULT},
{COL_CRAPIX_URANIUM, COL_CRAPIX_URANIUMENRICHMENT, URANIUM_MULT}};
private static final SQLiteQueryBuilder sCrapixSettingQueryBuilder;
static{
sCrapixSettingQueryBuilder = new SQLiteQueryBuilder();
//This is an inner join which looks like
//weather INNER JOIN location ON weather.location_id = location._id
sCrapixSettingQueryBuilder.setTables(
CrapixContract.CrapixEntry.TABLE_NAME);
}
private static final String sCountryIdSelection = CrapixContract.CrapixEntry.TABLE_NAME + "." + CrapixContract.CrapixEntry._ID + " = ? ";
private Cursor getValuesByCountryId(Uri uri, String[] projection, String sortOrder) {
String countryId = CrapixContract.CrapixEntry.getCountryIdFromUri(uri);
String[] selectionArgs= {countryId};
String selection= sCountryIdSelection;
return sCrapixSettingQueryBuilder.query(mOpenHelper.getReadableDatabase(),
projection,
selection,
selectionArgs,
null,
null,
sortOrder
);
}
static UriMatcher buildUriMatcher() {
// 1) The code passed into the constructor represents the code to return for the root
// URI. It's common to use NO_MATCH as the code for this case. Add the constructor below.
final UriMatcher matcher = new UriMatcher(UriMatcher.NO_MATCH);
final String authority = CrapixContract.CONTENT_AUTHORITY;
// 2) Use the addURI function to match each of the types. Use the constants from
// WeatherContract to help define the types to the UriMatcher.
matcher.addURI(authority, CrapixContract.PATH_Crapix, CRAPIX);
matcher.addURI(authority, CrapixContract.PATH_Crapix + "/*", ById);
// 3) Return the new matcher!
return matcher;
}
@Override
public boolean onCreate() {
mOpenHelper = new CrapixDbHelper(getContext());
return true;
}
/*
Students: Here's where you'll code the getType function that uses the UriMatcher. You can
test this by uncommenting testGetType in TestProvider.
*/
@Override
public String getType(Uri uri) {
final int match = sUriMatcher.match(uri);
switch(match){
case CRAPIX:
return CrapixContract.CrapixEntry.CONTENT_TYPE;
case ById:
return CrapixContract.CrapixEntry.CONTENT_ITEM_TYPE;
default:
throw new UnsupportedOperationException("Unknown uri: " + uri);
}
}
@Override
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs,
String sortOrder) {
// Here's the switch statement that, given a URI, will determine what kind of request it is,
// and query the database accordingly.
Cursor retCursor;
final int match = sUriMatcher.match(uri);
switch(match){
case CRAPIX: {
retCursor = mOpenHelper.getReadableDatabase().query(
CrapixContract.CrapixEntry.TABLE_NAME,
projection,
selection,
selectionArgs,
null,
null,
sortOrder
);
break;
}
case ById: {
retCursor = getValuesByCountryId(uri, projection, sortOrder);
break;
}
default:
throw new UnsupportedOperationException("Unknown uri: " + uri);
}
retCursor.setNotificationUri(getContext().getContentResolver(), uri);
return retCursor;
}
/*
Student: Add the ability to insert Locations to the implementation of this function.
*/
@Override
public Uri insert(Uri uri, ContentValues values) {
final SQLiteDatabase db = mOpenHelper.getWritableDatabase();
final int match = sUriMatcher.match(uri);
Uri returnUri;
switch(match){
case CRAPIX:{
long _id = db.insert(CrapixContract.CrapixEntry.TABLE_NAME, null, values);
if ( _id >= 0 )
returnUri = CrapixContract.CrapixEntry.buildCrapixUri(_id);
else
throw new android.database.SQLException("Failed to insert row into " + uri);
break;
}
default:
throw new UnsupportedOperationException("Unknown uri: " + uri);
}
getContext().getContentResolver().notifyChange(uri, null);
return returnUri;
}
@Override
public int delete(Uri uri, String selection, String[] selectionArgs) {
// Student: Start by getting a writable database
final SQLiteDatabase db = mOpenHelper.getWritableDatabase();
final int match = sUriMatcher.match(uri);
int rowsDeleted;
if( null == selection) selection = "1";
switch(match){
case CRAPIX:{
rowsDeleted = db.delete(CrapixContract.CrapixEntry.TABLE_NAME, selection, selectionArgs);
break;
}
default:
throw new UnsupportedOperationException("Unknown uri: " + uri);
}
if(rowsDeleted != 0) {
getContext().getContentResolver().notifyChange(uri, null);
}
return rowsDeleted;
}
@Override
public int update(
Uri uri, ContentValues values, String selection, String[] selectionArgs) {
final SQLiteDatabase db = mOpenHelper.getWritableDatabase();
int rowsUpdated;
rowsUpdated = db.update(CrapixContract.CrapixEntry.TABLE_NAME, values, selection, selectionArgs);
if(rowsUpdated != 0) {
getContext().getContentResolver().notifyChange(uri, null);
}
return rowsUpdated;
}
@Override
public int bulkInsert(Uri uri, ContentValues[] values) {
final SQLiteDatabase db = mOpenHelper.getWritableDatabase();
db.beginTransaction();
int returnCount = 0;
try {
for (ContentValues value : values) {
long _id = db.insert(CrapixContract.CrapixEntry.TABLE_NAME, null, value);
if (_id != -1) {
returnCount++;
}
}
db.setTransactionSuccessful();
} finally {
db.endTransaction();
}
getContext().getContentResolver().notifyChange(uri, null);
return returnCount;
}
// TODO needs to verify that the player is associated with the ID they provide (login)
// Currently requires a manual change of the mCountryID variable to create new rows.
// Opens a database,
// Queries the database for the current mCountryID value stored and returns a cursor pointing to that row
// If the value is new, the cursor will be null
// If the cursor is null, a new row is created with default values and the entered ID
public void getCountryId(SQLiteDatabase db){
Cursor test = getRowById(db);
if(test.getCount() == 0){
mCountryID = db.insert(CrapixContract.CrapixEntry.TABLE_NAME, null, newCountry());
}
test.close();
}
public Cursor getRowById(SQLiteDatabase db){
return db.query(CrapixContract.CrapixEntry.TABLE_NAME, null, CrapixContract.CrapixEntry.TABLE_NAME + "." + CrapixContract.CrapixEntry._ID + " = ? ", new String[]{String.valueOf(mCountryID)}, null, null, null);
}
static ContentValues newCountry() {
ContentValues playerValues = new ContentValues();
playerValues.put(CrapixEntry._ID, mCountryID);
playerValues.put(CrapixEntry.COLUMN_Money, 1000000);
playerValues.put(CrapixEntry.COLUMN_Housing, 25);
playerValues.put(CrapixEntry.COLUMN_Metal, 500000);
playerValues.put(CrapixEntry.COLUMN_MetalMine, 20);
playerValues.put(CrapixEntry.COLUMN_Minerals, 400000);
playerValues.put(CrapixEntry.COLUMN_MineralPlant, 23);
playerValues.put(CrapixEntry.COLUMN_Oil, 200000);
playerValues.put(CrapixEntry.COLUMN_OilRefinery, 5);
playerValues.put(CrapixEntry.COLUMN_Uranium, 100);
playerValues.put(CrapixEntry.COLUMN_UraniumEnrichment, 0);
return playerValues;
}
//Called every tick
//Takes values calculated from production buildings and adds to the appropriate resource.
public void tick(SQLiteDatabase db){
ContentValues updatedValues = calculator(db);
db.update(CrapixEntry.TABLE_NAME, updatedValues, CrapixContract.CrapixEntry.TABLE_NAME + "." + CrapixContract.CrapixEntry._ID + " = ? ", new String[]{String.valueOf(mCountryID)});
}
//Calculator for updating resources based on buildings
//Currently will add 10 units per building.
//TODO create balanced multipliers
public ContentValues calculator(SQLiteDatabase db){
Cursor cursor = getRowById(db);
cursor.moveToFirst();
ContentValues updatedValues = new ContentValues();
//counter variable for column name location in CRAPIX_COLUMNS
int i = 1;
//Runs through each resource and adds to updatedValues for each resource
//tickChange =RESOURCE MULTIPLIER(resources array) * VALUE STORED IN BUILDINGS COLUMN(resources array)
//tickChange value is stored to populate the change per tick on the stats screen
//updatedValues.put(COLUMN NAME, VALUE STORED IN RESOURCE COLUMN(resources array) + tickChange);
for(int res = 0; res < 5; res++){
tickChange[res]=resources[res][2] * cursor.getInt(resources[res][1]);
updatedValues.put(CRAPIX_COLUMNS[i], cursor.getInt(resources[res][0]) + tickChange[res]);
i+=2;
}
cursor.close();
return updatedValues;
}
public int[] getTickChange(SQLiteDatabase db){
calculator(db);
return tickChange;
}
// You do not need to call this method. This is a method specifically to assist the testing
// framework in running smoothly. You can read more at:
// http://developer.android.com/reference/android/content/ContentProvider.html#shutdown()
@Override
@TargetApi(11)
public void shutdown() {
mOpenHelper.close();
super.shutdown();
}
} | UTF-8 | Java | 13,467 | java | CrapixProvider.java | Java | [
{
"context": "ata.CrapixContract.CrapixEntry;\n\n/**\n * Created by Cody on 8/11/2015.\n */\n\npublic class CrapixProvider ex",
"end": 437,
"score": 0.7643448114395142,
"start": 433,
"tag": "NAME",
"value": "Cody"
}
] | null | [] | package com.example.android.crapix.data;
import android.annotation.TargetApi;
import android.content.ContentProvider;
import android.content.ContentValues;
import android.content.UriMatcher;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteQueryBuilder;
import android.net.Uri;
import com.example.android.crapix.data.CrapixContract.CrapixEntry;
/**
* Created by Cody on 8/11/2015.
*/
public class CrapixProvider extends ContentProvider {
// The URI Matcher used by this content provider.
private static final UriMatcher sUriMatcher = buildUriMatcher();
private CrapixDbHelper mOpenHelper;
static final int CRAPIX = 100;
static final int ById = 101;
public static long mCountryID;
private static final String[] CRAPIX_COLUMNS = {
CrapixContract.CrapixEntry.TABLE_NAME + "." + CrapixContract.CrapixEntry._ID,
CrapixContract.CrapixEntry.COLUMN_Money,
CrapixContract.CrapixEntry.COLUMN_Housing,
CrapixContract.CrapixEntry.COLUMN_Metal,
CrapixContract.CrapixEntry.COLUMN_MetalMine,
CrapixContract.CrapixEntry.COLUMN_Minerals,
CrapixContract.CrapixEntry.COLUMN_MineralPlant,
CrapixContract.CrapixEntry.COLUMN_Oil,
CrapixContract.CrapixEntry.COLUMN_OilRefinery,
CrapixContract.CrapixEntry.COLUMN_Uranium,
CrapixContract.CrapixEntry.COLUMN_UraniumEnrichment
};
private static final int COL_CRAPIX_ID = 0;
private static final int COL_CRAPIX_MONEY = 1;
private static final int COL_CRAPIX_HOUSING = 2;
private static final int COL_CRAPIX_METAL = 3;
private static final int COL_CRAPIX_METALMINE = 4;
private static final int COL_CRAPIX_MINERALS = 5;
private static final int COL_CRAPIX_MINERALPLANT = 6;
private static final int COL_CRAPIX_OIL = 7;
private static final int COL_CRAPIX_OILREFINERY = 8;
private static final int COL_CRAPIX_URANIUM = 9;
private static final int COL_CRAPIX_URANIUMENRICHMENT = 10;
private static final int MONEY_MULT = 10;
private static final int METAL_MULT = 10;
private static final int MINERALS_MULT = 10;
private static final int OIL_MULT = 10;
private static final int URANIUM_MULT = 10;
//Money, metal, minerals, oil, uranium
private int[] tickChange= {0, 0, 0, 0, 0};
//For use with calculator to do iterative magic
//DOUBLE ARRAYS!!!!! YAY!!!!!
//First layer is the resource
//Second layer is the resource, building, and multiplier in that order
int[][] resources = { {COL_CRAPIX_MONEY, COL_CRAPIX_HOUSING, MONEY_MULT},
{COL_CRAPIX_METAL, COL_CRAPIX_METALMINE, METAL_MULT},
{COL_CRAPIX_MINERALS, COL_CRAPIX_MINERALPLANT, MINERALS_MULT},
{COL_CRAPIX_OIL, COL_CRAPIX_OILREFINERY, OIL_MULT},
{COL_CRAPIX_URANIUM, COL_CRAPIX_URANIUMENRICHMENT, URANIUM_MULT}};
private static final SQLiteQueryBuilder sCrapixSettingQueryBuilder;
static{
sCrapixSettingQueryBuilder = new SQLiteQueryBuilder();
//This is an inner join which looks like
//weather INNER JOIN location ON weather.location_id = location._id
sCrapixSettingQueryBuilder.setTables(
CrapixContract.CrapixEntry.TABLE_NAME);
}
private static final String sCountryIdSelection = CrapixContract.CrapixEntry.TABLE_NAME + "." + CrapixContract.CrapixEntry._ID + " = ? ";
private Cursor getValuesByCountryId(Uri uri, String[] projection, String sortOrder) {
String countryId = CrapixContract.CrapixEntry.getCountryIdFromUri(uri);
String[] selectionArgs= {countryId};
String selection= sCountryIdSelection;
return sCrapixSettingQueryBuilder.query(mOpenHelper.getReadableDatabase(),
projection,
selection,
selectionArgs,
null,
null,
sortOrder
);
}
static UriMatcher buildUriMatcher() {
// 1) The code passed into the constructor represents the code to return for the root
// URI. It's common to use NO_MATCH as the code for this case. Add the constructor below.
final UriMatcher matcher = new UriMatcher(UriMatcher.NO_MATCH);
final String authority = CrapixContract.CONTENT_AUTHORITY;
// 2) Use the addURI function to match each of the types. Use the constants from
// WeatherContract to help define the types to the UriMatcher.
matcher.addURI(authority, CrapixContract.PATH_Crapix, CRAPIX);
matcher.addURI(authority, CrapixContract.PATH_Crapix + "/*", ById);
// 3) Return the new matcher!
return matcher;
}
@Override
public boolean onCreate() {
mOpenHelper = new CrapixDbHelper(getContext());
return true;
}
/*
Students: Here's where you'll code the getType function that uses the UriMatcher. You can
test this by uncommenting testGetType in TestProvider.
*/
@Override
public String getType(Uri uri) {
final int match = sUriMatcher.match(uri);
switch(match){
case CRAPIX:
return CrapixContract.CrapixEntry.CONTENT_TYPE;
case ById:
return CrapixContract.CrapixEntry.CONTENT_ITEM_TYPE;
default:
throw new UnsupportedOperationException("Unknown uri: " + uri);
}
}
@Override
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs,
String sortOrder) {
// Here's the switch statement that, given a URI, will determine what kind of request it is,
// and query the database accordingly.
Cursor retCursor;
final int match = sUriMatcher.match(uri);
switch(match){
case CRAPIX: {
retCursor = mOpenHelper.getReadableDatabase().query(
CrapixContract.CrapixEntry.TABLE_NAME,
projection,
selection,
selectionArgs,
null,
null,
sortOrder
);
break;
}
case ById: {
retCursor = getValuesByCountryId(uri, projection, sortOrder);
break;
}
default:
throw new UnsupportedOperationException("Unknown uri: " + uri);
}
retCursor.setNotificationUri(getContext().getContentResolver(), uri);
return retCursor;
}
/*
Student: Add the ability to insert Locations to the implementation of this function.
*/
@Override
public Uri insert(Uri uri, ContentValues values) {
final SQLiteDatabase db = mOpenHelper.getWritableDatabase();
final int match = sUriMatcher.match(uri);
Uri returnUri;
switch(match){
case CRAPIX:{
long _id = db.insert(CrapixContract.CrapixEntry.TABLE_NAME, null, values);
if ( _id >= 0 )
returnUri = CrapixContract.CrapixEntry.buildCrapixUri(_id);
else
throw new android.database.SQLException("Failed to insert row into " + uri);
break;
}
default:
throw new UnsupportedOperationException("Unknown uri: " + uri);
}
getContext().getContentResolver().notifyChange(uri, null);
return returnUri;
}
@Override
public int delete(Uri uri, String selection, String[] selectionArgs) {
// Student: Start by getting a writable database
final SQLiteDatabase db = mOpenHelper.getWritableDatabase();
final int match = sUriMatcher.match(uri);
int rowsDeleted;
if( null == selection) selection = "1";
switch(match){
case CRAPIX:{
rowsDeleted = db.delete(CrapixContract.CrapixEntry.TABLE_NAME, selection, selectionArgs);
break;
}
default:
throw new UnsupportedOperationException("Unknown uri: " + uri);
}
if(rowsDeleted != 0) {
getContext().getContentResolver().notifyChange(uri, null);
}
return rowsDeleted;
}
@Override
public int update(
Uri uri, ContentValues values, String selection, String[] selectionArgs) {
final SQLiteDatabase db = mOpenHelper.getWritableDatabase();
int rowsUpdated;
rowsUpdated = db.update(CrapixContract.CrapixEntry.TABLE_NAME, values, selection, selectionArgs);
if(rowsUpdated != 0) {
getContext().getContentResolver().notifyChange(uri, null);
}
return rowsUpdated;
}
@Override
public int bulkInsert(Uri uri, ContentValues[] values) {
final SQLiteDatabase db = mOpenHelper.getWritableDatabase();
db.beginTransaction();
int returnCount = 0;
try {
for (ContentValues value : values) {
long _id = db.insert(CrapixContract.CrapixEntry.TABLE_NAME, null, value);
if (_id != -1) {
returnCount++;
}
}
db.setTransactionSuccessful();
} finally {
db.endTransaction();
}
getContext().getContentResolver().notifyChange(uri, null);
return returnCount;
}
// TODO needs to verify that the player is associated with the ID they provide (login)
// Currently requires a manual change of the mCountryID variable to create new rows.
// Opens a database,
// Queries the database for the current mCountryID value stored and returns a cursor pointing to that row
// If the value is new, the cursor will be null
// If the cursor is null, a new row is created with default values and the entered ID
public void getCountryId(SQLiteDatabase db){
Cursor test = getRowById(db);
if(test.getCount() == 0){
mCountryID = db.insert(CrapixContract.CrapixEntry.TABLE_NAME, null, newCountry());
}
test.close();
}
public Cursor getRowById(SQLiteDatabase db){
return db.query(CrapixContract.CrapixEntry.TABLE_NAME, null, CrapixContract.CrapixEntry.TABLE_NAME + "." + CrapixContract.CrapixEntry._ID + " = ? ", new String[]{String.valueOf(mCountryID)}, null, null, null);
}
static ContentValues newCountry() {
ContentValues playerValues = new ContentValues();
playerValues.put(CrapixEntry._ID, mCountryID);
playerValues.put(CrapixEntry.COLUMN_Money, 1000000);
playerValues.put(CrapixEntry.COLUMN_Housing, 25);
playerValues.put(CrapixEntry.COLUMN_Metal, 500000);
playerValues.put(CrapixEntry.COLUMN_MetalMine, 20);
playerValues.put(CrapixEntry.COLUMN_Minerals, 400000);
playerValues.put(CrapixEntry.COLUMN_MineralPlant, 23);
playerValues.put(CrapixEntry.COLUMN_Oil, 200000);
playerValues.put(CrapixEntry.COLUMN_OilRefinery, 5);
playerValues.put(CrapixEntry.COLUMN_Uranium, 100);
playerValues.put(CrapixEntry.COLUMN_UraniumEnrichment, 0);
return playerValues;
}
//Called every tick
//Takes values calculated from production buildings and adds to the appropriate resource.
public void tick(SQLiteDatabase db){
ContentValues updatedValues = calculator(db);
db.update(CrapixEntry.TABLE_NAME, updatedValues, CrapixContract.CrapixEntry.TABLE_NAME + "." + CrapixContract.CrapixEntry._ID + " = ? ", new String[]{String.valueOf(mCountryID)});
}
//Calculator for updating resources based on buildings
//Currently will add 10 units per building.
//TODO create balanced multipliers
public ContentValues calculator(SQLiteDatabase db){
Cursor cursor = getRowById(db);
cursor.moveToFirst();
ContentValues updatedValues = new ContentValues();
//counter variable for column name location in CRAPIX_COLUMNS
int i = 1;
//Runs through each resource and adds to updatedValues for each resource
//tickChange =RESOURCE MULTIPLIER(resources array) * VALUE STORED IN BUILDINGS COLUMN(resources array)
//tickChange value is stored to populate the change per tick on the stats screen
//updatedValues.put(COLUMN NAME, VALUE STORED IN RESOURCE COLUMN(resources array) + tickChange);
for(int res = 0; res < 5; res++){
tickChange[res]=resources[res][2] * cursor.getInt(resources[res][1]);
updatedValues.put(CRAPIX_COLUMNS[i], cursor.getInt(resources[res][0]) + tickChange[res]);
i+=2;
}
cursor.close();
return updatedValues;
}
public int[] getTickChange(SQLiteDatabase db){
calculator(db);
return tickChange;
}
// You do not need to call this method. This is a method specifically to assist the testing
// framework in running smoothly. You can read more at:
// http://developer.android.com/reference/android/content/ContentProvider.html#shutdown()
@Override
@TargetApi(11)
public void shutdown() {
mOpenHelper.close();
super.shutdown();
}
} | 13,467 | 0.637855 | 0.630653 | 343 | 38.265305 | 32.642998 | 217 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.696793 | false | false | 9 |
115f9de0613d7c597ef54b44888feb98382f6984 | 8,718,783,625,457 | 828b5b42b1ec2445a56ef5c900f0ee45c3a86187 | /UserProject/src/main/java/com/LearnPractice/UserProject/Controller/UserController.java | e7a169c283d1de3dac5dfe0dec02ada0166ad07f | [] | no_license | Harish435/Practicegit | https://github.com/Harish435/Practicegit | 626ce2e7240b6f22fd13985fcd8eaea490e926e0 | 7da7616bd9b3e02704bc557159a5156d1030fef2 | refs/heads/main | 2023-06-20T08:52:56.871000 | 2021-06-06T06:44:05 | 2021-06-06T06:44:05 | 373,410,920 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.LearnPractice.UserProject.Controller;
import com.LearnPractice.UserProject.Dto.UserResponsedto;
import com.LearnPractice.UserProject.Dto.UserorderresponseDto;
import com.LearnPractice.UserProject.Dto.UsersRequestdto;
import com.LearnPractice.UserProject.Dto.orderresponse;
import com.LearnPractice.UserProject.Entity.Users;
import com.LearnPractice.UserProject.Service.UserServices;
import com.LearnPractice.UserProject.feingclient.OrderClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
@RestController
@RequestMapping("/users")
public class UserController {
@Autowired
UserServices userservices;
@GetMapping("/port")
public String getPortNumber(){
return userservices.getport();
}
@PostMapping("/save")
public Users saveusers(@Valid @RequestBody UsersRequestdto usersRequestdto){
return userservices.saveusers(usersRequestdto);
}
@GetMapping("/allUsers")
public List<Users> getListOfUsers(){
return userservices.getListOfUsers();
}
@GetMapping("/{userId}")
public UsersRequestdto getByUserid(@PathVariable Long userId){
return userservices.getusersById(userId);
}
@GetMapping("/getordes/{userId}")
public UserorderresponseDto getOrdersByUserId(@PathVariable Long userId){
return userservices.getordersbyid(userId);
}
@PostMapping("/savebyid/{userId}")
public UserorderresponseDto sendbyId(@PathVariable Long userId,@RequestBody orderresponse userdto)
{
return userservices.saveOrdersById(userId,userdto);
}
}
| UTF-8 | Java | 1,797 | java | UserController.java | Java | [] | null | [] | package com.LearnPractice.UserProject.Controller;
import com.LearnPractice.UserProject.Dto.UserResponsedto;
import com.LearnPractice.UserProject.Dto.UserorderresponseDto;
import com.LearnPractice.UserProject.Dto.UsersRequestdto;
import com.LearnPractice.UserProject.Dto.orderresponse;
import com.LearnPractice.UserProject.Entity.Users;
import com.LearnPractice.UserProject.Service.UserServices;
import com.LearnPractice.UserProject.feingclient.OrderClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
@RestController
@RequestMapping("/users")
public class UserController {
@Autowired
UserServices userservices;
@GetMapping("/port")
public String getPortNumber(){
return userservices.getport();
}
@PostMapping("/save")
public Users saveusers(@Valid @RequestBody UsersRequestdto usersRequestdto){
return userservices.saveusers(usersRequestdto);
}
@GetMapping("/allUsers")
public List<Users> getListOfUsers(){
return userservices.getListOfUsers();
}
@GetMapping("/{userId}")
public UsersRequestdto getByUserid(@PathVariable Long userId){
return userservices.getusersById(userId);
}
@GetMapping("/getordes/{userId}")
public UserorderresponseDto getOrdersByUserId(@PathVariable Long userId){
return userservices.getordersbyid(userId);
}
@PostMapping("/savebyid/{userId}")
public UserorderresponseDto sendbyId(@PathVariable Long userId,@RequestBody orderresponse userdto)
{
return userservices.saveOrdersById(userId,userdto);
}
}
| 1,797 | 0.740122 | 0.740122 | 56 | 30.089285 | 26.077684 | 103 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.392857 | false | false | 9 |
bb6fa848159fdac38e3662b53c2da6f07e5abfc3 | 12,773,232,759,777 | 7ee7594b444efce3a6af0f8e4d226de37fed3cc4 | /app/src/main/java/com/vietdms/smarttvads/Main.java | 8c3435e7a126a0b26cd9473217c2cb6d924260ac | [] | no_license | skdhruv/SmartTVAdsSlider | https://github.com/skdhruv/SmartTVAdsSlider | 2c7b284944438f3277396ff4a71ffcd92cac9bef | 128f73a4bc426e4256b6c27a8c49b06c5ef3e20b | refs/heads/master | 2020-09-28T05:18:40.163000 | 2015-12-31T07:11:36 | 2015-12-31T07:11:36 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.vietdms.smarttvads;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.database.sqlite.SQLiteDatabase;
import android.graphics.PixelFormat;
import android.media.MediaPlayer;
import android.net.Uri;
import android.net.wifi.WifiManager;
import android.os.Handler;
import android.os.PowerManager;
import android.provider.Settings;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.webkit.WebView;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.MediaController;
import android.widget.VideoView;
import java.util.ArrayList;
public class Main extends AppCompatActivity implements View.OnClickListener {
private SQLiteDatabase database;
private VideoView video;
private ImageView image;
private WebView web;
private Button btnSetting;
private int type = 0;
private Handler handler;
private Animation anim;
private String FOLDER = "MyAdsData";
protected PowerManager.WakeLock mWakeLock;
private ProgressDialog mProgressDialog;
private final float VOLUME = 0;
private final int OPENWIFI = 1;
private final int positionWeb = 1000;
private Context context;
private MediaController mediaController;
private ArrayList<Ads> arrAds = new ArrayList<>();
@Override// download and save to sdcard
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
getId();
loadData();
init();
}
private void loadData() {
database = context.openOrCreateDatabase(MyMethod.DATABASE_NAME, SQLiteDatabase.CREATE_IF_NECESSARY, null);
MyMethod.createFolder(FOLDER);
MyMethod.createSchedule(database);
if (MyMethod.isOnline(context)) {
MyMethod.requestDevice(arrAds,database, context, mProgressDialog, "tientest",FOLDER);
} else showLayout(Layouts.Setting);
mProgressDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
displayData(type);
}
});
// addData(); type RANDOM, DONT DELETE
}
private void init() {
final PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
this.mWakeLock = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, "My Tag");
this.mWakeLock.acquire();
handler = new Handler();
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.btnSetting:
WifiManager wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE);
if (wifi.isWifiEnabled()) {
if (MyMethod.isOnline(context)) loadData();
else
startActivityForResult(new Intent(Settings.ACTION_WIFI_SETTINGS), OPENWIFI);
} else {
startActivityForResult(new Intent(Settings.ACTION_WIFI_SETTINGS), OPENWIFI);
}
break;
default:
break;
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
switch (requestCode) {
case OPENWIFI:
btnSetting.setText(getString(R.string.loadagain));
btnSetting.performClick();
break;
default:
break;
}
}
private enum Layouts {
Video, Image, Webview, Setting
}
private void showLayout(Layouts layout) {
switch (layout) {
case Video:
video.setVisibility(View.VISIBLE);
image.setVisibility(View.GONE);
btnSetting.setVisibility(View.GONE);
web.setVisibility(View.GONE);
anim = AnimationUtils.loadAnimation(context,
R.anim.fade_in);
video.startAnimation(anim);
//MyMethod.playVideo(mediaController,video,LINK_VIDEO,VOLUME);
MyMethod.loadVideo(video, FOLDER, "File1.3gp", VOLUME);
video.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
@Override
public void onCompletion(MediaPlayer mp) {
displayData(type);
}
});
type = 1;
break;
case Image:
video.setVisibility(View.GONE);
btnSetting.setVisibility(View.GONE);
image.setVisibility(View.VISIBLE);
web.setVisibility(View.GONE);
anim = AnimationUtils.loadAnimation(context,
R.anim.fade_in);
image.startAnimation(anim);
MyMethod.loadImage(image, FOLDER, "File2.jpg");
type = 2;
handler.postDelayed(new Runnable() {
@Override
public void run() {
// Do something after 5s = 5000ms
displayData(type);
}
}, 1000 * 10);
break;
case Webview:
video.setVisibility(View.GONE);
image.setVisibility(View.GONE);
btnSetting.setVisibility(View.GONE);
web.setVisibility(View.VISIBLE);
anim = AnimationUtils.loadAnimation(context,
R.anim.fade_in);
web.startAnimation(anim);
MyMethod.loadWebview(web, positionWeb, MyMethod.LINKWEB);
type = 0;
handler.postDelayed(new Runnable() {
@Override
public void run() {
// Do something after 5s = 5000ms
displayData(type);
}
}, 1000 * 10);
break;
case Setting:
video.setVisibility(View.GONE);
image.setVisibility(View.GONE);
web.setVisibility(View.GONE);
btnSetting.setVisibility(View.VISIBLE);
break;
default:
break;
}
}
private void displayData(int type) {
switch (type) {
case 0:
anim = AnimationUtils.loadAnimation(context,
R.anim.fade_out);
web.startAnimation(anim);
// web.destroy();
web.destroyDrawingCache();
showLayout(Layouts.Video);
break;
case 1:
anim = AnimationUtils.loadAnimation(context,
R.anim.fade_out);
video.startAnimation(anim);
video.destroyDrawingCache();
showLayout(Layouts.Image);
break;
case 2:
anim = AnimationUtils.loadAnimation(context,
R.anim.fade_out);
image.startAnimation(anim);
image.destroyDrawingCache();
showLayout(Layouts.Webview);
break;
default:
break;
}
}
private void getId() {
mediaController = new MediaController(this);
context = getApplicationContext();
video = (VideoView) findViewById(R.id.vid);
image = (ImageView) findViewById(R.id.img);
web = (WebView) findViewById(R.id.web);
btnSetting = (Button) findViewById(R.id.btnSetting);
mProgressDialog = new ProgressDialog(Main.this);
btnSetting.setOnClickListener(this);
}
@Override
public void onBackPressed() {
}
@Override
public void onDestroy() {
this.mWakeLock.release();
Log.w(getString(R.string.app_name), "onDestroy");
super.onDestroy();
}
@Override
protected void onRestart() {
Log.w(getString(R.string.app_name), "onRestart");
super.onRestart();
}
@Override
protected void onStart() {
Log.w(getString(R.string.app_name), "onStart");
super.onStart();
}
@Override
protected void onStop() {
Log.w(getString(R.string.app_name), "onStop");
super.onStop();
}
@Override
protected void onPause() {
Log.w(getString(R.string.app_name), "onPause");
super.onPause();
}
@Override
protected void onResume() {
Log.w(getString(R.string.app_name), "onResume");
super.onResume();
}
}
| UTF-8 | Java | 8,924 | java | Main.java | Java | [] | null | [] | package com.vietdms.smarttvads;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.database.sqlite.SQLiteDatabase;
import android.graphics.PixelFormat;
import android.media.MediaPlayer;
import android.net.Uri;
import android.net.wifi.WifiManager;
import android.os.Handler;
import android.os.PowerManager;
import android.provider.Settings;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.webkit.WebView;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.MediaController;
import android.widget.VideoView;
import java.util.ArrayList;
public class Main extends AppCompatActivity implements View.OnClickListener {
private SQLiteDatabase database;
private VideoView video;
private ImageView image;
private WebView web;
private Button btnSetting;
private int type = 0;
private Handler handler;
private Animation anim;
private String FOLDER = "MyAdsData";
protected PowerManager.WakeLock mWakeLock;
private ProgressDialog mProgressDialog;
private final float VOLUME = 0;
private final int OPENWIFI = 1;
private final int positionWeb = 1000;
private Context context;
private MediaController mediaController;
private ArrayList<Ads> arrAds = new ArrayList<>();
@Override// download and save to sdcard
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
getId();
loadData();
init();
}
private void loadData() {
database = context.openOrCreateDatabase(MyMethod.DATABASE_NAME, SQLiteDatabase.CREATE_IF_NECESSARY, null);
MyMethod.createFolder(FOLDER);
MyMethod.createSchedule(database);
if (MyMethod.isOnline(context)) {
MyMethod.requestDevice(arrAds,database, context, mProgressDialog, "tientest",FOLDER);
} else showLayout(Layouts.Setting);
mProgressDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
displayData(type);
}
});
// addData(); type RANDOM, DONT DELETE
}
private void init() {
final PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
this.mWakeLock = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, "My Tag");
this.mWakeLock.acquire();
handler = new Handler();
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.btnSetting:
WifiManager wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE);
if (wifi.isWifiEnabled()) {
if (MyMethod.isOnline(context)) loadData();
else
startActivityForResult(new Intent(Settings.ACTION_WIFI_SETTINGS), OPENWIFI);
} else {
startActivityForResult(new Intent(Settings.ACTION_WIFI_SETTINGS), OPENWIFI);
}
break;
default:
break;
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
switch (requestCode) {
case OPENWIFI:
btnSetting.setText(getString(R.string.loadagain));
btnSetting.performClick();
break;
default:
break;
}
}
private enum Layouts {
Video, Image, Webview, Setting
}
private void showLayout(Layouts layout) {
switch (layout) {
case Video:
video.setVisibility(View.VISIBLE);
image.setVisibility(View.GONE);
btnSetting.setVisibility(View.GONE);
web.setVisibility(View.GONE);
anim = AnimationUtils.loadAnimation(context,
R.anim.fade_in);
video.startAnimation(anim);
//MyMethod.playVideo(mediaController,video,LINK_VIDEO,VOLUME);
MyMethod.loadVideo(video, FOLDER, "File1.3gp", VOLUME);
video.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
@Override
public void onCompletion(MediaPlayer mp) {
displayData(type);
}
});
type = 1;
break;
case Image:
video.setVisibility(View.GONE);
btnSetting.setVisibility(View.GONE);
image.setVisibility(View.VISIBLE);
web.setVisibility(View.GONE);
anim = AnimationUtils.loadAnimation(context,
R.anim.fade_in);
image.startAnimation(anim);
MyMethod.loadImage(image, FOLDER, "File2.jpg");
type = 2;
handler.postDelayed(new Runnable() {
@Override
public void run() {
// Do something after 5s = 5000ms
displayData(type);
}
}, 1000 * 10);
break;
case Webview:
video.setVisibility(View.GONE);
image.setVisibility(View.GONE);
btnSetting.setVisibility(View.GONE);
web.setVisibility(View.VISIBLE);
anim = AnimationUtils.loadAnimation(context,
R.anim.fade_in);
web.startAnimation(anim);
MyMethod.loadWebview(web, positionWeb, MyMethod.LINKWEB);
type = 0;
handler.postDelayed(new Runnable() {
@Override
public void run() {
// Do something after 5s = 5000ms
displayData(type);
}
}, 1000 * 10);
break;
case Setting:
video.setVisibility(View.GONE);
image.setVisibility(View.GONE);
web.setVisibility(View.GONE);
btnSetting.setVisibility(View.VISIBLE);
break;
default:
break;
}
}
private void displayData(int type) {
switch (type) {
case 0:
anim = AnimationUtils.loadAnimation(context,
R.anim.fade_out);
web.startAnimation(anim);
// web.destroy();
web.destroyDrawingCache();
showLayout(Layouts.Video);
break;
case 1:
anim = AnimationUtils.loadAnimation(context,
R.anim.fade_out);
video.startAnimation(anim);
video.destroyDrawingCache();
showLayout(Layouts.Image);
break;
case 2:
anim = AnimationUtils.loadAnimation(context,
R.anim.fade_out);
image.startAnimation(anim);
image.destroyDrawingCache();
showLayout(Layouts.Webview);
break;
default:
break;
}
}
private void getId() {
mediaController = new MediaController(this);
context = getApplicationContext();
video = (VideoView) findViewById(R.id.vid);
image = (ImageView) findViewById(R.id.img);
web = (WebView) findViewById(R.id.web);
btnSetting = (Button) findViewById(R.id.btnSetting);
mProgressDialog = new ProgressDialog(Main.this);
btnSetting.setOnClickListener(this);
}
@Override
public void onBackPressed() {
}
@Override
public void onDestroy() {
this.mWakeLock.release();
Log.w(getString(R.string.app_name), "onDestroy");
super.onDestroy();
}
@Override
protected void onRestart() {
Log.w(getString(R.string.app_name), "onRestart");
super.onRestart();
}
@Override
protected void onStart() {
Log.w(getString(R.string.app_name), "onStart");
super.onStart();
}
@Override
protected void onStop() {
Log.w(getString(R.string.app_name), "onStop");
super.onStop();
}
@Override
protected void onPause() {
Log.w(getString(R.string.app_name), "onPause");
super.onPause();
}
@Override
protected void onResume() {
Log.w(getString(R.string.app_name), "onResume");
super.onResume();
}
}
| 8,924 | 0.568691 | 0.564321 | 271 | 31.92989 | 21.657488 | 114 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.690037 | false | false | 9 |
cee3ab3f1bf48982d9ccd72bfbdaff94046729a3 | 2,559,800,512,195 | dd660979d282146ed57e57dbbd42b4c8aa13dc43 | /javase34/src/cn/edu360/javase34/day08/practise/DuoTaiDemo4.java | d0d271e693f20177a0c12fef89c89169a1f95aa9 | [] | no_license | ZongYangL/first | https://github.com/ZongYangL/first | b4716017d236211220301cb0f96f7a9b492619e3 | 3f29b5a0f698580e8055174d3d2890d977dcc0e7 | refs/heads/master | 2018-09-27T19:06:34.205000 | 2018-06-07T11:09:56 | 2018-06-07T11:09:56 | 136,463,710 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package cn.edu360.javase34.day08.practise;
/**
1. Java中类方法和实例方法的区别
类体中的方法分为实例方法和类方法两种,用static修饰的是类方法。
当类的字节码文件被加载到内存时,类的实例方法不会被分配入口地址,当该类创建对象后,
类中的实例方法才分配入口地址,从而实例方法可以被类创建的任何对象调用执行。
需要注意的是,当我们创建第一个对象时,类中的实例方法就分配了入口地址,
当再创建对象时,不再分配入口地址,也就是说,方法的入口地址被所有的对象共享,当所有的对象都不存在时,
方法的入口地址才被取消。
对于类中的类方法,在该类被加载到内存时,就分配了相应的入口地址。从而类方法不仅可以被类创建的任何对象调用执行,
也可以直接通过类名调用。类方法的入口地址直到程序退出才被取消。
类方法在类的字节码加载到内存时就分配了入口地址,因此,Java语言允许通过类名直接调用类方法,
而实例方法不能通过类名调用。在讲述类的时候我们强调过,在Java语言中,类中的类方法不可以操作实例变量,
也不可以调用实例方法,这是因为在类创建对象之前,实例成员变量还没有分配内存,而且实例方法也没有入口地址。
*/
class Fu {
int num = 5;
static void method4() {
System.out.println("fu method_4");
}
void method3() {
System.out.println("fu method_3");
}
}
class Zi extends Fu {
int num = 8;
static void method4() {
System.out.println("zi method_4");
}
void method3() {
System.out.println("zi method_3");
}
}
public class DuoTaiDemo4{
public static void main(String[] args) {
Fu f = new Zi();
System.out.println(f.num);//与父类一致 5
f.method4();//与父类一致fu method_4
f.method3();//编译时与父类一致,运行时与子类一致 zi method_3
Zi z = new Zi();
System.out.println(z.num);
z.method4();//zi method_4
z.method3();//zi method_3
}
}
/*Fu f = new Zi();----------首先了解变量F到底是什么,把这句子分2段:
* Fu f;这是声明一个变量f为Fu这个类,那么知道了f肯定是Fu类。然后我们f=newZi();
* 中建立一个子类对象赋值给了f,结果是什么??
结果是,拥有了被Zi类函数覆盖后的Fu类对象----f-------也就是说:
只有子类的函数覆盖了父类的函数这一个变化,但是f肯定是Fu这个类,也就是说f不可能变成其他比如Zi这个类等等
(突然f拥有了Zi类特有函数,成员变量等都是不可能的)。所以f所代表的是函数被复写后(多态的意义)的一个Fu类,
而Fu类原来有的成员变量(不是成员函数不可能被复写)没有任何变化----------------
获得结论:A:成员变量:编译和运行都看Fu。
但是f的Fu类函数被复写了。--------------获得结论:B:非静态方法:编译看Fu,运行看Zi
对于静态方法:编译和运行都看Fu!!
其实很简单,首先我们要理解静态情况下发生了什么?
----------------当静态时,Fu类的所有函数跟随Fu类加载而加载了。
也就是Fu类的函数(是先于对象建立之前就存在了,无法被后出现的Zi类对象所复写的,
所以没发生复写,那么获得:C:静态方法:编译和运行都看Fu。*/ | UTF-8 | Java | 3,581 | java | DuoTaiDemo4.java | Java | [] | null | [] | package cn.edu360.javase34.day08.practise;
/**
1. Java中类方法和实例方法的区别
类体中的方法分为实例方法和类方法两种,用static修饰的是类方法。
当类的字节码文件被加载到内存时,类的实例方法不会被分配入口地址,当该类创建对象后,
类中的实例方法才分配入口地址,从而实例方法可以被类创建的任何对象调用执行。
需要注意的是,当我们创建第一个对象时,类中的实例方法就分配了入口地址,
当再创建对象时,不再分配入口地址,也就是说,方法的入口地址被所有的对象共享,当所有的对象都不存在时,
方法的入口地址才被取消。
对于类中的类方法,在该类被加载到内存时,就分配了相应的入口地址。从而类方法不仅可以被类创建的任何对象调用执行,
也可以直接通过类名调用。类方法的入口地址直到程序退出才被取消。
类方法在类的字节码加载到内存时就分配了入口地址,因此,Java语言允许通过类名直接调用类方法,
而实例方法不能通过类名调用。在讲述类的时候我们强调过,在Java语言中,类中的类方法不可以操作实例变量,
也不可以调用实例方法,这是因为在类创建对象之前,实例成员变量还没有分配内存,而且实例方法也没有入口地址。
*/
class Fu {
int num = 5;
static void method4() {
System.out.println("fu method_4");
}
void method3() {
System.out.println("fu method_3");
}
}
class Zi extends Fu {
int num = 8;
static void method4() {
System.out.println("zi method_4");
}
void method3() {
System.out.println("zi method_3");
}
}
public class DuoTaiDemo4{
public static void main(String[] args) {
Fu f = new Zi();
System.out.println(f.num);//与父类一致 5
f.method4();//与父类一致fu method_4
f.method3();//编译时与父类一致,运行时与子类一致 zi method_3
Zi z = new Zi();
System.out.println(z.num);
z.method4();//zi method_4
z.method3();//zi method_3
}
}
/*Fu f = new Zi();----------首先了解变量F到底是什么,把这句子分2段:
* Fu f;这是声明一个变量f为Fu这个类,那么知道了f肯定是Fu类。然后我们f=newZi();
* 中建立一个子类对象赋值给了f,结果是什么??
结果是,拥有了被Zi类函数覆盖后的Fu类对象----f-------也就是说:
只有子类的函数覆盖了父类的函数这一个变化,但是f肯定是Fu这个类,也就是说f不可能变成其他比如Zi这个类等等
(突然f拥有了Zi类特有函数,成员变量等都是不可能的)。所以f所代表的是函数被复写后(多态的意义)的一个Fu类,
而Fu类原来有的成员变量(不是成员函数不可能被复写)没有任何变化----------------
获得结论:A:成员变量:编译和运行都看Fu。
但是f的Fu类函数被复写了。--------------获得结论:B:非静态方法:编译看Fu,运行看Zi
对于静态方法:编译和运行都看Fu!!
其实很简单,首先我们要理解静态情况下发生了什么?
----------------当静态时,Fu类的所有函数跟随Fu类加载而加载了。
也就是Fu类的函数(是先于对象建立之前就存在了,无法被后出现的Zi类对象所复写的,
所以没发生复写,那么获得:C:静态方法:编译和运行都看Fu。*/ | 3,581 | 0.688004 | 0.672405 | 102 | 16.245098 | 18.829699 | 56 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.509804 | false | false | 9 |
ad877645fe41565dbc29c8f48ea4bef29944e607 | 23,184,233,486,295 | ec61694cdc300c5db016746ac7449e4f94927c6c | /xuegeek-common-jpa/src/main/java/com/xuegeek/common/dao/CommonBaseDao.java | 66f7ca98cb1ec22b364281d68af3571aa106ffd1 | [] | no_license | liuyong1352/mm | https://github.com/liuyong1352/mm | 62ebcee45a232b6a594516029a555cc27196b940 | c568f400d0bd3562de130ff8363fbd3d69284527 | refs/heads/master | 2016-08-09T22:55:32.605000 | 2015-10-26T07:23:54 | 2015-10-26T07:23:54 | 44,951,506 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.xuegeek.common.dao;
import com.xuegeek.common.jdbc.SQL;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.PreparedStatementCreator;
import org.springframework.jdbc.core.SqlTypeValue;
import org.springframework.jdbc.core.StatementCreatorUtils;
import org.springframework.jdbc.support.GeneratedKeyHolder;
import org.springframework.jdbc.support.KeyHolder;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;
/**
* <p>
* 通用dao类
* </p>
* User: liuyong
* Date: 15-3-22
* Version: 1.0
*/
public class CommonBaseDao {
protected static final Logger logger = Logger.getLogger(CommonBaseDao.class);
public List<Map<String,Object>> executeQuery(String sql , Map<String ,Object> parameters){
return jdbcTemplate.queryForList(sql , parameters != null ? parameters.values().toArray() : null) ;
}
public boolean testTableExist(String table){
boolean exist = true ;
try{
jdbcTemplate.execute("select 1 from " + table + " where 1>1");
}catch (DataAccessException e){
exist = false ;
}
return exist ;
}
public int delete(String tableName ,Map<String ,Object> whereParams){
String sql = getDeleteSql(tableName, whereParams) ;
return jdbcTemplate.update(sql , whereParams.values().toArray()) ;
}
public int update(String tableName ,Map<String ,Object> setParams ,Map<String ,Object> whereParams){
String sql = getUpdateSql(tableName, setParams, whereParams) ;
List<Object> parameters = new ArrayList<Object>();
parameters.addAll(setParams.values());
parameters.addAll(whereParams.values());
return jdbcTemplate.update(sql , parameters.toArray()) ;
}
public List<Map<String,Object>> queryForList(String tableName ,List<String> columns, Map<String ,Object> parameters){
String sql = getQuerySql(tableName , columns , parameters) ;
return jdbcTemplate.queryForList(sql , parameters != null ? parameters.values().toArray() : null) ;
}
public Object saveForId(String tableName , final Map<String ,Object> parameters){
final String insertSql = getInsertSql(tableName, parameters);
KeyHolder keyHolder = new GeneratedKeyHolder() ;
jdbcTemplate.update(
new PreparedStatementCreator() {
@Override
public PreparedStatement createPreparedStatement(Connection con) throws SQLException {
PreparedStatement ps = con.prepareStatement(insertSql, Statement.RETURN_GENERATED_KEYS);
int index = 0;
Iterator<Object> iterator = parameters.values().iterator();
while (iterator.hasNext()) {
Object o = iterator.next();
int sqlType = SqlTypeValue.TYPE_UNKNOWN;
;
if (o != null)
sqlType = StatementCreatorUtils.javaTypeToSqlParameterType(o.getClass());
StatementCreatorUtils.setParameterValue(ps, index + 1, sqlType, o);
index++;
}
return ps;
}
}, keyHolder);
return keyHolder.getKey() ;
}
public int save(String tableName , Map<String ,Object> parameters){
final String insertSql = getInsertSql(tableName ,parameters);
final Object[] values = parameters.values().toArray() ;
return jdbcTemplate.update(insertSql,values);
}
private String getDeleteSql(String tableName , Map<String ,Object> whereParams) {
SQL deleteSql = new SQL().DELETE_FROM(tableName) ;
Object[] whereCols = whereParams.keySet().toArray();
for(Object whereCol : whereCols){
deleteSql.WHERE(whereCol + "=?");
}
return deleteSql.toString();
}
private String getUpdateSql(String tableName , Map<String ,Object> setParams ,Map<String ,Object> whereParams){
SQL updateSql = new SQL().UPDATE(tableName) ;
Object[] setCols = setParams.keySet().toArray();
for(Object setCol : setCols){
updateSql.SET(setCol + "=?");
}
Object[] whereCols = whereParams.keySet().toArray();
for(Object whereCol : whereCols){
updateSql.WHERE(whereCol + "=?");
}
return updateSql.toString();
}
private String getInsertSql(String tableName ,Map<String ,Object> parameters){
SQL insertSQL = new SQL().INSERT_INTO(tableName);
for(String column : parameters.keySet()){
/*if(column.equals("id"))
continue;*/
insertSQL.VALUES(column, "?");
}
/*cacheSql(INSERT , insertSQL.toString());*/
return insertSQL.toString();
}
private String getQuerySql(String tableName ,List<String> columns ,Map<String ,Object> parameters){
SQL querySql = new SQL().FROM(tableName);
if(columns == null || columns.size() == 0 ){
querySql.SELECT("*") ;
} else {
querySql.SELECT((String[])columns.toArray());
}
if(parameters == null ){
return querySql.toString();
}
Object[] whereColumns = parameters.keySet().toArray();
for(Object whereColumn : whereColumns){
querySql.WHERE(whereColumn + "=?");
}
return querySql.toString();
}
protected JdbcTemplate jdbcTemplate ;
@Autowired
protected void setDataSource(DataSource dataSource){
this.jdbcTemplate = new JdbcTemplate(dataSource);
}
public DataSource getDataSource(){
return this.jdbcTemplate.getDataSource();
}
}
| UTF-8 | Java | 6,196 | java | CommonBaseDao.java | Java | [
{
"context": "Logger;\n\n/**\n * <p>\n * 通用dao类\n * </p>\n * User: liuyong\n * Date: 15-3-22\n * Version: 1.0\n */\npublic class",
"end": 853,
"score": 0.9996213912963867,
"start": 846,
"tag": "USERNAME",
"value": "liuyong"
}
] | null | [] | package com.xuegeek.common.dao;
import com.xuegeek.common.jdbc.SQL;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.PreparedStatementCreator;
import org.springframework.jdbc.core.SqlTypeValue;
import org.springframework.jdbc.core.StatementCreatorUtils;
import org.springframework.jdbc.support.GeneratedKeyHolder;
import org.springframework.jdbc.support.KeyHolder;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;
/**
* <p>
* 通用dao类
* </p>
* User: liuyong
* Date: 15-3-22
* Version: 1.0
*/
public class CommonBaseDao {
protected static final Logger logger = Logger.getLogger(CommonBaseDao.class);
public List<Map<String,Object>> executeQuery(String sql , Map<String ,Object> parameters){
return jdbcTemplate.queryForList(sql , parameters != null ? parameters.values().toArray() : null) ;
}
public boolean testTableExist(String table){
boolean exist = true ;
try{
jdbcTemplate.execute("select 1 from " + table + " where 1>1");
}catch (DataAccessException e){
exist = false ;
}
return exist ;
}
public int delete(String tableName ,Map<String ,Object> whereParams){
String sql = getDeleteSql(tableName, whereParams) ;
return jdbcTemplate.update(sql , whereParams.values().toArray()) ;
}
public int update(String tableName ,Map<String ,Object> setParams ,Map<String ,Object> whereParams){
String sql = getUpdateSql(tableName, setParams, whereParams) ;
List<Object> parameters = new ArrayList<Object>();
parameters.addAll(setParams.values());
parameters.addAll(whereParams.values());
return jdbcTemplate.update(sql , parameters.toArray()) ;
}
public List<Map<String,Object>> queryForList(String tableName ,List<String> columns, Map<String ,Object> parameters){
String sql = getQuerySql(tableName , columns , parameters) ;
return jdbcTemplate.queryForList(sql , parameters != null ? parameters.values().toArray() : null) ;
}
public Object saveForId(String tableName , final Map<String ,Object> parameters){
final String insertSql = getInsertSql(tableName, parameters);
KeyHolder keyHolder = new GeneratedKeyHolder() ;
jdbcTemplate.update(
new PreparedStatementCreator() {
@Override
public PreparedStatement createPreparedStatement(Connection con) throws SQLException {
PreparedStatement ps = con.prepareStatement(insertSql, Statement.RETURN_GENERATED_KEYS);
int index = 0;
Iterator<Object> iterator = parameters.values().iterator();
while (iterator.hasNext()) {
Object o = iterator.next();
int sqlType = SqlTypeValue.TYPE_UNKNOWN;
;
if (o != null)
sqlType = StatementCreatorUtils.javaTypeToSqlParameterType(o.getClass());
StatementCreatorUtils.setParameterValue(ps, index + 1, sqlType, o);
index++;
}
return ps;
}
}, keyHolder);
return keyHolder.getKey() ;
}
public int save(String tableName , Map<String ,Object> parameters){
final String insertSql = getInsertSql(tableName ,parameters);
final Object[] values = parameters.values().toArray() ;
return jdbcTemplate.update(insertSql,values);
}
private String getDeleteSql(String tableName , Map<String ,Object> whereParams) {
SQL deleteSql = new SQL().DELETE_FROM(tableName) ;
Object[] whereCols = whereParams.keySet().toArray();
for(Object whereCol : whereCols){
deleteSql.WHERE(whereCol + "=?");
}
return deleteSql.toString();
}
private String getUpdateSql(String tableName , Map<String ,Object> setParams ,Map<String ,Object> whereParams){
SQL updateSql = new SQL().UPDATE(tableName) ;
Object[] setCols = setParams.keySet().toArray();
for(Object setCol : setCols){
updateSql.SET(setCol + "=?");
}
Object[] whereCols = whereParams.keySet().toArray();
for(Object whereCol : whereCols){
updateSql.WHERE(whereCol + "=?");
}
return updateSql.toString();
}
private String getInsertSql(String tableName ,Map<String ,Object> parameters){
SQL insertSQL = new SQL().INSERT_INTO(tableName);
for(String column : parameters.keySet()){
/*if(column.equals("id"))
continue;*/
insertSQL.VALUES(column, "?");
}
/*cacheSql(INSERT , insertSQL.toString());*/
return insertSQL.toString();
}
private String getQuerySql(String tableName ,List<String> columns ,Map<String ,Object> parameters){
SQL querySql = new SQL().FROM(tableName);
if(columns == null || columns.size() == 0 ){
querySql.SELECT("*") ;
} else {
querySql.SELECT((String[])columns.toArray());
}
if(parameters == null ){
return querySql.toString();
}
Object[] whereColumns = parameters.keySet().toArray();
for(Object whereColumn : whereColumns){
querySql.WHERE(whereColumn + "=?");
}
return querySql.toString();
}
protected JdbcTemplate jdbcTemplate ;
@Autowired
protected void setDataSource(DataSource dataSource){
this.jdbcTemplate = new JdbcTemplate(dataSource);
}
public DataSource getDataSource(){
return this.jdbcTemplate.getDataSource();
}
}
| 6,196 | 0.624071 | 0.621809 | 179 | 33.581005 | 30.640789 | 122 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.703911 | false | false | 9 |
4f04fbb7202a0660d6061890452ce23153bd995c | 26,362,509,269,010 | 95542f4f5a71a631c606840aba339493ba122a3c | /YouRule/src/main/java/org/finastra/hackathon/yourule/loader/WhereThenData.java | d620d64dfb3697f626b47be8dedfcef2d91da08b | [] | no_license | youruledev/YouRule | https://github.com/youruledev/YouRule | 8ccf57ad9428206a6da668c7318c0254d9066f69 | 7848949fa48516086b9df995a4ca6ef8d5330745 | refs/heads/master | 2021-05-02T11:27:10.551000 | 2018-02-26T14:21:52 | 2018-02-26T14:21:52 | 120,778,401 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.finastra.hackathon.yourule.loader;
public class WhereThenData
{
String sWhere;
String sThen;
public WhereThenData(String sWhere, String sThen)
{
super();
this.sWhere = sWhere;
this.sThen = sThen;
}
public String getsWhere() {
return sWhere;
}
public void setsWhere(String sWhere) {
this.sWhere = sWhere;
}
public String getsThen() {
return sThen;
}
public void setsThen(String sThen) {
this.sThen = sThen;
}
}
| UTF-8 | Java | 459 | java | WhereThenData.java | Java | [] | null | [] | package org.finastra.hackathon.yourule.loader;
public class WhereThenData
{
String sWhere;
String sThen;
public WhereThenData(String sWhere, String sThen)
{
super();
this.sWhere = sWhere;
this.sThen = sThen;
}
public String getsWhere() {
return sWhere;
}
public void setsWhere(String sWhere) {
this.sWhere = sWhere;
}
public String getsThen() {
return sThen;
}
public void setsThen(String sThen) {
this.sThen = sThen;
}
}
| 459 | 0.69281 | 0.69281 | 31 | 13.806452 | 14.928689 | 51 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.258065 | false | false | 9 |
9ff61b79167350fe2ca2a8aa3918450ed6423fe6 | 23,390,391,939,895 | 172165f98fdf0885348ef8385316f4eb3f9a137c | /src/main/java/testfile.java | 40767c6f308c8f837818ce3e0f8e6962df8a42d0 | [] | no_license | GM20150401/tad | https://github.com/GM20150401/tad | 4785ff56cc7911efcbea0e7abb54c8b1c4384d62 | 557b323a11febe3928de313e8681c511c3c0500c | refs/heads/master | 2021-01-01T03:50:51.366000 | 2016-05-06T03:37:36 | 2016-05-06T03:37:36 | 58,028,101 | 0 | 0 | null | false | 2016-05-06T02:06:39 | 2016-05-04T06:25:09 | 2016-05-04T06:50:09 | 2016-05-06T02:06:39 | 11 | 0 | 0 | 1 | Java | null | null | /**
* Created by zhanghuan on 2016/5/4.
*/
public class testfile {
public static void main(String[] args) {
System.out.println("??????5555555kkkkkkkkkkkkkkk555555554dfsfvsdfffs????????????????????????");
System.out.println("hello s ");
System.out.println("???asdasdsadasd????yyyyyyjjjjjjttttttttttttjjjjjjjjjjjjjjjyyyyyyyyyyyyyyyyyyyy????asdasdsad?????????????sdfsadfdsfds??????");
}
}
| UTF-8 | Java | 421 | java | testfile.java | Java | [
{
"context": "/**\n * Created by zhanghuan on 2016/5/4.\n */\npublic class testfile {\n\n pub",
"end": 27,
"score": 0.9932973980903625,
"start": 18,
"tag": "USERNAME",
"value": "zhanghuan"
}
] | null | [] | /**
* Created by zhanghuan on 2016/5/4.
*/
public class testfile {
public static void main(String[] args) {
System.out.println("??????5555555kkkkkkkkkkkkkkk555555554dfsfvsdfffs????????????????????????");
System.out.println("hello s ");
System.out.println("???asdasdsadasd????yyyyyyjjjjjjttttttttttttjjjjjjjjjjjjjjjyyyyyyyyyyyyyyyyyyyy????asdasdsad?????????????sdfsadfdsfds??????");
}
}
| 421 | 0.624703 | 0.572447 | 11 | 37.272728 | 46.770409 | 153 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.272727 | false | false | 9 |
1243ea670feae2cae272d350e14bb003a02572a8 | 33,182,917,337,218 | 65e3ad5cc5d1bc178e056b5be3730e167f962119 | /day11-code/src/cn/njupt/day11/Demo02/Demo01InnerClass.java | ca7080861c68a024b1bd1fc0812c71633346ea9d | [] | no_license | zhangmnt/zhang | https://github.com/zhangmnt/zhang | 3e7a729002a6400e4964a1c421da75c0d6de421b | 8c6a6e9a7fad2ce90c0daddf4ee113421c1e6e3f | refs/heads/master | 2022-12-31T08:06:16.601000 | 2020-05-11T07:29:51 | 2020-05-11T07:29:51 | 199,108,117 | 0 | 0 | null | false | 2022-12-16T01:25:20 | 2019-07-27T03:02:50 | 2020-05-11T07:31:51 | 2022-12-16T01:25:17 | 70,957 | 0 | 0 | 6 | TSQL | false | false | package cn.njupt.day11.Demo02;
public class Demo01InnerClass {
}
| UTF-8 | Java | 72 | java | Demo01InnerClass.java | Java | [] | null | [] | package cn.njupt.day11.Demo02;
public class Demo01InnerClass {
}
| 72 | 0.722222 | 0.638889 | 4 | 15.5 | 15.008331 | 31 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | false | false | 9 |
bc4b128bf332480e4e8eae80c1d86dda7737dcfb | 33,182,917,340,256 | 6dba6059a181f550aeae55b4448fa557741b0639 | /src/uk/co/quartzcraft/core/systems/chat/QCChat.java | d660f418580b82804d2fdb87c0008a4a20ece94c | [] | no_license | Quartzcraft/QuartzCore | https://github.com/Quartzcraft/QuartzCore | 8c9fd245504590fde8be5f5265dfc4f5285ebb06 | 69c3cb0b9cedb6fbf13d9018f71762ad3829c672 | refs/heads/master | 2021-01-15T15:32:51.394000 | 2018-01-03T09:54:17 | 2018-01-03T09:54:17 | 12,480,946 | 0 | 0 | null | false | 2014-02-06T10:14:41 | 2013-08-30T07:42:17 | 2014-02-06T10:14:41 | 2014-02-06T10:14:41 | 376 | 1 | 0 | 1 | Java | null | null | package uk.co.quartzcraft.core.systems.chat;
import java.util.Map;
public class QCChat {
/**
* Gets the requested phrase.
*
* @param requested_phrase_id
* @return phrase
*/
public static String getPhrase(String requested_phrase_id) {
if(ChatPhrase.match(requested_phrase_id)) {
String phrase_value = ChatPhrase.getValue(requested_phrase_id);
return ChatFormat.parse(phrase_value);
}
return requested_phrase_id;
}
/**
* Gets the requested phrase. Has input for variables.
*
* @param requested_phrase_id
* @return phrase
*/
public static String getPhrase(String requested_phrase_id, Map map_of_variables) {
if(ChatPhrase.match(requested_phrase_id)) {
String phrase_value = ChatPhrase.getValue(requested_phrase_id);
String final_value = ChatPhrase.replaceVariables(phrase_value, map_of_variables);
return ChatFormat.parse(phrase_value);
}
return requested_phrase_id;
}
/**
* Adds a phrase to the phrase list.
*
* @param phrase_id
* @param phrase
*/
public static void addPhrase(String phrase_id, String phrase) {
ChatPhrase.phrases.put(phrase_id, phrase);
}
/**
* Creates a new PreparedMessage object
*
* @return
*/
public static PreparedMessage prepareMessage() {
return new PreparedMessage();
}
/**
* Creates a new PreparedMessage object
*
* @return
*/
public static PreparedMessage prepareMessage(String message) {
return new PreparedMessage(message);
}
}
| UTF-8 | Java | 1,618 | java | QCChat.java | Java | [] | null | [] | package uk.co.quartzcraft.core.systems.chat;
import java.util.Map;
public class QCChat {
/**
* Gets the requested phrase.
*
* @param requested_phrase_id
* @return phrase
*/
public static String getPhrase(String requested_phrase_id) {
if(ChatPhrase.match(requested_phrase_id)) {
String phrase_value = ChatPhrase.getValue(requested_phrase_id);
return ChatFormat.parse(phrase_value);
}
return requested_phrase_id;
}
/**
* Gets the requested phrase. Has input for variables.
*
* @param requested_phrase_id
* @return phrase
*/
public static String getPhrase(String requested_phrase_id, Map map_of_variables) {
if(ChatPhrase.match(requested_phrase_id)) {
String phrase_value = ChatPhrase.getValue(requested_phrase_id);
String final_value = ChatPhrase.replaceVariables(phrase_value, map_of_variables);
return ChatFormat.parse(phrase_value);
}
return requested_phrase_id;
}
/**
* Adds a phrase to the phrase list.
*
* @param phrase_id
* @param phrase
*/
public static void addPhrase(String phrase_id, String phrase) {
ChatPhrase.phrases.put(phrase_id, phrase);
}
/**
* Creates a new PreparedMessage object
*
* @return
*/
public static PreparedMessage prepareMessage() {
return new PreparedMessage();
}
/**
* Creates a new PreparedMessage object
*
* @return
*/
public static PreparedMessage prepareMessage(String message) {
return new PreparedMessage(message);
}
}
| 1,618 | 0.636588 | 0.636588 | 67 | 23.149254 | 24.581423 | 93 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.597015 | false | false | 9 |
cd25c397d6e1b0fd1b53967023eb02dd530f7654 | 12,360,915,943,466 | ac0c052b742ad2965e7c144d2bdeaa00978bf173 | /src/dao/ParseAnnotation.java | b502b70de3c798465edebdb9d5239b55ea71d3ed | [] | no_license | yuerfeifei/createTable | https://github.com/yuerfeifei/createTable | b7edab7a72a0ec4e939bfea3d6aa924f9e866279 | 5d699bb27b0627262347e96bb798d5535774b704 | refs/heads/master | 2021-06-29T14:26:17.230000 | 2017-09-15T13:03:11 | 2017-09-15T13:03:11 | 103,378,014 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package dao;
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import annotation.Param;
import annotation.TableName;
import util.MysqlConnect;
import util.TypeMapping;
public class ParseAnnotation {
public boolean createTable(String className) throws Exception {
//Student student = new Student();
String sql = "";
TableName tableName = null;
boolean flg=false;
if(className.isEmpty()){
return true;
}
//实例化实体类
Class clazz = Class.forName(className);
//获取类层级注解
Annotation[] annotations = clazz.getAnnotations();
if(annotations.length<1){
System.out.println("未发现注解,跳过。。。。。。。。");
return true;
}
tableName = (TableName)annotations[0];
Field[] fields = clazz.getDeclaredFields();
for (Field field : fields) {
Annotation[] a = field.getDeclaredAnnotations();
if(a.length>0){
flg=true;
}
for (Annotation annotation : a) {
Param param = (Param) annotation;
sql = sql+"`"+param.name()+"` "+TypeMapping.typeMapping(param.type())+"("+param.length()+")"+",";
}
}
if(flg==false){
return flg;
}
sql=sql.substring(0,sql.length()-1);
sql="create table"+" "+"`"+tableName.name()+"`"+"("+sql+")";
System.out.println("正在创建"+tableName.name()+"表。。。。。。。。");
MysqlConnect mConnect = new MysqlConnect("");
try {
System.out.println(sql);
mConnect.pst.executeUpdate(sql);
} catch (Exception e) {
// TODO Auto-generated catch block
System.out.println(tableName.name()+"已存在。。。。。。。。");
return true;
}
System.out.println(tableName.name()+"表创建成功!");
return true;
}
}
| UTF-8 | Java | 1,697 | java | ParseAnnotation.java | Java | [] | null | [] | package dao;
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import annotation.Param;
import annotation.TableName;
import util.MysqlConnect;
import util.TypeMapping;
public class ParseAnnotation {
public boolean createTable(String className) throws Exception {
//Student student = new Student();
String sql = "";
TableName tableName = null;
boolean flg=false;
if(className.isEmpty()){
return true;
}
//实例化实体类
Class clazz = Class.forName(className);
//获取类层级注解
Annotation[] annotations = clazz.getAnnotations();
if(annotations.length<1){
System.out.println("未发现注解,跳过。。。。。。。。");
return true;
}
tableName = (TableName)annotations[0];
Field[] fields = clazz.getDeclaredFields();
for (Field field : fields) {
Annotation[] a = field.getDeclaredAnnotations();
if(a.length>0){
flg=true;
}
for (Annotation annotation : a) {
Param param = (Param) annotation;
sql = sql+"`"+param.name()+"` "+TypeMapping.typeMapping(param.type())+"("+param.length()+")"+",";
}
}
if(flg==false){
return flg;
}
sql=sql.substring(0,sql.length()-1);
sql="create table"+" "+"`"+tableName.name()+"`"+"("+sql+")";
System.out.println("正在创建"+tableName.name()+"表。。。。。。。。");
MysqlConnect mConnect = new MysqlConnect("");
try {
System.out.println(sql);
mConnect.pst.executeUpdate(sql);
} catch (Exception e) {
// TODO Auto-generated catch block
System.out.println(tableName.name()+"已存在。。。。。。。。");
return true;
}
System.out.println(tableName.name()+"表创建成功!");
return true;
}
}
| 1,697 | 0.657378 | 0.654212 | 60 | 25.316668 | 20.207664 | 101 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.483333 | false | false | 9 |
1cdda7f78e14669e633b5c645d3ddf9a98477fdc | 28,080,496,238,256 | 0fbdf38d6ad22cafec60e490f025bce79f7b4e95 | /src/main/java/com/dummy/teksystem/test/Test2.java | 281c918a4f7480a7fb4ff103217a9a6edeec078c | [] | no_license | pablodc00/ZZZ | https://github.com/pablodc00/ZZZ | b1f1549d5f17bc010d56ca075f9932bb567819a6 | 7d1ec07d4c32288e85bab917a355bb1c472760af | refs/heads/master | 2022-12-22T19:18:37.153000 | 2022-12-19T18:25:46 | 2022-12-19T18:25:46 | 102,210,626 | 0 | 0 | null | false | 2022-01-28T17:34:09 | 2017-09-02T16:53:59 | 2021-12-13T22:58:20 | 2022-01-28T17:34:08 | 2,907 | 0 | 0 | 0 | Java | false | false | package com.dummy.teksystem.test;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
public class Test2 {
public static void main(String[] args) {
ParentA obj = new ChildB();
//Number i = new Serializable();
//meth(args);
// TODO Auto-generated method stub
//int x = 5;
//x = x >> 1;
//x = ~x;
//x += 3;
String str1 = "My String";
String str2 = new String("My String");
//System.out.println(str1 == str2);
//System.out.println(str1.hashCode() == str2.hashCode());
//System.out.println(String.parse(str1) == str2);
//System.out.println(str1.matches(str2));
//System.out.println(str1.equals(str2));
int i = 1;
int j = 2;
if (i == j) {};
}
public void meth(String[] args) {
System.out.println(args);
System.out.println(args[1]);
}
public void writeFile() {
Path inputFile = Paths.get("input.txt");
Path outputFile = Paths.get("output.txt");
BufferedReader reader;
try {
reader = Files.newBufferedReader(inputFile, Charset.defaultCharset());
BufferedWriter writer = Files.newBufferedWriter(outputFile, Charset.defaultCharset());
String lineFromFile = "";
while ((lineFromFile = reader.readLine()) != null) {
writer.append(lineFromFile);
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
| UTF-8 | Java | 1,880 | java | Test2.java | Java | [] | null | [] | package com.dummy.teksystem.test;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
public class Test2 {
public static void main(String[] args) {
ParentA obj = new ChildB();
//Number i = new Serializable();
//meth(args);
// TODO Auto-generated method stub
//int x = 5;
//x = x >> 1;
//x = ~x;
//x += 3;
String str1 = "My String";
String str2 = new String("My String");
//System.out.println(str1 == str2);
//System.out.println(str1.hashCode() == str2.hashCode());
//System.out.println(String.parse(str1) == str2);
//System.out.println(str1.matches(str2));
//System.out.println(str1.equals(str2));
int i = 1;
int j = 2;
if (i == j) {};
}
public void meth(String[] args) {
System.out.println(args);
System.out.println(args[1]);
}
public void writeFile() {
Path inputFile = Paths.get("input.txt");
Path outputFile = Paths.get("output.txt");
BufferedReader reader;
try {
reader = Files.newBufferedReader(inputFile, Charset.defaultCharset());
BufferedWriter writer = Files.newBufferedWriter(outputFile, Charset.defaultCharset());
String lineFromFile = "";
while ((lineFromFile = reader.readLine()) != null) {
writer.append(lineFromFile);
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
| 1,880 | 0.540426 | 0.530319 | 71 | 25.478872 | 20.306011 | 98 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.535211 | false | false | 9 |
aeaddb2e7e1f4b4159b62d6ea6ab8debfef9c893 | 22,179,211,134,287 | 391046f97785c6567d241f2bfe44b2bda5ff9e7c | /src/by/it/doNotTouch/kondratev/calc/CalcLogger.java | f22770581a7f436e630ddcdc0fe22dedc187bf30 | [] | no_license | Lomazki/IT-Academy.Java_core | https://github.com/Lomazki/IT-Academy.Java_core | 1ad408cb70b161b3395de998cfdd30665d7b2fc8 | 637ccc96847060a3101bcafaa9bb76933a3ee52c | refs/heads/master | 2023-03-01T10:20:09.376000 | 2021-02-06T16:59:33 | 2021-02-06T16:59:33 | 333,447,378 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package by.it.doNotTouch.kondratev.calc;
import by.it.doNotTouch.kondratev.jd01_14.Helper;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
class CalcLogger {
public static CalcLogger calcLogger = new CalcLogger();
private static String path = Helper.getPath(CalcLogger.class, "calclog.txt");
public static List<String > fullReport = new ArrayList<>();
public static List<String > errorsReport = new ArrayList<>();
public static List<String > errorsShortReport = new ArrayList<>();
void log(String message, int i) {
try (PrintWriter pw = new PrintWriter(new FileWriter(path, true)))
{
Date calendar = new Date();
String date = String.format("%1$td.%1$tm.%1$tY", calendar);
String time = String.format("%tH:%tM:%tS", calendar, calendar, calendar);
String result = String.format("%s || %s ||%n%s%n", date, time, message);
pw.printf(result);
switch (i) {
case 1: fullReport.add(result); break;
case 2: errorsReport.add(result); break;
default: errorsShortReport.add(result); break;
}
} catch (IOException e) {
e.printStackTrace();
}
}
private CalcLogger() {
}
public static CalcLogger getInstance() {
CalcLogger local = calcLogger;
if (local==null) {
synchronized (CalcLogger.class) {
local = calcLogger;
if (local==null)
calcLogger = local = new CalcLogger();
}
}
return local;
}
}
| UTF-8 | Java | 1,725 | java | CalcLogger.java | Java | [] | null | [] | package by.it.doNotTouch.kondratev.calc;
import by.it.doNotTouch.kondratev.jd01_14.Helper;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
class CalcLogger {
public static CalcLogger calcLogger = new CalcLogger();
private static String path = Helper.getPath(CalcLogger.class, "calclog.txt");
public static List<String > fullReport = new ArrayList<>();
public static List<String > errorsReport = new ArrayList<>();
public static List<String > errorsShortReport = new ArrayList<>();
void log(String message, int i) {
try (PrintWriter pw = new PrintWriter(new FileWriter(path, true)))
{
Date calendar = new Date();
String date = String.format("%1$td.%1$tm.%1$tY", calendar);
String time = String.format("%tH:%tM:%tS", calendar, calendar, calendar);
String result = String.format("%s || %s ||%n%s%n", date, time, message);
pw.printf(result);
switch (i) {
case 1: fullReport.add(result); break;
case 2: errorsReport.add(result); break;
default: errorsShortReport.add(result); break;
}
} catch (IOException e) {
e.printStackTrace();
}
}
private CalcLogger() {
}
public static CalcLogger getInstance() {
CalcLogger local = calcLogger;
if (local==null) {
synchronized (CalcLogger.class) {
local = calcLogger;
if (local==null)
calcLogger = local = new CalcLogger();
}
}
return local;
}
}
| 1,725 | 0.593044 | 0.587826 | 52 | 32.173077 | 24.9559 | 85 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.826923 | false | false | 9 |
5343b2dbb24dafb88e0bd46a8a4412f8860010b7 | 7,017,976,566,002 | 22cf810032e264ba538fe858334e2280a7ed97c4 | /app/src/main/java/com/androidaura/p3/MainActivity.java | 74c77ee2ecda31ff35154c99958379b4386f0a23 | [] | no_license | vishaltorgal/p3 | https://github.com/vishaltorgal/p3 | d4014a4344bb345f4a9a31b55cdd36fe8fe87b37 | 26df5f060f61cb78a8fc95dad8c742cfda246f95 | refs/heads/master | 2020-11-25T15:34:49.495000 | 2019-12-18T02:28:18 | 2019-12-18T02:28:18 | 228,741,055 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.androidaura.p3;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Toast;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.URL;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.mymenu, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
switch (id){
case R.id.refresh:
new JsonPostRequest().execute();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
private class JsonPostRequest extends AsyncTask<Void, Void, String> {
@Override
protected String doInBackground(Void... voids) {
try {
String address = "http://cs101i:400/query";
JSONObject json = new JSONObject();
json.put("TableName", "student");
String requestBody = json.toString();
URL url = new URL(address);
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
urlConnection.setDoOutput(true);
urlConnection.setRequestProperty("Content-Type", "application/json");
OutputStream outputStream = new BufferedOutputStream(urlConnection.getOutputStream());
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(outputStream, "utf-8"));
writer.write(requestBody);
writer.flush();
writer.close();
outputStream.close();
InputStream inputStream;
// get stream
if (urlConnection.getResponseCode() < HttpURLConnection.HTTP_BAD_REQUEST) {
inputStream = urlConnection.getInputStream();
} else {
inputStream = urlConnection.getErrorStream();
}
// parse stream
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
String temp, response = "";
while ((temp = bufferedReader.readLine()) != null) {
response += temp;
}
JSONObject jsonObject = new JSONObject();
jsonObject.put("Content", response);
jsonObject.put("Message", urlConnection.getResponseMessage());
jsonObject.put("Length", urlConnection.getContentLength());
jsonObject.put("Type", urlConnection.getContentType());
return jsonObject.toString();
} catch (IOException | JSONException e) {
return e.toString();
}
}
@Override
protected void onPostExecute(String result) {
super.onPostExecute(result);
Log.i("vt", "POST RESPONSE: " + result);
// Refresh the Activity
Intent i = new Intent(MainActivity.this, MainActivity.class);
startActivity(i);
}
}
}
| UTF-8 | Java | 3,913 | java | MainActivity.java | Java | [] | null | [] | package com.androidaura.p3;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Toast;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.URL;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.mymenu, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
switch (id){
case R.id.refresh:
new JsonPostRequest().execute();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
private class JsonPostRequest extends AsyncTask<Void, Void, String> {
@Override
protected String doInBackground(Void... voids) {
try {
String address = "http://cs101i:400/query";
JSONObject json = new JSONObject();
json.put("TableName", "student");
String requestBody = json.toString();
URL url = new URL(address);
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
urlConnection.setDoOutput(true);
urlConnection.setRequestProperty("Content-Type", "application/json");
OutputStream outputStream = new BufferedOutputStream(urlConnection.getOutputStream());
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(outputStream, "utf-8"));
writer.write(requestBody);
writer.flush();
writer.close();
outputStream.close();
InputStream inputStream;
// get stream
if (urlConnection.getResponseCode() < HttpURLConnection.HTTP_BAD_REQUEST) {
inputStream = urlConnection.getInputStream();
} else {
inputStream = urlConnection.getErrorStream();
}
// parse stream
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
String temp, response = "";
while ((temp = bufferedReader.readLine()) != null) {
response += temp;
}
JSONObject jsonObject = new JSONObject();
jsonObject.put("Content", response);
jsonObject.put("Message", urlConnection.getResponseMessage());
jsonObject.put("Length", urlConnection.getContentLength());
jsonObject.put("Type", urlConnection.getContentType());
return jsonObject.toString();
} catch (IOException | JSONException e) {
return e.toString();
}
}
@Override
protected void onPostExecute(String result) {
super.onPostExecute(result);
Log.i("vt", "POST RESPONSE: " + result);
// Refresh the Activity
Intent i = new Intent(MainActivity.this, MainActivity.class);
startActivity(i);
}
}
}
| 3,913 | 0.609762 | 0.607718 | 107 | 35.570095 | 25.486706 | 106 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.700935 | false | false | 9 |
5a4bf76779f1747fb75cd077aa286a6cadba8210 | 10,866,267,289,733 | 9d0d622d459be1608c26e4ab09e37ef031661304 | /myBoz/src/com/myweb/bean/Bean.java | 13b210c790b684b08b320e3ec2c30289ef9cd573 | [] | no_license | abc89/myBoz | https://github.com/abc89/myBoz | a839bee2a7c50cd5fb80d32a1d892a2118725cb0 | 3cc3c1b5bc07f6692931ef717f9d87347d3498d9 | refs/heads/master | 2016-05-13T12:41:01.483000 | 2016-03-28T13:19:05 | 2016-03-28T13:19:05 | 53,777,441 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.myweb.bean;
/**
* 基本 用户 数据模型
* @author e7691
*
*/
public abstract class Bean {
//bean 子类类型
public static final String COMMONUSER = "COM";
public static final String VIPUSER = "VIP";
public static final String ARTICLE = "ARTICLE";
//默认类型
public static final String DEFAULTTYPE = "DEFAULTTYPE";
/**
*
* @return bean 子类类型
*/
public abstract String getType();
}
| GB18030 | Java | 465 | java | Bean.java | Java | [
{
"context": " com.myweb.bean;\r\n\r\n/**\r\n * 基本 用户 数据模型\r\n * @author e7691\r\n *\r\n */\r\npublic abstract class Bean {\r\n\t//bean ",
"end": 63,
"score": 0.9994643926620483,
"start": 58,
"tag": "USERNAME",
"value": "e7691"
}
] | null | [] | package com.myweb.bean;
/**
* 基本 用户 数据模型
* @author e7691
*
*/
public abstract class Bean {
//bean 子类类型
public static final String COMMONUSER = "COM";
public static final String VIPUSER = "VIP";
public static final String ARTICLE = "ARTICLE";
//默认类型
public static final String DEFAULTTYPE = "DEFAULTTYPE";
/**
*
* @return bean 子类类型
*/
public abstract String getType();
}
| 465 | 0.623529 | 0.614118 | 21 | 18.238094 | 18.317062 | 58 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.761905 | false | false | 9 |
5ba32d17431af3a2dc8a3ef5b018aedfb0b7933d | 10,419,590,713,922 | 48cb6dab34b53700a2c8921c76b143fff9f83aae | /wisdomreport/src/main/java/com/wslint/wisdomreport/domain/vo/xml/RelationVO.java | b341639e4ced2ed3774e0e174798d72cce17b12f | [] | no_license | ranzhonggeng1/code | https://github.com/ranzhonggeng1/code | 2422703cce046ffaa48f1421280ff35fe29bc38e | ee3c9af0004a05519c1586672b6a3483d6327510 | refs/heads/master | 2020-04-08T14:09:27.450000 | 2018-12-07T04:13:40 | 2018-12-07T04:13:40 | 159,424,616 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.wslint.wisdomreport.domain.vo.xml;
/**
* 方法参数关联关系保存数据对象
*
* @author yuxr
* @since 2018/11/1 16:43
*/
public class RelationVO {
private Long medicineId;
private Long secondId;
private Long functionId;
private Long tableId;
private String code;
private String value;
public Long getMedicineId() {
return medicineId;
}
public void setMedicineId(Long medicineId) {
this.medicineId = medicineId;
}
public Long getSecondId() {
return secondId;
}
public void setSecondId(Long secondId) {
this.secondId = secondId;
}
public Long getFunctionId() {
return functionId;
}
public void setFunctionId(Long functionId) {
this.functionId = functionId;
}
public Long getTableId() {
return tableId;
}
public void setTableId(Long tableId) {
this.tableId = tableId;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}
| UTF-8 | Java | 1,114 | java | RelationVO.java | Java | [
{
"context": "omain.vo.xml;\n\n/**\n * 方法参数关联关系保存数据对象\n *\n * @author yuxr\n * @since 2018/11/1 16:43\n */\npublic class Relati",
"end": 88,
"score": 0.9996961951255798,
"start": 84,
"tag": "USERNAME",
"value": "yuxr"
}
] | null | [] | package com.wslint.wisdomreport.domain.vo.xml;
/**
* 方法参数关联关系保存数据对象
*
* @author yuxr
* @since 2018/11/1 16:43
*/
public class RelationVO {
private Long medicineId;
private Long secondId;
private Long functionId;
private Long tableId;
private String code;
private String value;
public Long getMedicineId() {
return medicineId;
}
public void setMedicineId(Long medicineId) {
this.medicineId = medicineId;
}
public Long getSecondId() {
return secondId;
}
public void setSecondId(Long secondId) {
this.secondId = secondId;
}
public Long getFunctionId() {
return functionId;
}
public void setFunctionId(Long functionId) {
this.functionId = functionId;
}
public Long getTableId() {
return tableId;
}
public void setTableId(Long tableId) {
this.tableId = tableId;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}
| 1,114 | 0.668508 | 0.658379 | 65 | 15.707692 | 14.587374 | 46 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.292308 | false | false | 9 |
e82e996b66cf569f40cdcd260615e9eee5e8f9be | 30,399,778,534,134 | 877b41beb76cc3f2281e48cfebb90493f6c99bc4 | /UserCode/Pets/JavaBubblerTest.java | a59ec997b9276b57ec4fc2b7ecfb452e5d0fe425 | [] | no_license | chrismwilliams/aquarium-sim | https://github.com/chrismwilliams/aquarium-sim | 9c056f6341fdfaaed3b26634477278c322d330dc | 207d9e98430b8cd86c23be17aa88372e03e8195d | refs/heads/master | 2022-06-10T06:11:23.855000 | 2018-10-04T14:13:05 | 2018-10-04T14:13:05 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package UserCode.Pets;
import UserCode.Misc.ArgumentPathDoesNotExist;
import UserCode.Behaviours.IBehaviour;
import static org.junit.Assert.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
/**
* The test class JavaBubblerTest for testing the JavaBubbler production class.
*
* @author Chris Williams & Marc Price
* @version 3.0
*
* Test Conditions:
*
* 1: Construction: all fields are initialised as expected and checked via the object bench
* 2: Construction: check that the inherited setOrientation sets the orientation to 90,90,0
*
*/
public class JavaBubblerTest
{
/**
* Default constructor for test class JavaBubblerTest
*/
public JavaBubblerTest()
{
}
/**
* Sets up the test fixture.
*
* Called before every test case method.
*/
@Before
public void setUp()
{
}
/**
* Tears down the test fixture.
*
* Called after every test case method.
*/
@After
public void tearDown()
{
}
/**
*
* METHOD: Test condition 2:
* Check if the super class setOrientation sets the fields correctly within the token
* The X and Y orientation should be set as 90 in token
* The Z orientation should be 0 in token
*
*/
@Test
public void testCondition2()
{
// DECLARE an instance of Token, call it '_token':
IToken _token = null;
// CORRECT use of throw tested in token:
try
{
_token = new Token("textures/javaFish/Bubbler.png");
}
catch(ArgumentPathDoesNotExist e)
{
// TESTED in token
}
// DECLARE and initialise an instance of JavaBubbler, call it 'JavaBubbler':
IBehaviour _bubbler = new JavaBubbler(_token);
// DECLARE and intialise an array of type double to store the call to getOrientation, call it '_rtnOrientation':
double[] _rntOrientation = _token.getOrientation();
// CHECK if the X orientation in _token is 90:
assertEquals(_rntOrientation[0], 90.0, 0.0);
// CHECK if the Y orientation in _token is 90:
assertEquals(_rntOrientation[1], 90.0, 0.0);
// CHECK if the Z orientation in _token is 0:
assertEquals(_rntOrientation[2], 0.0, 0.0);
}
}
| UTF-8 | Java | 2,452 | java | JavaBubblerTest.java | Java | [
{
"context": "the JavaBubbler production class.\r\n *\r\n * @author Chris Williams & Marc Price\r\n * @version 3.0\r\n * \r\n * Test Condi",
"end": 344,
"score": 0.9998297691345215,
"start": 330,
"tag": "NAME",
"value": "Chris Williams"
},
{
"context": "roduction class.\r\n *\r\n * ... | null | [] | package UserCode.Pets;
import UserCode.Misc.ArgumentPathDoesNotExist;
import UserCode.Behaviours.IBehaviour;
import static org.junit.Assert.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
/**
* The test class JavaBubblerTest for testing the JavaBubbler production class.
*
* @author <NAME> & <NAME>
* @version 3.0
*
* Test Conditions:
*
* 1: Construction: all fields are initialised as expected and checked via the object bench
* 2: Construction: check that the inherited setOrientation sets the orientation to 90,90,0
*
*/
public class JavaBubblerTest
{
/**
* Default constructor for test class JavaBubblerTest
*/
public JavaBubblerTest()
{
}
/**
* Sets up the test fixture.
*
* Called before every test case method.
*/
@Before
public void setUp()
{
}
/**
* Tears down the test fixture.
*
* Called after every test case method.
*/
@After
public void tearDown()
{
}
/**
*
* METHOD: Test condition 2:
* Check if the super class setOrientation sets the fields correctly within the token
* The X and Y orientation should be set as 90 in token
* The Z orientation should be 0 in token
*
*/
@Test
public void testCondition2()
{
// DECLARE an instance of Token, call it '_token':
IToken _token = null;
// CORRECT use of throw tested in token:
try
{
_token = new Token("textures/javaFish/Bubbler.png");
}
catch(ArgumentPathDoesNotExist e)
{
// TESTED in token
}
// DECLARE and initialise an instance of JavaBubbler, call it 'JavaBubbler':
IBehaviour _bubbler = new JavaBubbler(_token);
// DECLARE and intialise an array of type double to store the call to getOrientation, call it '_rtnOrientation':
double[] _rntOrientation = _token.getOrientation();
// CHECK if the X orientation in _token is 90:
assertEquals(_rntOrientation[0], 90.0, 0.0);
// CHECK if the Y orientation in _token is 90:
assertEquals(_rntOrientation[1], 90.0, 0.0);
// CHECK if the Z orientation in _token is 0:
assertEquals(_rntOrientation[2], 0.0, 0.0);
}
}
| 2,440 | 0.59217 | 0.577488 | 92 | 24.652174 | 26.14443 | 120 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.271739 | false | false | 9 |
9e02478e5f32d9207002e9233de3b472c927111c | 26,671,746,921,629 | 51c7f8870beef59bf24095abfd5ef67c1f28f91a | /src/model/Comentario.java | 3274d0ac7f226bcbf7289aa26904c0a6cead5b79 | [] | no_license | ivanezeqgonzalez/TP-objetos2 | https://github.com/ivanezeqgonzalez/TP-objetos2 | 86ca14cb4ec02a8f3b012688584579f9889438ff | cd2eca564214d918bf7d4806e069d884db04ac5e | refs/heads/master | 2020-08-04T13:04:57.452000 | 2019-12-08T22:28:34 | 2019-12-08T22:28:34 | 212,145,715 | 1 | 1 | null | false | 2019-12-07T18:49:23 | 2019-10-01T16:31:45 | 2019-12-07T17:29:10 | 2019-12-07T18:49:22 | 1,626 | 0 | 0 | 0 | Java | false | false | package model;
public class Comentario {
private String nombreUsuario;
private String comentario;
public Comentario(Usuario usuario, String comentario) {
super();
this.nombreUsuario = usuario.getNombreCompleto();
this.comentario = comentario;
}
public String getNombreUsuario() {
return nombreUsuario;
}
public String getComentario() {
return comentario;
}
}
| UTF-8 | Java | 418 | java | Comentario.java | Java | [] | null | [] | package model;
public class Comentario {
private String nombreUsuario;
private String comentario;
public Comentario(Usuario usuario, String comentario) {
super();
this.nombreUsuario = usuario.getNombreCompleto();
this.comentario = comentario;
}
public String getNombreUsuario() {
return nombreUsuario;
}
public String getComentario() {
return comentario;
}
}
| 418 | 0.684211 | 0.684211 | 26 | 14.076923 | 16.746809 | 56 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.230769 | false | false | 9 |
23bfdb6dcb71819d475dee6e96e874584fcdaf9b | 3,831,110,847,721 | ee088584b1e0e8067e49b1fb3a66cfa3cd8e12ba | /src/zadanie1_variant8/JFrame1.java | f642248f6eff7b7cb5f6e316b39b94ffa570c9b5 | [] | no_license | Fyzek/Java-Swing-tasks | https://github.com/Fyzek/Java-Swing-tasks | 5e8b7328eb97340d9cdc5ddd24c920a5954436e1 | fda771fa1f4f31517b2fc38bdbd433a0582f666d | refs/heads/master | 2021-01-18T18:04:16.939000 | 2017-05-18T18:59:05 | 2017-05-18T18:59:05 | 86,840,607 | 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 zadanie1_variant8;
import java.text.DecimalFormat;
import javax.swing.JOptionPane;
import static zadanie1_variant8.MatrixCalculation.*;
/**
*
* @author User
*/
public class JFrame1 extends javax.swing.JFrame {
/**
* Creates new form JFrame1
*/
public JFrame1() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jTabbedPane1 = new javax.swing.JTabbedPane();
jPanel1 = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
jTextArea1 = new javax.swing.JTextArea();
textField1 = new java.awt.TextField();
textField2 = new java.awt.TextField();
textField3 = new java.awt.TextField();
textField4 = new java.awt.TextField();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jButton1 = new javax.swing.JButton();
jLabel5 = new javax.swing.JLabel();
jPanel2 = new javax.swing.JPanel();
jScrollPane3 = new javax.swing.JScrollPane();
jTextArea3 = new javax.swing.JTextArea();
jTextField1 = new javax.swing.JTextField();
jTextField2 = new javax.swing.JTextField();
jTextField3 = new javax.swing.JTextField();
jTextField4 = new javax.swing.JTextField();
jTextField5 = new javax.swing.JTextField();
jTextField6 = new javax.swing.JTextField();
jTextField7 = new javax.swing.JTextField();
jTextField8 = new javax.swing.JTextField();
jTextField9 = new javax.swing.JTextField();
jLabel6 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
jLabel8 = new javax.swing.JLabel();
jLabel9 = new javax.swing.JLabel();
jLabel10 = new javax.swing.JLabel();
jLabel11 = new javax.swing.JLabel();
jLabel12 = new javax.swing.JLabel();
jLabel13 = new javax.swing.JLabel();
jLabel14 = new javax.swing.JLabel();
jLabel15 = new javax.swing.JLabel();
jLabel16 = new javax.swing.JLabel();
jLabel17 = new javax.swing.JLabel();
jButton2 = new javax.swing.JButton();
jTextField10 = new javax.swing.JTextField();
jPanel3 = new javax.swing.JPanel();
jScrollPane4 = new javax.swing.JScrollPane();
jTextArea4 = new javax.swing.JTextArea();
jTextField3_1 = new javax.swing.JTextField();
jTextField3_2 = new javax.swing.JTextField();
jLabel18 = new javax.swing.JLabel();
jLabel19 = new javax.swing.JLabel();
jButton3 = new javax.swing.JButton();
jPanel4 = new javax.swing.JPanel();
jScrollPane5 = new javax.swing.JScrollPane();
jTextArea5 = new javax.swing.JTextArea();
jLabel20 = new javax.swing.JLabel();
jTextField3_3 = new javax.swing.JTextField();
jButton4 = new javax.swing.JButton();
jTextField3_4 = new javax.swing.JTextField();
jTextField3_5 = new javax.swing.JTextField();
jLabel21 = new javax.swing.JLabel();
jLabel22 = new javax.swing.JLabel();
jPanel5 = new javax.swing.JPanel();
jScrollPane6 = new javax.swing.JScrollPane();
jTextArea6 = new javax.swing.JTextArea();
jLabel23 = new javax.swing.JLabel();
jTextField3_6 = new javax.swing.JTextField();
jLabel24 = new javax.swing.JLabel();
jTextField3_7 = new javax.swing.JTextField();
jLabel25 = new javax.swing.JLabel();
jTextField3_8 = new javax.swing.JTextField();
jLabel26 = new javax.swing.JLabel();
jTextField3_9 = new javax.swing.JTextField();
jTextField3_10 = new javax.swing.JTextField();
jButton5 = new javax.swing.JButton();
jPanel6 = new javax.swing.JPanel();
jScrollPane7 = new javax.swing.JScrollPane();
jTextArea7 = new javax.swing.JTextArea();
jButton6 = new javax.swing.JButton();
jScrollPane8 = new javax.swing.JScrollPane();
jTextArea8 = new javax.swing.JTextArea();
jLabel27 = new javax.swing.JLabel();
jLabel28 = new javax.swing.JLabel();
jLabel29 = new javax.swing.JLabel();
jScrollPane2 = new javax.swing.JScrollPane();
jTextArea2 = new javax.swing.JTextArea();
jLabel30 = new javax.swing.JLabel();
jLabel31 = new javax.swing.JLabel();
jLabel32 = new javax.swing.JLabel();
jPanel7 = new javax.swing.JPanel();
jScrollPane9 = new javax.swing.JScrollPane();
jTextArea9 = new javax.swing.JTextArea();
jLabel34 = new javax.swing.JLabel();
jTextField11 = new javax.swing.JTextField();
jTextField12 = new javax.swing.JTextField();
jTextField13 = new javax.swing.JTextField();
jTextField14 = new javax.swing.JTextField();
jTextField15 = new javax.swing.JTextField();
jTextField16 = new javax.swing.JTextField();
jTextField17 = new javax.swing.JTextField();
jTextField18 = new javax.swing.JTextField();
jLabel35 = new javax.swing.JLabel();
jLabel36 = new javax.swing.JLabel();
jTextField19 = new javax.swing.JTextField();
jTextField20 = new javax.swing.JTextField();
jTextField21 = new javax.swing.JTextField();
jLabel38 = new javax.swing.JLabel();
jTextField27 = new javax.swing.JTextField();
jTextField28 = new javax.swing.JTextField();
jTextField29 = new javax.swing.JTextField();
jTextField30 = new javax.swing.JTextField();
jTextField31 = new javax.swing.JTextField();
jButton7 = new javax.swing.JButton();
jButton8 = new javax.swing.JButton();
jLabel33 = new javax.swing.JLabel();
jTextField22 = new javax.swing.JTextField();
jTextField23 = new javax.swing.JTextField();
jTextField24 = new javax.swing.JTextField();
jTextField25 = new javax.swing.JTextField();
jScrollPane10 = new javax.swing.JScrollPane();
jTextArea10 = new javax.swing.JTextArea();
jPanel8 = new javax.swing.JPanel();
jLabel37 = new javax.swing.JLabel();
jTextField26 = new javax.swing.JTextField();
jTextField32 = new javax.swing.JTextField();
jTextField33 = new javax.swing.JTextField();
jLabel39 = new javax.swing.JLabel();
jLabel40 = new javax.swing.JLabel();
jLabel41 = new javax.swing.JLabel();
jScrollPane11 = new javax.swing.JScrollPane();
jTextArea11 = new javax.swing.JTextArea();
jButton9 = new javax.swing.JButton();
jTextField34 = new javax.swing.JTextField();
jTextField35 = new javax.swing.JTextField();
jTextField36 = new javax.swing.JTextField();
jLabel42 = new javax.swing.JLabel();
jLabel43 = new javax.swing.JLabel();
jLabel44 = new javax.swing.JLabel();
jPanel9 = new javax.swing.JPanel();
jScrollPane12 = new javax.swing.JScrollPane();
jTextArea12 = new javax.swing.JTextArea();
jTextField37 = new javax.swing.JTextField();
jLabel45 = new javax.swing.JLabel();
jScrollPane13 = new javax.swing.JScrollPane();
jTextArea13 = new javax.swing.JTextArea();
jTextField38 = new javax.swing.JTextField();
jLabel46 = new javax.swing.JLabel();
jTextField39 = new javax.swing.JTextField();
jLabel47 = new javax.swing.JLabel();
jTextField40 = new javax.swing.JTextField();
jLabel48 = new javax.swing.JLabel();
jButton10 = new javax.swing.JButton();
jTextField41 = new javax.swing.JTextField();
jLabel49 = new javax.swing.JLabel();
jScrollPane14 = new javax.swing.JScrollPane();
jTextArea14 = new javax.swing.JTextArea();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("Вычислительная практика.Ражков А.Ф.");
setLocation(new java.awt.Point(200, 400));
setResizable(false);
jTabbedPane1.setName(""); // NOI18N
jTextArea1.setEditable(false);
jTextArea1.setColumns(20);
jTextArea1.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
jTextArea1.setRows(5);
jTextArea1.setText("Напишите программу на языке Java расчета y и z по формулам.\nПредусмотрите ввод исходных данных с экрана дисплея. \nПредварительно вычислите ожидаемые значения y и z с помощью калькулятора.\nУбедитесь, что значения, вычисленные с помощью калькулятора,\nсовпадают с результатами, которые получаются в результате работы программы.\nОпределить разность между значениями y и z. ");
jScrollPane1.setViewportView(jTextArea1);
textField1.setText("5");
textField1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
textField1ActionPerformed(evt);
}
});
textField2.setEditable(false);
textField3.setEditable(false);
textField4.setEditable(false);
textField4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
textField4ActionPerformed(evt);
}
});
jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/zadanie1_variant8/picture1.png"))); // NOI18N
jLabel1.setText("jLabel1");
jLabel1.setBorder(javax.swing.BorderFactory.createEtchedBorder());
jLabel2.setFont(new java.awt.Font("Arial", 0, 16)); // NOI18N
jLabel2.setText("Введите α (°):");
jLabel3.setFont(new java.awt.Font("Arial", 0, 16)); // NOI18N
jLabel3.setText("Вывод y:");
jLabel4.setFont(new java.awt.Font("Arial", 0, 16)); // NOI18N
jLabel4.setText("Вывод z:");
jButton1.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
jButton1.setText("Вывод");
jButton1.setToolTipText("");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jLabel5.setFont(new java.awt.Font("Arial", 0, 16)); // NOI18N
jLabel5.setText("Разность y и z:");
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 197, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2)
.addComponent(jLabel3))
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(textField1, javax.swing.GroupLayout.PREFERRED_SIZE, 271, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(31, 31, 31)
.addComponent(textField2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
.addComponent(jButton1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel5)
.addComponent(jLabel4))
.addGap(24, 24, 24)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(textField3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(textField4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))))
.addContainerGap())
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(11, 11, 11)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(textField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(textField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel3))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(textField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel4))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(textField4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel5)))
.addComponent(jLabel1))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jTabbedPane1.addTab("№1", jPanel1);
jTextArea3.setEditable(false);
jTextArea3.setColumns(20);
jTextArea3.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
jTextArea3.setRows(5);
jTextArea3.setText(" Определите, у какой из трех фигур площадь больше: \n● треугольник со стороной a и высотой h. \n● параллелограмм со стороной b и высотой hb, опущенной на эту сторону. \n● шестиугольник со стороной c и радиусом r вписанной окружности. ");
jScrollPane3.setViewportView(jTextArea3);
jTextField1.setText("3");
jTextField2.setText("3");
jTextField3.setText("4");
jTextField4.setText("3");
jTextField4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField4ActionPerformed(evt);
}
});
jTextField5.setText("4");
jTextField6.setText("5");
jTextField7.setEditable(false);
jTextField8.setEditable(false);
jTextField9.setEditable(false);
jLabel6.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jLabel6.setText("Треугольник");
jLabel7.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jLabel7.setText("Параллелограмм");
jLabel8.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jLabel8.setText("Шестиугольник");
jLabel9.setText("Сторона a:");
jLabel10.setText("Высота h:");
jLabel11.setText("Сторона b:");
jLabel12.setText("Высота hb:");
jLabel13.setText("Сторона c:");
jLabel14.setText("Радиус r:");
jLabel15.setText("Площадь:");
jLabel16.setText("Площадь:");
jLabel17.setText("Площадь:");
jButton2.setText("Вывод");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
jTextField10.setEditable(false);
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jScrollPane3)
.addContainerGap())
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(20, 20, 20)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel6)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel9)
.addComponent(jLabel10))
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
.addGap(4, 4, 4)
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)))))
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jLabel15)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jTextField7, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 106, Short.MAX_VALUE)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jLabel11)
.addGap(10, 10, 10)
.addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jLabel7)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
.addComponent(jLabel12, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
.addComponent(jLabel16, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jTextField8, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 107, Short.MAX_VALUE)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel8)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(4, 4, 4)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel14)
.addComponent(jLabel13)
.addComponent(jLabel17))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField9, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addGap(37, 37, 37))
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jTextField10)
.addContainerGap())
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(250, 250, 250)
.addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 185, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
.addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel6)
.addComponent(jLabel7)
.addComponent(jLabel8))
.addGap(9, 9, 9)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel9)
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel11)
.addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel13))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel10)
.addComponent(jLabel12)
.addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel14)
.addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jTextField7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel15)
.addComponent(jTextField8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel16)
.addComponent(jLabel17)
.addComponent(jTextField9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(4, 4, 4)
.addComponent(jTextField10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton2)
.addContainerGap(51, Short.MAX_VALUE))
);
jTabbedPane1.addTab("№2", jPanel2);
jTextArea4.setEditable(false);
jTextArea4.setColumns(20);
jTextArea4.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
jTextArea4.setRows(5);
jTextArea4.setText("\nВводится последовательность из N вещественных чисел. \nОпределить наименьшее число, среди чисел, больших 20. ");
jScrollPane4.setViewportView(jTextArea4);
jTextField3_1.setText("3 6 1 20 21 5 25 9 0");
jTextField3_1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField3_1ActionPerformed(evt);
}
});
jTextField3_2.setEditable(false);
jLabel18.setText("Ввод массива(между элементами пробел)");
jLabel19.setText("Наименьшее число, среди чисел, больших 20");
jButton3.setText("Вывод числа");
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGap(231, 231, 231)
.addComponent(jLabel18))
.addGroup(jPanel3Layout.createSequentialGroup()
.addGap(219, 219, 219)
.addComponent(jLabel19))
.addGroup(jPanel3Layout.createSequentialGroup()
.addGap(156, 156, 156)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 371, Short.MAX_VALUE)
.addComponent(jTextField3_1)
.addComponent(jTextField3_2)))
.addGroup(jPanel3Layout.createSequentialGroup()
.addGap(285, 285, 285)
.addComponent(jButton3)))
.addContainerGap(164, Short.MAX_VALUE))
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel18)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField3_1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel19)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField3_2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton3)
.addGap(0, 90, Short.MAX_VALUE))
);
jTabbedPane1.addTab("№3", jPanel3);
jTextArea5.setEditable(false);
jTextArea5.setColumns(20);
jTextArea5.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
jTextArea5.setRows(5);
jTextArea5.setText("Вводится последовательность целых чисел.\nДля каждого числа последовательности проверить, представляют ли его цифры строго \nвозрастающую последовательность, например, \n6543 (результатом функции будет 1 – Да, 0 - НЕТ). ");
jScrollPane5.setViewportView(jTextArea5);
jLabel20.setText("Ввод последовательности целых чисел");
jTextField3_3.setText("2341 6543 1234");
jTextField3_3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField3_3ActionPerformed(evt);
}
});
jButton4.setText("Вывод");
jButton4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton4ActionPerformed(evt);
}
});
jTextField3_4.setEditable(false);
jTextField3_4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField3_4ActionPerformed(evt);
}
});
jTextField3_5.setEditable(false);
jTextField3_5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField3_5ActionPerformed(evt);
}
});
jLabel21.setText("Числа,цифры которых являются строго возрастающей последовательностью");
jLabel22.setText("Результат функции для каждого числа");
javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
jPanel4.setLayout(jPanel4Layout);
jPanel4Layout.setHorizontalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane5, javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jTextField3_3)
.addComponent(jTextField3_4, javax.swing.GroupLayout.Alignment.TRAILING)))
.addGroup(jPanel4Layout.createSequentialGroup()
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addGap(143, 143, 143)
.addComponent(jLabel21))
.addGroup(jPanel4Layout.createSequentialGroup()
.addGap(244, 244, 244)
.addComponent(jLabel22))
.addGroup(jPanel4Layout.createSequentialGroup()
.addGap(237, 237, 237)
.addComponent(jLabel20))
.addGroup(jPanel4Layout.createSequentialGroup()
.addGap(307, 307, 307)
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jTextField3_5, javax.swing.GroupLayout.DEFAULT_SIZE, 87, Short.MAX_VALUE)
.addComponent(jButton4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
.addGap(0, 135, Short.MAX_VALUE)))
.addContainerGap())
);
jPanel4Layout.setVerticalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel20)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField3_3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(3, 3, 3)
.addComponent(jLabel21, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField3_4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel22)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField3_5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton4)
.addGap(47, 47, 47))
);
jTabbedPane1.addTab("№4", jPanel4);
jScrollPane6.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
jScrollPane6.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
jTextArea6.setEditable(false);
jTextArea6.setColumns(20);
jTextArea6.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
jTextArea6.setRows(5);
jTextArea6.setText("В массиве целых чисел Х(k) поменять местами первый и минимальный элементы. \nУдалить все простые элементы, стоящие после максимального элемента. \nНайти среднее арифметическое элементов массива до и после удаления.");
jScrollPane6.setViewportView(jTextArea6);
jLabel23.setText("Ввод последовательности целых чисел");
jTextField3_6.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jTextField3_6.setText("3 5 4 7 8 -5 1 7 20 4 5 2 1");
jTextField3_6.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField3_6ActionPerformed(evt);
}
});
jLabel24.setText("Первый и минимальный элемент поменялись местами");
jTextField3_7.setEditable(false);
jTextField3_7.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField3_7ActionPerformed(evt);
}
});
jLabel25.setText("Удаление всех простых элементов, стоящих после максимального элемента");
jTextField3_8.setEditable(false);
jTextField3_8.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField3_8ActionPerformed(evt);
}
});
jLabel26.setText("Среднее арифметическое элементов массива до и после удаления");
jTextField3_9.setEditable(false);
jTextField3_9.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField3_9ActionPerformed(evt);
}
});
jTextField3_10.setEditable(false);
jTextField3_10.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField3_10ActionPerformed(evt);
}
});
jButton5.setText("Вывод");
jButton5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton5ActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
jPanel5.setLayout(jPanel5Layout);
jPanel5Layout.setHorizontalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel5Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane6)
.addComponent(jTextField3_6, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jTextField3_7)
.addComponent(jTextField3_10)
.addGroup(jPanel5Layout.createSequentialGroup()
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel5Layout.createSequentialGroup()
.addGap(136, 136, 136)
.addComponent(jLabel25))
.addGroup(jPanel5Layout.createSequentialGroup()
.addGap(228, 228, 228)
.addComponent(jLabel23))
.addGroup(jPanel5Layout.createSequentialGroup()
.addGap(194, 194, 194)
.addComponent(jLabel24))
.addGroup(jPanel5Layout.createSequentialGroup()
.addGap(162, 162, 162)
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(jPanel5Layout.createSequentialGroup()
.addComponent(jTextField3_8, javax.swing.GroupLayout.PREFERRED_SIZE, 139, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jTextField3_9, javax.swing.GroupLayout.PREFERRED_SIZE, 139, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jLabel26, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
.addGap(0, 145, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 363, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE)))
.addContainerGap())
);
jPanel5Layout.setVerticalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel5Layout.createSequentialGroup()
.addComponent(jScrollPane6, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel23)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField3_6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(1, 1, 1)
.addComponent(jLabel24)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField3_7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(1, 1, 1)
.addComponent(jLabel25, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField3_10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(1, 1, 1)
.addComponent(jLabel26)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jTextField3_9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField3_8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton5)
.addContainerGap())
);
jTabbedPane1.addTab("№5", jPanel5);
jScrollPane7.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
jScrollPane7.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
jTextArea7.setEditable(false);
jTextArea7.setColumns(20);
jTextArea7.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
jTextArea7.setRows(5);
jTextArea7.setText("Обработка двумерных массивов.В программе предусмотреть диалог, откуда будут вводится \nэлементы исходной матрицы – с клавиатуры или из текстового файла. \nРезультаты выводить на экран и в результирующий текстовый файл.Матрицу выводить до и после преобразований. \n\nЗадана матрица A(n,n). Зеркально отразить ее относительно побочной диагонали. \nВ преобразованной матрице найти столбцы, элементы которых образуют убывающую последовательность. ");
jTextArea7.setFocusable(false);
jScrollPane7.setViewportView(jTextArea7);
jButton6.setText("Ввод матрицы");
jButton6.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton6ActionPerformed(evt);
}
});
jScrollPane8.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
jScrollPane8.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
jTextArea8.setEditable(false);
jTextArea8.setColumns(20);
jTextArea8.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
jTextArea8.setRows(5);
jTextArea8.setText(" 1 2 1\n 4 5 3\n 7 9 10\n");
jScrollPane8.setViewportView(jTextArea8);
jLabel27.setText("Пример ввода матрицы с клавиатуры");
jLabel28.setText("Перед вводом каждой строки - Space");
jLabel29.setText("После последнего элемента - Enter");
jScrollPane2.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
jScrollPane2.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
jTextArea2.setEditable(false);
jTextArea2.setColumns(20);
jTextArea2.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
jTextArea2.setRows(5);
jTextArea2.setText("3 3\n4 3 2 1 2 0 3 1 2");
jScrollPane2.setViewportView(jTextArea2);
jLabel30.setText("Пример ввода матрицы из текстового файла");
jLabel31.setText("В первой строке указываются количество строк и столбцов");
jLabel32.setText("Во второй строке - элементы матрицы");
javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
jPanel6.setLayout(jPanel6Layout);
jPanel6Layout.setHorizontalGroup(
jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel6Layout.createSequentialGroup()
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel6Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane7))
.addGroup(jPanel6Layout.createSequentialGroup()
.addGap(285, 285, 285)
.addComponent(jButton6)
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup()
.addContainerGap(71, Short.MAX_VALUE)
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel27, javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel29)
.addComponent(jLabel28)
.addGroup(jPanel6Layout.createSequentialGroup()
.addGap(58, 58, 58)
.addComponent(jScrollPane8, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel6Layout.createSequentialGroup()
.addGap(111, 111, 111)
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel32)
.addComponent(jLabel31)
.addComponent(jLabel30)))
.addGroup(jPanel6Layout.createSequentialGroup()
.addGap(163, 163, 163)
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)))))
.addContainerGap())
);
jPanel6Layout.setVerticalGroup(
jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel6Layout.createSequentialGroup()
.addComponent(jScrollPane7, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton6)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel27)
.addComponent(jLabel30))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 69, Short.MAX_VALUE)
.addComponent(jScrollPane8, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel29)
.addComponent(jLabel31))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel28)
.addComponent(jLabel32))
.addGap(47, 47, 47))
);
jTabbedPane1.addTab("№6", jPanel6);
jScrollPane9.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
jScrollPane9.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
jTextArea9.setEditable(false);
jTextArea9.setColumns(20);
jTextArea9.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
jTextArea9.setRows(5);
jTextArea9.setText(" \t\t Решение задач линейной алгебры.\n Проверить, образуют ли базис векторы. Если образуют, то найти x = [1 −1 3 −1]^T в этом базисе.\n Для решения задачи необходимо показать, что определитель матрицы F со столбцами \nf1,f2, f3, f4 отличен от нуля, а затем вычислить координаты вектора x в новом базисе по формуле y=(F^1)*x. ");
jTextArea9.setFocusable(false);
jScrollPane9.setViewportView(jTextArea9);
jLabel34.setText("f1 =");
jTextField11.setText("1");
jTextField12.setText("-2");
jTextField13.setText("1");
jTextField14.setText("1");
jTextField15.setText("2");
jTextField16.setText("-1");
jTextField17.setText("1");
jTextField18.setText("-1");
jLabel35.setText("f2 =");
jLabel36.setText("f3 =");
jTextField19.setText("5");
jTextField20.setText("-2");
jTextField21.setText("-3");
jLabel38.setText("f4 =");
jTextField27.setText("1");
jTextField28.setText("-1");
jTextField29.setText("1");
jTextField30.setText("-1");
jTextField31.setText("1");
jButton7.setText("Решение задачи");
jButton7.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton7ActionPerformed(evt);
}
});
jButton8.setText("Доп. Информация");
jButton8.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton8ActionPerformed(evt);
}
});
jLabel33.setText("x =");
jTextField22.setText("1");
jTextField23.setText("-1");
jTextField23.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField23ActionPerformed(evt);
}
});
jTextField24.setText("3");
jTextField25.setText("-1");
jTextArea10.setEditable(false);
jTextArea10.setColumns(20);
jTextArea10.setRows(5);
jScrollPane10.setViewportView(jTextArea10);
javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
jPanel7.setLayout(jPanel7Layout);
jPanel7Layout.setHorizontalGroup(
jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane9)
.addGroup(jPanel7Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel7Layout.createSequentialGroup()
.addComponent(jLabel34)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jTextField14)
.addComponent(jTextField13)
.addComponent(jTextField11)
.addComponent(jTextField12, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel35)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jTextField15)
.addComponent(jTextField16)
.addComponent(jTextField17)
.addComponent(jTextField18, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addComponent(jLabel36)
.addGap(19, 19, 19)
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jTextField21)
.addComponent(jTextField19)
.addComponent(jTextField20)
.addComponent(jTextField31))
.addGap(18, 18, 18)
.addComponent(jLabel38)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jTextField28)
.addComponent(jTextField27)
.addComponent(jTextField29)
.addComponent(jTextField30, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addComponent(jScrollPane10, javax.swing.GroupLayout.DEFAULT_SIZE, 426, Short.MAX_VALUE))
.addGroup(jPanel7Layout.createSequentialGroup()
.addComponent(jLabel33)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jTextField22, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField23, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField24, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField25, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jButton8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton7, javax.swing.GroupLayout.PREFERRED_SIZE, 401, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap())))
);
jPanel7Layout.setVerticalGroup(
jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel7Layout.createSequentialGroup()
.addComponent(jScrollPane9, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(1, 1, 1)
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel7Layout.createSequentialGroup()
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel38, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel7Layout.createSequentialGroup()
.addGap(1, 1, 1)
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel7Layout.createSequentialGroup()
.addComponent(jTextField27, javax.swing.GroupLayout.DEFAULT_SIZE, 31, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField28, javax.swing.GroupLayout.DEFAULT_SIZE, 32, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField29, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(10, 10, 10)
.addComponent(jTextField30, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel7Layout.createSequentialGroup()
.addComponent(jTextField19)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField20)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField21, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(10, 10, 10)
.addComponent(jTextField31, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))))
.addGap(111, 111, 111))
.addGroup(jPanel7Layout.createSequentialGroup()
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(jLabel36, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel7Layout.createSequentialGroup()
.addGap(3, 3, 3)
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(jPanel7Layout.createSequentialGroup()
.addComponent(jTextField11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField12, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField13, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField14, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel7Layout.createSequentialGroup()
.addComponent(jTextField15, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField16, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField17, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField18, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jLabel35, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel34, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
.addComponent(jScrollPane10, javax.swing.GroupLayout.PREFERRED_SIZE, 138, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton8)
.addComponent(jLabel33)
.addComponent(jTextField22, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField25, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField24, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField23, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(1, 1, 1)
.addComponent(jButton7)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
);
jTabbedPane1.addTab("№7", jPanel7);
jLabel37.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel37.setIcon(new javax.swing.ImageIcon(getClass().getResource("/zadanie1_variant8/nomer8_1.png"))); // NOI18N
jLabel37.setBorder(javax.swing.BorderFactory.createEtchedBorder());
jTextField26.setText("2");
jTextField32.setText("3");
jTextField33.setText("5");
jLabel39.setText("ax");
jLabel40.setText("ay");
jLabel41.setText("az");
jTextArea11.setEditable(false);
jTextArea11.setColumns(20);
jTextArea11.setRows(5);
jScrollPane11.setViewportView(jTextArea11);
jButton9.setText("Вывод");
jButton9.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton9ActionPerformed(evt);
}
});
jTextField34.setText("2");
jTextField35.setText("4");
jTextField36.setText("3");
jLabel42.setText("bx");
jLabel43.setText("by");
jLabel44.setText("bz");
javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
jPanel8.setLayout(jPanel8Layout);
jPanel8Layout.setHorizontalGroup(
jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel37, javax.swing.GroupLayout.PREFERRED_SIZE, 691, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel8Layout.createSequentialGroup()
.addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel8Layout.createSequentialGroup()
.addGap(32, 32, 32)
.addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel40)
.addGroup(jPanel8Layout.createSequentialGroup()
.addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel39)
.addComponent(jLabel41, javax.swing.GroupLayout.Alignment.TRAILING))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jTextField33)
.addComponent(jTextField32)
.addComponent(jTextField26, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addGap(18, 18, 18)
.addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel43)
.addGroup(jPanel8Layout.createSequentialGroup()
.addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel42)
.addComponent(jLabel44, javax.swing.GroupLayout.Alignment.TRAILING))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jTextField36)
.addComponent(jTextField35)
.addComponent(jTextField34, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)))))
.addGroup(jPanel8Layout.createSequentialGroup()
.addGap(116, 116, 116)
.addComponent(jButton9, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(18, 18, 18)
.addComponent(jScrollPane11)
.addGap(25, 25, 25))
);
jPanel8Layout.setVerticalGroup(
jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel8Layout.createSequentialGroup()
.addComponent(jLabel37)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane11, javax.swing.GroupLayout.PREFERRED_SIZE, 149, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel8Layout.createSequentialGroup()
.addGap(20, 20, 20)
.addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel8Layout.createSequentialGroup()
.addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel39)
.addComponent(jTextField26, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(1, 1, 1)
.addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jTextField32, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel40))
.addGap(1, 1, 1)
.addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jTextField33, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel41)))
.addGroup(jPanel8Layout.createSequentialGroup()
.addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel42)
.addComponent(jTextField34, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(1, 1, 1)
.addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jTextField35, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel43))
.addGap(1, 1, 1)
.addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jTextField36, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel44))))
.addGap(18, 18, 18)
.addComponent(jButton9)))
.addGap(28, 28, 28))
);
jTabbedPane1.addTab("№8", jPanel8);
jScrollPane12.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
jScrollPane12.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
jTextArea12.setEditable(false);
jTextArea12.setColumns(20);
jTextArea12.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
jTextArea12.setRows(5);
jTextArea12.setText("Создать класс круг, член класса - R. Предусмотреть в классе методы вычисления и вывода сведений \nо фигуре – площади, длины окружности.Создать производный класс – конус с высотой h, добавить в класс метод\nопределения объема фигуры, перегрузить методы расчета площади и вывода сведений о фигуре. \nНаписать программу, демонстрирующую работу с классом: дано N кругов и M конусов, найти количество \nкругов, у которых площадь меньше средней площади всех кругов, и наибольший по объему конус.");
jTextArea12.setFocusable(false);
jScrollPane12.setViewportView(jTextArea12);
jTextField37.setText("2 5 4 5");
jLabel45.setText("R");
jScrollPane13.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
jScrollPane13.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
jTextArea13.setEditable(false);
jTextArea13.setColumns(20);
jTextArea13.setFont(new java.awt.Font("Monospaced", 0, 14)); // NOI18N
jTextArea13.setRows(5);
jTextArea13.setText("Количество кругов и \nконусов определяется \nколичеством введенных \nрадиусов,высот фигур.");
jTextArea13.setFocusable(false);
jScrollPane13.setViewportView(jTextArea13);
jTextField38.setEditable(false);
jTextField38.setToolTipText("");
jLabel46.setText("N");
jTextField39.setEditable(false);
jLabel47.setText("M");
jTextField40.setText("3 4");
jLabel48.setText("r");
jButton10.setText("Вывод");
jButton10.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton10ActionPerformed(evt);
}
});
jTextField41.setText("3 3");
jLabel49.setText("h");
jScrollPane14.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
jScrollPane14.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
jTextArea14.setEditable(false);
jTextArea14.setColumns(20);
jTextArea14.setFont(new java.awt.Font("Monospaced", 0, 14)); // NOI18N
jTextArea14.setRows(5);
jTextArea14.setFocusable(false);
jScrollPane14.setViewportView(jTextArea14);
javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9);
jPanel9.setLayout(jPanel9Layout);
jPanel9Layout.setHorizontalGroup(
jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel9Layout.createSequentialGroup()
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel9Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane12))
.addGroup(jPanel9Layout.createSequentialGroup()
.addGap(95, 95, 95)
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel9Layout.createSequentialGroup()
.addComponent(jLabel49)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jTextField41, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel9Layout.createSequentialGroup()
.addComponent(jLabel48)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jTextField40, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(jPanel9Layout.createSequentialGroup()
.addComponent(jLabel47)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jTextField39)))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel9Layout.createSequentialGroup()
.addComponent(jLabel45)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jTextField37, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel9Layout.createSequentialGroup()
.addComponent(jLabel46)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jTextField38, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel9Layout.createSequentialGroup()
.addComponent(jScrollPane13, javax.swing.GroupLayout.DEFAULT_SIZE, 207, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jScrollPane14, javax.swing.GroupLayout.PREFERRED_SIZE, 241, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jButton10, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
.addContainerGap())
);
jPanel9Layout.setVerticalGroup(
jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel9Layout.createSequentialGroup()
.addComponent(jScrollPane12, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(jPanel9Layout.createSequentialGroup()
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel46)
.addComponent(jTextField38, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel45)
.addComponent(jTextField37, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel47)
.addComponent(jTextField39, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel49)
.addComponent(jTextField41, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addComponent(jScrollPane13, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
.addComponent(jScrollPane14, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel48)
.addComponent(jTextField40, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton10))
.addContainerGap(78, Short.MAX_VALUE))
);
jTabbedPane1.addTab("№9", jPanel9);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jTabbedPane1)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 320, Short.MAX_VALUE)
);
pack();
setLocationRelativeTo(null);
}// </editor-fold>//GEN-END:initComponents
public static int Proverka(int n)
{
int a; // хранит текущую самую правую цифру
int b = n % 10; // хранит правую цифру из предыдущей итерации
// выполняем цикл пока наше число не станет равно 0, на каждой итерации
// и перед первой, уменьшаем число 'забывая' самую правую цифру
for (n /= 10; n != 0; n /= 10)
{
a = n % 10; // получаем самую правую цифру числа
if (b <= a)
{ // сравнимаем с предыдущей самой правой
return 0; // если мы здесь, то условие строго убывающей последовательности
} // не выполняется - нужно выйти из функции
b = a; // иначе запоминаем самую правую цифру для последующего сравнения
}
return 1;
}
public boolean Prime(int n)
{
for (int i=2; i<n; i++)
{
if(n%i==0)
return false;
}
return true;
}
/*public int Vivod_number(int n)
{
int a; // хранит текущую самую правую цифру
int b = n % 10; // хранит правую цифру из предыдущей итерации
// выполняем цикл пока наше число не станет равно 0, на каждой итерации
// и перед первой, уменьшаем число 'забывая' самую правую цифру
for (n /= 10; n != 0; n /= 10)
{
a = n % 10; // получаем самую правую цифру числа
if (b <= a)
{ // сравнимаем с предыдущей самой правой
return 0; // если мы здесь, то условие строго убывающей последовательности
} // не выполняется - нужно выйти из функции
b = a; // иначе запоминаем самую правую цифру для последующего сравнения
}
return n;
}*/
//1 задание про градусы:
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
double a_degree = Double.parseDouble(textField1.getText());
double a_radian = (a_degree*Math.PI)/180;
double y = (Math.sin(Math.PI/2+3*a_radian))/(1-Math.sin(3*a_radian-Math.PI));
double z = 1/(Math.tan((5*Math.PI)/4+(3*a_radian)/2));
double razn = Math.abs(y-z);
String y_string,z_string,razn_string;
y_string=Double.toString(y);
textField2.setText(String.valueOf(y_string));
z_string = Double.toString(z);
textField3.setText(String.valueOf(z_string));
razn_string = Double.toString(razn);
textField4.setText(String.valueOf(razn_string));
}//GEN-LAST:event_jButton1ActionPerformed
private void textField4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_textField4ActionPerformed
}//GEN-LAST:event_textField4ActionPerformed
//Тоже первая задача:
private void textField1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_textField1ActionPerformed
double a_degree = Double.parseDouble(textField1.getText());
double a_radian = (a_degree*Math.PI)/180;
double y = (Math.sin(Math.PI/2+3*a_radian))/(1-Math.sin(3*a_radian-Math.PI));
double z = 1/(Math.tan((5*Math.PI)/4+(3*a_radian)/2));
double razn = Math.abs(y-z);
String y_string,z_string,razn_string;
y_string=Double.toString(y);
textField2.setText(String.valueOf(y_string));
z_string = Double.toString(z);
textField3.setText(String.valueOf(z_string));
razn_string = Double.toString(razn);
textField4.setText(String.valueOf(razn_string));
}//GEN-LAST:event_textField1ActionPerformed
//2 задача про фигуры:
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
//Ploshad
//Treygolnik
double a = Double.parseDouble(jTextField1.getText());
double h = Double.parseDouble(jTextField2.getText());
double St = (a*h)/2;
//Parallelogramm
double b = Double.parseDouble(jTextField3.getText());
double bh = Double.parseDouble(jTextField4.getText());
double Sp = b*bh;
//Shestiygolnik
double c=Double.parseDouble(jTextField5.getText());
double r=Double.parseDouble(jTextField6.getText());
double Ss =2*r*r* Math.sqrt(3);
if(St>Sp && St>Ss)
jTextField10.setText("Наибольшая площадь у треугольника.");
else if (Sp>St && Sp>Ss)
jTextField10.setText("Наибольшая площадь у параллелограмма.");
else if(Ss>St && Ss>Sp)
jTextField10.setText("Наибольшая площадь у шестиугольника.");
else if(St==Sp)
jTextField10.setText("Наибольшая площадь у треугольника и параллелограмма.");
else if(St==Ss)
jTextField10.setText("Наибольшая площадь у треугольника и шестиугольника.");
else if(Sp==Ss)
jTextField10.setText("Наибольшая площадь у параллелограмма и шестиугольника.");
else if (St==Sp && Sp==Ss)
jTextField10.setText("У трёх фигур одинаковая площадь.");
String St_string,Sp_string,Ss_string;
St_string=Double.toString(St);
String formattedSt = String.format("%.5f", St);
jTextField7.setText(String.valueOf(formattedSt));
Sp_string = Double.toString(Sp);
String formattedSp = String.format("%.5f", Sp);
jTextField8.setText(String.valueOf(formattedSp));
Ss_string = Double.toString(Ss);
String formattedSs = String.format("%.5f", Ss);
jTextField9.setText(String.valueOf(formattedSs));
}//GEN-LAST:event_jButton2ActionPerformed
//3 задание,нажатие кнопки:
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
//3 zadanie massiv
String text = jTextField3_1.getText(); // Парсим значение из текстового поля.
String[] sNums = text.split(" "); // Разбиваем текст из текстового поля, на массив строк, разделителем является пробел.
jTextField3_2.setText("");
double[] m = new double [sNums.length];
//minimalnii element
double min_number=0;
for(int i=0; i<sNums.length; i++)
{
m[i] = Double.parseDouble(sNums[i]);
if(m[i]>20)
min_number=m[i];
}
for(int i=0; i<sNums.length; i++)
{
if(m[i]>20)
{
if(min_number>m[i])
min_number = m[i];
}
}
if(min_number!=0)
{
String s_min=Double.toString(min_number);
jTextField3_2.setText(String.valueOf(s_min));
}
else
{
jTextField3_2.setText("В массиве не имеется такого элемента.");
}
}//GEN-LAST:event_jButton3ActionPerformed
//3 задание,нажатие на текстовое поле:
private void jTextField3_1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField3_1ActionPerformed
//3 zadanie massiv textfield
String text = jTextField3_1.getText(); // Парсим значение из текстового поля.
String[] sNums = text.split(" "); // Разбиваем текст из текстового поля, на массив строк, разделителем является пробел.
jTextField3_2.setText("");
double[] m = new double [sNums.length];
//minimalnii element
double min_number=0;
for(int i=0; i<sNums.length; i++)
{
m[i] = Double.parseDouble(sNums[i]);
if(m[i]>20)
min_number=m[i];
}
for(int i=0; i<sNums.length; i++)
{
if(m[i]>20)
{
if(min_number>m[i])
min_number = m[i];
}
}
if(min_number!=0)
{
String s_min=Double.toString(min_number);
jTextField3_2.setText(String.valueOf(s_min));
}
else
{
jTextField3_2.setText("В массиве не имеется такого элемента.");
}
}//GEN-LAST:event_jTextField3_1ActionPerformed
private void jTextField3_3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField3_3ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jTextField3_3ActionPerformed
private void jTextField3_4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField3_4ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jTextField3_4ActionPerformed
private void jTextField3_5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField3_5ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jTextField3_5ActionPerformed
//4 zadanie
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
//4 zadanie massiv textfield
String text = jTextField3_3.getText(); // Парсим значение из текстового поля.
if (text.length() == 0) {jTextField3_4.setText("Ни одного элемента не введено.");
return ;}
String[] sNums = text.split(" "); // Разбиваем текст из текстового поля, на массив строк, разделителем является пробел.
jTextField3_4.setText("");
jTextField3_5.setText("");
int[] m = new int [sNums.length];
for(int i=0; i<sNums.length; i++)
{
m[i] = Integer.parseInt(sNums[i]);
String s1=Integer.toString(Proverka(m[i]));
jTextField3_5.setText(jTextField3_5.getText() +" "+ String.valueOf(s1));
if(Proverka(m[i])!=0)
{
String s2=Integer.toString(m[i]);
jTextField3_4.setText(jTextField3_4.getText() +" "+ String.valueOf(s2));
}
}
}//GEN-LAST:event_jButton4ActionPerformed
//5 zadanie
private void jTextField3_6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField3_6ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jTextField3_6ActionPerformed
private void jTextField3_7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField3_7ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jTextField3_7ActionPerformed
private void jTextField3_8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField3_8ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jTextField3_8ActionPerformed
private void jTextField3_9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField3_9ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jTextField3_9ActionPerformed
private void jTextField3_10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField3_10ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jTextField3_10ActionPerformed
//5zadanie knopka
private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
String text = jTextField3_6.getText(); // Парсим значение из текстового поля.
if (text.length() == 0) {jTextField3_7.setText("Ни одного элемента не введено.");
return ;}
String[] sNums = text.split(" "); // Разбиваем текст из текстового поля, на массив строк, разделителем является пробел.
jTextField3_7.setText("");
jTextField3_8.setText("");
jTextField3_9.setText("");
jTextField3_10.setText("");
int[] m = new int [sNums.length];
for(int i=0; i<sNums.length; i++)
{
m[i] = Integer.parseInt(sNums[i]);
}
//1 part
int min = m[0];
int index=0;
double sum1=0,count1=sNums.length;
for(int i = 0; i < sNums.length; i ++)
{
sum1+=m[i];
if(m[i] < min)
{
min = m[i];
index=i;
}
}
int temp = m[0];
m[0]=m[index];
m[index]=temp;
for(int i=0; i<sNums.length; i++)
{
String s1=Integer.toString(m[i]);
jTextField3_7.setText(jTextField3_7.getText() +" "+ String.valueOf(s1));
}
double srednee_do=sum1/count1;
String s1=Double.toString(srednee_do);
jTextField3_8.setText(String.valueOf(s1));
//2part
int max=m[0];
for(int i = 0; i < sNums.length; i ++)
{
if(m[i] > max)
{
max = m[i];
index=i;
}
}
double count2=0,sum2=0;
for(int i=0;i<=index;i++)
{
count2++;
sum2+=m[i];
String s2=Integer.toString(m[i]);
jTextField3_10.setText(jTextField3_10.getText() +" "+ String.valueOf(s2));
}
for(int i = index+1; i < sNums.length; i ++)
{
if(Prime(m[i]))
{
jTextField3_10.setText(jTextField3_10.getText() +" _");
}
else
{
sum2+=m[i];
count2++;
String s2=Integer.toString(m[i]);
jTextField3_10.setText(jTextField3_10.getText() +" "+ String.valueOf(s2));
}
}
double srednee_posle=sum2/count2;
String s2=Double.toString(srednee_posle);
jTextField3_9.setText(String.valueOf(s2));
}//GEN-LAST:event_jButton5ActionPerformed
//6 zadanie!
private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed
JFrame1 s1 = new JFrame1();
JFrame2 s2 = new JFrame2();
s2.setVisible(true);
s2.toFront();
s1.toBack();
}//GEN-LAST:event_jButton6ActionPerformed
//ЗАДАЧА 7
private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton7ActionPerformed
double[][] m = new double [4][4];
double [][] x = new double [1][4];
double[][] A = new double[4][4];
//Pervaya stroka
m[0][0]=Integer.parseInt(jTextField11.getText());
m[0][1]=Integer.parseInt(jTextField15.getText());
m[0][2]=Integer.parseInt(jTextField19.getText());
m[0][3]=Integer.parseInt(jTextField27.getText());
//Vtoraya stroka
m[1][0]=Integer.parseInt(jTextField12.getText());
m[1][1]=Integer.parseInt(jTextField16.getText());
m[1][2]=Integer.parseInt(jTextField20.getText());
m[1][3]=Integer.parseInt(jTextField28.getText());
//Tretiya stroka
m[2][0]=Integer.parseInt(jTextField13.getText());
m[2][1]=Integer.parseInt(jTextField17.getText());
m[2][2]=Integer.parseInt(jTextField21.getText());
m[2][3]=Integer.parseInt(jTextField29.getText());
//Chetvertaya stroka
m[3][0]=Integer.parseInt(jTextField14.getText());
m[3][1]=Integer.parseInt(jTextField18.getText());
m[3][2]=Integer.parseInt(jTextField31.getText());
m[3][3]=Integer.parseInt(jTextField30.getText());
x[0][0]=Integer.parseInt(jTextField22.getText());
x[0][1]=Integer.parseInt(jTextField23.getText());
x[0][2]=Integer.parseInt(jTextField24.getText());
x[0][3]=Integer.parseInt(jTextField25.getText());
MatrixCalculation mc = new MatrixCalculation();
double Result = mc.CalculateMatrix(m);
System.out.println(Result);
if(Result!=0)
{
jTextArea10.setText("Определитель отличен от нуля.\n"
+ "Векторы образуют базис.");
JOptionPane.showMessageDialog(null, "Определитель отличен от нуля.\n"
+ "Векторы образуют базис.",
"Определитель", JOptionPane.INFORMATION_MESSAGE);
}
else
{
jTextArea10.setText("Определитель равен нулю.\n"
+ "Векторы не образуют базис.");
JOptionPane.showMessageDialog(null, "Определитель равен нулю.\n"
+ "Векторы не образуют базис.",
"Определитель", JOptionPane.INFORMATION_MESSAGE);
}
int N = m.length;
//System.out.println(N);
jTextArea10.setText(jTextArea10.getText()+"\n");
jTextArea10.setText(jTextArea10.getText()+"Матрица: "+"\n");
for (int i = 0; i < N; i++){
for (int j = 0; j < N; j++){
jTextArea10.setText(jTextArea10.getText()+"m1[" + i + "][" + j + "]=" + m[i][j]+ " ");
}
jTextArea10.setText(jTextArea10.getText()+"\n");
}
jTextArea10.setText(jTextArea10.getText()+"\n");
invert(m);
int N1 = m.length;
jTextArea10.setText(jTextArea10.getText()+"Обратная матрица: "+"\n");
for (int i = 0; i < N1; i++){
for (int j = 0; j < N1; j++){
m[i][j]=Math.rint(m[i][j] * 100.0) / 100.0;
jTextArea10.setText(jTextArea10.getText()+"m2[" + i + "][" + j + "]=" + m[i][j]+" ");
}
jTextArea10.setText(jTextArea10.getText()+"\n");
}
jTextArea10.setText(jTextArea10.getText()+"\n");
A=multiply(m,x);
int N2 = A.length;
jTextArea10.setText(jTextArea10.getText()+"Координаты вектора в базисе: "+"\n");
for (int i = 0; i < N2; i++)
{
for (int j = 0; j < N2; j++){
jTextArea10.setText(jTextArea10.getText()+"A[" + i + "][" + j + "]=" + A[i][j]+" ");
}
jTextArea10.setText(jTextArea10.getText()+"\n");
}
/*for(int i=0;i<4;i++)
{
for(int j=0;j<4;j++)
System.out.print(m[i][j]);
System.out.println("");
}*///Вывод матрицы
}//GEN-LAST:event_jButton7ActionPerformed
//КНОПКА ИНФОРМАЦИЯ
private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton8ActionPerformed
JOptionPane.showMessageDialog(null, "Находим определитель f1,f2,f3,f4, если он не равен 0, "
+ "\nто эти вектора задают базис.\n" +
"Координаты вектора x в базисе f1,f2,f3,f4: "
+ "\nX'=T^(-1)*X\n" +
"T^(-1) - обратная матрица f1,f2,f3,f4.\nX - вектор x.\n" +
"X' - координаты x в базисе f1,f2,f3,f4.\n" +
"",
"Дополнительная информация", JOptionPane.QUESTION_MESSAGE);
}//GEN-LAST:event_jButton8ActionPerformed
private void jTextField23ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField23ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jTextField23ActionPerformed
private void jButton9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton9ActionPerformed
Vector a = new Vector();
a.x=Integer.parseInt(jTextField26.getText());
a.y=Integer.parseInt(jTextField32.getText());
a.z=Integer.parseInt(jTextField33.getText());
Vector b = new Vector();
b.x=Integer.parseInt(jTextField34.getText());
b.y=Integer.parseInt(jTextField35.getText());
b.z=Integer.parseInt(jTextField36.getText());
Vector c1 = new Vector();
c1=a.add(b);
double d=0;
d=a.Skal(b);
Vector e = new Vector();
e=a.Vect(b);
Vector c = new Vector();
c= a.add(b);
c=c.Vect(b);
Vector f = new Vector();
f=f.Vect(c);
jTextArea11.setText("Вектор A имеет координаты: "+String.valueOf(a.x)+", "+String.valueOf(a.y)+ ", "+ String.valueOf(a.z)+"\n" );
jTextArea11.setText(jTextArea11.getText()+"Вектор B имеет координаты: "+String.valueOf(b.x)+", "+String.valueOf(b.y)+ ", "+ String.valueOf(b.z)+"\n" );
jTextArea11.setText(jTextArea11.getText()+"Сумма векторов: "+String.valueOf(c1.x)+", "+String.valueOf(c1.y)+ ", "+ String.valueOf(c1.z)+"\n" );
jTextArea11.setText(jTextArea11.getText()+"Скалярное произведение: "+String.valueOf(d)+"\n");
jTextArea11.setText(jTextArea11.getText()+"Векторное произведение: "+String.valueOf(e.x)+", "+String.valueOf(e.y)+ ", "+ String.valueOf(e.z)+"\n" );
jTextArea11.setText(jTextArea11.getText()+"1-ое выражение: "+String.valueOf(c.x)+", "+String.valueOf(c.y)+ ", "+ String.valueOf(c.z)+"\n" );
jTextArea11.setText(jTextArea11.getText()+"2-ое выражение: "+String.valueOf(f.x)+", "+String.valueOf(f.y)+ ", "+ String.valueOf(f.z)+"\n" );
}//GEN-LAST:event_jButton9ActionPerformed
private void jTextField4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField4ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jTextField4ActionPerformed
private void jButton10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton10ActionPerformed
String text = jTextField37.getText(); // Парсим значение из текстового поля.
String[] sR = text.split(" "); //РАДИУСЫ КРУГОВ
jTextField38.setText(String.valueOf(sR.length));
String text1 = jTextField41.getText(); // Парсим значение из текстового поля.
String[] sh = text1.split(" "); // ВЫСОТА конусов
jTextField39.setText(String.valueOf(sh.length));
String text2 = jTextField40.getText(); // Парсим значение из текстового поля.
String[] sr = text2.split(" "); //РАДИУСЫ оснований конусов
int N=sR.length;
int M=sh.length;
Circle[] circlearr = new Circle [N];
Conus[] conusarr = new Conus [M];
double[] sR1 = new double [N];
for(int i=0; i<N; i++)
{
sR1[i] = Double.parseDouble(sR[i]);
}
for(int i=0;i<N;i++)
{
circlearr[i] = new Circle(sR1[i]);
}
double[] sh1 = new double [M];
for(int i=0; i<M; i++)
{
sh1[i] = Double.parseDouble(sh[i]);
}
double[] sr1 = new double [M];
for(int i=0; i<M; i++)
{
sr1[i] = Double.parseDouble(sr[i]);
System.out.println("sr"+sr[i]+" ");
}
double sumsquare=0;
for(int i=0;i<N;i++)
{
sumsquare+=circlearr[i].square();
}
double srednsquare=sumsquare/N;
int count=0;
for(int i=0;i<N;i++)
{
if(circlearr[i].square()<srednsquare)
count++;
}
jTextArea13.setText("Количество кругов,\n"
+ "у которых площадь\n" +
"меньше средней площади\n"
+ "всех кругов:" +String.valueOf(count));
for(int i=0;i<M;i++)
{
conusarr[i] = new Conus(sr1[i],sh1[i]);
}
double max =conusarr[0].volume();
int index=0;
for(int i=0;i<M;i++)
{
System.out.println(i+1+"ый эл."+ conusarr[i].volume());
if(conusarr[i].volume()>max)
{
max=conusarr[i].volume();
index=i;
}
}
String formattedmax = String.format("%.3f", max);
jTextArea14.setText("Наибольший по объему конус\n"
+ String.valueOf(index+1)+"-ый конус. Объем: "+ String.valueOf(formattedmax));
}//GEN-LAST:event_jButton10ActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(JFrame1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(JFrame1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(JFrame1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(JFrame1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new JFrame1().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton10;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JButton jButton4;
private javax.swing.JButton jButton5;
private javax.swing.JButton jButton6;
private javax.swing.JButton jButton7;
private javax.swing.JButton jButton8;
private javax.swing.JButton jButton9;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel12;
private javax.swing.JLabel jLabel13;
private javax.swing.JLabel jLabel14;
private javax.swing.JLabel jLabel15;
private javax.swing.JLabel jLabel16;
private javax.swing.JLabel jLabel17;
private javax.swing.JLabel jLabel18;
private javax.swing.JLabel jLabel19;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel20;
private javax.swing.JLabel jLabel21;
private javax.swing.JLabel jLabel22;
private javax.swing.JLabel jLabel23;
private javax.swing.JLabel jLabel24;
private javax.swing.JLabel jLabel25;
private javax.swing.JLabel jLabel26;
private javax.swing.JLabel jLabel27;
private javax.swing.JLabel jLabel28;
private javax.swing.JLabel jLabel29;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel30;
private javax.swing.JLabel jLabel31;
private javax.swing.JLabel jLabel32;
private javax.swing.JLabel jLabel33;
private javax.swing.JLabel jLabel34;
private javax.swing.JLabel jLabel35;
private javax.swing.JLabel jLabel36;
private javax.swing.JLabel jLabel37;
private javax.swing.JLabel jLabel38;
private javax.swing.JLabel jLabel39;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel40;
private javax.swing.JLabel jLabel41;
private javax.swing.JLabel jLabel42;
private javax.swing.JLabel jLabel43;
private javax.swing.JLabel jLabel44;
private javax.swing.JLabel jLabel45;
private javax.swing.JLabel jLabel46;
private javax.swing.JLabel jLabel47;
private javax.swing.JLabel jLabel48;
private javax.swing.JLabel jLabel49;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private javax.swing.JPanel jPanel5;
private javax.swing.JPanel jPanel6;
private javax.swing.JPanel jPanel7;
private javax.swing.JPanel jPanel8;
private javax.swing.JPanel jPanel9;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane10;
private javax.swing.JScrollPane jScrollPane11;
private javax.swing.JScrollPane jScrollPane12;
private javax.swing.JScrollPane jScrollPane13;
private javax.swing.JScrollPane jScrollPane14;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JScrollPane jScrollPane3;
private javax.swing.JScrollPane jScrollPane4;
private javax.swing.JScrollPane jScrollPane5;
private javax.swing.JScrollPane jScrollPane6;
private javax.swing.JScrollPane jScrollPane7;
private javax.swing.JScrollPane jScrollPane8;
private javax.swing.JScrollPane jScrollPane9;
private javax.swing.JTabbedPane jTabbedPane1;
private javax.swing.JTextArea jTextArea1;
private javax.swing.JTextArea jTextArea10;
private javax.swing.JTextArea jTextArea11;
private javax.swing.JTextArea jTextArea12;
private javax.swing.JTextArea jTextArea13;
private javax.swing.JTextArea jTextArea14;
private javax.swing.JTextArea jTextArea2;
private javax.swing.JTextArea jTextArea3;
private javax.swing.JTextArea jTextArea4;
private javax.swing.JTextArea jTextArea5;
private javax.swing.JTextArea jTextArea6;
private javax.swing.JTextArea jTextArea7;
private javax.swing.JTextArea jTextArea8;
private javax.swing.JTextArea jTextArea9;
private javax.swing.JTextField jTextField1;
private javax.swing.JTextField jTextField10;
private javax.swing.JTextField jTextField11;
private javax.swing.JTextField jTextField12;
private javax.swing.JTextField jTextField13;
private javax.swing.JTextField jTextField14;
private javax.swing.JTextField jTextField15;
private javax.swing.JTextField jTextField16;
private javax.swing.JTextField jTextField17;
private javax.swing.JTextField jTextField18;
private javax.swing.JTextField jTextField19;
private javax.swing.JTextField jTextField2;
private javax.swing.JTextField jTextField20;
private javax.swing.JTextField jTextField21;
private javax.swing.JTextField jTextField22;
private javax.swing.JTextField jTextField23;
private javax.swing.JTextField jTextField24;
private javax.swing.JTextField jTextField25;
private javax.swing.JTextField jTextField26;
private javax.swing.JTextField jTextField27;
private javax.swing.JTextField jTextField28;
private javax.swing.JTextField jTextField29;
private javax.swing.JTextField jTextField3;
private javax.swing.JTextField jTextField30;
private javax.swing.JTextField jTextField31;
private javax.swing.JTextField jTextField32;
private javax.swing.JTextField jTextField33;
private javax.swing.JTextField jTextField34;
private javax.swing.JTextField jTextField35;
private javax.swing.JTextField jTextField36;
private javax.swing.JTextField jTextField37;
private javax.swing.JTextField jTextField38;
private javax.swing.JTextField jTextField39;
private javax.swing.JTextField jTextField3_1;
private javax.swing.JTextField jTextField3_10;
private javax.swing.JTextField jTextField3_2;
private javax.swing.JTextField jTextField3_3;
private javax.swing.JTextField jTextField3_4;
private javax.swing.JTextField jTextField3_5;
private javax.swing.JTextField jTextField3_6;
private javax.swing.JTextField jTextField3_7;
private javax.swing.JTextField jTextField3_8;
private javax.swing.JTextField jTextField3_9;
private javax.swing.JTextField jTextField4;
private javax.swing.JTextField jTextField40;
private javax.swing.JTextField jTextField41;
private javax.swing.JTextField jTextField5;
private javax.swing.JTextField jTextField6;
private javax.swing.JTextField jTextField7;
private javax.swing.JTextField jTextField8;
private javax.swing.JTextField jTextField9;
private java.awt.TextField textField1;
private java.awt.TextField textField2;
private java.awt.TextField textField3;
private java.awt.TextField textField4;
// End of variables declaration//GEN-END:variables
}
| UTF-8 | Java | 123,588 | java | JFrame1.java | Java | [
{
"context": "1_variant8.MatrixCalculation.*;\n\n/**\n *\n * @author User\n */\n\npublic class JFrame1 extends javax.swing.JFr",
"end": 353,
"score": 0.5915547609329224,
"start": 349,
"tag": "NAME",
"value": "User"
}
] | 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 zadanie1_variant8;
import java.text.DecimalFormat;
import javax.swing.JOptionPane;
import static zadanie1_variant8.MatrixCalculation.*;
/**
*
* @author User
*/
public class JFrame1 extends javax.swing.JFrame {
/**
* Creates new form JFrame1
*/
public JFrame1() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jTabbedPane1 = new javax.swing.JTabbedPane();
jPanel1 = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
jTextArea1 = new javax.swing.JTextArea();
textField1 = new java.awt.TextField();
textField2 = new java.awt.TextField();
textField3 = new java.awt.TextField();
textField4 = new java.awt.TextField();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jButton1 = new javax.swing.JButton();
jLabel5 = new javax.swing.JLabel();
jPanel2 = new javax.swing.JPanel();
jScrollPane3 = new javax.swing.JScrollPane();
jTextArea3 = new javax.swing.JTextArea();
jTextField1 = new javax.swing.JTextField();
jTextField2 = new javax.swing.JTextField();
jTextField3 = new javax.swing.JTextField();
jTextField4 = new javax.swing.JTextField();
jTextField5 = new javax.swing.JTextField();
jTextField6 = new javax.swing.JTextField();
jTextField7 = new javax.swing.JTextField();
jTextField8 = new javax.swing.JTextField();
jTextField9 = new javax.swing.JTextField();
jLabel6 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
jLabel8 = new javax.swing.JLabel();
jLabel9 = new javax.swing.JLabel();
jLabel10 = new javax.swing.JLabel();
jLabel11 = new javax.swing.JLabel();
jLabel12 = new javax.swing.JLabel();
jLabel13 = new javax.swing.JLabel();
jLabel14 = new javax.swing.JLabel();
jLabel15 = new javax.swing.JLabel();
jLabel16 = new javax.swing.JLabel();
jLabel17 = new javax.swing.JLabel();
jButton2 = new javax.swing.JButton();
jTextField10 = new javax.swing.JTextField();
jPanel3 = new javax.swing.JPanel();
jScrollPane4 = new javax.swing.JScrollPane();
jTextArea4 = new javax.swing.JTextArea();
jTextField3_1 = new javax.swing.JTextField();
jTextField3_2 = new javax.swing.JTextField();
jLabel18 = new javax.swing.JLabel();
jLabel19 = new javax.swing.JLabel();
jButton3 = new javax.swing.JButton();
jPanel4 = new javax.swing.JPanel();
jScrollPane5 = new javax.swing.JScrollPane();
jTextArea5 = new javax.swing.JTextArea();
jLabel20 = new javax.swing.JLabel();
jTextField3_3 = new javax.swing.JTextField();
jButton4 = new javax.swing.JButton();
jTextField3_4 = new javax.swing.JTextField();
jTextField3_5 = new javax.swing.JTextField();
jLabel21 = new javax.swing.JLabel();
jLabel22 = new javax.swing.JLabel();
jPanel5 = new javax.swing.JPanel();
jScrollPane6 = new javax.swing.JScrollPane();
jTextArea6 = new javax.swing.JTextArea();
jLabel23 = new javax.swing.JLabel();
jTextField3_6 = new javax.swing.JTextField();
jLabel24 = new javax.swing.JLabel();
jTextField3_7 = new javax.swing.JTextField();
jLabel25 = new javax.swing.JLabel();
jTextField3_8 = new javax.swing.JTextField();
jLabel26 = new javax.swing.JLabel();
jTextField3_9 = new javax.swing.JTextField();
jTextField3_10 = new javax.swing.JTextField();
jButton5 = new javax.swing.JButton();
jPanel6 = new javax.swing.JPanel();
jScrollPane7 = new javax.swing.JScrollPane();
jTextArea7 = new javax.swing.JTextArea();
jButton6 = new javax.swing.JButton();
jScrollPane8 = new javax.swing.JScrollPane();
jTextArea8 = new javax.swing.JTextArea();
jLabel27 = new javax.swing.JLabel();
jLabel28 = new javax.swing.JLabel();
jLabel29 = new javax.swing.JLabel();
jScrollPane2 = new javax.swing.JScrollPane();
jTextArea2 = new javax.swing.JTextArea();
jLabel30 = new javax.swing.JLabel();
jLabel31 = new javax.swing.JLabel();
jLabel32 = new javax.swing.JLabel();
jPanel7 = new javax.swing.JPanel();
jScrollPane9 = new javax.swing.JScrollPane();
jTextArea9 = new javax.swing.JTextArea();
jLabel34 = new javax.swing.JLabel();
jTextField11 = new javax.swing.JTextField();
jTextField12 = new javax.swing.JTextField();
jTextField13 = new javax.swing.JTextField();
jTextField14 = new javax.swing.JTextField();
jTextField15 = new javax.swing.JTextField();
jTextField16 = new javax.swing.JTextField();
jTextField17 = new javax.swing.JTextField();
jTextField18 = new javax.swing.JTextField();
jLabel35 = new javax.swing.JLabel();
jLabel36 = new javax.swing.JLabel();
jTextField19 = new javax.swing.JTextField();
jTextField20 = new javax.swing.JTextField();
jTextField21 = new javax.swing.JTextField();
jLabel38 = new javax.swing.JLabel();
jTextField27 = new javax.swing.JTextField();
jTextField28 = new javax.swing.JTextField();
jTextField29 = new javax.swing.JTextField();
jTextField30 = new javax.swing.JTextField();
jTextField31 = new javax.swing.JTextField();
jButton7 = new javax.swing.JButton();
jButton8 = new javax.swing.JButton();
jLabel33 = new javax.swing.JLabel();
jTextField22 = new javax.swing.JTextField();
jTextField23 = new javax.swing.JTextField();
jTextField24 = new javax.swing.JTextField();
jTextField25 = new javax.swing.JTextField();
jScrollPane10 = new javax.swing.JScrollPane();
jTextArea10 = new javax.swing.JTextArea();
jPanel8 = new javax.swing.JPanel();
jLabel37 = new javax.swing.JLabel();
jTextField26 = new javax.swing.JTextField();
jTextField32 = new javax.swing.JTextField();
jTextField33 = new javax.swing.JTextField();
jLabel39 = new javax.swing.JLabel();
jLabel40 = new javax.swing.JLabel();
jLabel41 = new javax.swing.JLabel();
jScrollPane11 = new javax.swing.JScrollPane();
jTextArea11 = new javax.swing.JTextArea();
jButton9 = new javax.swing.JButton();
jTextField34 = new javax.swing.JTextField();
jTextField35 = new javax.swing.JTextField();
jTextField36 = new javax.swing.JTextField();
jLabel42 = new javax.swing.JLabel();
jLabel43 = new javax.swing.JLabel();
jLabel44 = new javax.swing.JLabel();
jPanel9 = new javax.swing.JPanel();
jScrollPane12 = new javax.swing.JScrollPane();
jTextArea12 = new javax.swing.JTextArea();
jTextField37 = new javax.swing.JTextField();
jLabel45 = new javax.swing.JLabel();
jScrollPane13 = new javax.swing.JScrollPane();
jTextArea13 = new javax.swing.JTextArea();
jTextField38 = new javax.swing.JTextField();
jLabel46 = new javax.swing.JLabel();
jTextField39 = new javax.swing.JTextField();
jLabel47 = new javax.swing.JLabel();
jTextField40 = new javax.swing.JTextField();
jLabel48 = new javax.swing.JLabel();
jButton10 = new javax.swing.JButton();
jTextField41 = new javax.swing.JTextField();
jLabel49 = new javax.swing.JLabel();
jScrollPane14 = new javax.swing.JScrollPane();
jTextArea14 = new javax.swing.JTextArea();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("Вычислительная практика.Ражков А.Ф.");
setLocation(new java.awt.Point(200, 400));
setResizable(false);
jTabbedPane1.setName(""); // NOI18N
jTextArea1.setEditable(false);
jTextArea1.setColumns(20);
jTextArea1.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
jTextArea1.setRows(5);
jTextArea1.setText("Напишите программу на языке Java расчета y и z по формулам.\nПредусмотрите ввод исходных данных с экрана дисплея. \nПредварительно вычислите ожидаемые значения y и z с помощью калькулятора.\nУбедитесь, что значения, вычисленные с помощью калькулятора,\nсовпадают с результатами, которые получаются в результате работы программы.\nОпределить разность между значениями y и z. ");
jScrollPane1.setViewportView(jTextArea1);
textField1.setText("5");
textField1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
textField1ActionPerformed(evt);
}
});
textField2.setEditable(false);
textField3.setEditable(false);
textField4.setEditable(false);
textField4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
textField4ActionPerformed(evt);
}
});
jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/zadanie1_variant8/picture1.png"))); // NOI18N
jLabel1.setText("jLabel1");
jLabel1.setBorder(javax.swing.BorderFactory.createEtchedBorder());
jLabel2.setFont(new java.awt.Font("Arial", 0, 16)); // NOI18N
jLabel2.setText("Введите α (°):");
jLabel3.setFont(new java.awt.Font("Arial", 0, 16)); // NOI18N
jLabel3.setText("Вывод y:");
jLabel4.setFont(new java.awt.Font("Arial", 0, 16)); // NOI18N
jLabel4.setText("Вывод z:");
jButton1.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
jButton1.setText("Вывод");
jButton1.setToolTipText("");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jLabel5.setFont(new java.awt.Font("Arial", 0, 16)); // NOI18N
jLabel5.setText("Разность y и z:");
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 197, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2)
.addComponent(jLabel3))
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(textField1, javax.swing.GroupLayout.PREFERRED_SIZE, 271, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(31, 31, 31)
.addComponent(textField2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
.addComponent(jButton1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel5)
.addComponent(jLabel4))
.addGap(24, 24, 24)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(textField3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(textField4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))))
.addContainerGap())
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(11, 11, 11)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(textField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(textField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel3))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(textField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel4))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(textField4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel5)))
.addComponent(jLabel1))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jTabbedPane1.addTab("№1", jPanel1);
jTextArea3.setEditable(false);
jTextArea3.setColumns(20);
jTextArea3.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
jTextArea3.setRows(5);
jTextArea3.setText(" Определите, у какой из трех фигур площадь больше: \n● треугольник со стороной a и высотой h. \n● параллелограмм со стороной b и высотой hb, опущенной на эту сторону. \n● шестиугольник со стороной c и радиусом r вписанной окружности. ");
jScrollPane3.setViewportView(jTextArea3);
jTextField1.setText("3");
jTextField2.setText("3");
jTextField3.setText("4");
jTextField4.setText("3");
jTextField4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField4ActionPerformed(evt);
}
});
jTextField5.setText("4");
jTextField6.setText("5");
jTextField7.setEditable(false);
jTextField8.setEditable(false);
jTextField9.setEditable(false);
jLabel6.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jLabel6.setText("Треугольник");
jLabel7.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jLabel7.setText("Параллелограмм");
jLabel8.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jLabel8.setText("Шестиугольник");
jLabel9.setText("Сторона a:");
jLabel10.setText("Высота h:");
jLabel11.setText("Сторона b:");
jLabel12.setText("Высота hb:");
jLabel13.setText("Сторона c:");
jLabel14.setText("Радиус r:");
jLabel15.setText("Площадь:");
jLabel16.setText("Площадь:");
jLabel17.setText("Площадь:");
jButton2.setText("Вывод");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
jTextField10.setEditable(false);
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jScrollPane3)
.addContainerGap())
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(20, 20, 20)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel6)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel9)
.addComponent(jLabel10))
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
.addGap(4, 4, 4)
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)))))
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jLabel15)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jTextField7, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 106, Short.MAX_VALUE)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jLabel11)
.addGap(10, 10, 10)
.addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jLabel7)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
.addComponent(jLabel12, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
.addComponent(jLabel16, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jTextField8, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 107, Short.MAX_VALUE)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel8)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(4, 4, 4)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel14)
.addComponent(jLabel13)
.addComponent(jLabel17))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField9, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addGap(37, 37, 37))
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jTextField10)
.addContainerGap())
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(250, 250, 250)
.addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 185, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
.addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel6)
.addComponent(jLabel7)
.addComponent(jLabel8))
.addGap(9, 9, 9)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel9)
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel11)
.addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel13))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel10)
.addComponent(jLabel12)
.addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel14)
.addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jTextField7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel15)
.addComponent(jTextField8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel16)
.addComponent(jLabel17)
.addComponent(jTextField9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(4, 4, 4)
.addComponent(jTextField10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton2)
.addContainerGap(51, Short.MAX_VALUE))
);
jTabbedPane1.addTab("№2", jPanel2);
jTextArea4.setEditable(false);
jTextArea4.setColumns(20);
jTextArea4.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
jTextArea4.setRows(5);
jTextArea4.setText("\nВводится последовательность из N вещественных чисел. \nОпределить наименьшее число, среди чисел, больших 20. ");
jScrollPane4.setViewportView(jTextArea4);
jTextField3_1.setText("3 6 1 20 21 5 25 9 0");
jTextField3_1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField3_1ActionPerformed(evt);
}
});
jTextField3_2.setEditable(false);
jLabel18.setText("Ввод массива(между элементами пробел)");
jLabel19.setText("Наименьшее число, среди чисел, больших 20");
jButton3.setText("Вывод числа");
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGap(231, 231, 231)
.addComponent(jLabel18))
.addGroup(jPanel3Layout.createSequentialGroup()
.addGap(219, 219, 219)
.addComponent(jLabel19))
.addGroup(jPanel3Layout.createSequentialGroup()
.addGap(156, 156, 156)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 371, Short.MAX_VALUE)
.addComponent(jTextField3_1)
.addComponent(jTextField3_2)))
.addGroup(jPanel3Layout.createSequentialGroup()
.addGap(285, 285, 285)
.addComponent(jButton3)))
.addContainerGap(164, Short.MAX_VALUE))
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel18)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField3_1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel19)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField3_2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton3)
.addGap(0, 90, Short.MAX_VALUE))
);
jTabbedPane1.addTab("№3", jPanel3);
jTextArea5.setEditable(false);
jTextArea5.setColumns(20);
jTextArea5.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
jTextArea5.setRows(5);
jTextArea5.setText("Вводится последовательность целых чисел.\nДля каждого числа последовательности проверить, представляют ли его цифры строго \nвозрастающую последовательность, например, \n6543 (результатом функции будет 1 – Да, 0 - НЕТ). ");
jScrollPane5.setViewportView(jTextArea5);
jLabel20.setText("Ввод последовательности целых чисел");
jTextField3_3.setText("2341 6543 1234");
jTextField3_3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField3_3ActionPerformed(evt);
}
});
jButton4.setText("Вывод");
jButton4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton4ActionPerformed(evt);
}
});
jTextField3_4.setEditable(false);
jTextField3_4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField3_4ActionPerformed(evt);
}
});
jTextField3_5.setEditable(false);
jTextField3_5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField3_5ActionPerformed(evt);
}
});
jLabel21.setText("Числа,цифры которых являются строго возрастающей последовательностью");
jLabel22.setText("Результат функции для каждого числа");
javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
jPanel4.setLayout(jPanel4Layout);
jPanel4Layout.setHorizontalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane5, javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jTextField3_3)
.addComponent(jTextField3_4, javax.swing.GroupLayout.Alignment.TRAILING)))
.addGroup(jPanel4Layout.createSequentialGroup()
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addGap(143, 143, 143)
.addComponent(jLabel21))
.addGroup(jPanel4Layout.createSequentialGroup()
.addGap(244, 244, 244)
.addComponent(jLabel22))
.addGroup(jPanel4Layout.createSequentialGroup()
.addGap(237, 237, 237)
.addComponent(jLabel20))
.addGroup(jPanel4Layout.createSequentialGroup()
.addGap(307, 307, 307)
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jTextField3_5, javax.swing.GroupLayout.DEFAULT_SIZE, 87, Short.MAX_VALUE)
.addComponent(jButton4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
.addGap(0, 135, Short.MAX_VALUE)))
.addContainerGap())
);
jPanel4Layout.setVerticalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel20)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField3_3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(3, 3, 3)
.addComponent(jLabel21, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField3_4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel22)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField3_5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton4)
.addGap(47, 47, 47))
);
jTabbedPane1.addTab("№4", jPanel4);
jScrollPane6.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
jScrollPane6.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
jTextArea6.setEditable(false);
jTextArea6.setColumns(20);
jTextArea6.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
jTextArea6.setRows(5);
jTextArea6.setText("В массиве целых чисел Х(k) поменять местами первый и минимальный элементы. \nУдалить все простые элементы, стоящие после максимального элемента. \nНайти среднее арифметическое элементов массива до и после удаления.");
jScrollPane6.setViewportView(jTextArea6);
jLabel23.setText("Ввод последовательности целых чисел");
jTextField3_6.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jTextField3_6.setText("3 5 4 7 8 -5 1 7 20 4 5 2 1");
jTextField3_6.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField3_6ActionPerformed(evt);
}
});
jLabel24.setText("Первый и минимальный элемент поменялись местами");
jTextField3_7.setEditable(false);
jTextField3_7.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField3_7ActionPerformed(evt);
}
});
jLabel25.setText("Удаление всех простых элементов, стоящих после максимального элемента");
jTextField3_8.setEditable(false);
jTextField3_8.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField3_8ActionPerformed(evt);
}
});
jLabel26.setText("Среднее арифметическое элементов массива до и после удаления");
jTextField3_9.setEditable(false);
jTextField3_9.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField3_9ActionPerformed(evt);
}
});
jTextField3_10.setEditable(false);
jTextField3_10.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField3_10ActionPerformed(evt);
}
});
jButton5.setText("Вывод");
jButton5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton5ActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
jPanel5.setLayout(jPanel5Layout);
jPanel5Layout.setHorizontalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel5Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane6)
.addComponent(jTextField3_6, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jTextField3_7)
.addComponent(jTextField3_10)
.addGroup(jPanel5Layout.createSequentialGroup()
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel5Layout.createSequentialGroup()
.addGap(136, 136, 136)
.addComponent(jLabel25))
.addGroup(jPanel5Layout.createSequentialGroup()
.addGap(228, 228, 228)
.addComponent(jLabel23))
.addGroup(jPanel5Layout.createSequentialGroup()
.addGap(194, 194, 194)
.addComponent(jLabel24))
.addGroup(jPanel5Layout.createSequentialGroup()
.addGap(162, 162, 162)
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(jPanel5Layout.createSequentialGroup()
.addComponent(jTextField3_8, javax.swing.GroupLayout.PREFERRED_SIZE, 139, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jTextField3_9, javax.swing.GroupLayout.PREFERRED_SIZE, 139, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jLabel26, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
.addGap(0, 145, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 363, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE)))
.addContainerGap())
);
jPanel5Layout.setVerticalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel5Layout.createSequentialGroup()
.addComponent(jScrollPane6, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel23)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField3_6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(1, 1, 1)
.addComponent(jLabel24)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField3_7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(1, 1, 1)
.addComponent(jLabel25, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField3_10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(1, 1, 1)
.addComponent(jLabel26)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jTextField3_9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField3_8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton5)
.addContainerGap())
);
jTabbedPane1.addTab("№5", jPanel5);
jScrollPane7.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
jScrollPane7.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
jTextArea7.setEditable(false);
jTextArea7.setColumns(20);
jTextArea7.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
jTextArea7.setRows(5);
jTextArea7.setText("Обработка двумерных массивов.В программе предусмотреть диалог, откуда будут вводится \nэлементы исходной матрицы – с клавиатуры или из текстового файла. \nРезультаты выводить на экран и в результирующий текстовый файл.Матрицу выводить до и после преобразований. \n\nЗадана матрица A(n,n). Зеркально отразить ее относительно побочной диагонали. \nВ преобразованной матрице найти столбцы, элементы которых образуют убывающую последовательность. ");
jTextArea7.setFocusable(false);
jScrollPane7.setViewportView(jTextArea7);
jButton6.setText("Ввод матрицы");
jButton6.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton6ActionPerformed(evt);
}
});
jScrollPane8.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
jScrollPane8.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
jTextArea8.setEditable(false);
jTextArea8.setColumns(20);
jTextArea8.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
jTextArea8.setRows(5);
jTextArea8.setText(" 1 2 1\n 4 5 3\n 7 9 10\n");
jScrollPane8.setViewportView(jTextArea8);
jLabel27.setText("Пример ввода матрицы с клавиатуры");
jLabel28.setText("Перед вводом каждой строки - Space");
jLabel29.setText("После последнего элемента - Enter");
jScrollPane2.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
jScrollPane2.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
jTextArea2.setEditable(false);
jTextArea2.setColumns(20);
jTextArea2.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
jTextArea2.setRows(5);
jTextArea2.setText("3 3\n4 3 2 1 2 0 3 1 2");
jScrollPane2.setViewportView(jTextArea2);
jLabel30.setText("Пример ввода матрицы из текстового файла");
jLabel31.setText("В первой строке указываются количество строк и столбцов");
jLabel32.setText("Во второй строке - элементы матрицы");
javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
jPanel6.setLayout(jPanel6Layout);
jPanel6Layout.setHorizontalGroup(
jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel6Layout.createSequentialGroup()
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel6Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane7))
.addGroup(jPanel6Layout.createSequentialGroup()
.addGap(285, 285, 285)
.addComponent(jButton6)
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup()
.addContainerGap(71, Short.MAX_VALUE)
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel27, javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel29)
.addComponent(jLabel28)
.addGroup(jPanel6Layout.createSequentialGroup()
.addGap(58, 58, 58)
.addComponent(jScrollPane8, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel6Layout.createSequentialGroup()
.addGap(111, 111, 111)
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel32)
.addComponent(jLabel31)
.addComponent(jLabel30)))
.addGroup(jPanel6Layout.createSequentialGroup()
.addGap(163, 163, 163)
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)))))
.addContainerGap())
);
jPanel6Layout.setVerticalGroup(
jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel6Layout.createSequentialGroup()
.addComponent(jScrollPane7, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton6)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel27)
.addComponent(jLabel30))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 69, Short.MAX_VALUE)
.addComponent(jScrollPane8, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel29)
.addComponent(jLabel31))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel28)
.addComponent(jLabel32))
.addGap(47, 47, 47))
);
jTabbedPane1.addTab("№6", jPanel6);
jScrollPane9.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
jScrollPane9.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
jTextArea9.setEditable(false);
jTextArea9.setColumns(20);
jTextArea9.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
jTextArea9.setRows(5);
jTextArea9.setText(" \t\t Решение задач линейной алгебры.\n Проверить, образуют ли базис векторы. Если образуют, то найти x = [1 −1 3 −1]^T в этом базисе.\n Для решения задачи необходимо показать, что определитель матрицы F со столбцами \nf1,f2, f3, f4 отличен от нуля, а затем вычислить координаты вектора x в новом базисе по формуле y=(F^1)*x. ");
jTextArea9.setFocusable(false);
jScrollPane9.setViewportView(jTextArea9);
jLabel34.setText("f1 =");
jTextField11.setText("1");
jTextField12.setText("-2");
jTextField13.setText("1");
jTextField14.setText("1");
jTextField15.setText("2");
jTextField16.setText("-1");
jTextField17.setText("1");
jTextField18.setText("-1");
jLabel35.setText("f2 =");
jLabel36.setText("f3 =");
jTextField19.setText("5");
jTextField20.setText("-2");
jTextField21.setText("-3");
jLabel38.setText("f4 =");
jTextField27.setText("1");
jTextField28.setText("-1");
jTextField29.setText("1");
jTextField30.setText("-1");
jTextField31.setText("1");
jButton7.setText("Решение задачи");
jButton7.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton7ActionPerformed(evt);
}
});
jButton8.setText("Доп. Информация");
jButton8.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton8ActionPerformed(evt);
}
});
jLabel33.setText("x =");
jTextField22.setText("1");
jTextField23.setText("-1");
jTextField23.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField23ActionPerformed(evt);
}
});
jTextField24.setText("3");
jTextField25.setText("-1");
jTextArea10.setEditable(false);
jTextArea10.setColumns(20);
jTextArea10.setRows(5);
jScrollPane10.setViewportView(jTextArea10);
javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
jPanel7.setLayout(jPanel7Layout);
jPanel7Layout.setHorizontalGroup(
jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane9)
.addGroup(jPanel7Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel7Layout.createSequentialGroup()
.addComponent(jLabel34)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jTextField14)
.addComponent(jTextField13)
.addComponent(jTextField11)
.addComponent(jTextField12, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel35)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jTextField15)
.addComponent(jTextField16)
.addComponent(jTextField17)
.addComponent(jTextField18, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addComponent(jLabel36)
.addGap(19, 19, 19)
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jTextField21)
.addComponent(jTextField19)
.addComponent(jTextField20)
.addComponent(jTextField31))
.addGap(18, 18, 18)
.addComponent(jLabel38)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jTextField28)
.addComponent(jTextField27)
.addComponent(jTextField29)
.addComponent(jTextField30, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addComponent(jScrollPane10, javax.swing.GroupLayout.DEFAULT_SIZE, 426, Short.MAX_VALUE))
.addGroup(jPanel7Layout.createSequentialGroup()
.addComponent(jLabel33)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jTextField22, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField23, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField24, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField25, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jButton8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton7, javax.swing.GroupLayout.PREFERRED_SIZE, 401, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap())))
);
jPanel7Layout.setVerticalGroup(
jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel7Layout.createSequentialGroup()
.addComponent(jScrollPane9, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(1, 1, 1)
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel7Layout.createSequentialGroup()
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel38, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel7Layout.createSequentialGroup()
.addGap(1, 1, 1)
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel7Layout.createSequentialGroup()
.addComponent(jTextField27, javax.swing.GroupLayout.DEFAULT_SIZE, 31, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField28, javax.swing.GroupLayout.DEFAULT_SIZE, 32, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField29, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(10, 10, 10)
.addComponent(jTextField30, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel7Layout.createSequentialGroup()
.addComponent(jTextField19)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField20)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField21, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(10, 10, 10)
.addComponent(jTextField31, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))))
.addGap(111, 111, 111))
.addGroup(jPanel7Layout.createSequentialGroup()
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(jLabel36, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel7Layout.createSequentialGroup()
.addGap(3, 3, 3)
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(jPanel7Layout.createSequentialGroup()
.addComponent(jTextField11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField12, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField13, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField14, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel7Layout.createSequentialGroup()
.addComponent(jTextField15, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField16, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField17, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField18, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jLabel35, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel34, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
.addComponent(jScrollPane10, javax.swing.GroupLayout.PREFERRED_SIZE, 138, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton8)
.addComponent(jLabel33)
.addComponent(jTextField22, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField25, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField24, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField23, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(1, 1, 1)
.addComponent(jButton7)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
);
jTabbedPane1.addTab("№7", jPanel7);
jLabel37.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel37.setIcon(new javax.swing.ImageIcon(getClass().getResource("/zadanie1_variant8/nomer8_1.png"))); // NOI18N
jLabel37.setBorder(javax.swing.BorderFactory.createEtchedBorder());
jTextField26.setText("2");
jTextField32.setText("3");
jTextField33.setText("5");
jLabel39.setText("ax");
jLabel40.setText("ay");
jLabel41.setText("az");
jTextArea11.setEditable(false);
jTextArea11.setColumns(20);
jTextArea11.setRows(5);
jScrollPane11.setViewportView(jTextArea11);
jButton9.setText("Вывод");
jButton9.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton9ActionPerformed(evt);
}
});
jTextField34.setText("2");
jTextField35.setText("4");
jTextField36.setText("3");
jLabel42.setText("bx");
jLabel43.setText("by");
jLabel44.setText("bz");
javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
jPanel8.setLayout(jPanel8Layout);
jPanel8Layout.setHorizontalGroup(
jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel37, javax.swing.GroupLayout.PREFERRED_SIZE, 691, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel8Layout.createSequentialGroup()
.addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel8Layout.createSequentialGroup()
.addGap(32, 32, 32)
.addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel40)
.addGroup(jPanel8Layout.createSequentialGroup()
.addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel39)
.addComponent(jLabel41, javax.swing.GroupLayout.Alignment.TRAILING))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jTextField33)
.addComponent(jTextField32)
.addComponent(jTextField26, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addGap(18, 18, 18)
.addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel43)
.addGroup(jPanel8Layout.createSequentialGroup()
.addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel42)
.addComponent(jLabel44, javax.swing.GroupLayout.Alignment.TRAILING))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jTextField36)
.addComponent(jTextField35)
.addComponent(jTextField34, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)))))
.addGroup(jPanel8Layout.createSequentialGroup()
.addGap(116, 116, 116)
.addComponent(jButton9, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(18, 18, 18)
.addComponent(jScrollPane11)
.addGap(25, 25, 25))
);
jPanel8Layout.setVerticalGroup(
jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel8Layout.createSequentialGroup()
.addComponent(jLabel37)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane11, javax.swing.GroupLayout.PREFERRED_SIZE, 149, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel8Layout.createSequentialGroup()
.addGap(20, 20, 20)
.addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel8Layout.createSequentialGroup()
.addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel39)
.addComponent(jTextField26, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(1, 1, 1)
.addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jTextField32, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel40))
.addGap(1, 1, 1)
.addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jTextField33, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel41)))
.addGroup(jPanel8Layout.createSequentialGroup()
.addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel42)
.addComponent(jTextField34, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(1, 1, 1)
.addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jTextField35, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel43))
.addGap(1, 1, 1)
.addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jTextField36, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel44))))
.addGap(18, 18, 18)
.addComponent(jButton9)))
.addGap(28, 28, 28))
);
jTabbedPane1.addTab("№8", jPanel8);
jScrollPane12.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
jScrollPane12.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
jTextArea12.setEditable(false);
jTextArea12.setColumns(20);
jTextArea12.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
jTextArea12.setRows(5);
jTextArea12.setText("Создать класс круг, член класса - R. Предусмотреть в классе методы вычисления и вывода сведений \nо фигуре – площади, длины окружности.Создать производный класс – конус с высотой h, добавить в класс метод\nопределения объема фигуры, перегрузить методы расчета площади и вывода сведений о фигуре. \nНаписать программу, демонстрирующую работу с классом: дано N кругов и M конусов, найти количество \nкругов, у которых площадь меньше средней площади всех кругов, и наибольший по объему конус.");
jTextArea12.setFocusable(false);
jScrollPane12.setViewportView(jTextArea12);
jTextField37.setText("2 5 4 5");
jLabel45.setText("R");
jScrollPane13.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
jScrollPane13.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
jTextArea13.setEditable(false);
jTextArea13.setColumns(20);
jTextArea13.setFont(new java.awt.Font("Monospaced", 0, 14)); // NOI18N
jTextArea13.setRows(5);
jTextArea13.setText("Количество кругов и \nконусов определяется \nколичеством введенных \nрадиусов,высот фигур.");
jTextArea13.setFocusable(false);
jScrollPane13.setViewportView(jTextArea13);
jTextField38.setEditable(false);
jTextField38.setToolTipText("");
jLabel46.setText("N");
jTextField39.setEditable(false);
jLabel47.setText("M");
jTextField40.setText("3 4");
jLabel48.setText("r");
jButton10.setText("Вывод");
jButton10.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton10ActionPerformed(evt);
}
});
jTextField41.setText("3 3");
jLabel49.setText("h");
jScrollPane14.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
jScrollPane14.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
jTextArea14.setEditable(false);
jTextArea14.setColumns(20);
jTextArea14.setFont(new java.awt.Font("Monospaced", 0, 14)); // NOI18N
jTextArea14.setRows(5);
jTextArea14.setFocusable(false);
jScrollPane14.setViewportView(jTextArea14);
javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9);
jPanel9.setLayout(jPanel9Layout);
jPanel9Layout.setHorizontalGroup(
jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel9Layout.createSequentialGroup()
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel9Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane12))
.addGroup(jPanel9Layout.createSequentialGroup()
.addGap(95, 95, 95)
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel9Layout.createSequentialGroup()
.addComponent(jLabel49)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jTextField41, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel9Layout.createSequentialGroup()
.addComponent(jLabel48)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jTextField40, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(jPanel9Layout.createSequentialGroup()
.addComponent(jLabel47)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jTextField39)))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel9Layout.createSequentialGroup()
.addComponent(jLabel45)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jTextField37, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel9Layout.createSequentialGroup()
.addComponent(jLabel46)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jTextField38, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel9Layout.createSequentialGroup()
.addComponent(jScrollPane13, javax.swing.GroupLayout.DEFAULT_SIZE, 207, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jScrollPane14, javax.swing.GroupLayout.PREFERRED_SIZE, 241, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jButton10, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
.addContainerGap())
);
jPanel9Layout.setVerticalGroup(
jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel9Layout.createSequentialGroup()
.addComponent(jScrollPane12, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(jPanel9Layout.createSequentialGroup()
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel46)
.addComponent(jTextField38, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel45)
.addComponent(jTextField37, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel47)
.addComponent(jTextField39, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel49)
.addComponent(jTextField41, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addComponent(jScrollPane13, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
.addComponent(jScrollPane14, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel48)
.addComponent(jTextField40, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton10))
.addContainerGap(78, Short.MAX_VALUE))
);
jTabbedPane1.addTab("№9", jPanel9);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jTabbedPane1)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 320, Short.MAX_VALUE)
);
pack();
setLocationRelativeTo(null);
}// </editor-fold>//GEN-END:initComponents
public static int Proverka(int n)
{
int a; // хранит текущую самую правую цифру
int b = n % 10; // хранит правую цифру из предыдущей итерации
// выполняем цикл пока наше число не станет равно 0, на каждой итерации
// и перед первой, уменьшаем число 'забывая' самую правую цифру
for (n /= 10; n != 0; n /= 10)
{
a = n % 10; // получаем самую правую цифру числа
if (b <= a)
{ // сравнимаем с предыдущей самой правой
return 0; // если мы здесь, то условие строго убывающей последовательности
} // не выполняется - нужно выйти из функции
b = a; // иначе запоминаем самую правую цифру для последующего сравнения
}
return 1;
}
public boolean Prime(int n)
{
for (int i=2; i<n; i++)
{
if(n%i==0)
return false;
}
return true;
}
/*public int Vivod_number(int n)
{
int a; // хранит текущую самую правую цифру
int b = n % 10; // хранит правую цифру из предыдущей итерации
// выполняем цикл пока наше число не станет равно 0, на каждой итерации
// и перед первой, уменьшаем число 'забывая' самую правую цифру
for (n /= 10; n != 0; n /= 10)
{
a = n % 10; // получаем самую правую цифру числа
if (b <= a)
{ // сравнимаем с предыдущей самой правой
return 0; // если мы здесь, то условие строго убывающей последовательности
} // не выполняется - нужно выйти из функции
b = a; // иначе запоминаем самую правую цифру для последующего сравнения
}
return n;
}*/
//1 задание про градусы:
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
double a_degree = Double.parseDouble(textField1.getText());
double a_radian = (a_degree*Math.PI)/180;
double y = (Math.sin(Math.PI/2+3*a_radian))/(1-Math.sin(3*a_radian-Math.PI));
double z = 1/(Math.tan((5*Math.PI)/4+(3*a_radian)/2));
double razn = Math.abs(y-z);
String y_string,z_string,razn_string;
y_string=Double.toString(y);
textField2.setText(String.valueOf(y_string));
z_string = Double.toString(z);
textField3.setText(String.valueOf(z_string));
razn_string = Double.toString(razn);
textField4.setText(String.valueOf(razn_string));
}//GEN-LAST:event_jButton1ActionPerformed
private void textField4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_textField4ActionPerformed
}//GEN-LAST:event_textField4ActionPerformed
//Тоже первая задача:
private void textField1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_textField1ActionPerformed
double a_degree = Double.parseDouble(textField1.getText());
double a_radian = (a_degree*Math.PI)/180;
double y = (Math.sin(Math.PI/2+3*a_radian))/(1-Math.sin(3*a_radian-Math.PI));
double z = 1/(Math.tan((5*Math.PI)/4+(3*a_radian)/2));
double razn = Math.abs(y-z);
String y_string,z_string,razn_string;
y_string=Double.toString(y);
textField2.setText(String.valueOf(y_string));
z_string = Double.toString(z);
textField3.setText(String.valueOf(z_string));
razn_string = Double.toString(razn);
textField4.setText(String.valueOf(razn_string));
}//GEN-LAST:event_textField1ActionPerformed
//2 задача про фигуры:
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
//Ploshad
//Treygolnik
double a = Double.parseDouble(jTextField1.getText());
double h = Double.parseDouble(jTextField2.getText());
double St = (a*h)/2;
//Parallelogramm
double b = Double.parseDouble(jTextField3.getText());
double bh = Double.parseDouble(jTextField4.getText());
double Sp = b*bh;
//Shestiygolnik
double c=Double.parseDouble(jTextField5.getText());
double r=Double.parseDouble(jTextField6.getText());
double Ss =2*r*r* Math.sqrt(3);
if(St>Sp && St>Ss)
jTextField10.setText("Наибольшая площадь у треугольника.");
else if (Sp>St && Sp>Ss)
jTextField10.setText("Наибольшая площадь у параллелограмма.");
else if(Ss>St && Ss>Sp)
jTextField10.setText("Наибольшая площадь у шестиугольника.");
else if(St==Sp)
jTextField10.setText("Наибольшая площадь у треугольника и параллелограмма.");
else if(St==Ss)
jTextField10.setText("Наибольшая площадь у треугольника и шестиугольника.");
else if(Sp==Ss)
jTextField10.setText("Наибольшая площадь у параллелограмма и шестиугольника.");
else if (St==Sp && Sp==Ss)
jTextField10.setText("У трёх фигур одинаковая площадь.");
String St_string,Sp_string,Ss_string;
St_string=Double.toString(St);
String formattedSt = String.format("%.5f", St);
jTextField7.setText(String.valueOf(formattedSt));
Sp_string = Double.toString(Sp);
String formattedSp = String.format("%.5f", Sp);
jTextField8.setText(String.valueOf(formattedSp));
Ss_string = Double.toString(Ss);
String formattedSs = String.format("%.5f", Ss);
jTextField9.setText(String.valueOf(formattedSs));
}//GEN-LAST:event_jButton2ActionPerformed
//3 задание,нажатие кнопки:
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
//3 zadanie massiv
String text = jTextField3_1.getText(); // Парсим значение из текстового поля.
String[] sNums = text.split(" "); // Разбиваем текст из текстового поля, на массив строк, разделителем является пробел.
jTextField3_2.setText("");
double[] m = new double [sNums.length];
//minimalnii element
double min_number=0;
for(int i=0; i<sNums.length; i++)
{
m[i] = Double.parseDouble(sNums[i]);
if(m[i]>20)
min_number=m[i];
}
for(int i=0; i<sNums.length; i++)
{
if(m[i]>20)
{
if(min_number>m[i])
min_number = m[i];
}
}
if(min_number!=0)
{
String s_min=Double.toString(min_number);
jTextField3_2.setText(String.valueOf(s_min));
}
else
{
jTextField3_2.setText("В массиве не имеется такого элемента.");
}
}//GEN-LAST:event_jButton3ActionPerformed
//3 задание,нажатие на текстовое поле:
private void jTextField3_1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField3_1ActionPerformed
//3 zadanie massiv textfield
String text = jTextField3_1.getText(); // Парсим значение из текстового поля.
String[] sNums = text.split(" "); // Разбиваем текст из текстового поля, на массив строк, разделителем является пробел.
jTextField3_2.setText("");
double[] m = new double [sNums.length];
//minimalnii element
double min_number=0;
for(int i=0; i<sNums.length; i++)
{
m[i] = Double.parseDouble(sNums[i]);
if(m[i]>20)
min_number=m[i];
}
for(int i=0; i<sNums.length; i++)
{
if(m[i]>20)
{
if(min_number>m[i])
min_number = m[i];
}
}
if(min_number!=0)
{
String s_min=Double.toString(min_number);
jTextField3_2.setText(String.valueOf(s_min));
}
else
{
jTextField3_2.setText("В массиве не имеется такого элемента.");
}
}//GEN-LAST:event_jTextField3_1ActionPerformed
private void jTextField3_3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField3_3ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jTextField3_3ActionPerformed
private void jTextField3_4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField3_4ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jTextField3_4ActionPerformed
private void jTextField3_5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField3_5ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jTextField3_5ActionPerformed
//4 zadanie
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
//4 zadanie massiv textfield
String text = jTextField3_3.getText(); // Парсим значение из текстового поля.
if (text.length() == 0) {jTextField3_4.setText("Ни одного элемента не введено.");
return ;}
String[] sNums = text.split(" "); // Разбиваем текст из текстового поля, на массив строк, разделителем является пробел.
jTextField3_4.setText("");
jTextField3_5.setText("");
int[] m = new int [sNums.length];
for(int i=0; i<sNums.length; i++)
{
m[i] = Integer.parseInt(sNums[i]);
String s1=Integer.toString(Proverka(m[i]));
jTextField3_5.setText(jTextField3_5.getText() +" "+ String.valueOf(s1));
if(Proverka(m[i])!=0)
{
String s2=Integer.toString(m[i]);
jTextField3_4.setText(jTextField3_4.getText() +" "+ String.valueOf(s2));
}
}
}//GEN-LAST:event_jButton4ActionPerformed
//5 zadanie
private void jTextField3_6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField3_6ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jTextField3_6ActionPerformed
private void jTextField3_7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField3_7ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jTextField3_7ActionPerformed
private void jTextField3_8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField3_8ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jTextField3_8ActionPerformed
private void jTextField3_9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField3_9ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jTextField3_9ActionPerformed
private void jTextField3_10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField3_10ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jTextField3_10ActionPerformed
//5zadanie knopka
private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
String text = jTextField3_6.getText(); // Парсим значение из текстового поля.
if (text.length() == 0) {jTextField3_7.setText("Ни одного элемента не введено.");
return ;}
String[] sNums = text.split(" "); // Разбиваем текст из текстового поля, на массив строк, разделителем является пробел.
jTextField3_7.setText("");
jTextField3_8.setText("");
jTextField3_9.setText("");
jTextField3_10.setText("");
int[] m = new int [sNums.length];
for(int i=0; i<sNums.length; i++)
{
m[i] = Integer.parseInt(sNums[i]);
}
//1 part
int min = m[0];
int index=0;
double sum1=0,count1=sNums.length;
for(int i = 0; i < sNums.length; i ++)
{
sum1+=m[i];
if(m[i] < min)
{
min = m[i];
index=i;
}
}
int temp = m[0];
m[0]=m[index];
m[index]=temp;
for(int i=0; i<sNums.length; i++)
{
String s1=Integer.toString(m[i]);
jTextField3_7.setText(jTextField3_7.getText() +" "+ String.valueOf(s1));
}
double srednee_do=sum1/count1;
String s1=Double.toString(srednee_do);
jTextField3_8.setText(String.valueOf(s1));
//2part
int max=m[0];
for(int i = 0; i < sNums.length; i ++)
{
if(m[i] > max)
{
max = m[i];
index=i;
}
}
double count2=0,sum2=0;
for(int i=0;i<=index;i++)
{
count2++;
sum2+=m[i];
String s2=Integer.toString(m[i]);
jTextField3_10.setText(jTextField3_10.getText() +" "+ String.valueOf(s2));
}
for(int i = index+1; i < sNums.length; i ++)
{
if(Prime(m[i]))
{
jTextField3_10.setText(jTextField3_10.getText() +" _");
}
else
{
sum2+=m[i];
count2++;
String s2=Integer.toString(m[i]);
jTextField3_10.setText(jTextField3_10.getText() +" "+ String.valueOf(s2));
}
}
double srednee_posle=sum2/count2;
String s2=Double.toString(srednee_posle);
jTextField3_9.setText(String.valueOf(s2));
}//GEN-LAST:event_jButton5ActionPerformed
//6 zadanie!
private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed
JFrame1 s1 = new JFrame1();
JFrame2 s2 = new JFrame2();
s2.setVisible(true);
s2.toFront();
s1.toBack();
}//GEN-LAST:event_jButton6ActionPerformed
//ЗАДАЧА 7
private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton7ActionPerformed
double[][] m = new double [4][4];
double [][] x = new double [1][4];
double[][] A = new double[4][4];
//Pervaya stroka
m[0][0]=Integer.parseInt(jTextField11.getText());
m[0][1]=Integer.parseInt(jTextField15.getText());
m[0][2]=Integer.parseInt(jTextField19.getText());
m[0][3]=Integer.parseInt(jTextField27.getText());
//Vtoraya stroka
m[1][0]=Integer.parseInt(jTextField12.getText());
m[1][1]=Integer.parseInt(jTextField16.getText());
m[1][2]=Integer.parseInt(jTextField20.getText());
m[1][3]=Integer.parseInt(jTextField28.getText());
//Tretiya stroka
m[2][0]=Integer.parseInt(jTextField13.getText());
m[2][1]=Integer.parseInt(jTextField17.getText());
m[2][2]=Integer.parseInt(jTextField21.getText());
m[2][3]=Integer.parseInt(jTextField29.getText());
//Chetvertaya stroka
m[3][0]=Integer.parseInt(jTextField14.getText());
m[3][1]=Integer.parseInt(jTextField18.getText());
m[3][2]=Integer.parseInt(jTextField31.getText());
m[3][3]=Integer.parseInt(jTextField30.getText());
x[0][0]=Integer.parseInt(jTextField22.getText());
x[0][1]=Integer.parseInt(jTextField23.getText());
x[0][2]=Integer.parseInt(jTextField24.getText());
x[0][3]=Integer.parseInt(jTextField25.getText());
MatrixCalculation mc = new MatrixCalculation();
double Result = mc.CalculateMatrix(m);
System.out.println(Result);
if(Result!=0)
{
jTextArea10.setText("Определитель отличен от нуля.\n"
+ "Векторы образуют базис.");
JOptionPane.showMessageDialog(null, "Определитель отличен от нуля.\n"
+ "Векторы образуют базис.",
"Определитель", JOptionPane.INFORMATION_MESSAGE);
}
else
{
jTextArea10.setText("Определитель равен нулю.\n"
+ "Векторы не образуют базис.");
JOptionPane.showMessageDialog(null, "Определитель равен нулю.\n"
+ "Векторы не образуют базис.",
"Определитель", JOptionPane.INFORMATION_MESSAGE);
}
int N = m.length;
//System.out.println(N);
jTextArea10.setText(jTextArea10.getText()+"\n");
jTextArea10.setText(jTextArea10.getText()+"Матрица: "+"\n");
for (int i = 0; i < N; i++){
for (int j = 0; j < N; j++){
jTextArea10.setText(jTextArea10.getText()+"m1[" + i + "][" + j + "]=" + m[i][j]+ " ");
}
jTextArea10.setText(jTextArea10.getText()+"\n");
}
jTextArea10.setText(jTextArea10.getText()+"\n");
invert(m);
int N1 = m.length;
jTextArea10.setText(jTextArea10.getText()+"Обратная матрица: "+"\n");
for (int i = 0; i < N1; i++){
for (int j = 0; j < N1; j++){
m[i][j]=Math.rint(m[i][j] * 100.0) / 100.0;
jTextArea10.setText(jTextArea10.getText()+"m2[" + i + "][" + j + "]=" + m[i][j]+" ");
}
jTextArea10.setText(jTextArea10.getText()+"\n");
}
jTextArea10.setText(jTextArea10.getText()+"\n");
A=multiply(m,x);
int N2 = A.length;
jTextArea10.setText(jTextArea10.getText()+"Координаты вектора в базисе: "+"\n");
for (int i = 0; i < N2; i++)
{
for (int j = 0; j < N2; j++){
jTextArea10.setText(jTextArea10.getText()+"A[" + i + "][" + j + "]=" + A[i][j]+" ");
}
jTextArea10.setText(jTextArea10.getText()+"\n");
}
/*for(int i=0;i<4;i++)
{
for(int j=0;j<4;j++)
System.out.print(m[i][j]);
System.out.println("");
}*///Вывод матрицы
}//GEN-LAST:event_jButton7ActionPerformed
//КНОПКА ИНФОРМАЦИЯ
private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton8ActionPerformed
JOptionPane.showMessageDialog(null, "Находим определитель f1,f2,f3,f4, если он не равен 0, "
+ "\nто эти вектора задают базис.\n" +
"Координаты вектора x в базисе f1,f2,f3,f4: "
+ "\nX'=T^(-1)*X\n" +
"T^(-1) - обратная матрица f1,f2,f3,f4.\nX - вектор x.\n" +
"X' - координаты x в базисе f1,f2,f3,f4.\n" +
"",
"Дополнительная информация", JOptionPane.QUESTION_MESSAGE);
}//GEN-LAST:event_jButton8ActionPerformed
private void jTextField23ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField23ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jTextField23ActionPerformed
private void jButton9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton9ActionPerformed
Vector a = new Vector();
a.x=Integer.parseInt(jTextField26.getText());
a.y=Integer.parseInt(jTextField32.getText());
a.z=Integer.parseInt(jTextField33.getText());
Vector b = new Vector();
b.x=Integer.parseInt(jTextField34.getText());
b.y=Integer.parseInt(jTextField35.getText());
b.z=Integer.parseInt(jTextField36.getText());
Vector c1 = new Vector();
c1=a.add(b);
double d=0;
d=a.Skal(b);
Vector e = new Vector();
e=a.Vect(b);
Vector c = new Vector();
c= a.add(b);
c=c.Vect(b);
Vector f = new Vector();
f=f.Vect(c);
jTextArea11.setText("Вектор A имеет координаты: "+String.valueOf(a.x)+", "+String.valueOf(a.y)+ ", "+ String.valueOf(a.z)+"\n" );
jTextArea11.setText(jTextArea11.getText()+"Вектор B имеет координаты: "+String.valueOf(b.x)+", "+String.valueOf(b.y)+ ", "+ String.valueOf(b.z)+"\n" );
jTextArea11.setText(jTextArea11.getText()+"Сумма векторов: "+String.valueOf(c1.x)+", "+String.valueOf(c1.y)+ ", "+ String.valueOf(c1.z)+"\n" );
jTextArea11.setText(jTextArea11.getText()+"Скалярное произведение: "+String.valueOf(d)+"\n");
jTextArea11.setText(jTextArea11.getText()+"Векторное произведение: "+String.valueOf(e.x)+", "+String.valueOf(e.y)+ ", "+ String.valueOf(e.z)+"\n" );
jTextArea11.setText(jTextArea11.getText()+"1-ое выражение: "+String.valueOf(c.x)+", "+String.valueOf(c.y)+ ", "+ String.valueOf(c.z)+"\n" );
jTextArea11.setText(jTextArea11.getText()+"2-ое выражение: "+String.valueOf(f.x)+", "+String.valueOf(f.y)+ ", "+ String.valueOf(f.z)+"\n" );
}//GEN-LAST:event_jButton9ActionPerformed
private void jTextField4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField4ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jTextField4ActionPerformed
private void jButton10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton10ActionPerformed
String text = jTextField37.getText(); // Парсим значение из текстового поля.
String[] sR = text.split(" "); //РАДИУСЫ КРУГОВ
jTextField38.setText(String.valueOf(sR.length));
String text1 = jTextField41.getText(); // Парсим значение из текстового поля.
String[] sh = text1.split(" "); // ВЫСОТА конусов
jTextField39.setText(String.valueOf(sh.length));
String text2 = jTextField40.getText(); // Парсим значение из текстового поля.
String[] sr = text2.split(" "); //РАДИУСЫ оснований конусов
int N=sR.length;
int M=sh.length;
Circle[] circlearr = new Circle [N];
Conus[] conusarr = new Conus [M];
double[] sR1 = new double [N];
for(int i=0; i<N; i++)
{
sR1[i] = Double.parseDouble(sR[i]);
}
for(int i=0;i<N;i++)
{
circlearr[i] = new Circle(sR1[i]);
}
double[] sh1 = new double [M];
for(int i=0; i<M; i++)
{
sh1[i] = Double.parseDouble(sh[i]);
}
double[] sr1 = new double [M];
for(int i=0; i<M; i++)
{
sr1[i] = Double.parseDouble(sr[i]);
System.out.println("sr"+sr[i]+" ");
}
double sumsquare=0;
for(int i=0;i<N;i++)
{
sumsquare+=circlearr[i].square();
}
double srednsquare=sumsquare/N;
int count=0;
for(int i=0;i<N;i++)
{
if(circlearr[i].square()<srednsquare)
count++;
}
jTextArea13.setText("Количество кругов,\n"
+ "у которых площадь\n" +
"меньше средней площади\n"
+ "всех кругов:" +String.valueOf(count));
for(int i=0;i<M;i++)
{
conusarr[i] = new Conus(sr1[i],sh1[i]);
}
double max =conusarr[0].volume();
int index=0;
for(int i=0;i<M;i++)
{
System.out.println(i+1+"ый эл."+ conusarr[i].volume());
if(conusarr[i].volume()>max)
{
max=conusarr[i].volume();
index=i;
}
}
String formattedmax = String.format("%.3f", max);
jTextArea14.setText("Наибольший по объему конус\n"
+ String.valueOf(index+1)+"-ый конус. Объем: "+ String.valueOf(formattedmax));
}//GEN-LAST:event_jButton10ActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(JFrame1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(JFrame1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(JFrame1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(JFrame1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new JFrame1().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton10;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JButton jButton4;
private javax.swing.JButton jButton5;
private javax.swing.JButton jButton6;
private javax.swing.JButton jButton7;
private javax.swing.JButton jButton8;
private javax.swing.JButton jButton9;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel12;
private javax.swing.JLabel jLabel13;
private javax.swing.JLabel jLabel14;
private javax.swing.JLabel jLabel15;
private javax.swing.JLabel jLabel16;
private javax.swing.JLabel jLabel17;
private javax.swing.JLabel jLabel18;
private javax.swing.JLabel jLabel19;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel20;
private javax.swing.JLabel jLabel21;
private javax.swing.JLabel jLabel22;
private javax.swing.JLabel jLabel23;
private javax.swing.JLabel jLabel24;
private javax.swing.JLabel jLabel25;
private javax.swing.JLabel jLabel26;
private javax.swing.JLabel jLabel27;
private javax.swing.JLabel jLabel28;
private javax.swing.JLabel jLabel29;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel30;
private javax.swing.JLabel jLabel31;
private javax.swing.JLabel jLabel32;
private javax.swing.JLabel jLabel33;
private javax.swing.JLabel jLabel34;
private javax.swing.JLabel jLabel35;
private javax.swing.JLabel jLabel36;
private javax.swing.JLabel jLabel37;
private javax.swing.JLabel jLabel38;
private javax.swing.JLabel jLabel39;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel40;
private javax.swing.JLabel jLabel41;
private javax.swing.JLabel jLabel42;
private javax.swing.JLabel jLabel43;
private javax.swing.JLabel jLabel44;
private javax.swing.JLabel jLabel45;
private javax.swing.JLabel jLabel46;
private javax.swing.JLabel jLabel47;
private javax.swing.JLabel jLabel48;
private javax.swing.JLabel jLabel49;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private javax.swing.JPanel jPanel5;
private javax.swing.JPanel jPanel6;
private javax.swing.JPanel jPanel7;
private javax.swing.JPanel jPanel8;
private javax.swing.JPanel jPanel9;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane10;
private javax.swing.JScrollPane jScrollPane11;
private javax.swing.JScrollPane jScrollPane12;
private javax.swing.JScrollPane jScrollPane13;
private javax.swing.JScrollPane jScrollPane14;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JScrollPane jScrollPane3;
private javax.swing.JScrollPane jScrollPane4;
private javax.swing.JScrollPane jScrollPane5;
private javax.swing.JScrollPane jScrollPane6;
private javax.swing.JScrollPane jScrollPane7;
private javax.swing.JScrollPane jScrollPane8;
private javax.swing.JScrollPane jScrollPane9;
private javax.swing.JTabbedPane jTabbedPane1;
private javax.swing.JTextArea jTextArea1;
private javax.swing.JTextArea jTextArea10;
private javax.swing.JTextArea jTextArea11;
private javax.swing.JTextArea jTextArea12;
private javax.swing.JTextArea jTextArea13;
private javax.swing.JTextArea jTextArea14;
private javax.swing.JTextArea jTextArea2;
private javax.swing.JTextArea jTextArea3;
private javax.swing.JTextArea jTextArea4;
private javax.swing.JTextArea jTextArea5;
private javax.swing.JTextArea jTextArea6;
private javax.swing.JTextArea jTextArea7;
private javax.swing.JTextArea jTextArea8;
private javax.swing.JTextArea jTextArea9;
private javax.swing.JTextField jTextField1;
private javax.swing.JTextField jTextField10;
private javax.swing.JTextField jTextField11;
private javax.swing.JTextField jTextField12;
private javax.swing.JTextField jTextField13;
private javax.swing.JTextField jTextField14;
private javax.swing.JTextField jTextField15;
private javax.swing.JTextField jTextField16;
private javax.swing.JTextField jTextField17;
private javax.swing.JTextField jTextField18;
private javax.swing.JTextField jTextField19;
private javax.swing.JTextField jTextField2;
private javax.swing.JTextField jTextField20;
private javax.swing.JTextField jTextField21;
private javax.swing.JTextField jTextField22;
private javax.swing.JTextField jTextField23;
private javax.swing.JTextField jTextField24;
private javax.swing.JTextField jTextField25;
private javax.swing.JTextField jTextField26;
private javax.swing.JTextField jTextField27;
private javax.swing.JTextField jTextField28;
private javax.swing.JTextField jTextField29;
private javax.swing.JTextField jTextField3;
private javax.swing.JTextField jTextField30;
private javax.swing.JTextField jTextField31;
private javax.swing.JTextField jTextField32;
private javax.swing.JTextField jTextField33;
private javax.swing.JTextField jTextField34;
private javax.swing.JTextField jTextField35;
private javax.swing.JTextField jTextField36;
private javax.swing.JTextField jTextField37;
private javax.swing.JTextField jTextField38;
private javax.swing.JTextField jTextField39;
private javax.swing.JTextField jTextField3_1;
private javax.swing.JTextField jTextField3_10;
private javax.swing.JTextField jTextField3_2;
private javax.swing.JTextField jTextField3_3;
private javax.swing.JTextField jTextField3_4;
private javax.swing.JTextField jTextField3_5;
private javax.swing.JTextField jTextField3_6;
private javax.swing.JTextField jTextField3_7;
private javax.swing.JTextField jTextField3_8;
private javax.swing.JTextField jTextField3_9;
private javax.swing.JTextField jTextField4;
private javax.swing.JTextField jTextField40;
private javax.swing.JTextField jTextField41;
private javax.swing.JTextField jTextField5;
private javax.swing.JTextField jTextField6;
private javax.swing.JTextField jTextField7;
private javax.swing.JTextField jTextField8;
private javax.swing.JTextField jTextField9;
private java.awt.TextField textField1;
private java.awt.TextField textField2;
private java.awt.TextField textField3;
private java.awt.TextField textField4;
// End of variables declaration//GEN-END:variables
}
| 123,588 | 0.627391 | 0.60154 | 2,166 | 53.668053 | 44.338383 | 521 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.781625 | false | false | 9 |
bf73ec91a2467a30d2a01166ffaafef474d0f57f | 18,279,380,849,756 | ed3265d96cb34ca16f2926ebb6548a2b07831a07 | /src/main/java/TorrentSource.java | 388a24e70045faa9f3d91b9bba913a915fa558be | [] | no_license | phanijsp/SAnD_SE | https://github.com/phanijsp/SAnD_SE | b218eac16a4571c9239856edb94e0ab35af9fbf0 | 3027dbb4e1d3d0eba2389b8f246d15641db664de | refs/heads/master | 2023-02-09T11:44:06.857000 | 2021-01-06T04:01:25 | 2021-01-06T04:01:25 | 308,016,619 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
public class TorrentSource {
private String source; //[0]
private String title_descriptor; //[1]
private String seeds_descriptor; //[2]
private String leeches_descriptor; //[3]
private String size_descriptor; //[4]
private String added_descriptor; //[5]
private String endURLMagnet_descriptor; //[6]
private String endURL_descriptor; //[7]
private String searchURL; //[8]
private String baseURL; //[9]
private String queryIdentifier; //[10]
public TorrentSource(String source,
String title_descriptor,
String seeds_descriptor,
String leeches_descriptor,
String size_descriptor,
String added_descriptor,
String endURLMagnet_descriptor,
String endURL_descriptor,
String searchURL,
String baseURL,
String queryIdentifier) {
this.source = source;
this.title_descriptor = title_descriptor;
this.seeds_descriptor = seeds_descriptor;
this.leeches_descriptor = leeches_descriptor;
this.size_descriptor = size_descriptor;
this.added_descriptor = added_descriptor;
this.endURLMagnet_descriptor = endURLMagnet_descriptor;
this.endURL_descriptor = endURL_descriptor;
this.searchURL = searchURL;
this.baseURL = baseURL;
this.queryIdentifier = queryIdentifier;
}
public String getTitle_descriptor() {
return title_descriptor;
}
public String getSeeds_descriptor() {
return seeds_descriptor;
}
public String getLeeches_descriptor() {
return leeches_descriptor;
}
public String getSize_descriptor() {
return size_descriptor;
}
public String getAdded_descriptor() {
return added_descriptor;
}
public String getEndURLMagnet_descriptor() {
return endURLMagnet_descriptor;
}
public String getEndURL_descriptor() {
return endURL_descriptor;
}
public String getSource() {
return source;
}
public String getSearchURL() {
return searchURL;
}
public String getQueryIdentifier() {
return queryIdentifier;
}
public String getBaseURL() {
return baseURL;
}
}
| UTF-8 | Java | 2,508 | java | TorrentSource.java | Java | [] | null | [] |
public class TorrentSource {
private String source; //[0]
private String title_descriptor; //[1]
private String seeds_descriptor; //[2]
private String leeches_descriptor; //[3]
private String size_descriptor; //[4]
private String added_descriptor; //[5]
private String endURLMagnet_descriptor; //[6]
private String endURL_descriptor; //[7]
private String searchURL; //[8]
private String baseURL; //[9]
private String queryIdentifier; //[10]
public TorrentSource(String source,
String title_descriptor,
String seeds_descriptor,
String leeches_descriptor,
String size_descriptor,
String added_descriptor,
String endURLMagnet_descriptor,
String endURL_descriptor,
String searchURL,
String baseURL,
String queryIdentifier) {
this.source = source;
this.title_descriptor = title_descriptor;
this.seeds_descriptor = seeds_descriptor;
this.leeches_descriptor = leeches_descriptor;
this.size_descriptor = size_descriptor;
this.added_descriptor = added_descriptor;
this.endURLMagnet_descriptor = endURLMagnet_descriptor;
this.endURL_descriptor = endURL_descriptor;
this.searchURL = searchURL;
this.baseURL = baseURL;
this.queryIdentifier = queryIdentifier;
}
public String getTitle_descriptor() {
return title_descriptor;
}
public String getSeeds_descriptor() {
return seeds_descriptor;
}
public String getLeeches_descriptor() {
return leeches_descriptor;
}
public String getSize_descriptor() {
return size_descriptor;
}
public String getAdded_descriptor() {
return added_descriptor;
}
public String getEndURLMagnet_descriptor() {
return endURLMagnet_descriptor;
}
public String getEndURL_descriptor() {
return endURL_descriptor;
}
public String getSource() {
return source;
}
public String getSearchURL() {
return searchURL;
}
public String getQueryIdentifier() {
return queryIdentifier;
}
public String getBaseURL() {
return baseURL;
}
}
| 2,508 | 0.576156 | 0.571372 | 85 | 28.494118 | 20.418344 | 63 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.505882 | false | false | 9 |
710011b46de4b239d407761c7e532b486ede308a | 14,731,737,865,835 | 890709f716370cbe341141951ed18444b50fca18 | /zTurn/src_1st_round_test/leetcode/CountAndSayOJTest.java | b206ef970ad9a5dd5f5184d7983c5812ab525063 | [] | no_license | ziaoliu/zTurn | https://github.com/ziaoliu/zTurn | c65f66f311c3509b8247070b3d7a672d332bd462 | b3f120af9b1d4b8b93bb6a95dd7941c954d9f99f | refs/heads/master | 2021-07-05T20:33:47.732000 | 2016-09-29T15:57:19 | 2016-09-29T15:57:19 | 38,476,498 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package leetcode;
import static org.junit.Assert.*;
import leetcode.CountAndSayOJ.Solution;
import org.junit.Test;
public class CountAndSayOJTest {
@Test
public void test() {
CountAndSayOJ solution = new CountAndSayOJ();
Solution test = solution.new Solution();
for (int i = 0; i < 10; i++) {
System.out
.println("n = " + i + ", result = " + test.countAndSay(i));
}
}
}
| UTF-8 | Java | 414 | java | CountAndSayOJTest.java | Java | [] | null | [] | package leetcode;
import static org.junit.Assert.*;
import leetcode.CountAndSayOJ.Solution;
import org.junit.Test;
public class CountAndSayOJTest {
@Test
public void test() {
CountAndSayOJ solution = new CountAndSayOJ();
Solution test = solution.new Solution();
for (int i = 0; i < 10; i++) {
System.out
.println("n = " + i + ", result = " + test.countAndSay(i));
}
}
}
| 414 | 0.628019 | 0.620773 | 20 | 18.700001 | 18.929079 | 64 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.45 | false | false | 9 |
1149878adbaf0e867ae512b1a750f2089a275657 | 13,606,456,418,461 | 359e356976b0c747f7d97d638728c151e7383f97 | /src/exceptions/Plane.java | 79d1c36e16681341d5e58b5afae2929c0cce9113 | [] | no_license | muylukcu/chicago-b10 | https://github.com/muylukcu/chicago-b10 | e68407bb8f80a1c17cf30ef106f593582c1ea81c | 47c75255ef9757c7a90979a4bd45da4c50a0eb93 | refs/heads/master | 2020-05-24T11:17:11.771000 | 2019-01-03T03:05:49 | 2019-01-03T03:05:49 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package exceptions;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
import org.omg.CORBA.ExceptionList;
public class Plane {
public static void main(String[] args){
System.out.println("Program starting");
File file = new File("/Users/cybertekchicago-1/Desktop/test.txt");
try {
Scanner sc = new Scanner(file);
System.out.println("After scanner laod");
Thread.sleep(2000);
}
catch(Exception e) {
System.out.println("General exception here");
e.printStackTrace();
}
System.out.println("End of PRogram");
}
public static void test() throws Exception{
File file = new File("/Users/cybertekchicago-1/Desktop/test.txt");
Scanner sc = new Scanner(file);
System.out.println("After scanner laod");
Thread.sleep(2000);
}
}
| UTF-8 | Java | 826 | java | Plane.java | Java | [
{
"context": "rogram starting\");\n\t\tFile file = new File(\"/Users/cybertekchicago-1/Desktop/test.txt\");\n\t\t\n\t\ttry {\n\t\t\tScanner sc = ",
"end": 296,
"score": 0.617280125617981,
"start": 281,
"tag": "USERNAME",
"value": "cybertekchicago"
}
] | null | [] | package exceptions;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
import org.omg.CORBA.ExceptionList;
public class Plane {
public static void main(String[] args){
System.out.println("Program starting");
File file = new File("/Users/cybertekchicago-1/Desktop/test.txt");
try {
Scanner sc = new Scanner(file);
System.out.println("After scanner laod");
Thread.sleep(2000);
}
catch(Exception e) {
System.out.println("General exception here");
e.printStackTrace();
}
System.out.println("End of PRogram");
}
public static void test() throws Exception{
File file = new File("/Users/cybertekchicago-1/Desktop/test.txt");
Scanner sc = new Scanner(file);
System.out.println("After scanner laod");
Thread.sleep(2000);
}
}
| 826 | 0.686441 | 0.674334 | 41 | 19.146341 | 19.702124 | 68 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.926829 | false | false | 9 |
6c783e414e6a2728749a429c878c4884f9955aec | 28,278,064,678,870 | 2fd5bd8a77e075a6b2256cd508a3262e9ab4ec49 | /cmake-runner-server/src/jetbrains/buildServer/cmakerunner/server/MakeRunnerRunType.java | 357a0d217e973685e88632979b22ee1fd952c62d | [
"Apache-2.0"
] | permissive | MikeNeilson/CMake-runner-plugin | https://github.com/MikeNeilson/CMake-runner-plugin | 72480f0956e792dc145f62cdf3bc1787e41dc5c2 | 8931380304c94c69cdad0987a48bf9af906e7f16 | refs/heads/master | 2023-03-17T02:58:23.716000 | 2019-03-11T13:10:20 | 2019-03-11T13:10:20 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* Copyright 2000-2014 JetBrains s.r.o.
*
* 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 jetbrains.buildServer.cmakerunner.server;
/**
* @author : Vladislav.Rassokhin
*/
import jetbrains.buildServer.cmakerunner.MakeRunnerConstants;
import jetbrains.buildServer.serverSide.PropertiesProcessor;
import jetbrains.buildServer.serverSide.RunType;
import jetbrains.buildServer.serverSide.RunTypeRegistry;
import jetbrains.buildServer.web.openapi.PluginDescriptor;
import org.jetbrains.annotations.NotNull;
import java.util.Map;
public class MakeRunnerRunType extends RunType {
private final PluginDescriptor myPluginDescriptor;
public MakeRunnerRunType(@NotNull final RunTypeRegistry runTypeRegistry,
@NotNull final PluginDescriptor descriptor) {
runTypeRegistry.registerRunType(this);
myPluginDescriptor = descriptor;
}
@NotNull
@Override
public String getType() {
return MakeRunnerConstants.TYPE;
}
@NotNull
@Override
public String getDisplayName() {
return MakeRunnerConstants.DISPLAY_NAME;
}
@NotNull
@Override
public String getDescription() {
return MakeRunnerConstants.DESCRIPTION;
}
@Override
public PropertiesProcessor getRunnerPropertiesProcessor() {
// Do nothing
return null;
}
@Override
public String getEditRunnerParamsJspFilePath() {
return myPluginDescriptor.getPluginResourcesPath("editMakeRunner.jsp");
}
@Override
public String getViewRunnerParamsJspFilePath() {
return myPluginDescriptor.getPluginResourcesPath("viewMakeRunner.jsp");
}
@Override
public Map<String, String> getDefaultRunnerProperties() {
return null;
}
}
| UTF-8 | Java | 2,275 | java | MakeRunnerRunType.java | Java | [
{
"context": "dServer.cmakerunner.server;\r\n\r\n\r\n/**\r\n * @author : Vladislav.Rassokhin\r\n */\r\n\r\nimport jetbrains.buildServer.cmakerunner.",
"end": 710,
"score": 0.9998509883880615,
"start": 691,
"tag": "NAME",
"value": "Vladislav.Rassokhin"
}
] | null | [] | /*
* Copyright 2000-2014 JetBrains s.r.o.
*
* 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 jetbrains.buildServer.cmakerunner.server;
/**
* @author : Vladislav.Rassokhin
*/
import jetbrains.buildServer.cmakerunner.MakeRunnerConstants;
import jetbrains.buildServer.serverSide.PropertiesProcessor;
import jetbrains.buildServer.serverSide.RunType;
import jetbrains.buildServer.serverSide.RunTypeRegistry;
import jetbrains.buildServer.web.openapi.PluginDescriptor;
import org.jetbrains.annotations.NotNull;
import java.util.Map;
public class MakeRunnerRunType extends RunType {
private final PluginDescriptor myPluginDescriptor;
public MakeRunnerRunType(@NotNull final RunTypeRegistry runTypeRegistry,
@NotNull final PluginDescriptor descriptor) {
runTypeRegistry.registerRunType(this);
myPluginDescriptor = descriptor;
}
@NotNull
@Override
public String getType() {
return MakeRunnerConstants.TYPE;
}
@NotNull
@Override
public String getDisplayName() {
return MakeRunnerConstants.DISPLAY_NAME;
}
@NotNull
@Override
public String getDescription() {
return MakeRunnerConstants.DESCRIPTION;
}
@Override
public PropertiesProcessor getRunnerPropertiesProcessor() {
// Do nothing
return null;
}
@Override
public String getEditRunnerParamsJspFilePath() {
return myPluginDescriptor.getPluginResourcesPath("editMakeRunner.jsp");
}
@Override
public String getViewRunnerParamsJspFilePath() {
return myPluginDescriptor.getPluginResourcesPath("viewMakeRunner.jsp");
}
@Override
public Map<String, String> getDefaultRunnerProperties() {
return null;
}
}
| 2,275 | 0.731429 | 0.726154 | 82 | 25.743902 | 25.895103 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.304878 | false | false | 9 |
40dbbf54bec9d7efd8b954fd83f3da447cf07377 | 3,530,463,162,980 | b15fcbea84500825b454a8e0fca67e6c4a8c9cef | /ControlObligaciones/ControlObligacionesBack/src/test/java/mx/gob/sat/siat/cob/background/test/AfectacionPorTiempoTest.java | 3e4e8ac7db2038eff76f7c46d33411afabe30736 | [] | no_license | xtaticzero/COB | https://github.com/xtaticzero/COB | 0416523d1bbc96d6024df5eca79172cb0927423f | 96082d47e4ffb97dd6e61ce42feee65d5fe64e50 | refs/heads/master | 2021-09-09T22:02:10.153000 | 2018-03-20T00:18:00 | 2018-03-20T00:18:00 | 125,936,388 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package mx.gob.sat.siat.cob.background.test;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import mx.gob.sat.siat.cob.background.service.afectaciones.AfectacionTiempoService;
import mx.gob.sat.siat.cob.seguimiento.dto.stdcob.DetalleDocumento;
import mx.gob.sat.siat.cob.seguimiento.dto.stdcob.Documento;
import mx.gob.sat.siat.cob.seguimiento.dto.stdcob.enums.EtapaVigilanciaEnum;
import mx.gob.sat.siat.cob.seguimiento.dto.stdcob.enums.TipoDocumentoEnum;
import mx.gob.sat.siat.cob.seguimiento.exception.SGTServiceException;
import mx.gob.sat.siat.cob.seguimiento.service.afectaciones.ProcesoAfectacionTiempoService;
import mx.gob.sat.siat.cobranza.domain.ICEP;
import mx.gob.sat.siat.cobranza.domain.Persona;
import mx.gob.sat.siat.cobranza.domain.Resolucion;
import mx.gob.sat.siat.cobranza.negocio.registromasivo.api.RegistroMasivoFacade;
import mx.gob.sat.siat.cobranza.negocio.util.constante.NumerosConstante;
import mx.gob.sat.siat.cobranza.negocio.util.excepcion.FacadeNegocioException;
import org.junit.Ignore;
import org.junit.Test;
public class AfectacionPorTiempoTest extends ContextLoaderTest {
private static int N_22 = 54;
@Test
@Ignore
public void pruebaAfectacionTiempo() {
for (String s : getContext().getBeanDefinitionNames()) {
log.error(s);
}
AfectacionTiempoService afectacionTiempoService =
(AfectacionTiempoService) getContext().getBean("afectacionTiempoService");
try {
afectacionTiempoService.afectacionPorTiempo();
} catch (SGTServiceException e) {
log.error("error " + e);
}
}
@Test
@Ignore
public void testStoreProcedure() throws FacadeNegocioException {
RegistroMasivoFacade registroMasivoFacade = (RegistroMasivoFacade) getContext().getBean("registroMasivoFacade");
List<Resolucion> resoluciones = new ArrayList<Resolucion>();
resoluciones.add(resolucion1());
try {
Map resols = registroMasivoFacade.insertarResolucionSP(resoluciones);
if (resols != null) {
Long lote = (Long) resols.get("ID_LOTE");
log.info("### IdLote: " + lote);
List<String> fallados = (List<String>) resols.get("RESOLUCIONES");
log.info("### Numero de resoluciones falladas: " + fallados.size());
} else {
log.info("### no se guardo nada");
}
} catch (FacadeNegocioException e) {
log.error(e.getMessage());
throw new FacadeNegocioException();
}
}
private Resolucion resolucion1() {
Resolucion resolucion = new Resolucion();
resolucion.setNumResolucionDet("resolucion10008mil");
resolucion.setFecResolucionDet(new Date());
resolucion.setIdClaveSir(Long.valueOf(N_22));
resolucion.setIdResolMotivoConstante("RESOLMOTIVO_INCUMPLIMIENTO");
resolucion.setImporteDet(new BigDecimal(640));
resolucion.setIdFirmaTipo(Long.valueOf(NumerosConstante.N_1));
resolucion.setFolio(new BigDecimal("122"));
resolucion.setFecReqCob(new Date());
ICEP icep = new ICEP();
icep.setIdMultaDesc(1L);
List<ICEP> iceps = new ArrayList<ICEP>();
iceps.add(icep);
Persona per = new Persona();
per.setBoId("1018716446448457062980458107561");
per.setRfc("AARE8011132M8");
resolucion.setPersona(per);
resolucion.setListaICEPs(iceps);
return resolucion;
}
@Test
@Ignore
public void pruebaLiquidacion() throws SGTServiceException {
ProcesoAfectacionTiempoService procesoAfectacion =
(ProcesoAfectacionTiempoService) getContext().getBean("procesoAfectacionTiempoServiceImpl");
List<Documento> documentosVencidos = new ArrayList<Documento>();
Documento doc = new Documento();
List<DetalleDocumento> icepsOmisosDocumento = new ArrayList<DetalleDocumento>();
DetalleDocumento icep1 = new DetalleDocumento();
DetalleDocumento icep2 = new DetalleDocumento();
DetalleDocumento icep3 = new DetalleDocumento();
DetalleDocumento icep4 = new DetalleDocumento();
icep1.setClaveIcep(832L);
icep1.setNumeroControl("22129");
icep1.setIdObligacion(7);
icep1.setIdEjercicio("2013");
icep1.setIdPeriodo("1");
icep1.setFechaVencimiento("19/03/2014");
icep1.setIdPeriodicidad("M");
icep1.setIdSituacionIcep(0);
icep1.setTieneMultaComplementaria(0);
icep1.setTieneMultaExtemporaneidad(0);
icep2.setClaveIcep(833L);
icep2.setNumeroControl("22129");
icep2.setIdObligacion(7);
icep2.setIdEjercicio("2013");
icep2.setIdPeriodo("1");
icep2.setFechaVencimiento("19/03/2014");
icep2.setIdPeriodicidad("M");
icep2.setIdSituacionIcep(0);
icep2.setTieneMultaComplementaria(0);
icep2.setTieneMultaExtemporaneidad(0);
icep3.setClaveIcep(834L);
icep3.setNumeroControl("22129");
icep3.setIdObligacion(7);
icep3.setIdEjercicio("2013");
icep3.setIdPeriodo("1");
icep3.setFechaVencimiento("19/03/2014");
icep3.setIdPeriodicidad("M");
icep3.setIdSituacionIcep(0);
icep3.setTieneMultaComplementaria(0);
icep3.setTieneMultaExtemporaneidad(0);
icep4.setClaveIcep(835L);
icep4.setNumeroControl("22129");
icep4.setIdObligacion(7);
icep4.setIdEjercicio("2013");
icep4.setIdPeriodo("1");
icep4.setFechaVencimiento("19/03/2014");
icep4.setIdPeriodicidad("M");
icep4.setIdSituacionIcep(0);
icep4.setTieneMultaComplementaria(0);
icep4.setTieneMultaExtemporaneidad(0);
icepsOmisosDocumento.add(icep1);
icepsOmisosDocumento.add(icep2);
icepsOmisosDocumento.add(icep3);
icepsOmisosDocumento.add(icep4);
doc.setDetalles(icepsOmisosDocumento);
doc.setBoid("854027867417392778189516");
doc.setNumeroControl("22129");
doc.getVigilancia().setIdTipoDocumento(4);
doc.setIdEtapaVigilancia(3);
doc.getVigilancia().setIdVigilancia(141L);
doc.setRfc("MOLA830424MVZ");
doc.setEsUltimoGenerado(0);
doc.setFechaRegistro(new Date());
doc.setConsideraRenuencia(0);
documentosVencidos.add(doc);
procesoAfectacion.generaDocumentoLiquidacion(EtapaVigilanciaEnum.ETAPA_3, TipoDocumentoEnum.REQUERIMIENTO_MULTA, documentosVencidos);
}
} | UTF-8 | Java | 6,678 | java | AfectacionPorTiempoTest.java | Java | [] | null | [] | package mx.gob.sat.siat.cob.background.test;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import mx.gob.sat.siat.cob.background.service.afectaciones.AfectacionTiempoService;
import mx.gob.sat.siat.cob.seguimiento.dto.stdcob.DetalleDocumento;
import mx.gob.sat.siat.cob.seguimiento.dto.stdcob.Documento;
import mx.gob.sat.siat.cob.seguimiento.dto.stdcob.enums.EtapaVigilanciaEnum;
import mx.gob.sat.siat.cob.seguimiento.dto.stdcob.enums.TipoDocumentoEnum;
import mx.gob.sat.siat.cob.seguimiento.exception.SGTServiceException;
import mx.gob.sat.siat.cob.seguimiento.service.afectaciones.ProcesoAfectacionTiempoService;
import mx.gob.sat.siat.cobranza.domain.ICEP;
import mx.gob.sat.siat.cobranza.domain.Persona;
import mx.gob.sat.siat.cobranza.domain.Resolucion;
import mx.gob.sat.siat.cobranza.negocio.registromasivo.api.RegistroMasivoFacade;
import mx.gob.sat.siat.cobranza.negocio.util.constante.NumerosConstante;
import mx.gob.sat.siat.cobranza.negocio.util.excepcion.FacadeNegocioException;
import org.junit.Ignore;
import org.junit.Test;
public class AfectacionPorTiempoTest extends ContextLoaderTest {
private static int N_22 = 54;
@Test
@Ignore
public void pruebaAfectacionTiempo() {
for (String s : getContext().getBeanDefinitionNames()) {
log.error(s);
}
AfectacionTiempoService afectacionTiempoService =
(AfectacionTiempoService) getContext().getBean("afectacionTiempoService");
try {
afectacionTiempoService.afectacionPorTiempo();
} catch (SGTServiceException e) {
log.error("error " + e);
}
}
@Test
@Ignore
public void testStoreProcedure() throws FacadeNegocioException {
RegistroMasivoFacade registroMasivoFacade = (RegistroMasivoFacade) getContext().getBean("registroMasivoFacade");
List<Resolucion> resoluciones = new ArrayList<Resolucion>();
resoluciones.add(resolucion1());
try {
Map resols = registroMasivoFacade.insertarResolucionSP(resoluciones);
if (resols != null) {
Long lote = (Long) resols.get("ID_LOTE");
log.info("### IdLote: " + lote);
List<String> fallados = (List<String>) resols.get("RESOLUCIONES");
log.info("### Numero de resoluciones falladas: " + fallados.size());
} else {
log.info("### no se guardo nada");
}
} catch (FacadeNegocioException e) {
log.error(e.getMessage());
throw new FacadeNegocioException();
}
}
private Resolucion resolucion1() {
Resolucion resolucion = new Resolucion();
resolucion.setNumResolucionDet("resolucion10008mil");
resolucion.setFecResolucionDet(new Date());
resolucion.setIdClaveSir(Long.valueOf(N_22));
resolucion.setIdResolMotivoConstante("RESOLMOTIVO_INCUMPLIMIENTO");
resolucion.setImporteDet(new BigDecimal(640));
resolucion.setIdFirmaTipo(Long.valueOf(NumerosConstante.N_1));
resolucion.setFolio(new BigDecimal("122"));
resolucion.setFecReqCob(new Date());
ICEP icep = new ICEP();
icep.setIdMultaDesc(1L);
List<ICEP> iceps = new ArrayList<ICEP>();
iceps.add(icep);
Persona per = new Persona();
per.setBoId("1018716446448457062980458107561");
per.setRfc("AARE8011132M8");
resolucion.setPersona(per);
resolucion.setListaICEPs(iceps);
return resolucion;
}
@Test
@Ignore
public void pruebaLiquidacion() throws SGTServiceException {
ProcesoAfectacionTiempoService procesoAfectacion =
(ProcesoAfectacionTiempoService) getContext().getBean("procesoAfectacionTiempoServiceImpl");
List<Documento> documentosVencidos = new ArrayList<Documento>();
Documento doc = new Documento();
List<DetalleDocumento> icepsOmisosDocumento = new ArrayList<DetalleDocumento>();
DetalleDocumento icep1 = new DetalleDocumento();
DetalleDocumento icep2 = new DetalleDocumento();
DetalleDocumento icep3 = new DetalleDocumento();
DetalleDocumento icep4 = new DetalleDocumento();
icep1.setClaveIcep(832L);
icep1.setNumeroControl("22129");
icep1.setIdObligacion(7);
icep1.setIdEjercicio("2013");
icep1.setIdPeriodo("1");
icep1.setFechaVencimiento("19/03/2014");
icep1.setIdPeriodicidad("M");
icep1.setIdSituacionIcep(0);
icep1.setTieneMultaComplementaria(0);
icep1.setTieneMultaExtemporaneidad(0);
icep2.setClaveIcep(833L);
icep2.setNumeroControl("22129");
icep2.setIdObligacion(7);
icep2.setIdEjercicio("2013");
icep2.setIdPeriodo("1");
icep2.setFechaVencimiento("19/03/2014");
icep2.setIdPeriodicidad("M");
icep2.setIdSituacionIcep(0);
icep2.setTieneMultaComplementaria(0);
icep2.setTieneMultaExtemporaneidad(0);
icep3.setClaveIcep(834L);
icep3.setNumeroControl("22129");
icep3.setIdObligacion(7);
icep3.setIdEjercicio("2013");
icep3.setIdPeriodo("1");
icep3.setFechaVencimiento("19/03/2014");
icep3.setIdPeriodicidad("M");
icep3.setIdSituacionIcep(0);
icep3.setTieneMultaComplementaria(0);
icep3.setTieneMultaExtemporaneidad(0);
icep4.setClaveIcep(835L);
icep4.setNumeroControl("22129");
icep4.setIdObligacion(7);
icep4.setIdEjercicio("2013");
icep4.setIdPeriodo("1");
icep4.setFechaVencimiento("19/03/2014");
icep4.setIdPeriodicidad("M");
icep4.setIdSituacionIcep(0);
icep4.setTieneMultaComplementaria(0);
icep4.setTieneMultaExtemporaneidad(0);
icepsOmisosDocumento.add(icep1);
icepsOmisosDocumento.add(icep2);
icepsOmisosDocumento.add(icep3);
icepsOmisosDocumento.add(icep4);
doc.setDetalles(icepsOmisosDocumento);
doc.setBoid("854027867417392778189516");
doc.setNumeroControl("22129");
doc.getVigilancia().setIdTipoDocumento(4);
doc.setIdEtapaVigilancia(3);
doc.getVigilancia().setIdVigilancia(141L);
doc.setRfc("MOLA830424MVZ");
doc.setEsUltimoGenerado(0);
doc.setFechaRegistro(new Date());
doc.setConsideraRenuencia(0);
documentosVencidos.add(doc);
procesoAfectacion.generaDocumentoLiquidacion(EtapaVigilanciaEnum.ETAPA_3, TipoDocumentoEnum.REQUERIMIENTO_MULTA, documentosVencidos);
}
} | 6,678 | 0.679096 | 0.641509 | 175 | 37.165714 | 25.854118 | 141 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.697143 | false | false | 9 |
2db3e431fe584c5b62423452d9ef0e3f6cea1843 | 17,721,035,092,539 | 5f49946e75e860d18ecb91350c82b2686054d10b | /persistence/src/main/java/org/devgateway/toolkit/persistence/service/TestFormServiceImpl.java | 54019f33dff8f76b7340ac552af15c97015aa2a3 | [
"MIT"
] | permissive | devgateway/dg-toolkit | https://github.com/devgateway/dg-toolkit | 080eec142da6bdb511696a0e99c2d5becd585591 | 68e4103be8b6ca67ac0257f0f2cc2eb1f005649e | refs/heads/dgtkit-4.x | 2023-02-08T18:32:22.529000 | 2022-12-22T12:42:13 | 2022-12-22T12:42:13 | 39,519,020 | 8 | 8 | MIT | false | 2023-01-07T21:14:54 | 2015-07-22T17:06:37 | 2022-06-05T05:47:58 | 2023-01-07T21:14:53 | 6,227 | 3 | 0 | 47 | Java | false | false | package org.devgateway.toolkit.persistence.service;
import org.devgateway.toolkit.persistence.dao.TestForm;
import org.devgateway.toolkit.persistence.repository.TestFormRepository;
import org.devgateway.toolkit.persistence.repository.norepository.BaseJpaRepository;
import org.devgateway.toolkit.persistence.repository.norepository.UniquePropertyRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* @author idobre
* @since 2019-03-04
*/
@Service
@Transactional(readOnly = true)
public class TestFormServiceImpl extends BaseJpaServiceImpl<TestForm> implements TestFormService {
@Autowired
private TestFormRepository testFormRepository;
@Override
protected BaseJpaRepository<TestForm, Long> repository() {
return testFormRepository;
}
@Override
public UniquePropertyRepository<TestForm, Long> uniquePropertyRepository() {
return testFormRepository;
}
@Override
public TestForm newInstance() {
return new TestForm();
}
}
| UTF-8 | Java | 1,191 | java | TestFormServiceImpl.java | Java | [
{
"context": "nsaction.annotation.Transactional;\n\n/**\n * @author idobre\n * @since 2019-03-04\n */\n@Service\n@Transactional(",
"end": 613,
"score": 0.9996727108955383,
"start": 607,
"tag": "USERNAME",
"value": "idobre"
}
] | null | [] | package org.devgateway.toolkit.persistence.service;
import org.devgateway.toolkit.persistence.dao.TestForm;
import org.devgateway.toolkit.persistence.repository.TestFormRepository;
import org.devgateway.toolkit.persistence.repository.norepository.BaseJpaRepository;
import org.devgateway.toolkit.persistence.repository.norepository.UniquePropertyRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* @author idobre
* @since 2019-03-04
*/
@Service
@Transactional(readOnly = true)
public class TestFormServiceImpl extends BaseJpaServiceImpl<TestForm> implements TestFormService {
@Autowired
private TestFormRepository testFormRepository;
@Override
protected BaseJpaRepository<TestForm, Long> repository() {
return testFormRepository;
}
@Override
public UniquePropertyRepository<TestForm, Long> uniquePropertyRepository() {
return testFormRepository;
}
@Override
public TestForm newInstance() {
return new TestForm();
}
}
| 1,191 | 0.79429 | 0.787573 | 36 | 32.083332 | 29.617352 | 98 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.416667 | false | false | 9 |
451434bd2868fbc145b232420efdfc43577f8108 | 1,194,000,910,281 | 6e96745dbfffbc264f7e7892199ea2a8a1b07843 | /src/middleAir/common/requesthandler/Request.java | 68cea399cad29eaf92486cf0c66da7aa5376ca98 | [] | no_license | pedrotorchio/middleware-final | https://github.com/pedrotorchio/middleware-final | 8dadf8d1778adfcdbc40a9e20796006b73946c52 | 90ec9cdcd258f17089f7e69dd68d5401df7f5bc5 | refs/heads/master | 2020-03-12T12:35:31.367000 | 2018-06-20T08:14:59 | 2018-06-20T08:14:59 | 130,621,571 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package middleAir.common.requesthandler;
import java.util.Hashtable;
public class Request implements IHasHeader<Request> {
protected Hashtable<String, String> header = new Hashtable();
protected String body;
public Request() {
}
// public Request(Request other) {
// body = other.getBody();
// header = other.getHeader();
// }
public Request addHeader(String key, String value){
header.put(key, value);
return this;
}
public Request setHeader(Hashtable<String, String> header) {
this.header = header;
return this;
}
public Request setBody(String content){
body = content;
return this;
}
public Request setBody(Object anycontent){
body = anycontent.toString();
return this;
}
public String getHeader(String key) {
return header.get(key);
}
public Hashtable<String, String> getHeader() {
return header;
}
public String getBody() {
return body;
}
public String toString(){
return "Request:" + "\n" +
"Header: " + getHeader().toString() + "\n" +
"Body: " + getBody();
}
public Request clone(){
Request req = new Request();
req.setBody(getBody());
req.setHeader(getHeader());
return req;
}
}
| UTF-8 | Java | 1,383 | java | Request.java | Java | [] | null | [] | package middleAir.common.requesthandler;
import java.util.Hashtable;
public class Request implements IHasHeader<Request> {
protected Hashtable<String, String> header = new Hashtable();
protected String body;
public Request() {
}
// public Request(Request other) {
// body = other.getBody();
// header = other.getHeader();
// }
public Request addHeader(String key, String value){
header.put(key, value);
return this;
}
public Request setHeader(Hashtable<String, String> header) {
this.header = header;
return this;
}
public Request setBody(String content){
body = content;
return this;
}
public Request setBody(Object anycontent){
body = anycontent.toString();
return this;
}
public String getHeader(String key) {
return header.get(key);
}
public Hashtable<String, String> getHeader() {
return header;
}
public String getBody() {
return body;
}
public String toString(){
return "Request:" + "\n" +
"Header: " + getHeader().toString() + "\n" +
"Body: " + getBody();
}
public Request clone(){
Request req = new Request();
req.setBody(getBody());
req.setHeader(getHeader());
return req;
}
}
| 1,383 | 0.571222 | 0.571222 | 62 | 21.306452 | 18.959709 | 65 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.435484 | false | false | 9 |
5d5f0828aa92eceb558b3215ae4b698d4f56cfb1 | 10,943,576,733,510 | 0a0752dd39277c619e8c89823632b0757d5051f3 | /findbugs/baware_run/src/mid/classes/org/apache/batik/dom/svg/SVGLocatableSupport.java | ef6d05e452e3b1a73ae9d4d125e3abe44ce1ad87 | [] | no_license | anthonycanino1/entbench | https://github.com/anthonycanino1/entbench | fc5386f6806124a13059a1d7f21ba1128af7bb19 | 3c664cc693d4415fd8367c8307212d5aa2f3ae68 | refs/heads/master | 2021-01-10T13:49:12.811000 | 2016-11-14T21:57:38 | 2016-11-14T21:57:38 | 52,231,403 | 0 | 2 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.apache.batik.dom.svg;
public class SVGLocatableSupport {
public SVGLocatableSupport() { super(); }
public static org.w3c.dom.svg.SVGElement getNearestViewportElement(org.w3c.dom.Element e) {
org.w3c.dom.Element elt =
e;
while (elt !=
null) {
elt =
org.apache.batik.css.engine.SVGCSSEngine.
getParentCSSStylableElement(
elt);
if (elt instanceof org.w3c.dom.svg.SVGFitToViewBox) {
break;
}
}
return (org.w3c.dom.svg.SVGElement)
elt;
}
public static org.w3c.dom.svg.SVGElement getFarthestViewportElement(org.w3c.dom.Element elt) {
return (org.w3c.dom.svg.SVGElement)
elt.
getOwnerDocument(
).
getDocumentElement(
);
}
public static org.w3c.dom.svg.SVGRect getBBox(org.w3c.dom.Element elt) {
final org.apache.batik.dom.svg.SVGOMElement svgelt =
(org.apache.batik.dom.svg.SVGOMElement)
elt;
org.apache.batik.dom.svg.SVGContext svgctx =
svgelt.
getSVGContext(
);
if (svgctx ==
null)
return null;
if (svgctx.
getBBox(
) ==
null)
return null;
return new org.w3c.dom.svg.SVGRect(
) {
public float getX() {
return (float)
svgelt.
getSVGContext(
).
getBBox(
).
getX(
);
}
public void setX(float x)
throws org.w3c.dom.DOMException {
throw svgelt.
createDOMException(
org.w3c.dom.DOMException.
NO_MODIFICATION_ALLOWED_ERR,
"readonly.rect",
null);
}
public float getY() {
return (float)
svgelt.
getSVGContext(
).
getBBox(
).
getY(
);
}
public void setY(float y)
throws org.w3c.dom.DOMException {
throw svgelt.
createDOMException(
org.w3c.dom.DOMException.
NO_MODIFICATION_ALLOWED_ERR,
"readonly.rect",
null);
}
public float getWidth() {
return (float)
svgelt.
getSVGContext(
).
getBBox(
).
getWidth(
);
}
public void setWidth(float width)
throws org.w3c.dom.DOMException {
throw svgelt.
createDOMException(
org.w3c.dom.DOMException.
NO_MODIFICATION_ALLOWED_ERR,
"readonly.rect",
null);
}
public float getHeight() {
return (float)
svgelt.
getSVGContext(
).
getBBox(
).
getHeight(
);
}
public void setHeight(float height)
throws org.w3c.dom.DOMException {
throw svgelt.
createDOMException(
org.w3c.dom.DOMException.
NO_MODIFICATION_ALLOWED_ERR,
"readonly.rect",
null);
}
};
}
public static org.w3c.dom.svg.SVGMatrix getCTM(org.w3c.dom.Element elt) {
final org.apache.batik.dom.svg.SVGOMElement svgelt =
(org.apache.batik.dom.svg.SVGOMElement)
elt;
return new org.apache.batik.dom.svg.AbstractSVGMatrix(
) {
protected java.awt.geom.AffineTransform getAffineTransform() {
return svgelt.
getSVGContext(
).
getCTM(
);
}
};
}
public static org.w3c.dom.svg.SVGMatrix getScreenCTM(org.w3c.dom.Element elt) {
final org.apache.batik.dom.svg.SVGOMElement svgelt =
(org.apache.batik.dom.svg.SVGOMElement)
elt;
return new org.apache.batik.dom.svg.AbstractSVGMatrix(
) {
protected java.awt.geom.AffineTransform getAffineTransform() {
org.apache.batik.dom.svg.SVGContext context =
svgelt.
getSVGContext(
);
java.awt.geom.AffineTransform ret =
context.
getGlobalTransform(
);
java.awt.geom.AffineTransform scrnTrans =
context.
getScreenTransform(
);
if (scrnTrans !=
null)
ret.
preConcatenate(
scrnTrans);
return ret;
}
};
}
public static org.w3c.dom.svg.SVGMatrix getTransformToElement(org.w3c.dom.Element elt,
org.w3c.dom.svg.SVGElement element)
throws org.w3c.dom.svg.SVGException {
final org.apache.batik.dom.svg.SVGOMElement currentElt =
(org.apache.batik.dom.svg.SVGOMElement)
elt;
final org.apache.batik.dom.svg.SVGOMElement targetElt =
(org.apache.batik.dom.svg.SVGOMElement)
element;
return new org.apache.batik.dom.svg.AbstractSVGMatrix(
) {
protected java.awt.geom.AffineTransform getAffineTransform() {
java.awt.geom.AffineTransform cat =
currentElt.
getSVGContext(
).
getGlobalTransform(
);
if (cat ==
null) {
cat =
new java.awt.geom.AffineTransform(
);
}
java.awt.geom.AffineTransform tat =
targetElt.
getSVGContext(
).
getGlobalTransform(
);
if (tat ==
null) {
tat =
new java.awt.geom.AffineTransform(
);
}
java.awt.geom.AffineTransform at =
new java.awt.geom.AffineTransform(
cat);
try {
at.
preConcatenate(
tat.
createInverse(
));
return at;
}
catch (java.awt.geom.NoninvertibleTransformException ex) {
throw currentElt.
createSVGException(
org.w3c.dom.svg.SVGException.
SVG_MATRIX_NOT_INVERTABLE,
"noninvertiblematrix",
null);
}
}
};
}
public static final java.lang.String jlc$CompilerVersion$jl7 =
"2.7.0";
public static final long jlc$SourceLastModified$jl7 =
1445630120000L;
public static final java.lang.String jlc$ClassType$jl7 =
("H4sIAAAAAAAAAL1Ye2wUxxmfO7+NjR9gGwwYcAwtxNzVcgJqTUuwy+Po2b5i" +
"47amzXm8N+db2Ntddufss0lKIEqDUilC4CS0Eu4/RGlTStIqqP0nyFWlEkTT" +
"CBq1eahpq/7TF1L4J7Sir++b3bvd27uzi2L1pJ3dm/nmm/l+33Pm0m1SZhqk" +
"XadqjAb4tM7MQAS/I9QwWaxPoaY5DL1R6Zk/nDtx91dVJ/2kfJQsT1CzX6Im" +
"2yszJWaOknWyanKqSswcYCyGMyIGM5kxSbmsqaOkSTZDSV2RJZn3azGGBCPU" +
"CJMGyrkhj6c4C9kMOFkfFrsJit0Ed3sJesKkRtL0aWdCa86EPtcY0iad9UxO" +
"6sNH6CQNprisBMOyyXvSBnlQ15TpCUXjAZbmgSPKwzYQB8IP58HQ/mrdR/fO" +
"JOoFDCuoqmpciGgeZKamTLJYmNQ5vXsUljSPka+TkjBZ5iLmpCOcWTQIiwZh" +
"0Yy8DhXsvpapqWSfJsThGU7luoQb4mRjLhOdGjRps4mIPQOHSm7LLiaDtBuy" +
"0mbU7RHxuQeDsy88Wv+jElI3SupkdQi3I8EmOCwyCoCy5DgzzN2xGIuNkgYV" +
"FD7EDJkq8oyt7UZTnlApT4EJZGDBzpTODLGmgxVoEmQzUhLXjKx4cWFU9r+y" +
"uEInQNZmR1ZLwr3YDwJWy7AxI07B9uwppUdlNSbsKHdGVsaOLwABTK1IMp7Q" +
"skuVqhQ6SKNlIgpVJ4JDYHzqBJCWaWCChrC1IkwRa51KR+kEi3KyyksXsYaA" +
"qkoAgVM4afKSCU6gpVaPllz6uT2w89nj6n7VT3yw5xiTFNz/MpjU5pl0kMWZ" +
"wcAPrIk1W8PP0+bXT/sJAeImD7FF8+PH7jzS2Tb/hkWzpgDN4PgRJvGodHF8" +
"+c21fVs+XYLbqNQ1U0bl50guvCxij/SkdYg0zVmOOBjIDM4f/PlXnniZ/dVP" +
"qkOkXNKUVBLsqEHSkrqsMGMfU5lBOYuFSBVTY31iPEQq4Dssq8zqHYzHTcZD" +
"pFQRXeWa+A8QxYEFQlQN37Ia1zLfOuUJ8Z3WCSEV8JAaeD5BrJ94c5IMJrQk" +
"C1KJqrKqBSOGhvKjQkXMYSZ8x2BU14LjYP9Ht3UFdgRNLWWAQQY1YyJIwSoS" +
"zBoMxrRk0JwEwxrZF9Ykyum4woZSuq4ZEHnA7PT/94JpRGDFlM8HylnrDQ0K" +
"eNV+TYkxIyrNpnr33LkcvWGZHbqKjR0nnbBqwFo1IFYNwKoBWDVQYFXi84nF" +
"VuLqlhWADo9CNIBwXLNl6GsHxk63l4D56VOloAAk3ZyXnvqcsJGJ9VHp0s2D" +
"d996s/plP/FDZBmH9OTkiI6cHGGlOEOTWAyCVLFskYmYweL5oeA+yPz5qZMj" +
"Jz4l9uEO+8iwDCIWTo9gsM4u0eF190J8657+00evPP+45jh+Th7JpL+8mRhP" +
"2r2q9QoflbZuoFeirz/e4SelEKQgMHMKjgQKa/OukRNXejIxGmWpBIHjmpGk" +
"Cg5lAms1TxjalNMjbK5BfK8EFS9DR2uDp9P2PPHG0WYd2xbLRtFmPFKIHPDZ" +
"If3CO7/8c7eAO5Mu6lx5fojxHleIQmaNIhg1OCY4bDAGdL89Hzn33O2nDwv7" +
"A4oHCi3YgW0fhCZQIcD81BvH3v3dBxff9js2yyFHp8ah3ElnhcR+Ur2AkGjn" +
"zn4gxCng9Wg1HYdUsEo5LqMToZP8s25T15W/PVtv2YECPRkz6lycgdO/upc8" +
"cePRu22CjU/CFOtg5pBZcXuFw3m3YdBp3Ef65K1137pGL0AGgKhryjNMBFIi" +
"MCBCaQ8J+YOi7faMbcemw3Qbf65/uUqhqHTm7Q9rRz68ekfsNreWcuu6n+o9" +
"lnlhsykN7Fu8gWY/NRNA99D8wFfrlfl7wHEUOEoQPs1BA2JdOscybOqyivd+" +
"+rPmsZslxL+XVCsaje2lwslIFVg3MxMQJtP6rkcs5U5VQlMvRCV5wiOe6wtr" +
"ak9S5wLbmZ+0vLbzpbkPhFFZVrTGni7+bMZma9a6xK/cm7zc1pXDwSDritUX" +
"oja6eGp2Ljb4YpdVBTTm5uw9UJL+4Nf/+kXg/O+vF0gGVVzTtylskimuNcth" +
"yY15UbxflF9OBNpx627J+2dX1eQHcOTUViQ8by0enr0LXDv1l9bhzyXG7iMy" +
"r/cA5WX5vf5L1/dtls76RQVpBeW8yjN3Uo8bMljUYFAqqygW9tQK823PqnYd" +
"qmw7PN22arsLR0dhFaLdgk2nwN2Pn9sgHJmiiPeEo4YFuHoc12cnY/y/ipMV" +
"mPGnuiWR6PGUw1Qu9jG8gMN/GZt+TlZPMD7AKDgNH5HZFBYFNosM+1Y3e7uO" +
"cJPswGbAkuYz/5vPYccu0R3KhXYHPL02CL33DS02XywAazGOhWHFv4fEYmwB" +
"/CawgbNFK+C3lxo8kQ8gUow6EI19bIhacWgjPCFboNCSQVSM42IQGQtAJAAA" +
"D6wAiHp7tXTGoFoKGNRBrKqzUCU/NlRrcagdnklbsMklg6oYx8WgOrkAVE9i" +
"cxxCA0DVN9yfQWp1AaT6KRyD0w5Wjy0NVp+E55Qt2aklw6oYx8WwOrMAVmex" +
"eYaTGsBqSIJSUQXEsO8pB5RvLg0oXfDM2iLMLhkoxTh6ZPY7rA6JUCJWvLBw" +
"LlhbKFinJaZjZhUMvoPNC5w0AXzDBlVNPCIMa66Y5cLx/P3jmIaEVOCkiXXW" +
"qrzbLuuGRro8V1fZMnfoN+K0k71FqYFzQjylKK707E7V5brB4rKQqcaqMnXx" +
"+i4nq4qdgTkpgVbs/CWL+vucrCxEDZTQuikvc1LvpeSkTLzddD/kpNqhA5+2" +
"PtwkrwF3IMHPK3pGdfWiCsWbroB1rZP25ZeaQitNi2nFVVs+kFOQiVvJTPGU" +
"su4lo9IrcwcGjt/Z/qJ1aJMUOjODXJaFSYV1fswWYBuLcsvwKt+/5d7yV6s2" +
"+W1vbbA27DjLGpcr7wLL1dEyWj0nGrMje7B59+LOq2+eLr8F1e1h4qNgXYdd" +
"d4IWUnAsSkF1eDjsrmpdd9visNVT/cext/7+nq9RlPHEus1oW2hGVDp39f1I" +
"XNe/7SdVIVIGxThLj5Jq2fz8tAoZaxIOHJUpVT6WYqEYGOS4llKzF5jL0Ywp" +
"3lgKZGxAa7O9eOjnpD3varLARQiccKaY0YvckU2tp2QFB3OPpvFir4BUoJuu" +
"C/848Y13BsHNcjbu5lZhpsaz1a/7ftTijW29FdL+Az8fPP/GB1WKHfjmpLHP" +
"vivckL0s1PW0NVYSDffruk1b+iVhBrouYscNwfgaNtfTSMGJb6uu/xcbJD1Q" +
"GBkAAA==");
public static final java.lang.String jlc$CompilerVersion$jl5 =
"2.7.0";
public static final long jlc$SourceLastModified$jl5 =
1445630120000L;
public static final java.lang.String jlc$ClassType$jl5 =
("H4sIAAAAAAAAAL1aeczrWHX3+968lWHemxlmYTr7PJaZDJ/jJM7SYZnYiR07" +
"jpfEceK08HBsJ3G8xkvshA7LVBQEEtD2QQcJpqoEpaXDIlpEq4pqaEUBgaio" +
"UDepgKpKpQUk5o/SqrSl1863v+89NBpoJN/c3HvOufcs93eP780zP4BOBT6U" +
"81xrNbXccFtPwu25hW6HK08PtmkG5RU/0DXcUoJABG2X1Qc/feFHP37f7OIW" +
"dHoE3ao4jhsqoeE6QVcPXGupawx0Yb+1ael2EEIXmbmyVOAoNCyYMYLwMQZ6" +
"0QHWELrE7E4BBlOAwRTgbApwfZ8KML1YdyIbTzkUJwwW0JuhEwx02lPT6YXQ" +
"A4eFeIqv2Dti+EwDIOFs+lsCSmXMiQ/dv6f7RuerFH5/Dr7yW2+4+JmT0IUR" +
"dMFweul0VDCJEAwygm60dXus+0Fd03RtBN3s6LrW031DsYx1Nu8RdEtgTB0l" +
"jHx9z0hpY+TpfjbmvuVuVFPd/EgNXX9PvYmhW9rur1MTS5kCXW/f13WjIZG2" +
"AwXPG2Bi/kRR9V2WG0zD0ULovqMcezpeagMCwHrG1sOZuzfUDY4CGqBbNr6z" +
"FGcK90LfcKaA9JQbgVFC6K5rCk1t7SmqqUz1yyF051E6ftMFqM5lhkhZQui2" +
"o2SZJOClu4546YB/fsC++j1vclrOVjZnTVetdP5nAdO9R5i6+kT3dUfVN4w3" +
"PsJ8QLn98+/cgiBAfNsR4g3N537luccfvffZL29ofuEYGm4819XwsvqR8U3f" +
"uBt/uHYyncZZzw2M1PmHNM/Cn9/peSzxwMq7fU9i2rm92/ls9y/lt35c/94W" +
"dJ6CTquuFdkgjm5WXdszLN0ndUf3lVDXKOic7mh41k9BZ0CdMRx908pNJoEe" +
"UtANVtZ02s1+AxNNgIjURGdA3XAm7m7dU8JZVk88CILOgAe6ETyvgDaf7DuE" +
"bHjm2jqsqIpjOC7M+26qf+pQR1PgUA9AXQO9nguPQfybr0K2K3DgRj4ISNj1" +
"p7AComKmbzphzbXhYAkCSyIZV1VCZWzpvcjzXB/gEAg77/97wCS1wMX4xAng" +
"nLuPQoMFVlXLtTTdv6xeibDmc5+8/NWtvaWyY7sQehSMur0ZdTsbdRuMug1G" +
"3T5mVOjEiWywl6Sjb6IA+NAEaABw8saHe6+n3/jOB0+C8PPiG4ADUlL42nCN" +
"7+MHlaGkCoIYevap+G3SW/Jb0NZh3E1nDJrOp+x8ipZ7qHjp6Ho7Tu6Fd3z3" +
"R5/6wBPu/so7BOQ7gHA1Z7qgHzxqW99VdQ1A5L74R+5XPnv5809c2oJuACgB" +
"kDFUQCQDi917dIxDC/uxXZBMdTkFFJ64vq1Yadcusp0PZ74b77dkTr8pq98M" +
"bPyiNNLvBc+jO6Gffae9t3pp+ZJNkKROO6JFBsKv6Xkf/ruv/2sxM/cuXl84" +
"sAP29PCxAxiRCruQocHN+zEg+roO6P7xKf433/+Dd/xSFgCA4qHjBryUljjA" +
"BuBCYOa3f3nx99/+1ke+ubUfNCHYJKOxZajJnpJpO3T+OkqC0V6+Px+AMRZY" +
"dmnUXOo7tqsZEyON4jRK//vCy5DPfv89FzdxYIGW3TB69KcL2G9/KQa99atv" +
"+I97MzEn1HSP27fZPtkGOG/dl1z3fWWVziN521/f88EvKR8GEAxgLzDWeoZk" +
"UGYDKHManOn/SFZuH+lD0uK+4GDwH15fB3KRy+r7vvnDF0s//LPnstkeTmYO" +
"+rqjeI9twist7k+A+DuOrvSWEswAXelZ9pcvWs/+GEgcAYkqwK+A8wHYJIci" +
"Y4f61Jl/+MJf3P7Gb5yEtgjovOUqGqFkiww6B6JbD2YApxLvdY9vnBufBcXF" +
"TFXoKuU3QXFn9uskmODD18YXIs1F9pfonf/FWeMn/+k/rzJChizHbMFH+Efw" +
"Mx+6C3/t9zL+/SWect+bXA3AIG/b5y183P73rQdPf3ELOjOCLqo7SaGkWFG6" +
"cEYgEQp2M0WQOB7qP5zUbHbwx/Yg7O6j8HJg2KPgsg/8oJ5Sp/XzB/HkJ+Bz" +
"Ajz/mz6pudOGzVZ6C76zn9+/t6F7XnICrNZThe3Kdj7lf10m5YGsvJQWr9i4" +
"Ka2+EizrIMtGAcfEcBQrG/jxEISYpV7alS6B7BT45NLcqmRibgP5eBZOqfbb" +
"m5RuA2hpWchEbEICvWb4/OKGKtu5btoXxrggO3z3P7/va+996NvApzR0apna" +
"G7jywIhslCbMv/bM++950ZXvvDtDKQBR/AeaFx9PpTLX0zgtmmlB7Kp6V6pq" +
"L9vuGSUIOxmw6Fqm7XVDmfcNG+DvcicbhJ+45dvmh777iU2mdzRujxDr77zy" +
"rp9sv+fK1oH8+qGrUtyDPJscO5v0i3cs7EMPXG+UjIP4l0898ae/98Q7NrO6" +
"5XC22AQvQ5/4m//52vZT3/nKMWnIDZb7Ahwb3vj9Vimg6rsfBpH1QtxPEnvC" +
"VXLsvFubknEsq/U4TNi1pE7phdiP4lWOdwtj1ChVFHs9tKtsThsX2FDTokkQ" +
"5K021Vw0+oaFl/BevhmV4C5pib2QWiz4vLMiBlbTFEUcWyC6MvMWcEUkEKZE" +
"V3qGn8uNi+OlVqhEa6PAIB5d1GzYsW3YyhWLvJ23kd5otjCHiraY18elsFPp" +
"CPUeTNWEeKAkvKvIaINBuuWRCTuNMKkhmkTDBXNCC4GI4OthmbILq2BNDxTO" +
"dAYrxWkvekGsyviK7KwosoOaSW8MEiTQ3RNHjZ5U6NIjp6isSRLD+T5Od8iV" +
"b87mZbWE18wOR5gTwg9oI8w3tWJA60Hb7IZMXhlouFItN/lQlfOGotX6CVcO" +
"2FYZF1jPNwKsw61Ww2UPcywBQUUP7w/n9dHYnvb4dryWBaxK8Wi1JcC2r3Xh" +
"CUdzLtHAI3dhe6pBTvVRW7FFhpZtVkCXw6BvzXu8qeREc46NUIOxPZxTB6JA" +
"GfFolpdX1cZsGCw9xVsMehM6EGdkv2JFrjAu2d05M+M0ct71gpJN8QLX6tkV" +
"hjGURohFq7w97le6rSQS9EawqlYHy9y8aVFFkNWammAUqWrT5vB4hbv4Cm1M" +
"12u2kJBUxJpTWSIalWaDNhdVdxVW+iPRseqeWGrSI7KBrT2RazCkPU0kt2kL" +
"6/6MGc7bSUkdEP2an1tFTcoR2JHdRUZM7BflRkwPVpV6QuUrWC2KPa+vWWxv" +
"HLRbGikFCsfEdUxsI1THqwiBGUmLmVDutVmLmnoSXaIbcmu9wGh8oAxwfObj" +
"CGXGXQVF2t2c2TSK7dXKDIaBrNQXplufSp2SMmn38H4ZcCu8Za3LkViIqzVn" +
"XnYqklhcxWhiiAS7hjvevI96Vt7sDEaxWud9ykQGVZ7P58ZDEQ7ouk7ZjQpB" +
"VHN8qzJf9wriGJ6Zg7U3bbAlftqll6SrtUC3WkAmUpAbysx4wQpIPz+20Pw0" +
"WuKJMYd7piZP82vJ5jhsTjU6pQnMW0PHMUawJvELkzOHbLsvYQBTm62e6S+C" +
"DtmZ9FEL4+SI6GGSKBcRg28Ki1IjCBbV9aIlr1uiOmp4hNAd6gMlV68Kidwk" +
"BEtgixVKQdbMhIv6dHVUHOC9plSl64reQDGfrpVUlOrQvmDiSJte+O0F1uPI" +
"2bI9F8xhR+6NqkkB6yMlZi7ztVZY7BPatMsyg0FdEGREXtFU3HN7a8ztJH7X" +
"zNNxM078EVGTzVVkl2J31IsWpVGz5dQrvAjXSrTXJRuE1am2VpbjN4R8W2el" +
"nCibCbXyWc/xi0XGVJcDctQaL9rzbt5xxtgiJlyEImQ2brvYoCEJMjE0qiWH" +
"kCJmYc0G9YZbw1kKi4cMa5XJoJWY5aJVaqBlibPcet0sjlZDZ7lQA5qka1LL" +
"yweFhlarlQPYs3iYaIwwu1XjRNOgymqLJC2uyYmD+gqXGCIwZVuOdQZ19Xpu" +
"xa/Rxagzp9clqxY1uVzViBs4NRDd2jTolKK8TiC1PF0to5VcPq8veT5XQuez" +
"nDir0B6Tq9rdGV/wC4ua4E6s8ShyCd3w17Be6ulWsy1MO61Oez4V2grMRWaX" +
"HepzKiHtgYdRrbntkSY+Ra26HSBiMlcstjMft1Fs0q42iV6t0S1EDa/GF3i+" +
"ReYHslZIxkw3JGyeaFMtvjGiJkWcq8BVtaLXObQTla0EnbjzpGXplGArLDWb" +
"Ihwul8aNOqkx1Vpr7RSLXMFpxMtKveS2cKMoTwf5yQwfCZTaqCLYslVcFjUs" +
"mUxq86CwWhEtr6rMik3LmandXN8v1E1y7qyd0jTBnWltMEVastYPmi7KLDqi" +
"O+KrQQEVEXQA81K4LMhNnO+a67K1UqcaB0eeWlV1vhsVCvi8D+MEF05RDxup" +
"w4iIi3ZR1jCv2JyU0TaCFCseyeTr5LQ981dztoMRlNHBMVwRqnRO5ozKROmM" +
"Vd2Oi8IYcMBRfzFbtES7ItT87rpc1c1JwPr6QI2ispNza5ZjzYKVyVaIqDod" +
"yDDbZeu1WqMaExPfmliVuNXsc01X4AMEqxdojQvU1ZhbrIyllsv5vB2MAith" +
"ckMJD5S5XrDiwKIIaVrsJB2BDvmyb6oB2kclweosu7iExganl+PQV8xaD42Z" +
"sT3K5ZfMeO2NTX5GECPJF0nHqOTGnZGt1JRy0oZVu7JWEW/YiHsN3wj7Q3eu" +
"lHXSKzDzcUn2NAkTRRuN4lqfZnIldgLnzCHImnNLIj8lJWkthisrMA07YtVw" +
"tpIRtD9OJhZR4zDWS8qFCp0raENEF1oqJ/YlQ6iOV3nd8fPMsLFErNp4tl4N" +
"yYrRWfmwWkcHQ3Q5QRkE1kIrqJS7guRh+qAKfFHsu9Vxx5r3ZaK+WKymg1oo" +
"tKuFIr9wZG1hxxWeLRQUP2C6eW1GKIw2NQtOzBZ4pxZMW7RtGLzedEsyEbVc" +
"FSmojgyvYMPrSDZPOpEx6JZ5sh8jQlSbk9Vph4XJUZgTrRHfaVTq7caUbaGt" +
"EYHJBOsGnRwiF/VKxKk0H8TkuG5G8hpGl7ysqlG+W2zPhnKLZ/IFnCkWG718" +
"YbiK6yBX4GaDFrEsTZqyHWMwrsTTMUu0c3jRStyqKVSnfTcuNymkNqZmijqY" +
"znmcGLss3hOkXqdUoARSCOs0SMca5bhutLxKOBRJl3DbJNvFAOSu+3gfZq2u" +
"rypTzTGtcdAxrWnZlZPqYMr5Zl1q1gw1SfB6viGxtdVEGHhIXRHL7e6qkY/R" +
"wXyVZyUv10RRISwophVveGPO79QlW090WRHJAFv0KLrXF4bNgKt6GNpdMtO8" +
"O5w0OgWD6TAz003EWXnEyxW/XqZBcjRYMljMWLNxmzAcWhnNR7N+Z+nyLI7G" +
"+fpw3cAsieVxqqOUyzKqMgnMF+c2pTQlDjeN4XCw8NdjJorIru9WJWQy6jgT" +
"l82182YFIRYysRbmK6vdruQrzYqEjn2s5LeFhaosOs4wyRklZ1FaaFPR9KbS" +
"OIDxAZNbRqqPJ83GSBQiw1yqCLP09J4pMmtNa8Cmxy5mdTRX4MPY9GOiSHVa" +
"fLvokdpkYODBYOy7GOKP+AI60hXBCFmjAPYQsE+bBCcY0pIWQSwFUclya5Sv" +
"xio5D+ERvKARhe70uTnXGNIK0ZOBJkE8kLGIUYNl3A5zMKpVVlI5KOQGyHI8" +
"rhcqjTlDeqpfiRkG0ZqrwTzvkH5nrlcwtJZjuEUhpzN+lUB0ZFZasNOhrGla" +
"iRr0nXrQM0FzYx74tqdptaURsJIIq+nVSCXnLGpdi281owBxB4UZKTW8Ym2C" +
"UENWhys9TaIkigQ+ZOYovShM1tWw7o6UhOJadN+TxPJAXjRlkuuVLKu9JtA5" +
"k5djr2hN2yMyqSsVrqZzc8drFJeKz9S7gqGqbUXOy0vV7BdCryAQWJHjvSVh" +
"+CWs79JRhMPVUlVGiljQYtX5OEKt0cwLlDWiwJVJKBrzQaFGaEyuvq5OeB4m" +
"MWTQbk3AVsa0+KUB5DL5AOEHIHjlXmMy8SMTGecMaYb5biQHKhtPpgobTsRe" +
"h6TH5SiCE3VMNxCBxEywml7zmvS15/XP783z5uwle+8SBbxwph2t5/HGtel6" +
"IC1etncwl31OHz14P3gwt39aA6Vvkfdc624ke4P8yJNXnta4jyJbO6dcwxA6" +
"F7reqyx9qVsHRJ0Gkh659ttyJ7sa2j99+dKT/3aX+NrZG5/HmfJ9R+Z5VOTv" +
"d575Cvly9Te2oJN7ZzFXXVodZnrs8AnMeV8PI98RD53D3LNn2XtSi5XBU9yx" +
"bPH4c91jo2BrPwo2AXDkJPHEzvH8zgnLrekdQFxUs6P/9BZUd8KML7jOCWSc" +
"Fk4IvXSqh6yu+HoQSoYep9cEOyJ2xd91UPzOzcJBkiz03J/2sn9w/KzBPGyr" +
"CniwHVthP3tbpT83RvnV6xjl7WnxZqAyMAqh+OHsaqukFKt9vd/yAvS+K218" +
"ADzUjt7Uz1Pv915H719Pi3eF0BmgN4bt+BK4/o5jXN9Nb8T29H/3C9D/7rTx" +
"QfAsd/Rf/jz1//B19P/ttHgqhE4D/XGxs6v+S49Rv6OEvpHsG+CDL9QArwTP" +
"kzsGePLnaYA/uI4BPpEWvxtCNwID9FRf1x1ghrTtd/Y1/dgL1RQBz5UdTa/8" +
"DDXd2qfaLM+M6nPXB827j0O1RNW9dGfJBPxJWnwmhG4DNhF9xQnSyz3RPYAD" +
"B4zzh8/HOAnA7GOuZ9O7pjuv+ovI5m8N6iefvnD2jqf7f5vdUO799eAcA52d" +
"RJZ18GrgQP205+sTI9Pm3OaiwMu+/jyE7rzWxXEInQRlNucvbKi/GEIvOY4a" +
"UILyIOWXQ+jiUcoQOpV9H6T7agid36cD625TOUjydSAdkKTVv/KOuUvY3KQk" +
"Jw5nKHv+uOWn+eNAUvPQoVQk+yvPbtoQbf7Mc1n91NM0+6bnyh/dXLSqlrJe" +
"p1LOMtCZzZ3vXurxwDWl7co63Xr4xzd9+tzLdtOkmzYT3l8BB+Z23/G3mk3b" +
"C7N7yPUf3/FHr/7Y09/Krjb+D5zljGNjJQAA");
}
| UTF-8 | Java | 20,556 | java | SVGLocatableSupport.java | Java | [
{
"context": "inal java.lang.String jlc$ClassType$jl7 =\n (\"H4sIAAAAAAAAAL1Ye2wUxxmfO7+NjR9gGwwYcAwtxNzVcgJqTUuwy+Po2b5i\" +\n \"47amzXm8N+db2Ntddufss0lKIEqDUilC4CS0Eu",
"end": 8091,
"score": 0.906571090221405,
"start": 8031,
"tag": "KEY",
"value": "H4sIAAAAAAAAAL1Ye2wUxxmfO7+NjR... | null | [] | package org.apache.batik.dom.svg;
public class SVGLocatableSupport {
public SVGLocatableSupport() { super(); }
public static org.w3c.dom.svg.SVGElement getNearestViewportElement(org.w3c.dom.Element e) {
org.w3c.dom.Element elt =
e;
while (elt !=
null) {
elt =
org.apache.batik.css.engine.SVGCSSEngine.
getParentCSSStylableElement(
elt);
if (elt instanceof org.w3c.dom.svg.SVGFitToViewBox) {
break;
}
}
return (org.w3c.dom.svg.SVGElement)
elt;
}
public static org.w3c.dom.svg.SVGElement getFarthestViewportElement(org.w3c.dom.Element elt) {
return (org.w3c.dom.svg.SVGElement)
elt.
getOwnerDocument(
).
getDocumentElement(
);
}
public static org.w3c.dom.svg.SVGRect getBBox(org.w3c.dom.Element elt) {
final org.apache.batik.dom.svg.SVGOMElement svgelt =
(org.apache.batik.dom.svg.SVGOMElement)
elt;
org.apache.batik.dom.svg.SVGContext svgctx =
svgelt.
getSVGContext(
);
if (svgctx ==
null)
return null;
if (svgctx.
getBBox(
) ==
null)
return null;
return new org.w3c.dom.svg.SVGRect(
) {
public float getX() {
return (float)
svgelt.
getSVGContext(
).
getBBox(
).
getX(
);
}
public void setX(float x)
throws org.w3c.dom.DOMException {
throw svgelt.
createDOMException(
org.w3c.dom.DOMException.
NO_MODIFICATION_ALLOWED_ERR,
"readonly.rect",
null);
}
public float getY() {
return (float)
svgelt.
getSVGContext(
).
getBBox(
).
getY(
);
}
public void setY(float y)
throws org.w3c.dom.DOMException {
throw svgelt.
createDOMException(
org.w3c.dom.DOMException.
NO_MODIFICATION_ALLOWED_ERR,
"readonly.rect",
null);
}
public float getWidth() {
return (float)
svgelt.
getSVGContext(
).
getBBox(
).
getWidth(
);
}
public void setWidth(float width)
throws org.w3c.dom.DOMException {
throw svgelt.
createDOMException(
org.w3c.dom.DOMException.
NO_MODIFICATION_ALLOWED_ERR,
"readonly.rect",
null);
}
public float getHeight() {
return (float)
svgelt.
getSVGContext(
).
getBBox(
).
getHeight(
);
}
public void setHeight(float height)
throws org.w3c.dom.DOMException {
throw svgelt.
createDOMException(
org.w3c.dom.DOMException.
NO_MODIFICATION_ALLOWED_ERR,
"readonly.rect",
null);
}
};
}
public static org.w3c.dom.svg.SVGMatrix getCTM(org.w3c.dom.Element elt) {
final org.apache.batik.dom.svg.SVGOMElement svgelt =
(org.apache.batik.dom.svg.SVGOMElement)
elt;
return new org.apache.batik.dom.svg.AbstractSVGMatrix(
) {
protected java.awt.geom.AffineTransform getAffineTransform() {
return svgelt.
getSVGContext(
).
getCTM(
);
}
};
}
public static org.w3c.dom.svg.SVGMatrix getScreenCTM(org.w3c.dom.Element elt) {
final org.apache.batik.dom.svg.SVGOMElement svgelt =
(org.apache.batik.dom.svg.SVGOMElement)
elt;
return new org.apache.batik.dom.svg.AbstractSVGMatrix(
) {
protected java.awt.geom.AffineTransform getAffineTransform() {
org.apache.batik.dom.svg.SVGContext context =
svgelt.
getSVGContext(
);
java.awt.geom.AffineTransform ret =
context.
getGlobalTransform(
);
java.awt.geom.AffineTransform scrnTrans =
context.
getScreenTransform(
);
if (scrnTrans !=
null)
ret.
preConcatenate(
scrnTrans);
return ret;
}
};
}
public static org.w3c.dom.svg.SVGMatrix getTransformToElement(org.w3c.dom.Element elt,
org.w3c.dom.svg.SVGElement element)
throws org.w3c.dom.svg.SVGException {
final org.apache.batik.dom.svg.SVGOMElement currentElt =
(org.apache.batik.dom.svg.SVGOMElement)
elt;
final org.apache.batik.dom.svg.SVGOMElement targetElt =
(org.apache.batik.dom.svg.SVGOMElement)
element;
return new org.apache.batik.dom.svg.AbstractSVGMatrix(
) {
protected java.awt.geom.AffineTransform getAffineTransform() {
java.awt.geom.AffineTransform cat =
currentElt.
getSVGContext(
).
getGlobalTransform(
);
if (cat ==
null) {
cat =
new java.awt.geom.AffineTransform(
);
}
java.awt.geom.AffineTransform tat =
targetElt.
getSVGContext(
).
getGlobalTransform(
);
if (tat ==
null) {
tat =
new java.awt.geom.AffineTransform(
);
}
java.awt.geom.AffineTransform at =
new java.awt.geom.AffineTransform(
cat);
try {
at.
preConcatenate(
tat.
createInverse(
));
return at;
}
catch (java.awt.geom.NoninvertibleTransformException ex) {
throw currentElt.
createSVGException(
org.w3c.dom.svg.SVGException.
SVG_MATRIX_NOT_INVERTABLE,
"noninvertiblematrix",
null);
}
}
};
}
public static final java.lang.String jlc$CompilerVersion$jl7 =
"2.7.0";
public static final long jlc$SourceLastModified$jl7 =
1445630120000L;
public static final java.lang.String jlc$ClassType$jl7 =
("<KEY>" +
"<KEY>" +
"<KEY>/<KEY>" +
"<KEY>" +
"<KEY>ms<KEY>" +
"<KEY>" +
"<KEY>isBMOyyXvSBnlQ15TpCUXjAZbmgSPK<KEY>8HQ/mrdR/fO" +
"JOoFDCuoqmpciGgeZKamTLJYmNQ5vXsUljSPka+TkjBZ5iLmpCOcWTQIiwZh" +
"0Yy8DhXsvpapqWSfJsThGU7luoQb4mRjLhOdGjRps4mIPQOHSm7LLiaDtBuy" +
"0mbU7RHxuQeDsy88Wv+jElI3SupkdQi3I8EmOCwyCoCy5DgzzN2xGIuNkgYV" +
"FD7EDJkq8oyt7UZTnlApT4EJZGDBzpTODLGmgxVoEmQzUhLXjKx4cWFU9r+y" +
"uEInQNZmR1ZLwr3YDwJWy7AxI07B9uwppUdlNSbsKHdGVsaOLwABTK1IMp7Q" +
"skuVqhQ6SKNlIgpVJ4JDYHzqBJCWaWCChrC1IkwRa51KR+kEi3KyyksXsYaA" +
"qkoAgVM4afKSCU6gpVaPllz6uT2w89nj6n7VT3yw5xiTFNz/MpjU5pl0kMWZ" +
"wcAPrIk1W8PP0+bXT/sJAeImD7FF8+PH7jzS2Tb/hkWzpgDN4PgRJvGodHF8" +
"+c21fVs+XYLbqNQ1U0bl50guvCxij/SkdYg0zVmOOBjIDM4f/PlXnniZ/dVP" +
"qkOkXNKUVBLsqEHSkrqsMGMfU5lBOYuFSBVTY31iPEQq4Dssq8zqHYzHTcZD" +
"pFQRXeWa+A8QxYEFQlQN37Ia1zLfOuUJ8Z3WCSEV8JAaeD5BrJ94c5IMJrQk" +
"C1KJqrKqBSOGhvKjQkXMYSZ8x2BU14LjYP9Ht3UFdgRNLWWAQQY1YyJIwSoS" +
"zBoMxrRk0JwEwxrZF9Ykyum4woZSuq4ZEHnA7PT/94JpRGDFlM8HylnrDQ0K" +
"eNV+TYkxIyrNpnr33LkcvWGZHbqKjR0nnbBqwFo1IFYNwKoBWDVQYFXi84nF" +
"VuLqlhWADo9CNIBwXLNl6GsHxk63l4D56VOloAAk3ZyXnvqcsJGJ9VHp0s2D" +
"d996s/plP/FDZBmH9OTkiI6cHGGlOEOTWAyCVLFskYmYweL5oeA+yPz5qZMj" +
"Jz4l9uEO+8iwDCIWTo9gsM4u0eF190J8657+00evPP+45jh+Th7JpL+8mRhP" +
"2r2q9QoflbZuoFeirz/e4SelEKQgMHMKjgQKa/OukRNXejIxGmWpBIHjmpGk" +
"Cg5lAms1TxjalNMjbK5BfK8EFS9DR2uDp9P2PPHG0WYd2xbLRtFmPFKIHPDZ" +
"If3CO7/8c7eAO5Mu6lx5fojxHleIQmaNIhg1OCY4bDAGdL89Hzn33O2nDwv7" +
"A4oHCi3YgW0fhCZQIcD81BvH3v3dBxff9js2yyFHp8ah3ElnhcR+Ur2AkGjn" +
"zn4gxCng9Wg1HYdUsEo5LqMToZP8s25T15W/PVtv2YECPRkz6lycgdO/upc8" +
"cePRu22CjU/CFOtg5pBZcXuFw3m3YdBp3Ef65K1137pGL0AGgKhryjNMBFIi" +
"MCBCaQ8J+YOi7faMbcemw3Qbf65/uUqhqHTm7Q9rRz68ekfsNreWcuu6n+o9" +
"lnlhsykN7Fu8gWY/NRNA99D8wFfrlfl7wHEUOEoQPs1BA2JdOscybOqyivd+" +
"+rPmsZslxL+XVCsaje2lwslIFVg3MxMQJtP6rkcs5U5VQlMvRCV5wiOe6wtr" +
"ak9S5wLbmZ+0vLbzpbkPhFFZVrTGni7+bMZma9a6xK/cm7zc1pXDwSDritUX" +
"oja6eGp2Ljb4YpdVBTTm5uw9UJL+4Nf/+kXg/O+vF0gGVVzTtylskimuNcth" +
"yY15UbxflF9OBNpx627J+2dX1eQHcOTUViQ8by0enr0LXDv1l9bhzyXG7iMy" +
"r/cA5WX5vf5L1/dtls76RQVpBeW8yjN3Uo8bMljUYFAqqygW9tQK823PqnYd" +
"qmw7PN22arsLR0dhFaLdgk2nwN2Pn9sgHJmiiPeEo4YFuHoc12cnY/y/ipMV" +
"mPGnuiWR6PGUw1Qu9jG8gMN/GZt+TlZPMD7AKDgNH5HZFBYFNosM+1Y3e7uO" +
"cJPswGbAkuYz/5vPYccu0R3KhXYHPL02CL33DS02XywAazGOhWHFv4fEYmwB" +
"/CawgbNFK+C3lxo8kQ8gUow6EI19bIhacWgjPCFboNCSQVSM42IQGQtAJAAA" +
"D6wAiHp7tXTGoFoKGNRBrKqzUCU/NlRrcagdnklbsMklg6oYx8WgOrkAVE9i" +
"cxxCA0DVN9yfQWp1AaT6KRyD0w5Wjy0NVp+E55Qt2aklw6oYx8WwOrMAVmex" +
"eYaTGsBqSIJSUQXEsO8pB5RvLg0oXfDM2iLMLhkoxTh6ZPY7rA6JUCJWvLBw" +
"LlhbKFinJaZjZhUMvoPNC5w0AXzDBlVNPCIMa66Y5cLx/P3jmIaEVOCkiXXW" +
"qrzbLuuGRro8V1fZMnfoN+K0k71FqYFzQjylKK707E7V5brB4rKQqcaqMnXx" +
"+i4nq4qdgTkpgVbs/CWL+vucrCxEDZTQuikvc1LvpeSkTLzddD/kpNqhA5+2" +
"PtwkrwF3IMHPK3pGdfWiCsWbroB1rZP25ZeaQitNi2nFVVs+kFOQiVvJTPGU" +
"su4lo9IrcwcGjt/Z/qJ1aJMUOjODXJaFSYV1fswWYBuLcsvwKt+/5d7yV6s2" +
"+W1vbbA27DjLGpcr7wLL1dEyWj0nGrMje7B59+LOq2+eLr8F1e1h4qNgXYdd" +
"d4IWUnAsSkF1eDjsrmpdd9visNVT/cext/7+nq9RlPHEus1oW2hGVDp39f1I" +
"XNe/7SdVIVIGxThLj5Jq2fz8tAoZaxIOHJUpVT6WYqEYGOS4llKzF5jL0Ywp" +
"3lgKZGxAa7O9eOjnpD3varLARQiccKaY0YvckU2tp2QFB3OPpvFir4BUoJuu" +
"C/848Y13BsHNcjbu5lZhpsaz1a/7ftTijW29FdL+Az8fPP/GB1WKHfjmpLHP" +
"vivckL0s1PW0NVYSDffruk1b+iVhBrouYscNwfgaNtfTSMGJb6uu/xcbJD1Q" +
"GBkAAA==");
public static final java.lang.String jlc$CompilerVersion$jl5 =
"2.7.0";
public static final long jlc$SourceLastModified$jl5 =
1445630120000L;
public static final java.lang.String jlc$ClassType$jl5 =
("<KEY>aeczrWHX3+968lWHemxlmYTr7PJaZDJ/jJM7SYZnYiR07" +
"jpfEceK08HBsJ3G8xkvshA7LVBQEEtD2QQcJpqoEpaXDIlpEq4pqaEUBgaio" +
"UDepgKpKpQUk5o/SqrSl1863v+89NBpoJN/c3HvOufcs93eP780zP4BOBT6U" +
"<KEY>Ft<KEY>08PtmkG5RU/0DXcUo<KEY>/fe<KEY>" +
"dHoE3ao4jhsqoeE6QVcPXGupawx0Yb+1ael2EEIXmbmyVOAoNCyYMYLwMQZ6" +
"0QHWELrE7E4BBlOAwRTgbApwfZ8KML1YdyIbTzkUJwwW0JuhEwx02lPT6YXQ" +
"A4eFeIqv2Dti+EwDIOFs+lsCSmXMiQ/dv6f7RuerFH5/Dr7yW2+4+JmT0IUR" +
"dMFweul0VDCJEAwygm60dXus+0Fd03RtBN3s6LrW031DsYx1Nu8RdEtgTB0l" +
"jHx9z0hpY+TpfjbmvuVuVFPd/EgNXX9PvYmhW9rur1MTS5kCXW/f13WjIZG2" +
"AwXPG2Bi/kRR9V2WG0zD0ULovqMcezpeagMCwHrG1sOZuzfUDY4CGqBbNr6z" +
"FGcK90LfcKaA9JQbgVFC6K5rCk1t7SmqqUz1yyF051E6ftMFqM5lhkhZQui2" +
"o2SZJOClu4546YB/fsC++j1vclrOVjZnTVetdP5nAdO9R5i6+kT3dUfVN4w3" +
"PsJ8QLn98+/cgiBAfNsR4g3N537luccfvffZL29ofuEYGm4819XwsvqR8U3f" +
"uBt/uHYyncZZzw2M1PmHNM/Cn9/peSzxwMq7fU9i2rm92/ls9y/lt35c/94W" +
"dJ6CTquuFdkgjm5WXdszLN0ndUf3lVDXKOic7mh41k9BZ0CdMRx908pNJoEe" +
"UtANVtZ02s1+AxNNgIjURGdA3XAm7m7dU8JZVk88CILOgAe6ETyvgDaf7DuE" +
"bHjm2jqsqIpjOC7M+26qf+pQR1PgUA9AXQO9nguPQfybr0K2K3DgRj4ISNj1" +
"p7AComKmbzphzbXhYAkCSyIZV1VCZWzpvcjzXB/gEAg77/97wCS1wMX4xAng" +
"nLuPQoMFVlXLtTTdv6xeibDmc5+8/NWtvaWyY7sQehSMur0ZdTsbdRuMug1G" +
"3T5mVOjEiWywl6Sjb6IA+NAEaABw8saHe6+n3/jOB0+C8PPiG4ADUlL42nCN" +
"7+MHlaGkCoIYevap+G3SW/Jb0NZh3E1nDJrOp+x8ipZ7qHjp6Ho7Tu6Fd3z3" +
"R5/6wBPu/so7BOQ7gHA1Z7qgHzxqW99VdQ1A5L74R+5XPnv5809c2oJuACgB" +
"kDFUQCQDi917dIxDC/uxXZBMdTkFFJ64vq1Yadcusp0PZ74b77dkTr8pq98M" +
"bPyiNNLvBc+jO6Gffae9t3pp+ZJNkKROO6JFBsKv6Xkf/ruv/2sxM/cuXl84" +
"sAP29PCxAxiRCruQocHN+zEg+roO6P7xKf433/+Dd/xSFgCA4qHjBryUljjA" +
"BuBCYOa3f3nx99/+1ke+ubUfNCHYJKOxZajJnpJpO3T+OkqC0V6+Px+AMRZY" +
"dmnUXOo7tqsZEyON4jRK//vCy5DPfv89FzdxYIGW3TB69KcL2G9/KQa99atv" +
"+I97MzEn1HSP27fZPtkGOG/dl1z3fWWVziN521/f88EvKR8GEAxgLzDWeoZk" +
"UGYDKHManOn/SFZuH+lD0uK+4GDwH15fB3KRy+r7vvnDF0s//LPnstkeTmYO" +
"+rqjeI9twist7k+A+DuOrvSWEswAXelZ9pcvWs/+GEgcAYkqwK+A8wHYJIci" +
"Y4f61Jl/+MJf3P7Gb5yEtgjovOUqGqFkiww6B6JbD2YApxLvdY9vnBufBcXF" +
"TFXoKuU3QXFn9uskmODD18YXIs1F9pfonf/FWeMn/+k/rzJChizHbMFH+Efw" +
"Mx+6C3/t9zL+/SWect+bXA3AIG/b5y183P73rQdPf3ELOjOCLqo7SaGkWFG6" +
"cEYgEQp2M0WQOB7qP5zUbHbwx/Yg7O6j8HJg2KPgsg/8oJ5Sp/XzB/HkJ+Bz" +
"Ajz/mz6pudOGzVZ6C76zn9+/t6F7XnICrNZThe3Kdj7lf10m5YGsvJQWr9i4" +
"Ka2+EizrIMtGAcfEcBQrG/jxEISYpV7alS6B7BT45NLcqmRibgP5eBZOqfbb" +
"m5RuA2hpWchEbEICvWb4/OKGKtu5btoXxrggO3z3P7/va+996NvApzR0apna" +
"G7jywIhslCbMv/bM++950ZXvvDtDKQBR/AeaFx9PpTLX0zgtmmlB7Kp6V6pq" +
"L9vuGSUIOxmw6Fqm7XVDmfcNG+DvcicbhJ+45dvmh777iU2mdzRujxDr77zy" +
"rp9sv+fK1oH8+qGrUtyDPJscO5v0i3cs7EMPXG+UjIP4l0898ae/98Q7NrO6" +
"5XC22AQvQ5/4m//52vZT3/nKMWnIDZb7Ahwb3vj9Vimg6rsfBpH1QtxPEnvC" +
"VXLsvFubknEsq/U4TNi1pE7phdiP4lWOdwtj1ChVFHs9tKtsThsX2FDTokkQ" +
"5K021Vw0+oaFl/BevhmV4C5pib2QWiz4vLMiBlbTFEUcWyC6MvMWcEUkEKZE" +
"V3qGn8uNi+OlVqhEa6PAIB5d1GzYsW3YyhWLvJ23kd5otjCHiraY18elsFPp" +
"CPUeTNWEeKAkvKvIaINBuuWRCTuNMKkhmkTDBXNCC4GI4OthmbILq2BNDxTO" +
"dAYrxWkvekGsyviK7KwosoOaSW8MEiTQ3RNHjZ5U6NIjp6isSRLD+T5Od8iV" +
"b87mZbWE18wOR5gTwg9oI8w3tWJA60Hb7IZMXhlouFItN/lQlfOGotX6CVcO" +
"2FYZF1jPNwKsw61Ww2UPcywBQUUP7w/n9dHYnvb4dryWBaxK8Wi1JcC2r3Xh" +
"CUdzLtHAI3dhe6pBTvVRW7FFhpZtVkCXw6BvzXu8qeREc46NUIOxPZxTB6JA" +
"GfFolpdX1cZsGCw9xVsMehM6EGdkv2JFrjAu2d05M+M0ct71gpJN8QLX6tkV" +
"hjGURohFq7w97le6rSQS9EawqlYHy9y8aVFFkNWammAUqWrT5vB4hbv4Cm1M" +
"12u2kJBUxJpTWSIalWaDNhdVdxVW+iPRseqeWGrSI7KBrT2RazCkPU0kt2kL" +
"6/6MGc7bSUkdEP2an1tFTcoR2JHdRUZM7BflRkwPVpV6QuUrWC2KPa+vWWxv" +
"HLRbGikFCsfEdUxsI1THqwiBGUmLmVDutVmLmnoSXaIbcmu9wGh8oAxwfObj" +
"CGXGXQVF2t2c2TSK7dXKDIaBrNQXplufSp2SMmn38H4ZcCu8Za3LkViIqzVn" +
"XnYqklhcxWhiiAS7hjvevI96Vt7sDEaxWud9ykQGVZ7P58ZDEQ7ouk7ZjQpB" +
"VHN8qzJf9wriGJ6Zg7U3bbAlftqll6SrtUC3WkAmUpAbysx4wQpIPz+20Pw0" +
"WuKJMYd7piZP82vJ5jhsTjU6pQnMW0PHMUawJvELkzOHbLsvYQBTm62e6S+C" +
"DtmZ9FEL4+SI6GGSKBcRg28Ki1IjCBbV9aIlr1uiOmp4hNAd6gMlV68Kidwk" +
"BEtgixVKQdbMhIv6dHVUHOC9plSl64reQDGfrpVUlOrQvmDiSJte+O0F1uPI" +
"2bI9F8xhR+6NqkkB6yMlZi7ztVZY7BPatMsyg0FdEGREXtFU3HN7a8ztJH7X" +
"zNNxM078EVGTzVVkl2J31IsWpVGz5dQrvAjXSrTXJRuE1am2VpbjN4R8W2el" +
"nCibCbXyWc/xi0XGVJcDctQaL9rzbt5xxtgiJlyEImQ2brvYoCEJMjE0qiWH" +
"kCJmYc0G9YZbw1kKi4cMa5XJoJWY5aJVaqBlibPcet0sjlZDZ7lQA5qka1LL" +
"yweFhlarlQPYs3iYaIwwu1XjRNOgymqLJC2uyYmD+gqXGCIwZVuOdQZ19Xpu" +
"xa/Rxagzp9clqxY1uVzViBs4NRDd2jTolKK8TiC1PF0to5VcPq8veT5XQuez" +
"nDir0B6Tq9rdGV/wC4ua4E6s8ShyCd3w17Be6ulWsy1MO61Oez4V2grMRWaX" +
"HepzKiHtgYdRrbntkSY+Ra26HSBiMlcstjMft1Fs0q42iV6t0S1EDa/GF3i+" +
"ReYHslZIxkw3JGyeaFMtvjGiJkWcq8BVtaLXObQTla0EnbjzpGXplGArLDWb" +
"Ihwul8aNOqkx1Vpr7RSLXMFpxMtKveS2cKMoTwf5yQwfCZTaqCLYslVcFjUs" +
"mUxq86CwWhEtr6rMik3LmandXN8v1E1y7qyd0jTBnWltMEVastYPmi7KLDqi" +
"O+KrQQEVEXQA81K4LMhNnO+a67K1UqcaB0eeWlV1vhsVCvi8D+MEF05RDxup" +
"w4iIi3ZR1jCv2JyU0TaCFCseyeTr5LQ981dztoMRlNHBMVwRqnRO5ozKROmM" +
"Vd2Oi8IYcMBRfzFbtES7ItT87rpc1c1JwPr6QI2ispNza5ZjzYKVyVaIqDod" +
"yDDbZeu1WqMaExPfmliVuNXsc01X4AMEqxdojQvU1ZhbrIyllsv5vB2MAith" +
"ckMJD5S5XrDiwKIIaVrsJB2BDvmyb6oB2kclweosu7iExganl+PQV8xaD42Z" +
"sT3K5ZfMeO2NTX5GECPJF0nHqOTGnZGt1JRy0oZVu7JWEW/YiHsN3wj7Q3eu" +
"lHXSKzDzcUn2NAkTRRuN4lqfZnIldgLnzCHImnNLIj8lJWkthisrMA07YtVw" +
"tpIRtD9OJhZR4zDWS8qFCp0raENEF1oqJ/YlQ6iOV3nd8fPMsLFErNp4tl4N" +
"yYrRWfmwWkcHQ3Q5QRkE1kIrqJS7guRh+qAKfFHsu9Vxx5r3ZaK+WKymg1oo" +
"tKuFIr9wZG1hxxWeLRQUP2C6eW1GKIw2NQtOzBZ4pxZMW7RtGLzedEsyEbVc" +
"FSmojgyvYMPrSDZPOpEx6JZ5sh8jQlSbk9Vph4XJUZgTrRHfaVTq7caUbaGt" +
"EYHJBOsGnRwiF/VKxKk0H8TkuG5G8hpGl7ysqlG+W2zPhnKLZ/IFnCkWG718" +
"YbiK6yBX4GaDFrEsTZqyHWMwrsTTMUu0c3jRStyqKVSnfTcuNymkNqZmijqY" +
"znmcGLss3hOkXqdUoARSCOs0SMca5bhutLxKOBRJl3DbJNvFAOSu+3gfZq2u" +
"rypTzTGtcdAxrWnZlZPqYMr5Zl1q1gw1SfB6viGxtdVEGHhIXRHL7e6qkY/R" +
"wXyVZyUv10RRISwophVveGPO79QlW090WRHJAFv0KLrXF4bNgKt6GNpdMtO8" +
"O5w0OgWD6TAz003EWXnEyxW/XqZBcjRYMljMWLNxmzAcWhnNR7N+Z+nyLI7G" +
"+fpw3cAsieVxqqOUyzKqMgnMF+c2pTQlDjeN4XCw8NdjJorIru9WJWQy6jgT" +
"l82182YFIRYysRbmK6vdruQrzYqEjn2s5LeFhaosOs4wyRklZ1FaaFPR9KbS" +
"OIDxAZNbRqqPJ83GSBQiw1yqCLP09J4pMmtNa8Cmxy5mdTRX4MPY9GOiSHVa" +
"fLvokdpkYODBYOy7GOKP+AI60hXBCFmjAPYQsE+bBCcY0pIWQSwFUclya5Sv" +
"xio5D+ERvKARhe70uTnXGNIK0ZOBJkE8kLGIUYNl3A5zMKpVVlI5KOQGyHI8" +
"rhcqjTlDeqpfiRkG0ZqrwTzvkH5nrlcwtJZjuEUhpzN+lUB0ZFZasNOhrGla" +
"iRr0nXrQM0FzYx74tqdptaURsJIIq+nVSCXnLGpdi281owBxB4UZKTW8Ym2C" +
"UENWhys9TaIkigQ+ZOYovShM1tWw7o6UhOJadN+TxPJAXjRlkuuVLKu9JtA5" +
"k5djr2hN2yMyqSsVrqZzc8drFJeKz9S7gqGqbUXOy0vV7BdCryAQWJHjvSVh" +
"+CWs79JRhMPVUlVGiljQYtX5OEKt0cwLlDWiwJVJKBrzQaFGaEyuvq5OeB4m" +
"MWTQbk3AVsa0+KUB5DL5AOEHIHjlXmMy8SMTGecMaYb5biQHKhtPpgobTsRe" +
"h6TH5SiCE3VMNxCBxEywml7zmvS15/XP783z5uwle+8SBbxwph2t5/HGtel6" +
"IC1etncwl31OHz14P3gwt39aA6Vvkfdc624ke4P8yJNXnta4jyJbO6dcwxA6" +
"F7reqyx9qVsHRJ0Gkh659ttyJ7sa2j99+dKT/3aX+NrZG5/HmfJ9R+Z5VOTv" +
"d575Cvly9Te2oJN7ZzFXXVodZnrs8AnMeV8PI98RD53D3LNn2XtSi5XBU9yx" +
"bPH4c91jo2BrPwo2AXDkJPHEzvH8zgnLrekdQFxUs6P/9BZUd8KML7jOCWSc" +
"Fk4IvXSqh6yu+HoQSoYep9cEOyJ2xd91UPzOzcJBkiz03J/2sn9w/KzBPGyr" +
"CniwHVthP3tbpT83RvnV6xjl7WnxZqAyMAqh+OHsaqukFKt9vd/yAvS+K218" +
"ADzUjt7Uz1Pv915H719Pi3eF0BmgN4bt+BK4/o5jXN9Nb8T29H/3C9D/7rTx" +
"QfAsd/Rf/jz1//B19P/ttHgqhE4D/XGxs6v+S49Rv6OEvpHsG+CDL9QArwTP" +
"kzsGePLnaYA/uI4BPpEWvxtCNwID9FRf1x1ghrTtd/Y1/dgL1RQBz5UdTa/8" +
"DDXd2qfaLM+M6nPXB827j0O1RNW9dGfJBPxJWnwmhG4DNhF9xQnSyz3RPYAD" +
"B4zzh8/HOAnA7GOuZ9O7pjuv+ovI5m8N6iefvnD2jqf7f5vdUO799eAcA52d" +
"RJZ18GrgQP205+sTI9Pm3OaiwMu+/jyE7rzWxXEInQRlNucvbKi/GEIvOY4a" +
"UILyIOWXQ+jiUcoQOpV9H6T7agid36cD625TOUjydSAdkKTVv/KOuUvY3KQk" +
"Jw<KEY>k+yvPbto<KEY>/dXLSqlrJe" +
"<KEY>" +
"<KEY>Kr<KEY>");
}
| 20,093 | 0.65178 | 0.569469 | 407 | 49.506142 | 22.858595 | 101 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.142506 | false | false | 9 |
b9a721c2ca2788190f7c2fd814ef83d6b3b14b6e | 30,485,677,922,295 | c5a7481e091f29f60c55620780523cb73c9ff506 | /app/src/main/java/com/i_am_kern/Class/Myuser.java | 892c5dbd2a96c735e4c3c42f65cf60f8585d76c5 | [
"Apache-2.0"
] | permissive | Duoluozhijkhshang/hebmu | https://github.com/Duoluozhijkhshang/hebmu | 84495c465416d0ecd7203067d9c1799b88f74448 | 317043b7212c1f87ed224a351f0c30ad54159c2c | refs/heads/master | 2020-03-21T02:44:56.488000 | 2018-07-20T03:40:38 | 2018-07-20T03:40:38 | 138,016,136 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.i_am_kern.Class;
import android.content.Intent;
import cn.bmob.v3.BmobUser;
import cn.bmob.v3.datatype.BmobRelation;
public class Myuser extends BmobUser {
private String qq="未填写";
private Integer touxiang=1;
private Boolean IS_STUDENT=false;
private String unit = "没有数据0_0!";
private String nickname = "用户名";
private Integer importantnum = 1;
private BmobRelation friends;
private BmobRelation blacklist;
private String location="未填写所在地";
private String birthday="未填写生日";
private String hobbies="兴趣爱好未填写";
private String backupsd;
public String getBackupsd() {
return backupsd;
}
public void setBackupsd(String backupsd) {
this.backupsd = backupsd;
}
public Integer getTouxiang() {
return touxiang;
}
public void setTouxiang(Integer touxiang) {
this.touxiang = touxiang;
}
public String getHobbies() {
return hobbies;
}
public void setHobbies(String hobbies) {
this.hobbies = hobbies;
}
public String getBirthday() {
return birthday;
}
public void setBirthday(String birthday) {
this.birthday = birthday;
}
public String getLocation() {
return location;
}
public void setLocation(String location) {
this.location = location;
}
private String realname;
private String sex;
public BmobRelation getBlacklist() {
return blacklist;
}
public void setBlacklist(BmobRelation blacklist) {
this.blacklist = blacklist;
}
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
public String getRealname() {
return realname;
}
public void setRealname(String realname) {
this.realname = realname;
}
public BmobRelation getFriends() {
return friends;
}
public void setFriends(BmobRelation friends) {
this.friends = friends;
}
public String getQq() {
return qq;
}
public void setQq(String qq) {
this.qq = qq;
}
public Boolean getIS_STUDENT() {
return IS_STUDENT;
}
public void setIS_STUDENT(Boolean IS_STUDENT) {
this.IS_STUDENT = IS_STUDENT;
}
public String getUnit() {
return unit;
}
public void setUnit(String unit) {
this.unit = unit;
}
public String getNickname() {
return nickname;
}
public void setNickname(String nickname) {
this.nickname = nickname;
}
public Integer getImportantnum() {
return importantnum;
}
public void setImportantnum(Integer importantnum) {
this.importantnum = importantnum;
}
}
| UTF-8 | Java | 2,833 | java | Myuser.java | Java | [
{
"context": "unit = \"没有数据0_0!\";\n private String nickname = \"用户名\";\n private Integer importantnum = 1;\n priva",
"end": 342,
"score": 0.9993233680725098,
"start": 339,
"tag": "USERNAME",
"value": "用户名"
}
] | null | [] | package com.i_am_kern.Class;
import android.content.Intent;
import cn.bmob.v3.BmobUser;
import cn.bmob.v3.datatype.BmobRelation;
public class Myuser extends BmobUser {
private String qq="未填写";
private Integer touxiang=1;
private Boolean IS_STUDENT=false;
private String unit = "没有数据0_0!";
private String nickname = "用户名";
private Integer importantnum = 1;
private BmobRelation friends;
private BmobRelation blacklist;
private String location="未填写所在地";
private String birthday="未填写生日";
private String hobbies="兴趣爱好未填写";
private String backupsd;
public String getBackupsd() {
return backupsd;
}
public void setBackupsd(String backupsd) {
this.backupsd = backupsd;
}
public Integer getTouxiang() {
return touxiang;
}
public void setTouxiang(Integer touxiang) {
this.touxiang = touxiang;
}
public String getHobbies() {
return hobbies;
}
public void setHobbies(String hobbies) {
this.hobbies = hobbies;
}
public String getBirthday() {
return birthday;
}
public void setBirthday(String birthday) {
this.birthday = birthday;
}
public String getLocation() {
return location;
}
public void setLocation(String location) {
this.location = location;
}
private String realname;
private String sex;
public BmobRelation getBlacklist() {
return blacklist;
}
public void setBlacklist(BmobRelation blacklist) {
this.blacklist = blacklist;
}
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
public String getRealname() {
return realname;
}
public void setRealname(String realname) {
this.realname = realname;
}
public BmobRelation getFriends() {
return friends;
}
public void setFriends(BmobRelation friends) {
this.friends = friends;
}
public String getQq() {
return qq;
}
public void setQq(String qq) {
this.qq = qq;
}
public Boolean getIS_STUDENT() {
return IS_STUDENT;
}
public void setIS_STUDENT(Boolean IS_STUDENT) {
this.IS_STUDENT = IS_STUDENT;
}
public String getUnit() {
return unit;
}
public void setUnit(String unit) {
this.unit = unit;
}
public String getNickname() {
return nickname;
}
public void setNickname(String nickname) {
this.nickname = nickname;
}
public Integer getImportantnum() {
return importantnum;
}
public void setImportantnum(Integer importantnum) {
this.importantnum = importantnum;
}
}
| 2,833 | 0.620454 | 0.618293 | 136 | 19.419117 | 16.69385 | 55 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.338235 | false | false | 9 |
ec9bd85e6ffa719f0c6769440200b836adb803e0 | 10,986,526,394,661 | 912ac4fd24ef5bc69771d5af1cf5a0d3e0222786 | /src/main/java/com/boatfly/designpattern/decorator/ABatterCake.java | cdb7dbf0a6ad20c0a807de8b0f0d42f7801d4514 | [] | no_license | boatfly/boatTutorial | https://github.com/boatfly/boatTutorial | b5040b715b95e9d633defe5c7f108e6eb99a8d45 | 6f52d8b5f4b69b876836453b222724ad23c80b17 | refs/heads/master | 2022-07-02T05:53:58.797000 | 2020-04-02T15:01:45 | 2020-04-02T15:01:45 | 243,071,853 | 1 | 0 | null | false | 2022-06-21T02:51:53 | 2020-02-25T18:33:52 | 2020-04-02T15:02:07 | 2022-06-21T02:51:51 | 500 | 1 | 0 | 4 | Java | false | false | package com.boatfly.designpattern.decorator;
public abstract class ABatterCake {
protected abstract String getDesc();
protected abstract int getCost();
}
| UTF-8 | Java | 164 | java | ABatterCake.java | Java | [] | null | [] | package com.boatfly.designpattern.decorator;
public abstract class ABatterCake {
protected abstract String getDesc();
protected abstract int getCost();
}
| 164 | 0.768293 | 0.768293 | 7 | 22.428572 | 19.308453 | 44 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.428571 | false | false | 9 |
923dbf1bcf2b4da9fb52584f5c1c080342b44667 | 15,075,335,263,828 | 4f28990bc74c9695d1f62c5417e40cb2f2182691 | /interlight-interface/src/main/java/pl/edu/agh/kis/interlight/fx/parts/BoundsAnchor.java | 8715ba62ca4b25487aceaaed35c92e618b30ac0a | [] | no_license | Horuss/InterLight | https://github.com/Horuss/InterLight | b31186e755eb2213ac59fbfca9f3bdb4d6318dc6 | eb65ed845a5825d85a65aeeaa5eb30b5f152301a | refs/heads/master | 2021-03-24T13:54:48.453000 | 2015-09-06T10:50:10 | 2015-09-06T10:50:10 | 32,475,660 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package pl.edu.agh.kis.interlight.fx.parts;
import java.awt.geom.Point2D;
import javafx.beans.property.DoubleProperty;
import javafx.beans.property.SimpleDoubleProperty;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.event.EventHandler;
import javafx.scene.Cursor;
import javafx.scene.control.Label;
import javafx.scene.input.MouseButton;
import javafx.scene.input.MouseEvent;
import javafx.scene.paint.Color;
import javafx.scene.shape.Circle;
import javafx.scene.shape.StrokeType;
import javafx.scene.text.Font;
import javafx.scene.text.FontWeight;
import pl.edu.agh.kis.interlight.fx.GuiHelper;
public class BoundsAnchor extends Circle {
private GuiHelper guiHelper;
private Double dragDeltaX;
private Double dragDeltaY;
private DoubleProperty x;
private DoubleProperty y;
private EventHandler<MouseEvent> mouseEventAny;
private EventHandler<MouseEvent> mouseEventPressed;
private EventHandler<MouseEvent> mouseEventDragged;
private EventHandler<MouseEvent> mouseEventEntered;
private EventHandler<MouseEvent> mouseEventExited;
private Label label;
private Label lengthLabelPrev;
private Label lengthLabelNext;
public BoundsAnchor(GuiHelper gh, double x, double y) {
super();
this.guiHelper = gh;
this.label = new Label();
gh.getCanvas().getChildren().add(label);
lengthLabelNext = new Label();
lengthLabelNext.setTextFill(Color.BLACK);
gh.getCanvas().getChildren().add(lengthLabelNext);
if(!gh.getAnchorsList().isEmpty()) {
lengthLabelPrev = gh.getAnchorsList().get(gh.getAnchorsList().size() - 1).getLengthLabelNext();
gh.getAnchorsList().get(0).setLengthLabelPrev(lengthLabelNext);
}
this.x = new SimpleDoubleProperty(x);
this.y = new SimpleDoubleProperty(y);
this.x.addListener(new ChangeListener<Number>() {
@Override
public void changed(ObservableValue<? extends Number> ov,
Number oldX, Number x) {
gh.getSceneModel().getRoomBounds().getPoints()
.set(guiHelper.getAnchorsList().indexOf(BoundsAnchor.this) * 2, (double) x);
}
});
this.y.addListener(new ChangeListener<Number>() {
@Override
public void changed(ObservableValue<? extends Number> ov,
Number oldY, Number y) {
gh.getSceneModel().getRoomBounds().getPoints()
.set(guiHelper.getAnchorsList().indexOf(BoundsAnchor.this) * 2 + 1, (double) y);
}
});
setCenterX(this.x.get());
setCenterY(this.y.get());
setRadius(5);
label.setTextFill(Color.GREEN);
label.setFont(Font.font(label.getFont().getFamily(), FontWeight.BOLD, label.getFont().getSize()));
setFill(Color.GREEN.deriveColor(1, 1, 1, 0.5));
setStroke(Color.GREEN);
setStrokeWidth(2);
setStrokeType(StrokeType.OUTSIDE);
if(!gh.getAnchorsList().isEmpty()) {
BoundsAnchor last = gh.getAnchorsList().get(gh.getAnchorsList().size() - 1);
last.getLabel().setFont(Font.font(last.getLabel().getFont().getFamily(), FontWeight.NORMAL, last.getLabel().getFont().getSize()));
last.setStrokeWidth(1);
}
updateLabel(this.x.get(), this.y.get());
if(gh.getAnchorsList().size() > 0) {
updateLengthLabel(lengthLabelPrev, this.x.get(), this.y.get(), gh.getAnchorsList().get(gh.getAnchorsList().size() - 1).getCenterX(), gh.getAnchorsList().get(gh.getAnchorsList().size() - 1).getCenterY());
}
if(gh.getAnchorsList().size() > 1) {
updateLengthLabel(lengthLabelNext, this.x.get(), this.y.get(), gh.getAnchorsList().get(0).getCenterX(), gh.getAnchorsList().get(0).getCenterY());
}
this.x.bind(centerXProperty());
this.y.bind(centerYProperty());
mouseEventAny = new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent mouseEvent) {
mouseEvent.consume();
}
};
mouseEventPressed = new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent mouseEvent) {
if(mouseEvent.getButton() == MouseButton.SECONDARY) {
guiHelper.removeAnchor(BoundsAnchor.this);
} else if(mouseEvent.getButton() == MouseButton.PRIMARY) {
dragDeltaX = getCenterX() - mouseEvent.getX();
dragDeltaY = getCenterY() - mouseEvent.getY();
getScene().setCursor(Cursor.MOVE);
}
mouseEvent.consume();
}
};
mouseEventDragged = new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent mouseEvent) {
if(mouseEvent.getButton() == MouseButton.PRIMARY) {
double newX = mouseEvent.getX() + dragDeltaX;
if (newX < 0) {
newX = 0;
} else if (newX > GuiHelper.CANVAS_WIDTH) {
newX = GuiHelper.CANVAS_WIDTH;
}
double newY = mouseEvent.getY() + dragDeltaY;
if (newY < 0) {
newY = 0;
} else if (newY > GuiHelper.CANVAS_HEIGHT) {
newY = GuiHelper.CANVAS_HEIGHT;
}
setCenterX(newX);
setCenterY(newY);
updateLabel(newX, newY);
if(gh.getAnchorsList().size() > 0) {
if(gh.getAnchorsList().indexOf(BoundsAnchor.this) == 0) {
if(gh.getAnchorsList().size() != 1) {
updateLengthLabel(lengthLabelPrev, newX, newY, gh.getAnchorsList().get(gh.getAnchorsList().size() - 1).getCenterX(), gh.getAnchorsList().get(gh.getAnchorsList().size() - 1).getCenterY());
}
} else {
updateLengthLabel(lengthLabelPrev, newX, newY, gh.getAnchorsList().get(gh.getAnchorsList().indexOf(BoundsAnchor.this) - 1).getCenterX(), gh.getAnchorsList().get(gh.getAnchorsList().indexOf(BoundsAnchor.this) - 1).getCenterY());
}
}
if(gh.getAnchorsList().size() > 1) {
if(gh.getAnchorsList().indexOf(BoundsAnchor.this) == (gh.getAnchorsList().size() - 1)) {
updateLengthLabel(lengthLabelNext, newX, newY, gh.getAnchorsList().get(0).getCenterX(), gh.getAnchorsList().get(0).getCenterY());
} else {
updateLengthLabel(lengthLabelNext, newX, newY, gh.getAnchorsList().get(gh.getAnchorsList().indexOf(BoundsAnchor.this) + 1).getCenterX(), gh.getAnchorsList().get(gh.getAnchorsList().indexOf(BoundsAnchor.this) + 1).getCenterY());
}
}
}
mouseEvent.consume();
}
};
mouseEventEntered = new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent mouseEvent) {
getScene().setCursor(Cursor.MOVE);
mouseEvent.consume();
}
};
mouseEventExited = new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent mouseEvent) {
getScene().setCursor(Cursor.DEFAULT);
mouseEvent.consume();
}
};
enableMouseEvents();
}
public void enableMouseEvents() {
addEventHandler(MouseEvent.ANY, mouseEventAny);
addEventHandler(MouseEvent.MOUSE_PRESSED, mouseEventPressed);
addEventHandler(MouseEvent.MOUSE_DRAGGED, mouseEventDragged);
addEventHandler(MouseEvent.MOUSE_ENTERED, mouseEventEntered);
addEventHandler(MouseEvent.MOUSE_EXITED, mouseEventExited);
}
public void disableMouseEvents() {
removeEventHandler(MouseEvent.ANY, mouseEventAny);
removeEventHandler(MouseEvent.MOUSE_PRESSED, mouseEventPressed);
removeEventHandler(MouseEvent.MOUSE_DRAGGED, mouseEventDragged);
removeEventHandler(MouseEvent.MOUSE_ENTERED, mouseEventEntered);
removeEventHandler(MouseEvent.MOUSE_EXITED, mouseEventExited);
}
private void updateLabel(double x, double y) {
label.setLayoutX(x - 25);
label.setLayoutY(y - 25);
label.setText(GuiHelper.DF.format(x * GuiHelper.SCALE_PX_TO_M) + ", "
+ GuiHelper.DF.format(y * GuiHelper.SCALE_PX_TO_M));
}
private void updateLengthLabel(Label label, double x, double y, double x2,
double y2) {
label.setLayoutX((x + x2) / 2 - 10);
label.setLayoutY((y + y2) / 2);
label.setText(GuiHelper.DF.format(Point2D.distance(x, y, x2, y2) * GuiHelper.SCALE_PX_TO_M));
}
public Label getLabel() {
return label;
}
public Label getLengthLabelNext() {
return lengthLabelNext;
}
public void setLengthLabelNext(Label lengthLabelNext) {
this.lengthLabelNext = lengthLabelNext;
}
public Label getLengthLabelPrev() {
return lengthLabelPrev;
}
public void setLengthLabelPrev(Label lengthLabelPrev) {
this.lengthLabelPrev = lengthLabelPrev;
}
public void updateDuringRemove() {
if(guiHelper.getAnchorsList().size() > 1 && guiHelper.getAnchorsList().indexOf(this) == guiHelper.getAnchorsList().size() - 1) {
BoundsAnchor boundsAnchor = guiHelper.getAnchorsList().get(guiHelper.getAnchorsList().size() - 2);
boundsAnchor.setStrokeWidth(2);
boundsAnchor.getLabel().setFont(Font.font(label.getFont().getFamily(), FontWeight.BOLD, label.getFont().getSize()));
}
if(guiHelper.getAnchorsList().size() > 2) {
BoundsAnchor prev = null;
BoundsAnchor next = null;
if(guiHelper.getAnchorsList().indexOf(this) == 0) {
prev = guiHelper.getAnchorsList().get(guiHelper.getAnchorsList().size() - 1);
} else {
prev = guiHelper.getAnchorsList().get(guiHelper.getAnchorsList().indexOf(this) - 1);
}
if(guiHelper.getAnchorsList().indexOf(this) == guiHelper.getAnchorsList().size() - 1) {
next = guiHelper.getAnchorsList().get(0);
} else {
next = guiHelper.getAnchorsList().get(guiHelper.getAnchorsList().indexOf(this) + 1);
}
next.setLengthLabelPrev(lengthLabelPrev);
updateLengthLabel(lengthLabelPrev, prev.getCenterX(), prev.getCenterY(), next.getCenterX(), next.getCenterY());
}
}
}
| UTF-8 | Java | 9,447 | java | BoundsAnchor.java | Java | [] | null | [] | package pl.edu.agh.kis.interlight.fx.parts;
import java.awt.geom.Point2D;
import javafx.beans.property.DoubleProperty;
import javafx.beans.property.SimpleDoubleProperty;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.event.EventHandler;
import javafx.scene.Cursor;
import javafx.scene.control.Label;
import javafx.scene.input.MouseButton;
import javafx.scene.input.MouseEvent;
import javafx.scene.paint.Color;
import javafx.scene.shape.Circle;
import javafx.scene.shape.StrokeType;
import javafx.scene.text.Font;
import javafx.scene.text.FontWeight;
import pl.edu.agh.kis.interlight.fx.GuiHelper;
public class BoundsAnchor extends Circle {
private GuiHelper guiHelper;
private Double dragDeltaX;
private Double dragDeltaY;
private DoubleProperty x;
private DoubleProperty y;
private EventHandler<MouseEvent> mouseEventAny;
private EventHandler<MouseEvent> mouseEventPressed;
private EventHandler<MouseEvent> mouseEventDragged;
private EventHandler<MouseEvent> mouseEventEntered;
private EventHandler<MouseEvent> mouseEventExited;
private Label label;
private Label lengthLabelPrev;
private Label lengthLabelNext;
public BoundsAnchor(GuiHelper gh, double x, double y) {
super();
this.guiHelper = gh;
this.label = new Label();
gh.getCanvas().getChildren().add(label);
lengthLabelNext = new Label();
lengthLabelNext.setTextFill(Color.BLACK);
gh.getCanvas().getChildren().add(lengthLabelNext);
if(!gh.getAnchorsList().isEmpty()) {
lengthLabelPrev = gh.getAnchorsList().get(gh.getAnchorsList().size() - 1).getLengthLabelNext();
gh.getAnchorsList().get(0).setLengthLabelPrev(lengthLabelNext);
}
this.x = new SimpleDoubleProperty(x);
this.y = new SimpleDoubleProperty(y);
this.x.addListener(new ChangeListener<Number>() {
@Override
public void changed(ObservableValue<? extends Number> ov,
Number oldX, Number x) {
gh.getSceneModel().getRoomBounds().getPoints()
.set(guiHelper.getAnchorsList().indexOf(BoundsAnchor.this) * 2, (double) x);
}
});
this.y.addListener(new ChangeListener<Number>() {
@Override
public void changed(ObservableValue<? extends Number> ov,
Number oldY, Number y) {
gh.getSceneModel().getRoomBounds().getPoints()
.set(guiHelper.getAnchorsList().indexOf(BoundsAnchor.this) * 2 + 1, (double) y);
}
});
setCenterX(this.x.get());
setCenterY(this.y.get());
setRadius(5);
label.setTextFill(Color.GREEN);
label.setFont(Font.font(label.getFont().getFamily(), FontWeight.BOLD, label.getFont().getSize()));
setFill(Color.GREEN.deriveColor(1, 1, 1, 0.5));
setStroke(Color.GREEN);
setStrokeWidth(2);
setStrokeType(StrokeType.OUTSIDE);
if(!gh.getAnchorsList().isEmpty()) {
BoundsAnchor last = gh.getAnchorsList().get(gh.getAnchorsList().size() - 1);
last.getLabel().setFont(Font.font(last.getLabel().getFont().getFamily(), FontWeight.NORMAL, last.getLabel().getFont().getSize()));
last.setStrokeWidth(1);
}
updateLabel(this.x.get(), this.y.get());
if(gh.getAnchorsList().size() > 0) {
updateLengthLabel(lengthLabelPrev, this.x.get(), this.y.get(), gh.getAnchorsList().get(gh.getAnchorsList().size() - 1).getCenterX(), gh.getAnchorsList().get(gh.getAnchorsList().size() - 1).getCenterY());
}
if(gh.getAnchorsList().size() > 1) {
updateLengthLabel(lengthLabelNext, this.x.get(), this.y.get(), gh.getAnchorsList().get(0).getCenterX(), gh.getAnchorsList().get(0).getCenterY());
}
this.x.bind(centerXProperty());
this.y.bind(centerYProperty());
mouseEventAny = new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent mouseEvent) {
mouseEvent.consume();
}
};
mouseEventPressed = new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent mouseEvent) {
if(mouseEvent.getButton() == MouseButton.SECONDARY) {
guiHelper.removeAnchor(BoundsAnchor.this);
} else if(mouseEvent.getButton() == MouseButton.PRIMARY) {
dragDeltaX = getCenterX() - mouseEvent.getX();
dragDeltaY = getCenterY() - mouseEvent.getY();
getScene().setCursor(Cursor.MOVE);
}
mouseEvent.consume();
}
};
mouseEventDragged = new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent mouseEvent) {
if(mouseEvent.getButton() == MouseButton.PRIMARY) {
double newX = mouseEvent.getX() + dragDeltaX;
if (newX < 0) {
newX = 0;
} else if (newX > GuiHelper.CANVAS_WIDTH) {
newX = GuiHelper.CANVAS_WIDTH;
}
double newY = mouseEvent.getY() + dragDeltaY;
if (newY < 0) {
newY = 0;
} else if (newY > GuiHelper.CANVAS_HEIGHT) {
newY = GuiHelper.CANVAS_HEIGHT;
}
setCenterX(newX);
setCenterY(newY);
updateLabel(newX, newY);
if(gh.getAnchorsList().size() > 0) {
if(gh.getAnchorsList().indexOf(BoundsAnchor.this) == 0) {
if(gh.getAnchorsList().size() != 1) {
updateLengthLabel(lengthLabelPrev, newX, newY, gh.getAnchorsList().get(gh.getAnchorsList().size() - 1).getCenterX(), gh.getAnchorsList().get(gh.getAnchorsList().size() - 1).getCenterY());
}
} else {
updateLengthLabel(lengthLabelPrev, newX, newY, gh.getAnchorsList().get(gh.getAnchorsList().indexOf(BoundsAnchor.this) - 1).getCenterX(), gh.getAnchorsList().get(gh.getAnchorsList().indexOf(BoundsAnchor.this) - 1).getCenterY());
}
}
if(gh.getAnchorsList().size() > 1) {
if(gh.getAnchorsList().indexOf(BoundsAnchor.this) == (gh.getAnchorsList().size() - 1)) {
updateLengthLabel(lengthLabelNext, newX, newY, gh.getAnchorsList().get(0).getCenterX(), gh.getAnchorsList().get(0).getCenterY());
} else {
updateLengthLabel(lengthLabelNext, newX, newY, gh.getAnchorsList().get(gh.getAnchorsList().indexOf(BoundsAnchor.this) + 1).getCenterX(), gh.getAnchorsList().get(gh.getAnchorsList().indexOf(BoundsAnchor.this) + 1).getCenterY());
}
}
}
mouseEvent.consume();
}
};
mouseEventEntered = new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent mouseEvent) {
getScene().setCursor(Cursor.MOVE);
mouseEvent.consume();
}
};
mouseEventExited = new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent mouseEvent) {
getScene().setCursor(Cursor.DEFAULT);
mouseEvent.consume();
}
};
enableMouseEvents();
}
public void enableMouseEvents() {
addEventHandler(MouseEvent.ANY, mouseEventAny);
addEventHandler(MouseEvent.MOUSE_PRESSED, mouseEventPressed);
addEventHandler(MouseEvent.MOUSE_DRAGGED, mouseEventDragged);
addEventHandler(MouseEvent.MOUSE_ENTERED, mouseEventEntered);
addEventHandler(MouseEvent.MOUSE_EXITED, mouseEventExited);
}
public void disableMouseEvents() {
removeEventHandler(MouseEvent.ANY, mouseEventAny);
removeEventHandler(MouseEvent.MOUSE_PRESSED, mouseEventPressed);
removeEventHandler(MouseEvent.MOUSE_DRAGGED, mouseEventDragged);
removeEventHandler(MouseEvent.MOUSE_ENTERED, mouseEventEntered);
removeEventHandler(MouseEvent.MOUSE_EXITED, mouseEventExited);
}
private void updateLabel(double x, double y) {
label.setLayoutX(x - 25);
label.setLayoutY(y - 25);
label.setText(GuiHelper.DF.format(x * GuiHelper.SCALE_PX_TO_M) + ", "
+ GuiHelper.DF.format(y * GuiHelper.SCALE_PX_TO_M));
}
private void updateLengthLabel(Label label, double x, double y, double x2,
double y2) {
label.setLayoutX((x + x2) / 2 - 10);
label.setLayoutY((y + y2) / 2);
label.setText(GuiHelper.DF.format(Point2D.distance(x, y, x2, y2) * GuiHelper.SCALE_PX_TO_M));
}
public Label getLabel() {
return label;
}
public Label getLengthLabelNext() {
return lengthLabelNext;
}
public void setLengthLabelNext(Label lengthLabelNext) {
this.lengthLabelNext = lengthLabelNext;
}
public Label getLengthLabelPrev() {
return lengthLabelPrev;
}
public void setLengthLabelPrev(Label lengthLabelPrev) {
this.lengthLabelPrev = lengthLabelPrev;
}
public void updateDuringRemove() {
if(guiHelper.getAnchorsList().size() > 1 && guiHelper.getAnchorsList().indexOf(this) == guiHelper.getAnchorsList().size() - 1) {
BoundsAnchor boundsAnchor = guiHelper.getAnchorsList().get(guiHelper.getAnchorsList().size() - 2);
boundsAnchor.setStrokeWidth(2);
boundsAnchor.getLabel().setFont(Font.font(label.getFont().getFamily(), FontWeight.BOLD, label.getFont().getSize()));
}
if(guiHelper.getAnchorsList().size() > 2) {
BoundsAnchor prev = null;
BoundsAnchor next = null;
if(guiHelper.getAnchorsList().indexOf(this) == 0) {
prev = guiHelper.getAnchorsList().get(guiHelper.getAnchorsList().size() - 1);
} else {
prev = guiHelper.getAnchorsList().get(guiHelper.getAnchorsList().indexOf(this) - 1);
}
if(guiHelper.getAnchorsList().indexOf(this) == guiHelper.getAnchorsList().size() - 1) {
next = guiHelper.getAnchorsList().get(0);
} else {
next = guiHelper.getAnchorsList().get(guiHelper.getAnchorsList().indexOf(this) + 1);
}
next.setLengthLabelPrev(lengthLabelPrev);
updateLengthLabel(lengthLabelPrev, prev.getCenterX(), prev.getCenterY(), next.getCenterX(), next.getCenterY());
}
}
}
| 9,447 | 0.693024 | 0.68625 | 248 | 36.092743 | 36.696163 | 234 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.241935 | false | false | 9 |
ed3e070735c6051e7272e1de34a36d29676052b3 | 1,047,972,030,892 | 9af36afcf549b9b43f517a4d7fd369273a5458a6 | /hello123/src/com/cmeiyuan/hello123/activity/HistoryActivity.java | a94b5187ec45cd415bb2cfb8b27e03c48a366568 | [] | no_license | lengendray/jzgs | https://github.com/lengendray/jzgs | b2b4249a526d68571e9ed993ce9a96db740e5c67 | e305d21fae8d5e2ce7155342dda4338be92578ff | refs/heads/master | 2021-05-29T05:23:44.629000 | 2015-03-03T09:34:06 | 2015-03-03T09:34:06 | 31,589,320 | 2 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.cmeiyuan.hello123.activity;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import android.annotation.SuppressLint;
import android.graphics.Color;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnTouchListener;
import android.widget.TextView;
import com.cmeiyuan.hello123.Constants;
import com.cmeiyuan.hello123.R;
import com.cmeiyuan.hello123.api.BaseApi.AsyncCallBack;
import com.cmeiyuan.hello123.api.BaseApi.Error;
import com.cmeiyuan.hello123.api.HistoryNetValueApi;
import com.cmeiyuan.hello123.bean.FundHold;
import com.cmeiyuan.hello123.bean.HistoryNetValue;
import com.cmeiyuan.hello123.bean.NetValue;
import com.cmeiyuan.hello123.util.StringUtil;
import com.github.mikephil.charting.charts.BarLineChartBase.BorderPosition;
import com.github.mikephil.charting.charts.LineChart;
import com.github.mikephil.charting.data.Entry;
import com.github.mikephil.charting.data.LineData;
import com.github.mikephil.charting.data.LineDataSet;
import com.github.mikephil.charting.utils.Highlight;
import com.github.mikephil.charting.utils.LabelColorFormatter;
import com.github.mikephil.charting.utils.XLabels.XLabelPosition;
import com.github.mikephil.charting.utils.YLabelFormatter;
public class HistoryActivity extends AnalysisActivity implements
OnClickListener {
public static final String FUND = "fund";
private LineChart mLineChart;
private TextView btn_month;
private TextView btn_season;
private TextView btn_half;
private TextView btn_year;
private TextView tv_net_value;
private TextView tv_grow_value;
private TextView tv_date_value;
private TextView tv_range_grow_value;
private TextView tv_label_range;
private FundHold fund;
private HistoryNetValueApi api = new HistoryNetValueApi();
private final DecimalFormat yLabelFormat = new DecimalFormat("#0.00");
private final SimpleDateFormat xLabelFormat = new SimpleDateFormat(
"MM月dd日", Locale.CHINA);
private HashMap<String, List<NetValue>> dataCache = new HashMap<String, List<NetValue>>();
private String range = HistoryNetValueApi.MONTH;
@Override
protected void onCreate(Bundle arg0) {
super.onCreate(arg0);
setContentView(R.layout.activity_history);
mLineChart = (LineChart) findViewById(R.id.lineChart);
btn_month = (TextView) findViewById(R.id.btn_month);
btn_season = (TextView) findViewById(R.id.btn_season);
btn_half = (TextView) findViewById(R.id.btn_half);
btn_year = (TextView) findViewById(R.id.btn_year);
tv_net_value = (TextView) findViewById(R.id.tv_net_value);
tv_grow_value = (TextView) findViewById(R.id.tv_grow_value);
tv_range_grow_value = (TextView) findViewById(R.id.tv_range_grow_value);
tv_date_value = (TextView) findViewById(R.id.tv_date_value);
tv_label_range = (TextView) findViewById(R.id.tv_label_range_grow);
btn_month.setOnClickListener(this);
btn_season.setOnClickListener(this);
btn_half.setOnClickListener(this);
btn_year.setOnClickListener(this);
btn_month.setSelected(true);
setLineChart();
api.setAsyncCallBack(new AsyncCallBack<HistoryNetValue>() {
@Override
public void onSuccess(HistoryNetValue t) {
List<NetValue> list = t.getNetValues();
dataCache.put(range, list);
setLineData(list);
showSelectData(list.get(0));
showRangeData();
}
@Override
public void onFailed(Error error) {
String text = error.getMessage();
if (StringUtil.isEmpty(text)) {
text = "数据加载失败";
}
showToast(text);
}
});
try {
fund = (FundHold) getIntent().getSerializableExtra(FUND);
} catch (Exception e) {
showToast("传入数据有误 :" + e.toString());
}
if (fund != null) {
setTitle(fund.fundName);
get(fund.fundCode);
}
}
@Override
protected void onInitTopBar(TextView left, TextView right, TextView center) {
left.setText("返回");
right.setVisibility(View.GONE);
}
@Override
protected void onTopBarSelected(View v) {
if (v == getLeftTextView()) {
finish();
}
}
@SuppressLint("ClickableViewAccessibility")
protected void setLineChart() {
// 无描述
mLineChart.setDescription("");
// 无数据时描述
mLineChart.setNoDataText("");
mLineChart.setNoDataTextDescription("");
// y轴不从0开始
mLineChart.setStartAtZero(false);
// 绘制横向网络线
mLineChart.setDrawHorizontalGrid(true);
// 绘制垂直网络线1
mLineChart.setDrawVerticalGrid(false);
// 不绘制网络背景
mLineChart.setDrawGridBackground(false);
// 设置网格线颜色
mLineChart.setGridColor(Color.parseColor("#414141"));
// 设置网格线宽度
mLineChart.setGridWidth(1.25f);
// 可触摸
mLineChart.setTouchEnabled(true);
// 不可拖动、缩放
mLineChart.setDragScaleEnabled(false);
// 禁用双击缩放
mLineChart.setDoubleTapToZoomEnabled(false);
// 绘制图例
mLineChart.setDrawLegend(false);
// 设置x轴标签在下方
mLineChart.getXLabels().setPosition(XLabelPosition.BOTTOM);
// 不绘制y值
mLineChart.setDrawYValues(false);
// 绘制边框
mLineChart.setDrawBorder(true);
// 设置边框位置
BorderPosition[] border = new BorderPosition[] { BorderPosition.BOTTOM };
mLineChart.setBorderPositions(border);
// 启用高亮线
mLineChart.setHighlightEnabled(true);
mLineChart.setHighlightIndicatorEnabled(true);
mLineChart.setHighlightLineWidth(0.1f);
// 设置单位
mLineChart.setUnit("元");
// 设置内容边距
mLineChart.setOffsets(40, 30, 20, 25);
// 设置网络线风格为破折线
// Paint paint = mLineChart.getPaint(Chart.PAINT_GRID);
// paint.setColor(Color.GRAY);
// paint.setPathEffect(new DashPathEffect(new float[] { 4, 4 }, 0));
mLineChart.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
Highlight hight = mLineChart.getHighlightByTouchPoint(
event.getX(), event.getY());
if (hight != null) {
mLineChart.highlightTouch(new Highlight(hight.getXIndex(),
0));
Entry entry = mLineChart.getEntryByDataSetIndex(
hight.getXIndex(), 0);
if (entry != null) {
NetValue value = (NetValue) entry.getData();
showSelectData(value);
}
}
int action = event.getAction();
if (action == MotionEvent.ACTION_UP
|| action == MotionEvent.ACTION_CANCEL
|| action == MotionEvent.ACTION_OUTSIDE) {
}
return true;
}
});
mLineChart.getYLabels().setFormatter(new YLabelFormatter() {
@Override
public String getFormattedLabel(float arg0) {
return yLabelFormat.format(arg0);
}
});
mLineChart.getYLabels().setLabelColorFormatter(
new LabelColorFormatter() {
@Override
public int getFormattedColor(float value) {
int resId = R.color.val_zero;
return getResources().getColor(resId);
}
});
mLineChart.getYLabels().setLabelCount(6);
}
protected void setLineData(List<NetValue> list) {
ArrayList<String> xVals = new ArrayList<String>();
ArrayList<Entry> yVals1 = new ArrayList<Entry>();
int size = list.size();
for (int i = 0; i < size; i++) {
NetValue value = list.get(i);
xVals.add(xLabelFormat.format(value.getApplyDate()));
float val = (float) value.getNetValue();
Entry entry = new Entry(val, i);
entry.setData(value);
yVals1.add(entry);
}
LineDataSet dataSet1 = new LineDataSet(yVals1, "净值");
dataSet1.setDrawCubic(true);
dataSet1.setLineWidth(1f);
dataSet1.setDrawFilled(false);
dataSet1.setFillColor(Color.parseColor("#22FF0000"));
dataSet1.setColor(Constants.COLOR_POSITIVE);
dataSet1.setDrawCircles(false);
dataSet1.setHighLightColor(Color.BLACK);
ArrayList<LineDataSet> dataSets = new ArrayList<LineDataSet>();
dataSets.add(dataSet1);
LineData data = new LineData(xVals, dataSets);
mLineChart.setData(data);
mLineChart.invalidate();
mLineChart.animateX(2000);
}
@Override
public void onClick(View v) {
if (v instanceof TextView) {
TextView tv = (TextView) v;
tv_label_range.setText(tv.getText().toString().trim());
showRangeData();
}
btn_month.setSelected(false);
btn_season.setSelected(false);
btn_half.setSelected(false);
btn_year.setSelected(false);
v.setSelected(true);
if (v == btn_month) {
range = HistoryNetValueApi.MONTH;
} else if (v == btn_season) {
range = HistoryNetValueApi.SEASON;
} else if (v == btn_half) {
range = HistoryNetValueApi.HALF;
} else if (v == btn_year) {
range = HistoryNetValueApi.YEAR;
}
if (fund != null) {
get(fund.fundCode);
}
}
private void get(String fundCode) {
mLineChart.highlightTouch(null);
List<NetValue> list = dataCache.get(range);
if (list != null) {
setLineData(list);
} else {
api.get(fundCode, range);
}
}
private void showSelectData(NetValue value) {
tv_net_value.setText(String.valueOf(value.getNetValue()));
String growValue = yLabelFormat.format(value.getGrowPercent()) + "%";
tv_grow_value.setText(growValue);
tv_date_value.setText(xLabelFormat.format(value.getApplyDate()));
tv_grow_value.setTextColor(getColor(value.getGrowPercent()));
}
private void showRangeData() {
List<NetValue> list = dataCache.get(range);
if (list != null) {
double first = list.get(0).getNetValue();
double end = list.get(list.size() - 1).getNetValue();
double percent = (end - first) / first * 100;
String growValue = yLabelFormat.format(percent) + "%";
tv_range_grow_value.setText(growValue);
tv_range_grow_value.setTextColor(getColor(percent));
}
}
private int getColor(double value) {
int resId = R.color.val_zero;
if (value == 0) {
resId = R.color.val_zero;
} else if (value < 0) {
resId = R.color.val_negative;
} else if (value > 0) {
resId = R.color.val_positive;
}
return getResources().getColor(resId);
}
}
| UTF-8 | Java | 10,006 | java | HistoryActivity.java | Java | [] | null | [] | package com.cmeiyuan.hello123.activity;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import android.annotation.SuppressLint;
import android.graphics.Color;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnTouchListener;
import android.widget.TextView;
import com.cmeiyuan.hello123.Constants;
import com.cmeiyuan.hello123.R;
import com.cmeiyuan.hello123.api.BaseApi.AsyncCallBack;
import com.cmeiyuan.hello123.api.BaseApi.Error;
import com.cmeiyuan.hello123.api.HistoryNetValueApi;
import com.cmeiyuan.hello123.bean.FundHold;
import com.cmeiyuan.hello123.bean.HistoryNetValue;
import com.cmeiyuan.hello123.bean.NetValue;
import com.cmeiyuan.hello123.util.StringUtil;
import com.github.mikephil.charting.charts.BarLineChartBase.BorderPosition;
import com.github.mikephil.charting.charts.LineChart;
import com.github.mikephil.charting.data.Entry;
import com.github.mikephil.charting.data.LineData;
import com.github.mikephil.charting.data.LineDataSet;
import com.github.mikephil.charting.utils.Highlight;
import com.github.mikephil.charting.utils.LabelColorFormatter;
import com.github.mikephil.charting.utils.XLabels.XLabelPosition;
import com.github.mikephil.charting.utils.YLabelFormatter;
public class HistoryActivity extends AnalysisActivity implements
OnClickListener {
public static final String FUND = "fund";
private LineChart mLineChart;
private TextView btn_month;
private TextView btn_season;
private TextView btn_half;
private TextView btn_year;
private TextView tv_net_value;
private TextView tv_grow_value;
private TextView tv_date_value;
private TextView tv_range_grow_value;
private TextView tv_label_range;
private FundHold fund;
private HistoryNetValueApi api = new HistoryNetValueApi();
private final DecimalFormat yLabelFormat = new DecimalFormat("#0.00");
private final SimpleDateFormat xLabelFormat = new SimpleDateFormat(
"MM月dd日", Locale.CHINA);
private HashMap<String, List<NetValue>> dataCache = new HashMap<String, List<NetValue>>();
private String range = HistoryNetValueApi.MONTH;
@Override
protected void onCreate(Bundle arg0) {
super.onCreate(arg0);
setContentView(R.layout.activity_history);
mLineChart = (LineChart) findViewById(R.id.lineChart);
btn_month = (TextView) findViewById(R.id.btn_month);
btn_season = (TextView) findViewById(R.id.btn_season);
btn_half = (TextView) findViewById(R.id.btn_half);
btn_year = (TextView) findViewById(R.id.btn_year);
tv_net_value = (TextView) findViewById(R.id.tv_net_value);
tv_grow_value = (TextView) findViewById(R.id.tv_grow_value);
tv_range_grow_value = (TextView) findViewById(R.id.tv_range_grow_value);
tv_date_value = (TextView) findViewById(R.id.tv_date_value);
tv_label_range = (TextView) findViewById(R.id.tv_label_range_grow);
btn_month.setOnClickListener(this);
btn_season.setOnClickListener(this);
btn_half.setOnClickListener(this);
btn_year.setOnClickListener(this);
btn_month.setSelected(true);
setLineChart();
api.setAsyncCallBack(new AsyncCallBack<HistoryNetValue>() {
@Override
public void onSuccess(HistoryNetValue t) {
List<NetValue> list = t.getNetValues();
dataCache.put(range, list);
setLineData(list);
showSelectData(list.get(0));
showRangeData();
}
@Override
public void onFailed(Error error) {
String text = error.getMessage();
if (StringUtil.isEmpty(text)) {
text = "数据加载失败";
}
showToast(text);
}
});
try {
fund = (FundHold) getIntent().getSerializableExtra(FUND);
} catch (Exception e) {
showToast("传入数据有误 :" + e.toString());
}
if (fund != null) {
setTitle(fund.fundName);
get(fund.fundCode);
}
}
@Override
protected void onInitTopBar(TextView left, TextView right, TextView center) {
left.setText("返回");
right.setVisibility(View.GONE);
}
@Override
protected void onTopBarSelected(View v) {
if (v == getLeftTextView()) {
finish();
}
}
@SuppressLint("ClickableViewAccessibility")
protected void setLineChart() {
// 无描述
mLineChart.setDescription("");
// 无数据时描述
mLineChart.setNoDataText("");
mLineChart.setNoDataTextDescription("");
// y轴不从0开始
mLineChart.setStartAtZero(false);
// 绘制横向网络线
mLineChart.setDrawHorizontalGrid(true);
// 绘制垂直网络线1
mLineChart.setDrawVerticalGrid(false);
// 不绘制网络背景
mLineChart.setDrawGridBackground(false);
// 设置网格线颜色
mLineChart.setGridColor(Color.parseColor("#414141"));
// 设置网格线宽度
mLineChart.setGridWidth(1.25f);
// 可触摸
mLineChart.setTouchEnabled(true);
// 不可拖动、缩放
mLineChart.setDragScaleEnabled(false);
// 禁用双击缩放
mLineChart.setDoubleTapToZoomEnabled(false);
// 绘制图例
mLineChart.setDrawLegend(false);
// 设置x轴标签在下方
mLineChart.getXLabels().setPosition(XLabelPosition.BOTTOM);
// 不绘制y值
mLineChart.setDrawYValues(false);
// 绘制边框
mLineChart.setDrawBorder(true);
// 设置边框位置
BorderPosition[] border = new BorderPosition[] { BorderPosition.BOTTOM };
mLineChart.setBorderPositions(border);
// 启用高亮线
mLineChart.setHighlightEnabled(true);
mLineChart.setHighlightIndicatorEnabled(true);
mLineChart.setHighlightLineWidth(0.1f);
// 设置单位
mLineChart.setUnit("元");
// 设置内容边距
mLineChart.setOffsets(40, 30, 20, 25);
// 设置网络线风格为破折线
// Paint paint = mLineChart.getPaint(Chart.PAINT_GRID);
// paint.setColor(Color.GRAY);
// paint.setPathEffect(new DashPathEffect(new float[] { 4, 4 }, 0));
mLineChart.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
Highlight hight = mLineChart.getHighlightByTouchPoint(
event.getX(), event.getY());
if (hight != null) {
mLineChart.highlightTouch(new Highlight(hight.getXIndex(),
0));
Entry entry = mLineChart.getEntryByDataSetIndex(
hight.getXIndex(), 0);
if (entry != null) {
NetValue value = (NetValue) entry.getData();
showSelectData(value);
}
}
int action = event.getAction();
if (action == MotionEvent.ACTION_UP
|| action == MotionEvent.ACTION_CANCEL
|| action == MotionEvent.ACTION_OUTSIDE) {
}
return true;
}
});
mLineChart.getYLabels().setFormatter(new YLabelFormatter() {
@Override
public String getFormattedLabel(float arg0) {
return yLabelFormat.format(arg0);
}
});
mLineChart.getYLabels().setLabelColorFormatter(
new LabelColorFormatter() {
@Override
public int getFormattedColor(float value) {
int resId = R.color.val_zero;
return getResources().getColor(resId);
}
});
mLineChart.getYLabels().setLabelCount(6);
}
protected void setLineData(List<NetValue> list) {
ArrayList<String> xVals = new ArrayList<String>();
ArrayList<Entry> yVals1 = new ArrayList<Entry>();
int size = list.size();
for (int i = 0; i < size; i++) {
NetValue value = list.get(i);
xVals.add(xLabelFormat.format(value.getApplyDate()));
float val = (float) value.getNetValue();
Entry entry = new Entry(val, i);
entry.setData(value);
yVals1.add(entry);
}
LineDataSet dataSet1 = new LineDataSet(yVals1, "净值");
dataSet1.setDrawCubic(true);
dataSet1.setLineWidth(1f);
dataSet1.setDrawFilled(false);
dataSet1.setFillColor(Color.parseColor("#22FF0000"));
dataSet1.setColor(Constants.COLOR_POSITIVE);
dataSet1.setDrawCircles(false);
dataSet1.setHighLightColor(Color.BLACK);
ArrayList<LineDataSet> dataSets = new ArrayList<LineDataSet>();
dataSets.add(dataSet1);
LineData data = new LineData(xVals, dataSets);
mLineChart.setData(data);
mLineChart.invalidate();
mLineChart.animateX(2000);
}
@Override
public void onClick(View v) {
if (v instanceof TextView) {
TextView tv = (TextView) v;
tv_label_range.setText(tv.getText().toString().trim());
showRangeData();
}
btn_month.setSelected(false);
btn_season.setSelected(false);
btn_half.setSelected(false);
btn_year.setSelected(false);
v.setSelected(true);
if (v == btn_month) {
range = HistoryNetValueApi.MONTH;
} else if (v == btn_season) {
range = HistoryNetValueApi.SEASON;
} else if (v == btn_half) {
range = HistoryNetValueApi.HALF;
} else if (v == btn_year) {
range = HistoryNetValueApi.YEAR;
}
if (fund != null) {
get(fund.fundCode);
}
}
private void get(String fundCode) {
mLineChart.highlightTouch(null);
List<NetValue> list = dataCache.get(range);
if (list != null) {
setLineData(list);
} else {
api.get(fundCode, range);
}
}
private void showSelectData(NetValue value) {
tv_net_value.setText(String.valueOf(value.getNetValue()));
String growValue = yLabelFormat.format(value.getGrowPercent()) + "%";
tv_grow_value.setText(growValue);
tv_date_value.setText(xLabelFormat.format(value.getApplyDate()));
tv_grow_value.setTextColor(getColor(value.getGrowPercent()));
}
private void showRangeData() {
List<NetValue> list = dataCache.get(range);
if (list != null) {
double first = list.get(0).getNetValue();
double end = list.get(list.size() - 1).getNetValue();
double percent = (end - first) / first * 100;
String growValue = yLabelFormat.format(percent) + "%";
tv_range_grow_value.setText(growValue);
tv_range_grow_value.setTextColor(getColor(percent));
}
}
private int getColor(double value) {
int resId = R.color.val_zero;
if (value == 0) {
resId = R.color.val_zero;
} else if (value < 0) {
resId = R.color.val_negative;
} else if (value > 0) {
resId = R.color.val_positive;
}
return getResources().getColor(resId);
}
}
| 10,006 | 0.719174 | 0.709207 | 345 | 27.208696 | 20.830231 | 91 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.368116 | false | false | 9 |
4f55c49e62214c1f8a94382d7d4ecb5d13e147f8 | 27,608,049,836,280 | f5ea60a140508f74d5a897e624d201c1618896f6 | /bookstore-model-instructor/src/main/java/mx/com/mentoringit/model/entities/Category.java | 234d900a02f5340537c8ebfee1e71ccc2e7540ac | [] | no_license | mentoringIT/javaframeworks | https://github.com/mentoringIT/javaframeworks | 4ec1514b785e130bd6f50204a8b27bf4dc723686 | f6bb80519033c3312dbfe5249c27f8f2f2428b62 | refs/heads/master | 2022-12-24T22:25:26.354000 | 2019-08-29T17:51:56 | 2019-08-29T17:51:56 | 88,658,893 | 3 | 0 | null | false | 2022-12-10T00:50:15 | 2017-04-18T18:43:40 | 2021-02-19T13:22:26 | 2022-12-10T00:50:15 | 3,271 | 0 | 1 | 10 | Java | false | false | package mx.com.mentoringit.model.entities;
// Generated 7/10/2017 06:48:09 AM by Hibernate Tools 4.0.1.Final
import java.util.HashSet;
import java.util.Set;
/**
* Category generated by hbm2java
*/
public class Category implements java.io.Serializable {
private Integer categoryId;
private String categoryName;
private Set<Book> books = new HashSet<Book>(0);
public Category() {
}
public Category(String categoryName) {
this.categoryName = categoryName;
}
public Category(String categoryName, Set<Book> books) {
this.categoryName = categoryName;
this.books = books;
}
public Integer getCategoryId() {
return this.categoryId;
}
public void setCategoryId(Integer categoryId) {
this.categoryId = categoryId;
}
public String getCategoryName() {
return this.categoryName;
}
public void setCategoryName(String categoryName) {
this.categoryName = categoryName;
}
public Set<Book> getBooks() {
return this.books;
}
public void setBooks(Set<Book> books) {
this.books = books;
}
}
| UTF-8 | Java | 1,076 | java | Category.java | Java | [] | null | [] | package mx.com.mentoringit.model.entities;
// Generated 7/10/2017 06:48:09 AM by Hibernate Tools 4.0.1.Final
import java.util.HashSet;
import java.util.Set;
/**
* Category generated by hbm2java
*/
public class Category implements java.io.Serializable {
private Integer categoryId;
private String categoryName;
private Set<Book> books = new HashSet<Book>(0);
public Category() {
}
public Category(String categoryName) {
this.categoryName = categoryName;
}
public Category(String categoryName, Set<Book> books) {
this.categoryName = categoryName;
this.books = books;
}
public Integer getCategoryId() {
return this.categoryId;
}
public void setCategoryId(Integer categoryId) {
this.categoryId = categoryId;
}
public String getCategoryName() {
return this.categoryName;
}
public void setCategoryName(String categoryName) {
this.categoryName = categoryName;
}
public Set<Book> getBooks() {
return this.books;
}
public void setBooks(Set<Book> books) {
this.books = books;
}
}
| 1,076 | 0.696097 | 0.679368 | 52 | 18.692308 | 19.096455 | 65 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.057692 | false | false | 9 |
85b344cb39e3eceafe746709be3cc6192dbae26b | 25,228,637,950,845 | b5fb926b8048f0ff73988e285ff6b455e7b8e288 | /bit-manipulation/convert-a-number-to-hexadecimal.java | 90fc98c346380c337b8b80573a92bfb75717fae3 | [] | no_license | EdwardYZN/LeetCode | https://github.com/EdwardYZN/LeetCode | 4b02ca94cc80384ff7fb93a092cff0e13af3de99 | 408fa49af48b90cf030b84ae94f33a566e26a261 | refs/heads/master | 2021-01-11T00:33:03.270000 | 2016-10-15T14:44:17 | 2016-10-15T14:44:17 | 70,516,878 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
Given an integer, write an algorithm to convert it to hexadecimal. For negative
integer, two’s complement method is used. Note: All letters in hexadecimal (
a-f ) must be in lowercase. The hexadecimal string must not contain extra
leading 0 s. If the number is zero, it is represented by a single zero character
'0' ; otherwise, the first character in the hexadecimal string will not be the
zero character. The given number is guaranteed to fit within the range of a
32-bit signed integer. You must not use any method provided by the library
which converts/formats the number to hex directly. Example 1: Input:
26
Output:
"1a" Example 2: Input:
-1
Output:
"ffffffff" Subscribe to see which companies asked this question Show Tags
Bit Manipulation
*/
public class Solution {
public String toHex(int num) {
}
} | UTF-8 | Java | 856 | java | convert-a-number-to-hexadecimal.java | Java | [] | null | [] | /*
Given an integer, write an algorithm to convert it to hexadecimal. For negative
integer, two’s complement method is used. Note: All letters in hexadecimal (
a-f ) must be in lowercase. The hexadecimal string must not contain extra
leading 0 s. If the number is zero, it is represented by a single zero character
'0' ; otherwise, the first character in the hexadecimal string will not be the
zero character. The given number is guaranteed to fit within the range of a
32-bit signed integer. You must not use any method provided by the library
which converts/formats the number to hex directly. Example 1: Input:
26
Output:
"1a" Example 2: Input:
-1
Output:
"ffffffff" Subscribe to see which companies asked this question Show Tags
Bit Manipulation
*/
public class Solution {
public String toHex(int num) {
}
} | 856 | 0.738876 | 0.727166 | 24 | 34.458332 | 33.973003 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.208333 | false | false | 9 |
a7540c1a6112366ff0681450acf1f1c84371d1c0 | 6,305,011,997,521 | e58a7c26535cf44b7046c9ddcd1a689754f8ba1e | /src/main/java/org/tenpo/test/mstenpotest/security/user/UserRepository.java | 658bfb7fc0aa0a2330736b3f407c9af6fc86750d | [] | no_license | ceeconro/ms-tenpo-test | https://github.com/ceeconro/ms-tenpo-test | 60d3b4f7d5466e0ad0ed46fc34314def8ad9c9ba | e2d4d1d37afbdd8667beb023a95c57a60c1e5e55 | refs/heads/master | 2023-02-25T06:26:01.572000 | 2021-02-08T12:18:56 | 2021-02-08T12:18:56 | 336,596,683 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.tenpo.test.mstenpotest.security.user;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.Optional;
@Repository
public interface UserRepository extends JpaRepository<User, Integer> {
Optional<User> findUserByEmail(String emailAddress);
}
| UTF-8 | Java | 336 | java | UserRepository.java | Java | [] | null | [] | package org.tenpo.test.mstenpotest.security.user;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.Optional;
@Repository
public interface UserRepository extends JpaRepository<User, Integer> {
Optional<User> findUserByEmail(String emailAddress);
}
| 336 | 0.824405 | 0.824405 | 13 | 24.846153 | 26.79221 | 70 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.461538 | false | false | 9 |
e8dc8cc1b65d24f11a3ccc6a5d660621c213f5ef | 26,998,164,473,743 | 906b21df0b240eaa6a6bd863094a4ec11c31d1a5 | /lab10/src/main/java/SpringBoot/REST/MainController.java | 52e497b5d2a7c4273b598e3b5a4b2f74c51af999 | [] | no_license | wojrac/Java_GCL05_lato_2018_Wojciech_Rachwal | https://github.com/wojrac/Java_GCL05_lato_2018_Wojciech_Rachwal | c7f4c4cb58f31df381705356225bbf552427414c | 5a7a81db99adfb4e9555eca4a175ae339e2e0ad6 | refs/heads/master | 2021-01-25T10:00:18.072000 | 2018-06-05T12:07:40 | 2018-06-05T12:07:40 | 123,333,334 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package SpringBoot.REST;
import SpringBoot.Extras.MyImage;
import SpringBoot.Extras.Result;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.io.InputStreamResource;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.awt.image.BufferedImage;
import java.io.*;
import java.lang.reflect.Array;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
@Component
@PropertySource("classpath:application.properties")
@Controller
public class MainController {
@Value("${folderPath}")
private String path;
private List<MyImage> listOfImages;
@RequestMapping(value = "view/photos", method = RequestMethod.GET)
@ResponseBody
public ModelAndView allPictures() {
listOfImages = new ArrayList<MyImage>();
BufferedImage readImage = null;
String name = "";
int h = 0, w = 0;
String resulution = "";
long size = 0;
MyImage.clearid();
File folder = new File(path);
File[] listOfFiles = folder.listFiles();
if (listOfFiles != null) {
for (File f : listOfFiles) {
MyImage tempImage;
try {
readImage = ImageIO.read(f);
name = f.getName();
size = f.length();
w = readImage.getWidth();
h = readImage.getHeight();
} catch (IOException e) {
readImage = null;
e.printStackTrace();
}
BasicFileAttributes attr;
try {
attr = Files.readAttributes(Paths.get(f.getPath()), BasicFileAttributes.class);
String time = String.valueOf(attr.creationTime());
resulution = w + "x" + h;
tempImage = new MyImage(name, resulution, size, time);
listOfImages.add(tempImage);
} catch (IOException e) {
e.printStackTrace();
}
}
}
ModelAndView modelAndView = new ModelAndView("index");
modelAndView.addObject("photosArray", listOfImages);
return modelAndView;
//return listOfImages;
}
@RequestMapping(value = "/view/photos/{index}", method = RequestMethod.GET,produces = MediaType.IMAGE_JPEG_VALUE)
public BufferedImage getImage(HttpServletResponse response, @PathVariable(value = "index") int index) {
BufferedImage img=null;
response.setContentType(MediaType.IMAGE_JPEG_VALUE);
try {
img = ImageIO.read(new File("C:\\Images\\image.png"));
} catch (IOException e) {
e.printStackTrace();
}
return img; //nie działa
}
public List<MyImage> allPictures2() {
listOfImages = new ArrayList<MyImage>();
BufferedImage readImage = null;
String name = "";
int h = 0, w = 0;
String resulution = "";
long size = 0;
MyImage.clearid();
File folder = new File(path);
File[] listOfFiles = folder.listFiles();
if (listOfFiles != null) {
for (File f : listOfFiles) {
MyImage tempImage;
try {
readImage = ImageIO.read(f);
name = f.getName();
size = f.length();
w = readImage.getWidth();
h = readImage.getHeight();
} catch (IOException e) {
readImage = null;
e.printStackTrace();
}
BasicFileAttributes attr;
try {
attr = Files.readAttributes(Paths.get(f.getPath()), BasicFileAttributes.class);
String time = String.valueOf(attr.creationTime());
resulution = w + "x" + h;
tempImage = new MyImage(name, resulution, size, time);
listOfImages.add(tempImage);
} catch (IOException e) {
e.printStackTrace();
}
}
}
return listOfImages;
}
/* @RequestMapping(method = RequestMethod.GET, value = "/view/photos/{index}", produces = MediaType.IMAGE_JPEG_VALUE)
public ResponseEntity<InputStreamResource> showImage(@PathVariable int index) throws FileNotFoundException {
File file = new File(this.path.get(index).toString());
InputStream inputStream = new FileInputStream(file);
return ResponseEntity.ok().contentType(MediaType.IMAGE_JPEG).body(new InputStreamResource(inputStream));}*/
@RequestMapping(value = "/view/photos/{index}", method = RequestMethod.DELETE)
@ResponseBody
public Result deleteImage(@PathVariable(value = "index") int index) {
String nameToDelete="";
boolean resDel=false;
Result result=new Result();
for(Object img: listOfImages)
{
MyImage tempImage=(MyImage)img;
if(tempImage.getIndex()==index)
nameToDelete=tempImage.getName();
}
if(nameToDelete.equals(""))
result.setResult(false);
File folder = new File(path);
File[] listOfFiles = folder.listFiles();
for (File f: listOfFiles) {
if(f.getName().equals(nameToDelete)) {
resDel=f.delete();
}
}
if(resDel==true)
result.setResult(true);
else
result.setResult(false);
return result;
}
/* @RequestMapping(method = RequestMethod.DELETE, value = "view/photos/{id}")
@ResponseBody
public void deleteGallery ( @PathVariable int id){
listOfImages.removeIf(t -> t.getIndex() == id);
}*/
@RequestMapping(value = "view/photos/{index}")
public MyImage getPhoto(@PathVariable int index)
{
return listOfImages.stream().filter(t->t.getIndex()==index).findFirst().get();
}
}
| UTF-8 | Java | 6,614 | java | MainController.java | Java | [] | null | [] | package SpringBoot.REST;
import SpringBoot.Extras.MyImage;
import SpringBoot.Extras.Result;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.io.InputStreamResource;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.awt.image.BufferedImage;
import java.io.*;
import java.lang.reflect.Array;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
@Component
@PropertySource("classpath:application.properties")
@Controller
public class MainController {
@Value("${folderPath}")
private String path;
private List<MyImage> listOfImages;
@RequestMapping(value = "view/photos", method = RequestMethod.GET)
@ResponseBody
public ModelAndView allPictures() {
listOfImages = new ArrayList<MyImage>();
BufferedImage readImage = null;
String name = "";
int h = 0, w = 0;
String resulution = "";
long size = 0;
MyImage.clearid();
File folder = new File(path);
File[] listOfFiles = folder.listFiles();
if (listOfFiles != null) {
for (File f : listOfFiles) {
MyImage tempImage;
try {
readImage = ImageIO.read(f);
name = f.getName();
size = f.length();
w = readImage.getWidth();
h = readImage.getHeight();
} catch (IOException e) {
readImage = null;
e.printStackTrace();
}
BasicFileAttributes attr;
try {
attr = Files.readAttributes(Paths.get(f.getPath()), BasicFileAttributes.class);
String time = String.valueOf(attr.creationTime());
resulution = w + "x" + h;
tempImage = new MyImage(name, resulution, size, time);
listOfImages.add(tempImage);
} catch (IOException e) {
e.printStackTrace();
}
}
}
ModelAndView modelAndView = new ModelAndView("index");
modelAndView.addObject("photosArray", listOfImages);
return modelAndView;
//return listOfImages;
}
@RequestMapping(value = "/view/photos/{index}", method = RequestMethod.GET,produces = MediaType.IMAGE_JPEG_VALUE)
public BufferedImage getImage(HttpServletResponse response, @PathVariable(value = "index") int index) {
BufferedImage img=null;
response.setContentType(MediaType.IMAGE_JPEG_VALUE);
try {
img = ImageIO.read(new File("C:\\Images\\image.png"));
} catch (IOException e) {
e.printStackTrace();
}
return img; //nie działa
}
public List<MyImage> allPictures2() {
listOfImages = new ArrayList<MyImage>();
BufferedImage readImage = null;
String name = "";
int h = 0, w = 0;
String resulution = "";
long size = 0;
MyImage.clearid();
File folder = new File(path);
File[] listOfFiles = folder.listFiles();
if (listOfFiles != null) {
for (File f : listOfFiles) {
MyImage tempImage;
try {
readImage = ImageIO.read(f);
name = f.getName();
size = f.length();
w = readImage.getWidth();
h = readImage.getHeight();
} catch (IOException e) {
readImage = null;
e.printStackTrace();
}
BasicFileAttributes attr;
try {
attr = Files.readAttributes(Paths.get(f.getPath()), BasicFileAttributes.class);
String time = String.valueOf(attr.creationTime());
resulution = w + "x" + h;
tempImage = new MyImage(name, resulution, size, time);
listOfImages.add(tempImage);
} catch (IOException e) {
e.printStackTrace();
}
}
}
return listOfImages;
}
/* @RequestMapping(method = RequestMethod.GET, value = "/view/photos/{index}", produces = MediaType.IMAGE_JPEG_VALUE)
public ResponseEntity<InputStreamResource> showImage(@PathVariable int index) throws FileNotFoundException {
File file = new File(this.path.get(index).toString());
InputStream inputStream = new FileInputStream(file);
return ResponseEntity.ok().contentType(MediaType.IMAGE_JPEG).body(new InputStreamResource(inputStream));}*/
@RequestMapping(value = "/view/photos/{index}", method = RequestMethod.DELETE)
@ResponseBody
public Result deleteImage(@PathVariable(value = "index") int index) {
String nameToDelete="";
boolean resDel=false;
Result result=new Result();
for(Object img: listOfImages)
{
MyImage tempImage=(MyImage)img;
if(tempImage.getIndex()==index)
nameToDelete=tempImage.getName();
}
if(nameToDelete.equals(""))
result.setResult(false);
File folder = new File(path);
File[] listOfFiles = folder.listFiles();
for (File f: listOfFiles) {
if(f.getName().equals(nameToDelete)) {
resDel=f.delete();
}
}
if(resDel==true)
result.setResult(true);
else
result.setResult(false);
return result;
}
/* @RequestMapping(method = RequestMethod.DELETE, value = "view/photos/{id}")
@ResponseBody
public void deleteGallery ( @PathVariable int id){
listOfImages.removeIf(t -> t.getIndex() == id);
}*/
@RequestMapping(value = "view/photos/{index}")
public MyImage getPhoto(@PathVariable int index)
{
return listOfImages.stream().filter(t->t.getIndex()==index).findFirst().get();
}
}
| 6,614 | 0.584908 | 0.58385 | 199 | 32.221104 | 25.364307 | 120 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.60804 | false | false | 9 |
86ad83c933046060619f34d70e69f4ab1aa859fa | 33,423,435,551,685 | 8f99f3e4e240f267a62b15199773ba6872b706af | /src/main/java/name/mdemidov/interview/leetcode/task1007/Solution.java | 2b10cd31aa6017b9c6064d69541a21e3c6e388e4 | [] | no_license | max-demidov/interview | https://github.com/max-demidov/interview | be2e80b8e9aefc14f887cfbcec2ef26f439522ce | 78c597f9c5ab4c612639b4afc29bf74523155693 | refs/heads/master | 2021-12-24T16:28:48.172000 | 2021-09-13T05:09:20 | 2021-09-13T05:09:20 | 189,901,888 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package name.mdemidov.interview.leetcode.task1007;
/**
* https://leetcode.com/problems/minimum-domino-rotations-for-equal-row/
*
* 1007. Minimum Domino Rotations For Equal Row
*
* In a row of dominoes, A[i] and B[i] represent the top and bottom halves of the i-th domino.
* (A domino is a tile with two numbers from 1 to 6 - one on each half of the tile.)
*
* We may rotate the i-th domino, so that A[i] and B[i] swap values.
*
* Return the minimum number of rotations so that all the values in A are the same,
* or all the values in B are the same.
*
* If it cannot be done, return -1.
*
* Example 1:
*
* Input: A = [2,1,2,4,2,2], B = [5,2,6,2,3,2]
* Output: 2
* Explanation:
* The first figure represents the dominoes as given by A and B: before we do any rotations.
* If we rotate the second and fourth dominoes, we can make every value in the top row equal to 2,
* as indicated by the second figure.
*
* Example 2:
*
* Input: A = [3,5,1,2,3], B = [3,6,3,3,4]
* Output: -1
* Explanation:
* In this case, it is not possible to rotate the dominoes to make one row of values equal.
*/
public class Solution {
private static final Solution S = new Solution();
public int minDominoRotations(int[] A, int[] B) {
int a = A[0];
int b = B[0];
int countA = 1;
int countB = 1;
int topA = 1;
int bottomA = 0;
int topB = 0;
int bottomB = 1;
for (int i = 1; i < A.length; i++) {
if (countA > 0) {
if (a == A[i] || a == B[i]) {
countA++;
if (a == A[i]) {
topA++;
}
if (a == B[i]) {
bottomA++;
}
} else {
countA = -1;
}
}
if (countB > 0) {
if (b == A[i] || b == B[i]) {
countB++;
if (b == A[i]) {
topB++;
}
if (b == B[i]) {
bottomB++;
}
} else {
countB = -1;
}
}
if (countA < i && countB < i) {
return -1;
}
}
int rotA = countA > 0 ? countA - Integer.max(topA, bottomA) : Integer.MAX_VALUE;
int rotB = countB > 0 ? countB - Integer.max(topB, bottomB) : Integer.MAX_VALUE;
return Integer.min(rotA, rotB);
}
public static void main(String[] args) {
int[] a1 = {2, 1, 2, 4, 2, 2};
int[] b1 = {5, 2, 6, 2, 3, 2};
System.out.println(S.minDominoRotations(a1, b1));
int[] a2 = {3, 5, 1, 2, 3};
int[] b2 = {3, 6, 3, 3, 4};
System.out.println(S.minDominoRotations(a2, b2));
}
}
| UTF-8 | Java | 2,884 | java | Solution.java | Java | [
{
"context": "package name.mdemidov.interview.leetcode.task1007;\n\n/**\n * https://leet",
"end": 21,
"score": 0.9477789998054504,
"start": 13,
"tag": "USERNAME",
"value": "mdemidov"
}
] | null | [] | package name.mdemidov.interview.leetcode.task1007;
/**
* https://leetcode.com/problems/minimum-domino-rotations-for-equal-row/
*
* 1007. Minimum Domino Rotations For Equal Row
*
* In a row of dominoes, A[i] and B[i] represent the top and bottom halves of the i-th domino.
* (A domino is a tile with two numbers from 1 to 6 - one on each half of the tile.)
*
* We may rotate the i-th domino, so that A[i] and B[i] swap values.
*
* Return the minimum number of rotations so that all the values in A are the same,
* or all the values in B are the same.
*
* If it cannot be done, return -1.
*
* Example 1:
*
* Input: A = [2,1,2,4,2,2], B = [5,2,6,2,3,2]
* Output: 2
* Explanation:
* The first figure represents the dominoes as given by A and B: before we do any rotations.
* If we rotate the second and fourth dominoes, we can make every value in the top row equal to 2,
* as indicated by the second figure.
*
* Example 2:
*
* Input: A = [3,5,1,2,3], B = [3,6,3,3,4]
* Output: -1
* Explanation:
* In this case, it is not possible to rotate the dominoes to make one row of values equal.
*/
public class Solution {
private static final Solution S = new Solution();
public int minDominoRotations(int[] A, int[] B) {
int a = A[0];
int b = B[0];
int countA = 1;
int countB = 1;
int topA = 1;
int bottomA = 0;
int topB = 0;
int bottomB = 1;
for (int i = 1; i < A.length; i++) {
if (countA > 0) {
if (a == A[i] || a == B[i]) {
countA++;
if (a == A[i]) {
topA++;
}
if (a == B[i]) {
bottomA++;
}
} else {
countA = -1;
}
}
if (countB > 0) {
if (b == A[i] || b == B[i]) {
countB++;
if (b == A[i]) {
topB++;
}
if (b == B[i]) {
bottomB++;
}
} else {
countB = -1;
}
}
if (countA < i && countB < i) {
return -1;
}
}
int rotA = countA > 0 ? countA - Integer.max(topA, bottomA) : Integer.MAX_VALUE;
int rotB = countB > 0 ? countB - Integer.max(topB, bottomB) : Integer.MAX_VALUE;
return Integer.min(rotA, rotB);
}
public static void main(String[] args) {
int[] a1 = {2, 1, 2, 4, 2, 2};
int[] b1 = {5, 2, 6, 2, 3, 2};
System.out.println(S.minDominoRotations(a1, b1));
int[] a2 = {3, 5, 1, 2, 3};
int[] b2 = {3, 6, 3, 3, 4};
System.out.println(S.minDominoRotations(a2, b2));
}
}
| 2,884 | 0.468447 | 0.43932 | 93 | 30.010754 | 24.846407 | 98 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.913979 | false | false | 9 |
2cea8d9391a3da698e6e30e211c98efa8d2c8784 | 5,050,881,597,290 | 2492841d0902c7b4783151b56ad16595e144036a | /src/main/java/pl/edu/wszib/homebudget/controller/TransactionController.java | 23aa79553ab0e69693d3aff5f23547606873ecc3 | [] | no_license | codebyub/HomeBudget | https://github.com/codebyub/HomeBudget | c9ad03b5d9a4b56a42f398a849ec88185276df39 | b2eef30ccf4ef653b2ad5f55143f2bfefc1e2194 | refs/heads/master | 2022-12-08T15:52:35.251000 | 2020-08-25T20:09:50 | 2020-08-25T20:09:50 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package pl.edu.wszib.homebudget.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import pl.edu.wszib.homebudget.dao.TransactionDao;
import pl.edu.wszib.homebudget.dao.UserDao;
import pl.edu.wszib.homebudget.domain.Transaction;
import javax.validation.Valid;
@Controller
public class TransactionController {
@Autowired
private TransactionDao transactionDao;
@Autowired
private UserDao userDao;
@GetMapping
public String welcome() {
return "entry";
}
@GetMapping("expenses")
public String expenses(Model model) {
model.addAttribute("expenses", transactionDao.findAllExpenses());
return "expenses";
}
@GetMapping("expenses/new")
public String newExpense(Model model) {
model.addAttribute("expense", new Transaction());
return "expense";
}
@PostMapping("expenses/save")
public String saveExpense(@Valid @ModelAttribute("expense") Transaction transaction, BindingResult bindingResult, Model model) {
if (bindingResult.hasErrors()) {
model.addAttribute("expense", transaction);
return "expense";
}
transactionDao.save(transaction);
return "redirect:/expenses";
}
@GetMapping("expenses/edit/{id}")
public String editExpenseForm(@PathVariable long id, Model model) {
model.addAttribute("expense", transactionDao.findById(id));
return "expense";
}
@GetMapping("expenses/delete/{id}")
public String deleteExpense(@PathVariable long id) {
transactionDao.deleteById(id);
return "redirect:/expenses";
}
@GetMapping("incomes")
public String incomes(Model model) {
model.addAttribute("incomes", transactionDao.findIncomesInCurrentMonth());
return "incomes";
}
@GetMapping("incomes/new")
public String newIncome(Model model) {
model.addAttribute("income", new Transaction());
return "income";
}
@PostMapping("incomes/save")
public String saveIncome(@Valid @ModelAttribute("income") Transaction transaction, BindingResult bindingResult, Model model) {
if (bindingResult.hasErrors()) {
model.addAttribute("income", transaction);
return "income";
}
transactionDao.save(transaction);
return "redirect:/incomes";
}
@GetMapping("incomes/edit/{id}")
public String editIncomeForm(@PathVariable long id, Model model) {
model.addAttribute("income", transactionDao.findById(id));
return "income";
}
@GetMapping("incomes/delete/{id}")
public String deleteIncome(@PathVariable long id) {
transactionDao.deleteById(id);
return "redirect:/incomes";
}
@GetMapping("this-month")
public String thisMonth(Model model) {
model.addAttribute("transactions", transactionDao.findAllInCurrentMonth());
return "monthly-balance";
}
@GetMapping("this-year")
public String thisYear(Model model) {
model.addAttribute("transactions", transactionDao.findAllInCurrentYear());
return "annual-balance";
}
@GetMapping("statistics")
public String stats(Model model) {
model.addAttribute("transactions", transactionDao.findAllInCurrentYear());
model.addAttribute("expenses", transactionDao.findAllExpenses());
model.addAttribute("salaries", transactionDao.findSalariesInCurrentYear());
model.addAttribute("users", userDao.findAll());
return "stats";
}
} | UTF-8 | Java | 3,934 | java | TransactionController.java | Java | [] | null | [] | package pl.edu.wszib.homebudget.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import pl.edu.wszib.homebudget.dao.TransactionDao;
import pl.edu.wszib.homebudget.dao.UserDao;
import pl.edu.wszib.homebudget.domain.Transaction;
import javax.validation.Valid;
@Controller
public class TransactionController {
@Autowired
private TransactionDao transactionDao;
@Autowired
private UserDao userDao;
@GetMapping
public String welcome() {
return "entry";
}
@GetMapping("expenses")
public String expenses(Model model) {
model.addAttribute("expenses", transactionDao.findAllExpenses());
return "expenses";
}
@GetMapping("expenses/new")
public String newExpense(Model model) {
model.addAttribute("expense", new Transaction());
return "expense";
}
@PostMapping("expenses/save")
public String saveExpense(@Valid @ModelAttribute("expense") Transaction transaction, BindingResult bindingResult, Model model) {
if (bindingResult.hasErrors()) {
model.addAttribute("expense", transaction);
return "expense";
}
transactionDao.save(transaction);
return "redirect:/expenses";
}
@GetMapping("expenses/edit/{id}")
public String editExpenseForm(@PathVariable long id, Model model) {
model.addAttribute("expense", transactionDao.findById(id));
return "expense";
}
@GetMapping("expenses/delete/{id}")
public String deleteExpense(@PathVariable long id) {
transactionDao.deleteById(id);
return "redirect:/expenses";
}
@GetMapping("incomes")
public String incomes(Model model) {
model.addAttribute("incomes", transactionDao.findIncomesInCurrentMonth());
return "incomes";
}
@GetMapping("incomes/new")
public String newIncome(Model model) {
model.addAttribute("income", new Transaction());
return "income";
}
@PostMapping("incomes/save")
public String saveIncome(@Valid @ModelAttribute("income") Transaction transaction, BindingResult bindingResult, Model model) {
if (bindingResult.hasErrors()) {
model.addAttribute("income", transaction);
return "income";
}
transactionDao.save(transaction);
return "redirect:/incomes";
}
@GetMapping("incomes/edit/{id}")
public String editIncomeForm(@PathVariable long id, Model model) {
model.addAttribute("income", transactionDao.findById(id));
return "income";
}
@GetMapping("incomes/delete/{id}")
public String deleteIncome(@PathVariable long id) {
transactionDao.deleteById(id);
return "redirect:/incomes";
}
@GetMapping("this-month")
public String thisMonth(Model model) {
model.addAttribute("transactions", transactionDao.findAllInCurrentMonth());
return "monthly-balance";
}
@GetMapping("this-year")
public String thisYear(Model model) {
model.addAttribute("transactions", transactionDao.findAllInCurrentYear());
return "annual-balance";
}
@GetMapping("statistics")
public String stats(Model model) {
model.addAttribute("transactions", transactionDao.findAllInCurrentYear());
model.addAttribute("expenses", transactionDao.findAllExpenses());
model.addAttribute("salaries", transactionDao.findSalariesInCurrentYear());
model.addAttribute("users", userDao.findAll());
return "stats";
}
} | 3,934 | 0.690646 | 0.690646 | 122 | 31.254099 | 26.914425 | 132 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.565574 | false | false | 9 |
0f872822c06699d45cd631be4c9fd43dee130229 | 28,501,403,034,605 | 6c3259ff16d986a999721abf2853fafa7f7d1101 | /EJBCore/src/main/java/intf/entity/SysSmsTemplate.java | 627e3eb18c07566b73e43fd97284ff6135e9e0ed | [] | no_license | ragrok/Jsf_ejb_jpa | https://github.com/ragrok/Jsf_ejb_jpa | 4fcc537fa0f6d88a0a354b60c730246ecf338137 | f0e8582ffd2d9192b424f26328b758246eb75741 | refs/heads/master | 2017-12-16T23:51:51.868000 | 2017-02-14T10:05:10 | 2017-02-14T10:05:10 | 77,425,814 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | // ******************************COPYRIGHT NOTICE*******************************
// All rights reserved. This material is confidential and proprietary to Excel
// Technology International (Hong Kong) Limited and no part of this material
// should be reproduced, published in any form by any means, electronic or
// mechanical including photocopy or any information storage or retrieval system
// nor should the material be disclosed to third parties without the express
// written authorization of Excel Technology International (Hong Kong) Limited.
/*
<PRE>
* **************************VSS GENERATED VERSION NUMBER************************
* $Revision: $
* ******************************PROGRAM DESCRIPTION*****************************
* Program Name : SysSmsTemplate.java
* Nature : Application
* Description : The persistent class for the SYS_SMS_TEMPLATE database table
* Creation Date :
* Creator :
* ******************************MODIFICATION HISTORY****************************
* Modify Date :
* Modifier :
* CR / SIR No. :
* Description :
* ******************************************************************************
</PRE>
*/
package intf.entity;
import java.io.Serializable;
import javax.persistence.*;
/**
* The persistent class for the SYS_SMS_TEMPLATE database table.
*
*/
@Entity
@Table(name="SYS_SMS_TEMPLATE")
@NamedQuery(name="SysSmsTemplate.findAll", query="SELECT i FROM SysSmsTemplate i")
@Cacheable(false)
public class SysSmsTemplate implements Serializable {
private static final long serialVersionUID = 1L;
@EmbeddedId
private SysSmsTemplatePK id;
@Column(name="SMS_TEMPLATE")
private String smsTemplate;
public SysSmsTemplate() {
}
public SysSmsTemplatePK getId() {
return this.id;
}
public void setId(SysSmsTemplatePK id) {
this.id = id;
}
public String getSmsTemplate() {
return smsTemplate;
}
public void setSmsTemplate(String smsTemplate) {
this.smsTemplate = smsTemplate;
}
@Override
public String toString() {
return "SysSmsTemplate [id=" + id + ", smsTemplate=" + smsTemplate
+ "]";
}
}
/*
******************************VSS GENERATED HISTORY*****************************
*$History: $
********************************************************************************
**/ | UTF-8 | Java | 2,378 | java | SysSmsTemplate.java | Java | [] | null | [] | // ******************************COPYRIGHT NOTICE*******************************
// All rights reserved. This material is confidential and proprietary to Excel
// Technology International (Hong Kong) Limited and no part of this material
// should be reproduced, published in any form by any means, electronic or
// mechanical including photocopy or any information storage or retrieval system
// nor should the material be disclosed to third parties without the express
// written authorization of Excel Technology International (Hong Kong) Limited.
/*
<PRE>
* **************************VSS GENERATED VERSION NUMBER************************
* $Revision: $
* ******************************PROGRAM DESCRIPTION*****************************
* Program Name : SysSmsTemplate.java
* Nature : Application
* Description : The persistent class for the SYS_SMS_TEMPLATE database table
* Creation Date :
* Creator :
* ******************************MODIFICATION HISTORY****************************
* Modify Date :
* Modifier :
* CR / SIR No. :
* Description :
* ******************************************************************************
</PRE>
*/
package intf.entity;
import java.io.Serializable;
import javax.persistence.*;
/**
* The persistent class for the SYS_SMS_TEMPLATE database table.
*
*/
@Entity
@Table(name="SYS_SMS_TEMPLATE")
@NamedQuery(name="SysSmsTemplate.findAll", query="SELECT i FROM SysSmsTemplate i")
@Cacheable(false)
public class SysSmsTemplate implements Serializable {
private static final long serialVersionUID = 1L;
@EmbeddedId
private SysSmsTemplatePK id;
@Column(name="SMS_TEMPLATE")
private String smsTemplate;
public SysSmsTemplate() {
}
public SysSmsTemplatePK getId() {
return this.id;
}
public void setId(SysSmsTemplatePK id) {
this.id = id;
}
public String getSmsTemplate() {
return smsTemplate;
}
public void setSmsTemplate(String smsTemplate) {
this.smsTemplate = smsTemplate;
}
@Override
public String toString() {
return "SysSmsTemplate [id=" + id + ", smsTemplate=" + smsTemplate
+ "]";
}
}
/*
******************************VSS GENERATED HISTORY*****************************
*$History: $
********************************************************************************
**/ | 2,378 | 0.560135 | 0.559714 | 82 | 27.024391 | 29.013023 | 82 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.621951 | false | false | 13 |
62ee58400a3f0e7429c5f0137c78ec4305bac47d | 31,610,959,338,420 | 8dcb14094c15ddfea16283f10d6816167dc69039 | /src/main/java/gui/mapviewer/MotePainter.java | bed5012143e07f83193cf0cf4766bc57b6c15460 | [
"MIT"
] | permissive | DingNet-Simulator/DingNet | https://github.com/DingNet-Simulator/DingNet | 3cd586f428e9ba13b55fa4a02cd00a671371e30d | 73d8be0d4b0324ed554c0c25558e74cd77a4c3f4 | refs/heads/master | 2022-09-24T17:50:18.905000 | 2022-02-17T15:16:43 | 2022-02-17T15:16:43 | 194,922,600 | 3 | 1 | MIT | false | 2022-06-20T22:43:43 | 2019-07-02T19:24:40 | 2022-02-17T15:16:52 | 2022-06-20T22:43:42 | 39,456 | 0 | 7 | 2 | Java | false | false | package gui.mapviewer;
import org.jxmapviewer.JXMapViewer;
import org.jxmapviewer.painter.AbstractPainter;
import util.SettingsReader;
import java.awt.*;
import java.awt.geom.Point2D;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
/**
* Paints waypoints on the JXMapViewer. This is an
* instance of Painter that only can draw on to JXMapViewers.
* @param <W> the waypoint type
* @author rbair
*/
public class MotePainter<W extends MoteWayPoint> extends AbstractPainter<JXMapViewer> {
private Set<W> waypoints = new HashSet<>();
public MotePainter() {
setAntialiasing(SettingsReader.getInstance().useGUIAntialiasing());
setCacheable(false);
}
/**
* Gets the current set of waypoints to paint
* @return a typed Set of Waypoints
*/
public Set<W> getWaypoints() {
return Collections.unmodifiableSet(waypoints);
}
/**
* Sets the current set of waypoints to paint
* @param waypoints the new Set of Waypoints to use
*/
public MotePainter<W> setWaypoints(Set<? extends W> waypoints) {
this.waypoints.clear();
this.waypoints.addAll(waypoints);
return this;
}
@Override
protected void doPaint(Graphics2D g, JXMapViewer map, int width, int height) {
Rectangle viewportBounds = map.getViewportBounds();
g.translate(-viewportBounds.getX(), -viewportBounds.getY());
for (var wp : getWaypoints()) {
Point2D point = map.getTileFactory().geoToPixel(wp.getPosition(), map.getZoom());
int x = (int) (point.getX() - (wp.getIcon().getWidth() * 0.1));
int y = (int) (point.getY() - (wp.getIcon().getHeight() * 0.1));
g.drawImage(wp.getIcon(), x, y, null);
}
g.translate(viewportBounds.getX(), viewportBounds.getY());
}
}
| UTF-8 | Java | 1,863 | java | MotePainter.java | Java | [
{
"context": "iewers.\n * @param <W> the waypoint type\n * @author rbair\n */\npublic class MotePainter<W extends MoteWayPoi",
"end": 430,
"score": 0.9994533061981201,
"start": 425,
"tag": "USERNAME",
"value": "rbair"
}
] | null | [] | package gui.mapviewer;
import org.jxmapviewer.JXMapViewer;
import org.jxmapviewer.painter.AbstractPainter;
import util.SettingsReader;
import java.awt.*;
import java.awt.geom.Point2D;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
/**
* Paints waypoints on the JXMapViewer. This is an
* instance of Painter that only can draw on to JXMapViewers.
* @param <W> the waypoint type
* @author rbair
*/
public class MotePainter<W extends MoteWayPoint> extends AbstractPainter<JXMapViewer> {
private Set<W> waypoints = new HashSet<>();
public MotePainter() {
setAntialiasing(SettingsReader.getInstance().useGUIAntialiasing());
setCacheable(false);
}
/**
* Gets the current set of waypoints to paint
* @return a typed Set of Waypoints
*/
public Set<W> getWaypoints() {
return Collections.unmodifiableSet(waypoints);
}
/**
* Sets the current set of waypoints to paint
* @param waypoints the new Set of Waypoints to use
*/
public MotePainter<W> setWaypoints(Set<? extends W> waypoints) {
this.waypoints.clear();
this.waypoints.addAll(waypoints);
return this;
}
@Override
protected void doPaint(Graphics2D g, JXMapViewer map, int width, int height) {
Rectangle viewportBounds = map.getViewportBounds();
g.translate(-viewportBounds.getX(), -viewportBounds.getY());
for (var wp : getWaypoints()) {
Point2D point = map.getTileFactory().geoToPixel(wp.getPosition(), map.getZoom());
int x = (int) (point.getX() - (wp.getIcon().getWidth() * 0.1));
int y = (int) (point.getY() - (wp.getIcon().getHeight() * 0.1));
g.drawImage(wp.getIcon(), x, y, null);
}
g.translate(viewportBounds.getX(), viewportBounds.getY());
}
}
| 1,863 | 0.654321 | 0.650564 | 64 | 28.109375 | 26.913704 | 93 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false | 13 |
072fc78293d0e5bf0590b5ea23ec7c549c669843 | 11,175,504,930,310 | 850e65d110166ba7094fc680215285329545752c | /Capitulo 02/Projeto inicial/src/main/java/com/algaworks/algafood/di/notificacao/NotificadorEmail.java | b9f71899d4f1c82e03dc7412d9d9adff81f72363 | [] | no_license | cesarschutz/2020-01-algaworks-especialista-spring-rest | https://github.com/cesarschutz/2020-01-algaworks-especialista-spring-rest | 665779c640b0536b1aeac8c8b26ec9776065a17d | a5f58b021ad2001223923a3fff1e48a2cde403b1 | refs/heads/master | 2020-12-10T00:54:44.034000 | 2020-03-01T18:41:59 | 2020-03-01T18:41:59 | 233,464,770 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.algaworks.algafood.di.notificacao;
import com.algaworks.algafood.di.modelo.Cliente;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@TipoDoNotificador(NivelUrgencia.SEM_URGENCIA)
@Component
public class NotificadorEmail implements Notificador {
@Autowired
private NotificadorProperties notificadorProperties;
@Override
public void notificar(Cliente cliente, String mensagem) {
System.out.println(notificadorProperties.getHostServidor());
System.out.println(notificadorProperties.getPortaServidor().toString());
System.out.printf(
"Notificando %s através do e-mail %s: %s\n",
cliente.getNome(), cliente.getEmail(), mensagem);
}
}
| UTF-8 | Java | 786 | java | NotificadorEmail.java | Java | [] | null | [] | package com.algaworks.algafood.di.notificacao;
import com.algaworks.algafood.di.modelo.Cliente;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@TipoDoNotificador(NivelUrgencia.SEM_URGENCIA)
@Component
public class NotificadorEmail implements Notificador {
@Autowired
private NotificadorProperties notificadorProperties;
@Override
public void notificar(Cliente cliente, String mensagem) {
System.out.println(notificadorProperties.getHostServidor());
System.out.println(notificadorProperties.getPortaServidor().toString());
System.out.printf(
"Notificando %s através do e-mail %s: %s\n",
cliente.getNome(), cliente.getEmail(), mensagem);
}
}
| 786 | 0.743949 | 0.743949 | 22 | 34.68182 | 26.977072 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.545455 | false | false | 13 |
0fab32d335c98e524e0f988427d5800376488fc8 | 16,862,041,625,362 | 725638b5f628de74dce207f926a458b2052d3358 | /ydhy-service/src/main/java/com/example/ydhy/service/DemoService.java | 9953cdedaa1e5cbbea251907fdfdd2c4df4fd4e7 | [] | no_license | waveFuzf/ydhy | https://github.com/waveFuzf/ydhy | c2d4eae2a0da1bbf87047427e2d2832db9b77ede | b39ce1611eb8128257098f7ce4b052dec335d96d | refs/heads/master | 2020-04-05T03:31:14.154000 | 2019-02-15T09:29:42 | 2019-02-15T09:29:42 | 156,475,467 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.ydhy.service;
import com.example.ydhy.entity.User;
public interface DemoService {
User getSomething();
}
| UTF-8 | Java | 131 | java | DemoService.java | Java | [] | null | [] | package com.example.ydhy.service;
import com.example.ydhy.entity.User;
public interface DemoService {
User getSomething();
}
| 131 | 0.763359 | 0.763359 | 7 | 17.714285 | 15.424603 | 36 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.428571 | false | false | 13 |
e3cdf81ba04ec3e73cf2e517e5863304a060c3ee | 7,447,473,295,473 | 4c5a195105dcba2c01aeaccaa160274224927333 | /src/test_integration/java/com/tabler/reservatron/service/SubscriptionsTest.java | 459c9a06a4b628d1605e36310b397137d8790e75 | [] | no_license | GCPBigData/reservatron | https://github.com/GCPBigData/reservatron | f000a921f32985c7fba33e10a509ec9babd2b84e | 1dbe8b1d8cf2af2249fce35e90d3fef5389bb029 | refs/heads/master | 2020-04-13T19:18:19.572000 | 2018-05-13T15:42:41 | 2018-05-13T15:42:41 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.tabler.reservatron.service;
import com.tabler.reservatron.graphql.type.ReservationResult;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.jdbc.Sql;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.web.socket.TextMessage;
import org.springframework.web.socket.WebSocketSession;
import org.springframework.web.socket.client.WebSocketConnectionManager;
import org.springframework.web.socket.client.standard.StandardWebSocketClient;
import org.springframework.web.socket.handler.TextWebSocketHandler;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingDeque;
import static java.util.concurrent.TimeUnit.SECONDS;
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class SubscriptionsTest extends IntegrationTest {
private final static String SUBSCRIBE_TO_TABLE = " subscription RealTimeReservationsSubscription {\n" +
" newReservationMade(tableId: %d) {\n" +
" guest\n" +
" from\n" +
" to\n" +
" }\n" +
" }";
private BlockingQueue<String> blockingQueue;
private WebSocketConnectionManager connectionManager;
@Before
public void setup() {
blockingQueue = new LinkedBlockingDeque<>();
connectionManager = new WebSocketConnectionManager(new StandardWebSocketClient(),
new TextWebSocketHandler() {
@Override
public void afterConnectionEstablished(WebSocketSession session) throws Exception {
session.sendMessage(new TextMessage(String.format(SUBSCRIBE_TO_TABLE, 1)));
}
@Override
protected void handleTextMessage(WebSocketSession session, TextMessage message) {
blockingQueue.add(message.getPayload());
}
},
"ws://localhost:" + port + "/subscriptions");
}
@After
public void tearDown() throws Exception {
connectionManager.stopInternal();
}
@Test
@Sql(executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD, scripts = "classpath:table.sql")
public void realTimeReservationSubscription() throws Exception {
connectionManager.startInternal();
Thread.sleep(500);
ReservationResult.ReservationStatus reservationStatus = performReservation(1L,
"Mr. Smith",
"2018-01-05T18:00:00.000+0000",
"2018-01-05T20:00:00.000+0000");
Assert.assertEquals(ReservationResult.ReservationStatus.SUCCESS, reservationStatus);
String message = blockingQueue.poll(1, SECONDS);
Assert.assertNotNull(message);
Assert.assertEquals("{\"data\":{\"newReservationMade\":" +
"{\"guest\":\"Mr. Smith\"," +
"\"from\":\"2018-01-05T18:00:00.000+0000\"," +
"\"to\":\"2018-01-05T20:00:00.000+0000\"}}," +
"\"errors\":[],\"extensions\":null}", message);
}
}
| UTF-8 | Java | 3,295 | java | SubscriptionsTest.java | Java | [
{
"context": "nStatus = performReservation(1L,\n \"Mr. Smith\",\n \"2018-01-05T18:00:00.000+",
"end": 2687,
"score": 0.6800569295883179,
"start": 2685,
"tag": "NAME",
"value": "Mr"
},
{
"context": "atus = performReservation(1L,\n \"Mr. Smi... | null | [] | package com.tabler.reservatron.service;
import com.tabler.reservatron.graphql.type.ReservationResult;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.jdbc.Sql;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.web.socket.TextMessage;
import org.springframework.web.socket.WebSocketSession;
import org.springframework.web.socket.client.WebSocketConnectionManager;
import org.springframework.web.socket.client.standard.StandardWebSocketClient;
import org.springframework.web.socket.handler.TextWebSocketHandler;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingDeque;
import static java.util.concurrent.TimeUnit.SECONDS;
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class SubscriptionsTest extends IntegrationTest {
private final static String SUBSCRIBE_TO_TABLE = " subscription RealTimeReservationsSubscription {\n" +
" newReservationMade(tableId: %d) {\n" +
" guest\n" +
" from\n" +
" to\n" +
" }\n" +
" }";
private BlockingQueue<String> blockingQueue;
private WebSocketConnectionManager connectionManager;
@Before
public void setup() {
blockingQueue = new LinkedBlockingDeque<>();
connectionManager = new WebSocketConnectionManager(new StandardWebSocketClient(),
new TextWebSocketHandler() {
@Override
public void afterConnectionEstablished(WebSocketSession session) throws Exception {
session.sendMessage(new TextMessage(String.format(SUBSCRIBE_TO_TABLE, 1)));
}
@Override
protected void handleTextMessage(WebSocketSession session, TextMessage message) {
blockingQueue.add(message.getPayload());
}
},
"ws://localhost:" + port + "/subscriptions");
}
@After
public void tearDown() throws Exception {
connectionManager.stopInternal();
}
@Test
@Sql(executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD, scripts = "classpath:table.sql")
public void realTimeReservationSubscription() throws Exception {
connectionManager.startInternal();
Thread.sleep(500);
ReservationResult.ReservationStatus reservationStatus = performReservation(1L,
"Mr. Smith",
"2018-01-05T18:00:00.000+0000",
"2018-01-05T20:00:00.000+0000");
Assert.assertEquals(ReservationResult.ReservationStatus.SUCCESS, reservationStatus);
String message = blockingQueue.poll(1, SECONDS);
Assert.assertNotNull(message);
Assert.assertEquals("{\"data\":{\"newReservationMade\":" +
"{\"guest\":\"<NAME>\"," +
"\"from\":\"2018-01-05T18:00:00.000+0000\"," +
"\"to\":\"2018-01-05T20:00:00.000+0000\"}}," +
"\"errors\":[],\"extensions\":null}", message);
}
}
| 3,292 | 0.661305 | 0.633687 | 79 | 40.708862 | 28.985876 | 107 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.607595 | false | false | 13 |
f2d7e472656eaa2f783b666cc16f5b6075234c9c | 7,146,825,642,960 | b0724eca2f5fa3de23ee7d0b72d3a5a66c4a55e4 | /src/main/Controller.java | 46da0178f10065808d9f0ebf1ce497a2ff210220 | [] | no_license | koch35u/NavalBattle2019 | https://github.com/koch35u/NavalBattle2019 | 25e982577b1e009e15a572b2d7168522f788d91c | 5248e5f8f5c7d6fae543d495d989e8b67b81cf95 | refs/heads/master | 2020-04-05T13:10:41.176000 | 2019-12-23T08:14:30 | 2019-12-23T08:14:30 | 156,890,116 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package main;
import java.io.File;
import java.io.IOException;
import java.rmi.AlreadyBoundException;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;
import model.Game;
import views.MainView;
import views.StartView;
public class Controller {
private Game game;
private MainView gameInterface;
/**
* Constructeur créant le controller.
* Enregistre le jeu, créé l'interface visuelle et le listener pour le clavier.
* @param game
* @throws NotBoundException
* @throws RemoteException
*/
public Controller(Game game) {
this.game = game;
new StartView(this);
}
/**
* Renvoie le jeu courant
* @return Game
*/
public Game getGame() {
return this.game;
}
/**
* Renvoie vrai si la création d'un bateau au coordonnées x y est réussie
* @param i : Numéro de joueur
* @param x
* @param y
* @return True/False
*/
public boolean addBoat(int i, int x, int y) {
if(this.game.getState() == 1) {
if(game.addBoat(i, x, y)) {
return true;
}
}
return false;
}
/**
* Renvoie vrai si l'attaque d'une cellule d'un joueur est réussie
* @param x
* @param y
* @return True/False
*/
public boolean attack(int x, int y) {
if(this.game.getState() == 2 && !this.game.strickenCellP2(x, y)) {
game.setState(3);
return game.attack(x, y);
}
return false;
}
/**
* Mets a jour les vues du jeu
* @throws RemoteException
*/
public void update() throws RemoteException {
this.game.setChange();
}
/**
* Relance une nouvelle partie en créant un nouveau jeu et de nouvelles vues
* @throws RemoteException
* @throws AlreadyBoundException
* @throws NotBoundException
*/
@SuppressWarnings("deprecation")
public void reload() throws RemoteException, AlreadyBoundException, NotBoundException {
int age = this.game.getAge();
this.game = new Game();
this.game.setAge(age);
this.game.init();
this.gameInterface.dispose();
this.gameInterface = new MainView(this);
this.gameInterface.addKeyListener(new KeyBoardListener(this));
this.game.addObserver(this.gameInterface);
try {
this.game.start();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
/**
* Fonction d'enregistrement de la partie.
* @throws IOException
*/
public void save() throws IOException {
this.game.save();
}
/**
* Fonction qui relance une partie en fonction d'un fichier d'enregistrement
* @param file
* @param file2
* @throws IOException
* @throws NotBoundException
*/
@SuppressWarnings("deprecation")
public void reload(File file, File file2) throws IOException, NotBoundException {
this.game = new Game(file, file2);
this.gameInterface.dispose();
this.gameInterface = new MainView(this);
this.gameInterface.addKeyListener(new KeyBoardListener(this));
this.game.addObserver(this.gameInterface);
try {
this.game.start();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
@SuppressWarnings("deprecation")
public void setAge(int i) throws RemoteException, NotBoundException {
this.game.setAge(i);
this.game.init();
this.gameInterface = new MainView(this);
this.gameInterface.addKeyListener(new KeyBoardListener(this));
this.game.addObserver(this.gameInterface);
}
}
| UTF-8 | Java | 3,257 | java | Controller.java | Java | [] | null | [] | package main;
import java.io.File;
import java.io.IOException;
import java.rmi.AlreadyBoundException;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;
import model.Game;
import views.MainView;
import views.StartView;
public class Controller {
private Game game;
private MainView gameInterface;
/**
* Constructeur créant le controller.
* Enregistre le jeu, créé l'interface visuelle et le listener pour le clavier.
* @param game
* @throws NotBoundException
* @throws RemoteException
*/
public Controller(Game game) {
this.game = game;
new StartView(this);
}
/**
* Renvoie le jeu courant
* @return Game
*/
public Game getGame() {
return this.game;
}
/**
* Renvoie vrai si la création d'un bateau au coordonnées x y est réussie
* @param i : Numéro de joueur
* @param x
* @param y
* @return True/False
*/
public boolean addBoat(int i, int x, int y) {
if(this.game.getState() == 1) {
if(game.addBoat(i, x, y)) {
return true;
}
}
return false;
}
/**
* Renvoie vrai si l'attaque d'une cellule d'un joueur est réussie
* @param x
* @param y
* @return True/False
*/
public boolean attack(int x, int y) {
if(this.game.getState() == 2 && !this.game.strickenCellP2(x, y)) {
game.setState(3);
return game.attack(x, y);
}
return false;
}
/**
* Mets a jour les vues du jeu
* @throws RemoteException
*/
public void update() throws RemoteException {
this.game.setChange();
}
/**
* Relance une nouvelle partie en créant un nouveau jeu et de nouvelles vues
* @throws RemoteException
* @throws AlreadyBoundException
* @throws NotBoundException
*/
@SuppressWarnings("deprecation")
public void reload() throws RemoteException, AlreadyBoundException, NotBoundException {
int age = this.game.getAge();
this.game = new Game();
this.game.setAge(age);
this.game.init();
this.gameInterface.dispose();
this.gameInterface = new MainView(this);
this.gameInterface.addKeyListener(new KeyBoardListener(this));
this.game.addObserver(this.gameInterface);
try {
this.game.start();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
/**
* Fonction d'enregistrement de la partie.
* @throws IOException
*/
public void save() throws IOException {
this.game.save();
}
/**
* Fonction qui relance une partie en fonction d'un fichier d'enregistrement
* @param file
* @param file2
* @throws IOException
* @throws NotBoundException
*/
@SuppressWarnings("deprecation")
public void reload(File file, File file2) throws IOException, NotBoundException {
this.game = new Game(file, file2);
this.gameInterface.dispose();
this.gameInterface = new MainView(this);
this.gameInterface.addKeyListener(new KeyBoardListener(this));
this.game.addObserver(this.gameInterface);
try {
this.game.start();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
@SuppressWarnings("deprecation")
public void setAge(int i) throws RemoteException, NotBoundException {
this.game.setAge(i);
this.game.init();
this.gameInterface = new MainView(this);
this.gameInterface.addKeyListener(new KeyBoardListener(this));
this.game.addObserver(this.gameInterface);
}
}
| 3,257 | 0.697968 | 0.695813 | 137 | 22.708029 | 20.674099 | 88 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.649635 | false | false | 13 |
68328e4561d7bb9917a3fffc0153a087e90fa6c4 | 27,977,416,992,255 | 0de09a2249e72961861c00e9d6f83bd2cec33227 | /src/designpatterns/roles/StateStrategyRole.java | f5454a0f8f850c8f52cb7892db4ddd40c54661ac | [] | no_license | BrunoLSousa/DesignPatternSmell | https://github.com/BrunoLSousa/DesignPatternSmell | 0bc4858c82d653739c96a9f24099b02915654aec | d772bff683a425b281d7e0bc2b50b3e840668b6e | refs/heads/master | 2021-01-19T08:09:06.995000 | 2020-05-27T19:29:18 | 2020-05-27T19:29:18 | 87,603,701 | 3 | 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 designpatterns.roles;
import designpatterns.structure.Type;
import java.util.ArrayList;
import java.util.List;
/**
*
* @author bruno
*/
public class StateStrategyRole extends Type {
private List<Context> contextStateStrategy;
public StateStrategyRole(String completeName) {
super(completeName);
contextStateStrategy = new ArrayList<>();
}
public List<Context> getContextStateStrategy() {
return this.contextStateStrategy;
}
public Context lastContextStateStrategy() {
int size = this.contextStateStrategy.size();
return this.contextStateStrategy.get(size - 1);
}
public void addStateStrategy(Context contextStateStrategy) {
if (contextStateStrategy != null) {
this.contextStateStrategy.add(contextStateStrategy);
}
}
@Override
public String toString() {
return "State/Strategy";
}
}
| UTF-8 | Java | 1,112 | java | StateStrategyRole.java | Java | [
{
"context": "rayList;\nimport java.util.List;\n\n/**\n *\n * @author bruno\n */\npublic class StateStrategyRole extends Type {",
"end": 329,
"score": 0.8678836822509766,
"start": 324,
"tag": "USERNAME",
"value": "bruno"
}
] | 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 designpatterns.roles;
import designpatterns.structure.Type;
import java.util.ArrayList;
import java.util.List;
/**
*
* @author bruno
*/
public class StateStrategyRole extends Type {
private List<Context> contextStateStrategy;
public StateStrategyRole(String completeName) {
super(completeName);
contextStateStrategy = new ArrayList<>();
}
public List<Context> getContextStateStrategy() {
return this.contextStateStrategy;
}
public Context lastContextStateStrategy() {
int size = this.contextStateStrategy.size();
return this.contextStateStrategy.get(size - 1);
}
public void addStateStrategy(Context contextStateStrategy) {
if (contextStateStrategy != null) {
this.contextStateStrategy.add(contextStateStrategy);
}
}
@Override
public String toString() {
return "State/Strategy";
}
}
| 1,112 | 0.690647 | 0.689748 | 45 | 23.711111 | 23.146511 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | false | false | 13 |
dd6ef5ddd6cd8d1c896cf6a0a262489ed142bf9f | 14,851,996,964,705 | fa8d29ec1ad7898df59db9988feed99a5c178398 | /org.mondo.visualization.ui/src/org/mondo/visualization/ui/page/LabelProvider/CActivate.java | e6be2729a934977537c63c1889ead2fd23f4f6af | [] | no_license | antoniogarmendia/EMF-Splitter | https://github.com/antoniogarmendia/EMF-Splitter | d40aa2ee1d70638c0637d0520946815b80a61e86 | ceb33e26b964407b11f4ec80b7161bfec2f95d83 | refs/heads/master | 2021-04-06T12:23:28.791000 | 2018-05-17T17:08:40 | 2018-05-17T17:08:40 | 42,922,455 | 2 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.mondo.visualization.ui.page.LabelProvider;
import graphic_representation.AffixedCompartmentElement;
import graphic_representation.AffixedElement;
import graphic_representation.CompartmentElement;
import graphic_representation.EdgeLabelEAttribute;
import graphic_representation.LabelEAttribute;
import graphic_representation.Link;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.jface.viewers.ColumnLabelProvider;
import org.eclipse.swt.graphics.Image;
import org.mondo.visualization.ui.Activator;
public class CActivate extends ColumnLabelProvider {
//Icons
private static final Image EAttribute = Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/EAttribute.gif").createImage();
private static final Image EReference = Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/EReference.gif").createImage();
@Override
public String getText(Object element) {
if(element instanceof EdgeLabelEAttribute)
return ((EdgeLabelEAttribute) element).getLabelEAttribute().getName();
if(element instanceof Link)
return ((Link) element).getAnEReference().getName();
if(element instanceof AffixedCompartmentElement)
return ((AffixedCompartmentElement) element).getAnEReference().getName();
if(element instanceof LabelEAttribute)
return ((LabelEAttribute) element).getAnEAttribute().getName();
return "";
}
@Override
public Image getImage(Object element) {
if(element instanceof LabelEAttribute || element instanceof EdgeLabelEAttribute)
return EAttribute;
if(element instanceof AffixedElement || element instanceof CompartmentElement || element instanceof Link)
return EReference;
return super.getImage(element);
}
}
| UTF-8 | Java | 1,712 | java | CActivate.java | Java | [] | null | [] | package org.mondo.visualization.ui.page.LabelProvider;
import graphic_representation.AffixedCompartmentElement;
import graphic_representation.AffixedElement;
import graphic_representation.CompartmentElement;
import graphic_representation.EdgeLabelEAttribute;
import graphic_representation.LabelEAttribute;
import graphic_representation.Link;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.jface.viewers.ColumnLabelProvider;
import org.eclipse.swt.graphics.Image;
import org.mondo.visualization.ui.Activator;
public class CActivate extends ColumnLabelProvider {
//Icons
private static final Image EAttribute = Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/EAttribute.gif").createImage();
private static final Image EReference = Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/EReference.gif").createImage();
@Override
public String getText(Object element) {
if(element instanceof EdgeLabelEAttribute)
return ((EdgeLabelEAttribute) element).getLabelEAttribute().getName();
if(element instanceof Link)
return ((Link) element).getAnEReference().getName();
if(element instanceof AffixedCompartmentElement)
return ((AffixedCompartmentElement) element).getAnEReference().getName();
if(element instanceof LabelEAttribute)
return ((LabelEAttribute) element).getAnEAttribute().getName();
return "";
}
@Override
public Image getImage(Object element) {
if(element instanceof LabelEAttribute || element instanceof EdgeLabelEAttribute)
return EAttribute;
if(element instanceof AffixedElement || element instanceof CompartmentElement || element instanceof Link)
return EReference;
return super.getImage(element);
}
}
| 1,712 | 0.806075 | 0.806075 | 46 | 36.217392 | 33.846142 | 136 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.782609 | false | false | 13 |
6375b2eade01150f799512cc0f490d3107067348 | 14,740,327,763,477 | f25369bc720405dba4f27a8eca177647f8f25e1e | /src/main/java/com/esrinea/gssteam/stocktask/util/StockObjectMapper.java | d4b4178989d7d75237387d10706f340d6003a7db | [] | no_license | PassantAhmed/StockTask | https://github.com/PassantAhmed/StockTask | 2b881e3c514476afe9dcb12dc31514c131a22a4a | 8096dbe5fbc0e75500d2c0737be2cbfeef033988 | refs/heads/master | 2022-12-21T14:34:17.777000 | 2020-02-06T11:40:40 | 2020-02-06T11:40:40 | 235,317,564 | 1 | 0 | null | false | 2020-01-22T00:24:22 | 2020-01-21T10:38:06 | 2020-01-21T11:01:47 | 2020-01-22T00:24:20 | 26 | 1 | 0 | 1 | Java | false | false | /*
* 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.esrinea.gssteam.stocktask.util;
/**
*
* @author passant.swelum
*/
public interface StockObjectMapper {
Object mapFromEntity(Object object);
Object mapToEntity(Object object);
}
| UTF-8 | Java | 401 | java | StockObjectMapper.java | Java | [
{
"context": "nea.gssteam.stocktask.util;\r\n\r\n/**\r\n *\r\n * @author passant.swelum\r\n */\r\npublic interface StockObjectMapper {\r\n O",
"end": 271,
"score": 0.9990898966789246,
"start": 257,
"tag": "NAME",
"value": "passant.swelum"
}
] | 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.esrinea.gssteam.stocktask.util;
/**
*
* @author passant.swelum
*/
public interface StockObjectMapper {
Object mapFromEntity(Object object);
Object mapToEntity(Object object);
}
| 401 | 0.710723 | 0.710723 | 15 | 24.733334 | 24.062326 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.4 | false | false | 13 |
9c693f5627775813aeda9d0f6b4aa0db4f28b16c | 24,936,580,176,223 | 7a29d4b33e39efb5c8c482b19e0ee333b3340644 | /VM/Mnemonic.java | 3a18d7976841990bbc08593e4b62e76488911f38 | [] | no_license | sky4walk/VirtualMachine | https://github.com/sky4walk/VirtualMachine | 1435217135d703dab55e0f318f558418fecd025f | b1b3433484e167840bbd98d68b0b8524614ab256 | refs/heads/master | 2021-01-13T08:05:25.216000 | 2017-06-20T09:58:24 | 2017-06-20T09:58:24 | 94,876,706 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | //written by André Betz
//http://www.andrebetz.de
class Mnemonic
{
private String MnemName;
private int AnzParams;
private Befehl m_func;
Mnemonic(String Name, int Params, Befehl func){
MnemName = Name;
AnzParams = Params;
m_func = func;
}
public String GetMnemName(){
return MnemName;
}
public int GetParamsCount(){
return AnzParams;
}
public Befehl GetFunc(){
return m_func;
}
} | WINDOWS-1250 | Java | 431 | java | Mnemonic.java | Java | [
{
"context": "//written by André Betz \r\n//http://www.andrebetz.de\r\n\r\nclass Mnemonic\r\n{\r",
"end": 23,
"score": 0.9998764991760254,
"start": 13,
"tag": "NAME",
"value": "André Betz"
}
] | null | [] | //written by <NAME>
//http://www.andrebetz.de
class Mnemonic
{
private String MnemName;
private int AnzParams;
private Befehl m_func;
Mnemonic(String Name, int Params, Befehl func){
MnemName = Name;
AnzParams = Params;
m_func = func;
}
public String GetMnemName(){
return MnemName;
}
public int GetParamsCount(){
return AnzParams;
}
public Befehl GetFunc(){
return m_func;
}
} | 426 | 0.662791 | 0.662791 | 24 | 16 | 12.124355 | 48 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.458333 | false | false | 13 |
2d993b4c4aa765de5b0c20b44504443d7a95aa65 | 24,034,637,054,699 | 5d5f8f042310a0e5100c37f8e11800027fee71af | /My_DSA/src/com/graphs/DetectCycleInUndirectedGraph_UnionFind_Algo.java | 5ea8acd98421465548a3de4174de2dcc8bf6a611 | [] | no_license | sohimankotia/DSA | https://github.com/sohimankotia/DSA | 51dc074466bdfe09b99e720457943e43db3469e1 | b79c35d61774319e9e687a3a8906124d33dfd866 | refs/heads/master | 2016-06-01T11:26:52.013000 | 2015-07-16T12:58:51 | 2015-07-16T12:58:51 | 37,517,423 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.graphs;
import java.util.Arrays;
public class DetectCycleInUndirectedGraph_UnionFind_Algo {
public static void main(String[] args) {
Graph graph = createGraph(3, 3);
// add edge 0-1
Edge e1 = new Edge(0, 1);
graph.getEdgeArray()[0] = e1;
// add edge 1-2
Edge e2 = new Edge(1, 2);
graph.getEdgeArray()[1] = e2;
// add edge 0-2
Edge e3 = new Edge(0, 2);
graph.getEdgeArray()[2] = e3 ;
if (isCycle(graph))
System.out.println("Graph contains cycle");
else
System.out.println("Graph doesn't contain cycle");
}
private static boolean isCycle(Graph graph) {
// Allocate memory for creating V subsets
int[] parent = new int[graph.getNoOfvertices()];
// Initialize all subsets as single element sets
for (int i = 0; i < parent.length; i++) {
parent[i] = -1;
}
// Iterate through all edges of graph, find subset of both
// vertices of every edge, if both subsets are same, then there is
// cycle in graph.
for (int i = 0; i < graph.getNoOfEdges(); ++i) {
//System.out.println("i ="+i);
Edge edge = graph.getEdgeArray()[i];
if (edge != null) {
//System.out.println("Parent array " + Arrays.toString(parent));
//System.out.println("Edge : "+edge.src+" ==> "+edge.dest);
int parentOfSrc = find(parent, edge.src);
int parentOfDest = find(parent, edge.dest);
//System.out.println("Parent of "+edge.src+" is "+parentOfSrc);
//System.out.println("Parent of "+edge.dest+" is "+parentOfDest);
if (parentOfSrc == parentOfDest)
return true;
Union(parent, parentOfSrc, parentOfDest);
}
}
return false;
}
private static void Union(int[] parent, int x, int y) {
parent[x] = y;
}
private static int find(int[] parent, int i) {
if (parent[i] == -1) {
return i;
}
return find(parent, parent[i]);
}
private static Graph createGraph(int noOfVertices, int noOfEdges) {
return new Graph(noOfVertices, noOfEdges);
}
}
// a class to represent an edge in graph
class Edge {
int src, dest;
public Edge() {
}
public Edge(int i, int j) {
src = i;
dest = j;
}
}
// a class to represent a graph
class Graph {
// noOfvertices -> Number of vertices, noOfEdges -> Number of edges
private int noOfvertices, noOfEdges;
// graph is represented as an array of edges
private Edge[] edgeArray;
public Graph(int noOfvertices, int noOfEdges) {
super();
this.noOfvertices = noOfvertices;
this.noOfEdges = noOfEdges;
this.edgeArray = new Edge[this.noOfEdges];
}
public synchronized int getNoOfvertices() {
return noOfvertices;
}
public synchronized int getNoOfEdges() {
return noOfEdges;
}
public synchronized Edge[] getEdgeArray() {
return edgeArray;
}
} | UTF-8 | Java | 2,718 | java | DetectCycleInUndirectedGraph_UnionFind_Algo.java | Java | [] | null | [] | package com.graphs;
import java.util.Arrays;
public class DetectCycleInUndirectedGraph_UnionFind_Algo {
public static void main(String[] args) {
Graph graph = createGraph(3, 3);
// add edge 0-1
Edge e1 = new Edge(0, 1);
graph.getEdgeArray()[0] = e1;
// add edge 1-2
Edge e2 = new Edge(1, 2);
graph.getEdgeArray()[1] = e2;
// add edge 0-2
Edge e3 = new Edge(0, 2);
graph.getEdgeArray()[2] = e3 ;
if (isCycle(graph))
System.out.println("Graph contains cycle");
else
System.out.println("Graph doesn't contain cycle");
}
private static boolean isCycle(Graph graph) {
// Allocate memory for creating V subsets
int[] parent = new int[graph.getNoOfvertices()];
// Initialize all subsets as single element sets
for (int i = 0; i < parent.length; i++) {
parent[i] = -1;
}
// Iterate through all edges of graph, find subset of both
// vertices of every edge, if both subsets are same, then there is
// cycle in graph.
for (int i = 0; i < graph.getNoOfEdges(); ++i) {
//System.out.println("i ="+i);
Edge edge = graph.getEdgeArray()[i];
if (edge != null) {
//System.out.println("Parent array " + Arrays.toString(parent));
//System.out.println("Edge : "+edge.src+" ==> "+edge.dest);
int parentOfSrc = find(parent, edge.src);
int parentOfDest = find(parent, edge.dest);
//System.out.println("Parent of "+edge.src+" is "+parentOfSrc);
//System.out.println("Parent of "+edge.dest+" is "+parentOfDest);
if (parentOfSrc == parentOfDest)
return true;
Union(parent, parentOfSrc, parentOfDest);
}
}
return false;
}
private static void Union(int[] parent, int x, int y) {
parent[x] = y;
}
private static int find(int[] parent, int i) {
if (parent[i] == -1) {
return i;
}
return find(parent, parent[i]);
}
private static Graph createGraph(int noOfVertices, int noOfEdges) {
return new Graph(noOfVertices, noOfEdges);
}
}
// a class to represent an edge in graph
class Edge {
int src, dest;
public Edge() {
}
public Edge(int i, int j) {
src = i;
dest = j;
}
}
// a class to represent a graph
class Graph {
// noOfvertices -> Number of vertices, noOfEdges -> Number of edges
private int noOfvertices, noOfEdges;
// graph is represented as an array of edges
private Edge[] edgeArray;
public Graph(int noOfvertices, int noOfEdges) {
super();
this.noOfvertices = noOfvertices;
this.noOfEdges = noOfEdges;
this.edgeArray = new Edge[this.noOfEdges];
}
public synchronized int getNoOfvertices() {
return noOfvertices;
}
public synchronized int getNoOfEdges() {
return noOfEdges;
}
public synchronized Edge[] getEdgeArray() {
return edgeArray;
}
} | 2,718 | 0.656365 | 0.646431 | 126 | 20.579365 | 21.25445 | 69 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.833333 | false | false | 13 |
c4fa483d59005bb49d85d442f4bc3bb010406f35 | 19,146,964,213,610 | ae607fc78d6a9aea143f392f08972f2167700072 | /Dictionary.java | 37a2f2d774e27aa05cf2b2ae3c9ce9852eeb5f14 | [
"MIT"
] | permissive | yhasansenyurt/Library-Kutuphane | https://github.com/yhasansenyurt/Library-Kutuphane | b944349c84020768ca4beb516f5e8ee5408fbfcb | 4bb8f4d8c8efa5fa19fe23e1c2af479e38b7e936 | refs/heads/main | 2023-05-14T01:05:11.303000 | 2021-05-31T17:36:28 | 2021-05-31T17:36:28 | 350,374,288 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | public class Dictionary extends Book {
protected int definitions;
public Dictionary(int id,String title,Author author,int definitions){
super(id, title, author);
try {
setDefinitions(definitions);
}
catch (Exception e){
System.out.println("Please check your inputs. Object was not created.");
}
}
public Dictionary(int id,String title,int definitions){
super(id,title);
setDefinitions(definitions);
}
public int getDefinitions() {
return definitions;
}
public void setDefinitions(int definitions){
// This mechanism checks whether int variable is positive or not.
try {
if (definitions <= 0) {
throw new Exception();
} else {
this.definitions = definitions;
}
}
catch (Exception e){
System.out.println("Please check your definitions of dictionary. " +
"Definitions cannot be negative or zero.");
}
}
public String toString() {
return "Dictionary Name is " + getTitle() + ", definitions: " + getDefinitions();
}
}
| UTF-8 | Java | 1,241 | java | Dictionary.java | Java | [] | null | [] | public class Dictionary extends Book {
protected int definitions;
public Dictionary(int id,String title,Author author,int definitions){
super(id, title, author);
try {
setDefinitions(definitions);
}
catch (Exception e){
System.out.println("Please check your inputs. Object was not created.");
}
}
public Dictionary(int id,String title,int definitions){
super(id,title);
setDefinitions(definitions);
}
public int getDefinitions() {
return definitions;
}
public void setDefinitions(int definitions){
// This mechanism checks whether int variable is positive or not.
try {
if (definitions <= 0) {
throw new Exception();
} else {
this.definitions = definitions;
}
}
catch (Exception e){
System.out.println("Please check your definitions of dictionary. " +
"Definitions cannot be negative or zero.");
}
}
public String toString() {
return "Dictionary Name is " + getTitle() + ", definitions: " + getDefinitions();
}
}
| 1,241 | 0.551168 | 0.550363 | 42 | 27.547619 | 25.514891 | 89 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.47619 | false | false | 13 |
f2db059ef294192963d33d8462cb8bb9fbf0e6ff | 5,634,997,122,696 | af606a04ed291e8c9b1e500739106a926e205ee2 | /aliyun-java-sdk-ecd/src/main/java/com/aliyuncs/ecd/transform/v20200930/DescribeScaleStrategysResponseUnmarshaller.java | e515fc0189464be420bc349f0b13d50241f0bcfa | [
"Apache-2.0"
] | permissive | xtlGitHub/aliyun-openapi-java-sdk | https://github.com/xtlGitHub/aliyun-openapi-java-sdk | a733f0a16c8cc493cc28062751290f563ab73ace | f60c71de2c9277932b6549c79631b0f03b11cc36 | refs/heads/master | 2023-09-03T13:56:50.071000 | 2021-11-10T11:53:25 | 2021-11-10T11:53:25 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* 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.aliyuncs.ecd.transform.v20200930;
import java.util.ArrayList;
import java.util.List;
import com.aliyuncs.ecd.model.v20200930.DescribeScaleStrategysResponse;
import com.aliyuncs.ecd.model.v20200930.DescribeScaleStrategysResponse.ScaleStrategy;
import com.aliyuncs.transform.UnmarshallerContext;
public class DescribeScaleStrategysResponseUnmarshaller {
public static DescribeScaleStrategysResponse unmarshall(DescribeScaleStrategysResponse describeScaleStrategysResponse, UnmarshallerContext _ctx) {
describeScaleStrategysResponse.setRequestId(_ctx.stringValue("DescribeScaleStrategysResponse.RequestId"));
describeScaleStrategysResponse.setNextToken(_ctx.stringValue("DescribeScaleStrategysResponse.NextToken"));
List<ScaleStrategy> scaleStrategys = new ArrayList<ScaleStrategy>();
for (int i = 0; i < _ctx.lengthValue("DescribeScaleStrategysResponse.ScaleStrategys.Length"); i++) {
ScaleStrategy scaleStrategy = new ScaleStrategy();
scaleStrategy.setScaleStrategyId(_ctx.stringValue("DescribeScaleStrategysResponse.ScaleStrategys["+ i +"].ScaleStrategyId"));
scaleStrategy.setScaleStrategyName(_ctx.stringValue("DescribeScaleStrategysResponse.ScaleStrategys["+ i +"].ScaleStrategyName"));
scaleStrategy.setScaleStrategyType(_ctx.stringValue("DescribeScaleStrategysResponse.ScaleStrategys["+ i +"].ScaleStrategyType"));
scaleStrategy.setMinDesktopsCount(_ctx.integerValue("DescribeScaleStrategysResponse.ScaleStrategys["+ i +"].MinDesktopsCount"));
scaleStrategy.setMaxDesktopsCount(_ctx.integerValue("DescribeScaleStrategysResponse.ScaleStrategys["+ i +"].MaxDesktopsCount"));
scaleStrategy.setMinAvailableDesktopsCount(_ctx.integerValue("DescribeScaleStrategysResponse.ScaleStrategys["+ i +"].MinAvailableDesktopsCount"));
scaleStrategy.setMaxAvailableDesktopsCount(_ctx.integerValue("DescribeScaleStrategysResponse.ScaleStrategys["+ i +"].MaxAvailableDesktopsCount"));
scaleStrategy.setScaleStep(_ctx.integerValue("DescribeScaleStrategysResponse.ScaleStrategys["+ i +"].ScaleStep"));
scaleStrategys.add(scaleStrategy);
}
describeScaleStrategysResponse.setScaleStrategys(scaleStrategys);
return describeScaleStrategysResponse;
}
} | UTF-8 | Java | 2,786 | java | DescribeScaleStrategysResponseUnmarshaller.java | Java | [] | null | [] | /*
* 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.aliyuncs.ecd.transform.v20200930;
import java.util.ArrayList;
import java.util.List;
import com.aliyuncs.ecd.model.v20200930.DescribeScaleStrategysResponse;
import com.aliyuncs.ecd.model.v20200930.DescribeScaleStrategysResponse.ScaleStrategy;
import com.aliyuncs.transform.UnmarshallerContext;
public class DescribeScaleStrategysResponseUnmarshaller {
public static DescribeScaleStrategysResponse unmarshall(DescribeScaleStrategysResponse describeScaleStrategysResponse, UnmarshallerContext _ctx) {
describeScaleStrategysResponse.setRequestId(_ctx.stringValue("DescribeScaleStrategysResponse.RequestId"));
describeScaleStrategysResponse.setNextToken(_ctx.stringValue("DescribeScaleStrategysResponse.NextToken"));
List<ScaleStrategy> scaleStrategys = new ArrayList<ScaleStrategy>();
for (int i = 0; i < _ctx.lengthValue("DescribeScaleStrategysResponse.ScaleStrategys.Length"); i++) {
ScaleStrategy scaleStrategy = new ScaleStrategy();
scaleStrategy.setScaleStrategyId(_ctx.stringValue("DescribeScaleStrategysResponse.ScaleStrategys["+ i +"].ScaleStrategyId"));
scaleStrategy.setScaleStrategyName(_ctx.stringValue("DescribeScaleStrategysResponse.ScaleStrategys["+ i +"].ScaleStrategyName"));
scaleStrategy.setScaleStrategyType(_ctx.stringValue("DescribeScaleStrategysResponse.ScaleStrategys["+ i +"].ScaleStrategyType"));
scaleStrategy.setMinDesktopsCount(_ctx.integerValue("DescribeScaleStrategysResponse.ScaleStrategys["+ i +"].MinDesktopsCount"));
scaleStrategy.setMaxDesktopsCount(_ctx.integerValue("DescribeScaleStrategysResponse.ScaleStrategys["+ i +"].MaxDesktopsCount"));
scaleStrategy.setMinAvailableDesktopsCount(_ctx.integerValue("DescribeScaleStrategysResponse.ScaleStrategys["+ i +"].MinAvailableDesktopsCount"));
scaleStrategy.setMaxAvailableDesktopsCount(_ctx.integerValue("DescribeScaleStrategysResponse.ScaleStrategys["+ i +"].MaxAvailableDesktopsCount"));
scaleStrategy.setScaleStep(_ctx.integerValue("DescribeScaleStrategysResponse.ScaleStrategys["+ i +"].ScaleStep"));
scaleStrategys.add(scaleStrategy);
}
describeScaleStrategysResponse.setScaleStrategys(scaleStrategys);
return describeScaleStrategysResponse;
}
} | 2,786 | 0.805097 | 0.794688 | 50 | 54.279999 | 49.393539 | 149 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.56 | false | false | 13 |
6eeba36c698121593021a298ffca152f501ad586 | 5,634,997,120,299 | 0af8b92686a58eb0b64e319b22411432aca7a8f3 | /single-large-project/src/test/java/org/gradle/test/performancenull_456/Testnull_45555.java | dedfb4586e83aba074232e62e5fd90da09f29227 | [] | no_license | gradle/performance-comparisons | https://github.com/gradle/performance-comparisons | b0d38db37c326e0ce271abebdb3c91769b860799 | e53dc7182fafcf9fedf07920cbbea8b40ee4eef4 | refs/heads/master | 2023-08-14T19:24:39.164000 | 2022-11-24T05:18:33 | 2022-11-24T05:18:33 | 80,121,268 | 17 | 15 | null | false | 2022-09-30T08:04:35 | 2017-01-26T14:25:33 | 2022-09-09T14:38:38 | 2022-09-30T08:04:34 | 19,731 | 14 | 13 | 103 | null | false | false | package org.gradle.test.performancenull_456;
import static org.junit.Assert.*;
public class Testnull_45555 {
private final Productionnull_45555 production = new Productionnull_45555("value");
@org.junit.Test
public void test() {
assertEquals(production.getProperty(), "value");
}
} | UTF-8 | Java | 308 | java | Testnull_45555.java | Java | [] | null | [] | package org.gradle.test.performancenull_456;
import static org.junit.Assert.*;
public class Testnull_45555 {
private final Productionnull_45555 production = new Productionnull_45555("value");
@org.junit.Test
public void test() {
assertEquals(production.getProperty(), "value");
}
} | 308 | 0.714286 | 0.655844 | 12 | 24.75 | 25.836424 | 86 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.416667 | false | false | 13 |
1bab5280bbe4c7822aa3f885b3caf59aceed6e52 | 34,333,968,575,252 | 248d9e2ffa4b1fe9c3d01fac1cd7b61d73d0213d | /BTServerChange/src/net/gametk/megaflary/bukkittools/serverchange/listener/PlayerListener.java | ecc3045a7623886d8745fd6609fd9d18904cf765 | [] | no_license | MegaFlary/BukkitTools | https://github.com/MegaFlary/BukkitTools | dcdb1809eb07e9bc22d4a8182112ed9762fce0ad | 8b96f1c304ffa5aab92042e3ef5f3fb3ebfcbc9b | refs/heads/master | 2015-08-13T14:46:21.577000 | 2014-09-22T12:44:57 | 2014-09-22T12:44:57 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package net.gametk.megaflary.bukkittools.serverchange.listener;
import net.gametk.megaflary.bukkittools.event.Event;
import net.gametk.megaflary.bukkittools.serverchange.ServerChangeModule;
import net.gametk.megaflary.bukkittools.serverchange.ServerChangeSettings;
import net.gametk.megaflary.bukkittools.serverchange.connection.User;
import net.gametk.megaflary.bukkittools.serverchange.util.UtilDatabase;
import net.gametk.megaflary.bukkittools.serverchange.util.UtilMain;
import net.gametk.megaflary.bukkittools.util.UtilMessages;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
public class PlayerListener implements Listener, Event {
private ServerChangeModule m;
public PlayerListener(ServerChangeModule module) {
this.m = module;
}
@EventHandler(priority = EventPriority.LOWEST)
public void onJoin(PlayerJoinEvent e) {
final Player p = e.getPlayer();
final String pName = p.getName();
if (ServerChangeSettings.isLobbyServer) {
UtilMessages.sendMessage(p, ChatColor.YELLOW + ServerChangeSettings.msgWelcome);
}
Bukkit.getScheduler().runTaskLater(m.getPlugin(), new Runnable() {
@Override
public void run() {
User user = UtilDatabase.getUser(pName);
if (user != null) {
if (user.getServerName().equals(ServerChangeSettings.serverName)) {
return;
} else {
UtilDatabase.updateUser(user.getID(), ServerChangeSettings.serverName);
}
if (ServerChangeSettings.isLobbyServer) {
if (ServerChangeSettings.isValidServer(user.getServerName())) {
UtilMain.transferPlayer(p, ServerChangeSettings.getServer(user.getServerName()));
} else {
UtilDatabase.removeUser(user.getID());
}
}
} else {
UtilDatabase.addUser(pName, ServerChangeSettings.serverName);
}
}
}, 20L);
}
@Override
public void load() {
Bukkit.getPluginManager().registerEvents(this, m.getPlugin());
}
@Override
public void unload() {
HandlerList.unregisterAll(this);
}
@Override
public String getName() {
return "ServerChange";
}
}
| UTF-8 | Java | 2,683 | java | PlayerListener.java | Java | [] | null | [] | package net.gametk.megaflary.bukkittools.serverchange.listener;
import net.gametk.megaflary.bukkittools.event.Event;
import net.gametk.megaflary.bukkittools.serverchange.ServerChangeModule;
import net.gametk.megaflary.bukkittools.serverchange.ServerChangeSettings;
import net.gametk.megaflary.bukkittools.serverchange.connection.User;
import net.gametk.megaflary.bukkittools.serverchange.util.UtilDatabase;
import net.gametk.megaflary.bukkittools.serverchange.util.UtilMain;
import net.gametk.megaflary.bukkittools.util.UtilMessages;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
public class PlayerListener implements Listener, Event {
private ServerChangeModule m;
public PlayerListener(ServerChangeModule module) {
this.m = module;
}
@EventHandler(priority = EventPriority.LOWEST)
public void onJoin(PlayerJoinEvent e) {
final Player p = e.getPlayer();
final String pName = p.getName();
if (ServerChangeSettings.isLobbyServer) {
UtilMessages.sendMessage(p, ChatColor.YELLOW + ServerChangeSettings.msgWelcome);
}
Bukkit.getScheduler().runTaskLater(m.getPlugin(), new Runnable() {
@Override
public void run() {
User user = UtilDatabase.getUser(pName);
if (user != null) {
if (user.getServerName().equals(ServerChangeSettings.serverName)) {
return;
} else {
UtilDatabase.updateUser(user.getID(), ServerChangeSettings.serverName);
}
if (ServerChangeSettings.isLobbyServer) {
if (ServerChangeSettings.isValidServer(user.getServerName())) {
UtilMain.transferPlayer(p, ServerChangeSettings.getServer(user.getServerName()));
} else {
UtilDatabase.removeUser(user.getID());
}
}
} else {
UtilDatabase.addUser(pName, ServerChangeSettings.serverName);
}
}
}, 20L);
}
@Override
public void load() {
Bukkit.getPluginManager().registerEvents(this, m.getPlugin());
}
@Override
public void unload() {
HandlerList.unregisterAll(this);
}
@Override
public String getName() {
return "ServerChange";
}
}
| 2,683 | 0.63921 | 0.638464 | 76 | 34.302631 | 27.916237 | 109 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.513158 | false | false | 13 |
20a4caed71eee150459728b6b84d741d03a3d588 | 12,816,182,444,870 | 30bb5a3bb77686819a95995067f9b87a1b64a571 | /Sem1/Week 5/Practical 5A/DayOfTheWeek.java | 4af8cff3e5e95ea7ecdda6fcdb677f21090f00ad | [] | no_license | Rehgallag/OOP-Java | https://github.com/Rehgallag/OOP-Java | 3d7f1690e6873882684d9fb8470b3358359532b3 | 07dd32f51d95b683f7646ec7f24918cbb9a9688f | refs/heads/main | 2023-03-21T21:59:02.451000 | 2021-03-16T11:07:38 | 2021-03-16T11:07:38 | 348,309,787 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | // Practical 5A- Extra Practice Question
// John Gallagher
// 15 October 2019
// Program to display result on screen
import java.util.Scanner;
public class DayOfTheWeek
{
public static void main(String [ ] args)
{
//declare variable
Scanner in = new Scanner(System.in);
int day;
System.out.print("Enter a day [1 to 7] : ");
day = in.nextInt();
switch(day)
{
case 1:
System.out.print("The day is Monday");
break;
case 2:
System.out.print("The day is Tuesday");
break;
case 3:
System.out.print("The day is Wednesday");
break;
case 4:
System.out.print("The day is Thursday");
break;
case 5: case 6: case 7:
System.out.print("The weekend is here!");
break;
default: System.out.print("Incorrect Day");
}
}
} | UTF-8 | Java | 1,034 | java | DayOfTheWeek.java | Java | [
{
"context": "// Practical 5A- Extra Practice Question\r\n// John Gallagher\r\n// 15 October 2019\r\n// Program to display result",
"end": 59,
"score": 0.9998074769973755,
"start": 45,
"tag": "NAME",
"value": "John Gallagher"
}
] | null | [] | // Practical 5A- Extra Practice Question
// <NAME>
// 15 October 2019
// Program to display result on screen
import java.util.Scanner;
public class DayOfTheWeek
{
public static void main(String [ ] args)
{
//declare variable
Scanner in = new Scanner(System.in);
int day;
System.out.print("Enter a day [1 to 7] : ");
day = in.nextInt();
switch(day)
{
case 1:
System.out.print("The day is Monday");
break;
case 2:
System.out.print("The day is Tuesday");
break;
case 3:
System.out.print("The day is Wednesday");
break;
case 4:
System.out.print("The day is Thursday");
break;
case 5: case 6: case 7:
System.out.print("The weekend is here!");
break;
default: System.out.print("Incorrect Day");
}
}
} | 1,026 | 0.482592 | 0.467118 | 41 | 23.268293 | 17.740713 | 56 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.390244 | false | false | 13 |
ccb35f6cf96ad2ad6a6d2afe0e1c7471c9640c86 | 20,212,116,165,920 | 1f56dff8edbb1c3b8551f2f41d0c13753ebcd61f | /patchsdk/tinker-sample/src/main/java/com/dx168/patchsdk/sample/tinker/TinkerApplicationLike.java | 5df8162b22d5a43c5b48dc35f3ddff867b5ee6e6 | [
"Apache-2.0"
] | permissive | kelifu/tinker-manager | https://github.com/kelifu/tinker-manager | 85b559a0b0cbced7162b76743ebc9fda9f0460b6 | cb44c9f4ef168a7e0be4ff5141383ceadca21c29 | refs/heads/master | 2020-06-15T19:36:20.089000 | 2016-11-28T08:41:34 | 2016-11-28T08:41:34 | 75,267,766 | 1 | 0 | null | true | 2016-12-01T07:36:23 | 2016-12-01T07:36:22 | 2016-12-01T07:36:14 | 2016-11-28T08:41:34 | 59,335 | 0 | 0 | 0 | null | null | null | package com.dx168.patchsdk.sample.tinker;
import android.annotation.TargetApi;
import android.app.Application;
import android.content.Context;
import android.content.Intent;
import android.content.res.AssetManager;
import android.content.res.Resources;
import android.os.Build;
import android.support.multidex.MultiDex;
import com.tencent.tinker.lib.tinker.TinkerInstaller;
import com.tencent.tinker.loader.app.DefaultApplicationLike;
/**
* Created by jianjun.lin on 2016/10/25.
*/
public class TinkerApplicationLike extends DefaultApplicationLike {
public static Application application;
private static final String TAG = TinkerApplicationLike.class.getSimpleName();
public TinkerApplicationLike(Application application, int tinkerFlags, boolean tinkerLoadVerifyFlag,
long applicationStartElapsedTime, long applicationStartMillisTime, Intent tinkerResultIntent,
Resources[] resources, ClassLoader[] classLoader, AssetManager[] assetManager) {
super(application, tinkerFlags, tinkerLoadVerifyFlag, applicationStartElapsedTime, applicationStartMillisTime, tinkerResultIntent, resources, classLoader, assetManager);
}
/**
* install multiDex before install com.dx168.patchsdk.sample.tinker
* so we don't need to put the com.dx168.patchsdk.sample.tinker lib classes in the main dex
*
* @param base
*/
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
@Override
public void onBaseContextAttached(Context base) {
super.onBaseContextAttached(base);
//you must install multiDex whatever com.dx168.patchsdk.sample.tinker is installed!
MultiDex.install(base);
SampleTinkerManager.setTinkerApplicationLike(this);
SampleTinkerManager.initFastCrashProtect();
//should set before com.dx168.patchsdk.sample.tinker is installed
SampleTinkerManager.setUpgradeRetryEnable(true);
//optional set logIml, or you can use default debug log
TinkerInstaller.setLogIml(new SampleTinkerLog());
//installTinker after load multiDex
//or you can put com.tencent.com.dx168.patchsdk.sample.tinker.** to main dex
SampleTinkerManager.installTinker(this);
}
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
public void registerActivityLifecycleCallbacks(Application.ActivityLifecycleCallbacks callback) {
getApplication().registerActivityLifecycleCallbacks(callback);
}
}
| UTF-8 | Java | 2,506 | java | TinkerApplicationLike.java | Java | [
{
"context": "der.app.DefaultApplicationLike;\n\n/**\n * Created by jianjun.lin on 2016/10/25.\n */\npublic class TinkerA",
"end": 457,
"score": 0.9819095730781555,
"start": 456,
"tag": "NAME",
"value": "j"
},
{
"context": "r.app.DefaultApplicationLike;\n\n/**\n * Created by jianjun.... | null | [] | package com.dx168.patchsdk.sample.tinker;
import android.annotation.TargetApi;
import android.app.Application;
import android.content.Context;
import android.content.Intent;
import android.content.res.AssetManager;
import android.content.res.Resources;
import android.os.Build;
import android.support.multidex.MultiDex;
import com.tencent.tinker.lib.tinker.TinkerInstaller;
import com.tencent.tinker.loader.app.DefaultApplicationLike;
/**
* Created by jianjun.lin on 2016/10/25.
*/
public class TinkerApplicationLike extends DefaultApplicationLike {
public static Application application;
private static final String TAG = TinkerApplicationLike.class.getSimpleName();
public TinkerApplicationLike(Application application, int tinkerFlags, boolean tinkerLoadVerifyFlag,
long applicationStartElapsedTime, long applicationStartMillisTime, Intent tinkerResultIntent,
Resources[] resources, ClassLoader[] classLoader, AssetManager[] assetManager) {
super(application, tinkerFlags, tinkerLoadVerifyFlag, applicationStartElapsedTime, applicationStartMillisTime, tinkerResultIntent, resources, classLoader, assetManager);
}
/**
* install multiDex before install com.dx168.patchsdk.sample.tinker
* so we don't need to put the com.dx168.patchsdk.sample.tinker lib classes in the main dex
*
* @param base
*/
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
@Override
public void onBaseContextAttached(Context base) {
super.onBaseContextAttached(base);
//you must install multiDex whatever com.dx168.patchsdk.sample.tinker is installed!
MultiDex.install(base);
SampleTinkerManager.setTinkerApplicationLike(this);
SampleTinkerManager.initFastCrashProtect();
//should set before com.dx168.patchsdk.sample.tinker is installed
SampleTinkerManager.setUpgradeRetryEnable(true);
//optional set logIml, or you can use default debug log
TinkerInstaller.setLogIml(new SampleTinkerLog());
//installTinker after load multiDex
//or you can put com.tencent.com.dx168.patchsdk.sample.tinker.** to main dex
SampleTinkerManager.installTinker(this);
}
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
public void registerActivityLifecycleCallbacks(Application.ActivityLifecycleCallbacks callback) {
getApplication().registerActivityLifecycleCallbacks(callback);
}
}
| 2,506 | 0.747406 | 0.737031 | 62 | 39.419353 | 37.881203 | 177 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.629032 | false | false | 13 |
5645b72d75a04d0bdd037993723dcd9abc636ee8 | 1,357,209,689,119 | 4d28c760a9bb855f3ae4ce9bb01d7a4552299e68 | /app/src/main/java/com/itg/jobcardmanagement/common/BaseModule.java | bcdb9cd3a3b9d3f01da16a8dd3afc99aa0d67066 | [] | no_license | AndroidItg8/JobCardManagementNew | https://github.com/AndroidItg8/JobCardManagementNew | 7562f159cea5a4711d0a14029517d96180de8140 | 84ba3db944e93c90ef8dbaf8423333ea6806d7c0 | refs/heads/master | 2021-01-02T22:49:36.635000 | 2017-08-19T11:40:45 | 2017-08-19T11:40:45 | 99,405,595 | 0 | 1 | null | false | 2017-08-18T10:33:32 | 2017-08-05T07:02:25 | 2017-08-05T07:02:44 | 2017-08-18T10:33:32 | 1,041 | 0 | 0 | 0 | Java | null | null | package com.itg.jobcardmanagement.common;
/**
* itg_Android on 8/5/2017.
*/
public interface BaseModule {
void onPause();
void onResume();
void onDestroy();
}
| UTF-8 | Java | 179 | java | BaseModule.java | Java | [] | null | [] | package com.itg.jobcardmanagement.common;
/**
* itg_Android on 8/5/2017.
*/
public interface BaseModule {
void onPause();
void onResume();
void onDestroy();
}
| 179 | 0.642458 | 0.608939 | 13 | 12.769231 | 13.768156 | 41 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.307692 | false | false | 13 |
6418b35b36cecbf7558c84dc3a0648670b21516e | 8,993,661,532,881 | 2ec945962bb725d618987405afea6ddc45644e58 | /bicloud/src/main/java/com/cebbank/bicloud/base/entity/DeviceStatusTemp.java | 91792c821d82891b0b10a4b6c6b925bbea88fe07 | [] | no_license | zhy313606366/test2 | https://github.com/zhy313606366/test2 | 8826a9c3f7e5b6679572375bf121261be48f271b | b47d6c15016af9deb76e747f3fcf7d09d5af6f0c | refs/heads/master | 2020-04-30T14:55:38.507000 | 2019-03-21T08:41:18 | 2019-03-21T08:41:18 | 176,906,315 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.cebbank.bicloud.base.entity;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
/**
* 设备状态记录表
* @author wangfeng
*
*/
@Entity
@Table(name="base_device_status_temp")
@SequenceGenerator(name="generator",sequenceName="base_device_status_temp_cee",
allocationSize=1,initialValue=1)
public class DeviceStatusTemp {
/**
* 主键
*/
@Id
@GeneratedValue(strategy=GenerationType.SEQUENCE,generator="generator")
@Column(name="id", nullable=false)
private int id;
/**
* 设备ID
*/
@Column(name="device_id", nullable=false, length=30)
private String deviceId;
/**
* 终端ID
*/
@Column(name="client_id", nullable=false, length=30)
private String clientId;
/**
* CPU使用率(%)
*/
@Column(name="cpu_rate", precision=3, scale=2)
private String cpuRate;
/**
* 磁盘使用量
*/
@Column(name="residue_disk", precision=10, scale=2)
private String residueDisk;
/**
* 内存使用率
*/
@Column(name="mem_rate", precision=10, scale=2)
private String memRate;
/**
* 播放包名
*/
@Column(name="package_name")
private String packageName;
/**
* 播放模式
*/
@Column(name="play_model", precision=3, scale=2)
private String playModel;
/**
* 设备名称
*/
@Column(name="device_name", precision=3, scale=2)
private String deviceName;
/**
* 版本号
*/
@Column(name="VERSION_NUMBER", length=50)
private String versionNumber;
public String getDeviceName() {
return deviceName;
}
public void setDeviceName(String deviceName) {
this.deviceName = deviceName;
}
@Column(name="update_time", precision=3, scale=2)
private Date updateTime=new Date(System.currentTimeMillis());
@Column(name="flag", length=2, nullable=false)
private int flag=1;
public int getId() {
return id;
}
public String getMemRate() {
return memRate;
}
public void setMemRate(String memRate) {
this.memRate = memRate;
}
public int getFlag() {
return flag;
}
public void setFlag(int flag) {
this.flag = flag;
}
public void setId(int id) {
this.id = id;
}
public String getDeviceId() {
return deviceId;
}
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
public String getClientId() {
return clientId;
}
public void setClientId(String clientId) {
this.clientId = clientId;
}
public String getCpuRate() {
return cpuRate;
}
public void setCpuRate(String cpuRate) {
this.cpuRate = cpuRate;
}
public String getResidueDisk() {
return residueDisk;
}
public void setResidueDisk(String residueDisk) {
this.residueDisk = residueDisk;
}
public String getPackageName() {
return packageName;
}
public void setPackageName(String packageName) {
this.packageName = packageName;
}
public String getPlayModel() {
return playModel;
}
public void setPlayModel(String playModel) {
this.playModel = playModel;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public String getVersionNumber() {
return versionNumber;
}
public void setVersionNumber(String versionNumber) {
this.versionNumber = versionNumber;
}
}
| UTF-8 | Java | 3,458 | java | DeviceStatusTemp.java | Java | [
{
"context": "javax.persistence.Table;\n/**\n * 设备状态记录表\n * @author wangfeng\n *\n */\n@Entity\n@Table(name=\"base_device_status_te",
"end": 382,
"score": 0.9993439316749573,
"start": 374,
"tag": "USERNAME",
"value": "wangfeng"
}
] | null | [] | package com.cebbank.bicloud.base.entity;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
/**
* 设备状态记录表
* @author wangfeng
*
*/
@Entity
@Table(name="base_device_status_temp")
@SequenceGenerator(name="generator",sequenceName="base_device_status_temp_cee",
allocationSize=1,initialValue=1)
public class DeviceStatusTemp {
/**
* 主键
*/
@Id
@GeneratedValue(strategy=GenerationType.SEQUENCE,generator="generator")
@Column(name="id", nullable=false)
private int id;
/**
* 设备ID
*/
@Column(name="device_id", nullable=false, length=30)
private String deviceId;
/**
* 终端ID
*/
@Column(name="client_id", nullable=false, length=30)
private String clientId;
/**
* CPU使用率(%)
*/
@Column(name="cpu_rate", precision=3, scale=2)
private String cpuRate;
/**
* 磁盘使用量
*/
@Column(name="residue_disk", precision=10, scale=2)
private String residueDisk;
/**
* 内存使用率
*/
@Column(name="mem_rate", precision=10, scale=2)
private String memRate;
/**
* 播放包名
*/
@Column(name="package_name")
private String packageName;
/**
* 播放模式
*/
@Column(name="play_model", precision=3, scale=2)
private String playModel;
/**
* 设备名称
*/
@Column(name="device_name", precision=3, scale=2)
private String deviceName;
/**
* 版本号
*/
@Column(name="VERSION_NUMBER", length=50)
private String versionNumber;
public String getDeviceName() {
return deviceName;
}
public void setDeviceName(String deviceName) {
this.deviceName = deviceName;
}
@Column(name="update_time", precision=3, scale=2)
private Date updateTime=new Date(System.currentTimeMillis());
@Column(name="flag", length=2, nullable=false)
private int flag=1;
public int getId() {
return id;
}
public String getMemRate() {
return memRate;
}
public void setMemRate(String memRate) {
this.memRate = memRate;
}
public int getFlag() {
return flag;
}
public void setFlag(int flag) {
this.flag = flag;
}
public void setId(int id) {
this.id = id;
}
public String getDeviceId() {
return deviceId;
}
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
public String getClientId() {
return clientId;
}
public void setClientId(String clientId) {
this.clientId = clientId;
}
public String getCpuRate() {
return cpuRate;
}
public void setCpuRate(String cpuRate) {
this.cpuRate = cpuRate;
}
public String getResidueDisk() {
return residueDisk;
}
public void setResidueDisk(String residueDisk) {
this.residueDisk = residueDisk;
}
public String getPackageName() {
return packageName;
}
public void setPackageName(String packageName) {
this.packageName = packageName;
}
public String getPlayModel() {
return playModel;
}
public void setPlayModel(String playModel) {
this.playModel = playModel;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public String getVersionNumber() {
return versionNumber;
}
public void setVersionNumber(String versionNumber) {
this.versionNumber = versionNumber;
}
}
| 3,458 | 0.701957 | 0.69484 | 204 | 15.529411 | 17.621124 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.112745 | false | false | 13 |
8a497b958271cf8d52babd50d5c5837fc876761f | 20,718,922,287,456 | d9f1af020c3bc75f58533b1f92b08bb56e633e84 | /src/model/beans/EditionBean.java | 4dac61bde2cc747ab55baebd2a11e9a1da64ba69 | [] | no_license | Wint3rNuk3/Hiboukili | https://github.com/Wint3rNuk3/Hiboukili | d2d0069d19bbbc3ff54f92ac32e155ac2c1ac916 | 1436936d3fd68cf50a5ed2bf706188a775f841cc | refs/heads/master | 2021-01-13T09:18:03.861000 | 2020-10-13T08:09:09 | 2020-10-13T08:09:09 | 69,856,445 | 0 | 1 | null | false | 2020-10-13T08:09:10 | 2016-10-03T09:18:46 | 2016-10-03T12:27:53 | 2020-10-13T08:09:09 | 3,291 | 0 | 1 | 1 | Java | false | false | package model.beans;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.sql.DataSource;
import model.classes.Editeur;
import model.classes.Edition;
import model.classes.Langue;
import model.classes.Ouvrage;
import model.classes.Promotion;
import model.classes.StatutEdition;
import model.classes.Taxe;
public class EditionBean {
private static final String SQL_FIND_ALL = "SELECT"
+ " idEdition, isbn, idOuvrage, idEditeur, idLangue,"
+ " idStatutEdition, datePubli, prixHt,"
+ " couverture, titre, stock"
+ " FROM Edition";
private static final String SQL_FIND_BY_RUBRIQUE = "SELECT"
+ " e.idEdition, e.isbn, e.idOuvrage, e.idEditeur, e.idLangue,"
+ " e.idStatutEdition, e.datePubli, e.prixHt,"
+ " e.couverture, e.titre, e.stock"
+ " FROM Edition as e"
+ " JOIN MiseEnRubrique AS mer ON mer.idOuvrage = e.idOuvrage"
+ " WHERE mer.idRubrique = ?";
public List<Edition> findAll(ConnexionBean bc) {
List<Edition> list = new ArrayList();
// le nom de méthode commence par une majuscule,
// mais ce n'est pas de mon ressort.
DataSource ds = bc.MaConnexion();
try (Connection c = ds.getConnection()) {
PreparedStatement ps = c.prepareStatement(SQL_FIND_ALL);
ResultSet rs = ps.executeQuery();
list = list(rs, bc);
} catch (SQLException ex) {
Logger.getLogger(EditionBean.class.getName()).log(Level.SEVERE, null, ex);
}
return list;
}
public List<Edition> findByRubrique(ConnexionBean bc, Long idRubrique) {
List<Edition> list = new ArrayList();
DataSource ds = bc.MaConnexion();
try (Connection c = ds.getConnection()) {
PreparedStatement ps = c.prepareStatement(SQL_FIND_BY_RUBRIQUE);
ps.setLong(1, idRubrique);
ResultSet rs = ps.executeQuery();
list = list(rs, bc);
} catch (SQLException ex) {
Logger.getLogger(EditionBean.class.getName()).log(Level.SEVERE, null, ex);
}
return list;
}
private static final String SQL_FIND_BY_ISBN = "SELECT"
+ " idEdition, isbn, idOuvrage, idEditeur, idLangue,"
+ " idStatutEdition, datePubli, prixHt,"
+ " couverture, titre, stock"
+ " FROM Edition"
+ " WHERE isbn=?";
public Edition findByIsbn(ConnexionBean bc, String isbn) {
Edition edition = new Edition();
// le nom de méthode commence par une majuscule,
// mais ce n'est pas de mon ressort.
DataSource ds = bc.MaConnexion();
try (Connection c = ds.getConnection()) {
PreparedStatement ps = c.prepareStatement(SQL_FIND_BY_ISBN);
ps.setString(1, isbn);
ResultSet rs = ps.executeQuery();
//String executedQuery = rs.getStatement().toString();
//System.out.println(executedQuery);
edition = one(rs, bc);
// mettre à jour le prix.
// on ne veut afficher le prix ttc seulement lors de l'affichage de la commande ou du panier ?
// edition.initPrix();
} catch (SQLException ex) {
Logger.getLogger(EditionBean.class.getName()).log(Level.SEVERE, null, ex);
}
System.out.println(edition);
return edition;
}
private Edition map(ResultSet rs, ConnexionBean bc) throws SQLException {
Edition edition = new Edition();
Long idEdition = rs.getLong("idEdition");
Long idOuvrage = rs.getLong("idOuvrage");
Long idEditeur = rs.getLong("idEditeur");
Long idLangue = rs.getLong("idLangue");
Long idStatut = rs.getLong("idStatutEdition");
edition.setId(idEdition);
edition.setIsbn(rs.getString("isbn"));
edition.setDatePublication(rs.getDate("datePubli"));
edition.setPrixHt(rs.getFloat("prixHt"));
edition.setCouverture(rs.getString("couverture"));
edition.setTitre(rs.getString("titre"));
edition.setStock(rs.getInt("stock"));
// recuperer l'editeur.
Editeur editeur = new EditeurBean().findById(bc, idEditeur);
edition.setEditeur(editeur);
// recuperer l'ouvrage.
Ouvrage ouvrage = new OuvrageBean().findById(bc, idOuvrage);
edition.setOuvrage(ouvrage);
// recuperer la langue.
Langue langue = new LangueBean().findById(bc, idLangue);
edition.setLangue(langue);
// recupere le statut edition.
StatutEdition findById = new StatutEditionBean().findById(bc, idStatut);
edition.setStatut(findById);
// recuperer les taxes.
List<Taxe> taxes = new TaxeBean().findByEdition(bc, idEdition);
edition.setTaxes(taxes);
// recuperer les promotions.
List<Promotion> promos = new PromotionBean().findByEdition(bc, idEdition);
edition.setPromotions(promos);
return edition;
}
private List<Edition> list(ResultSet rs, ConnexionBean bc) throws SQLException {
List<Edition> list = new ArrayList();
while (rs.next()) {
list.add(map(rs, bc));
}
return list;
}
private Edition one(ResultSet rs, ConnexionBean bc) throws SQLException {
if (rs.next()) {
return map(rs, bc);
}
return null;
}
private static final String SQL_GET_STOCK = "SELECT"
+ " stock"
+ " FROM Edition"
+ " WHERE isbn = ?";
private static final String SQL_SET_STOCK = "UPDATE Edition"
+ " SET stock = ?"
+ " WHERE isbn = ?";
public void setStockInDB(ConnexionBean bc, Edition e) {
DataSource ds = bc.MaConnexion();
try (Connection c = ds.getConnection()) {
PreparedStatement ps1 = c.prepareStatement(SQL_GET_STOCK);
ps1.setString(1, e.getIsbn());
ResultSet rs1 = ps1.executeQuery();
String leStock = null;
// les entrailles
ResultSetMetaData rsmd = rs1.getMetaData();
int columnsNumber = rsmd.getColumnCount();
while (rs1.next()) {
for (int i = 1; i <= columnsNumber; i++) {
if (i > 1) {
System.out.print(", ");
}
String columnValue = rs1.getString(i);
System.out.print(rsmd.getColumnName(i) + " : " + columnValue);
}
leStock = rs1.getString(1);
System.out.println("");
}
///////////////////////////////////////////////////////
int leStockVersionIntegreSaMere = Integer.parseInt(leStock);
PreparedStatement ps2 = c.prepareStatement(SQL_SET_STOCK);
if(e.getCartQty() > leStockVersionIntegreSaMere)
ps2.setInt(1, 0);
//eventuellement appeler une erreur
else
ps2.setInt(1, leStockVersionIntegreSaMere - e.getCartQty());
ps2.setString(2, e.getIsbn());
ps2.executeUpdate();
} catch (SQLException ex) {
Logger.getLogger(EditionBean.class.getName()).log(Level.SEVERE, null, ex);
}
}
public void setStockInDB(ConnexionBean bc, String isbn, int qty) {
DataSource ds = bc.MaConnexion();
try (Connection c = ds.getConnection()) {
PreparedStatement ps1 = c.prepareStatement(SQL_GET_STOCK);
ps1.setString(1, isbn);
ResultSet rs1 = ps1.executeQuery();
String leStock = null;
// les entrailles
ResultSetMetaData rsmd = rs1.getMetaData();
int columnsNumber = rsmd.getColumnCount();
while (rs1.next()) {
for (int i = 1; i <= columnsNumber; i++) {
if (i > 1) {
System.out.print(", ");
}
String columnValue = rs1.getString(i);
System.out.print(rsmd.getColumnName(i) + " : " + columnValue);
}
leStock = rs1.getString(1);
System.out.println("");
}
///////////////////////////////////////////////////////
int leStockVersionIntegreSaMere = Integer.parseInt(leStock);
PreparedStatement ps2 = c.prepareStatement(SQL_SET_STOCK);
ps2.setInt(1, leStockVersionIntegreSaMere + qty);
ps2.setString(2, isbn);
ps2.executeUpdate();
} catch (SQLException ex) {
Logger.getLogger(EditionBean.class.getName()).log(Level.SEVERE, null, ex);
}
}
// on recherche par
// - le titre ( tout ou partie ) OK
// - mot clef
// - la rubrique
// - le theme
// - le resume ?
// - l'auteur ( nom, prenom )
private static final String SQL_RECHERCHE = "SELECT DISTINCT"
+ " e.idEdition, e.isbn, e.idOuvrage, e.idEditeur, e.idLangue,"
+ " e.idStatutEdition, e.datePubli, e.prixHt,"
+ " e.couverture, e.titre, e.stock"
+ " FROM Edition AS e"
+ " JOIN Ouvrage AS ouv ON ouv.idOuvrage = e.idOuvrage"
+ " JOIN Auteur AS aut ON ouv.idAuteur = aut.idAuteur"
+ " JOIN MiseEnRubrique AS mer ON mer.idOuvrage = e.idOuvrage"
+ " JOIN Rubrique AS rub ON mer.idRubrique = rub.idRubrique"
+ " JOIN Thematique AS thq ON thq.idOuvrage = e.idOuvrage"
+ " JOIN Theme AS the ON thq.idTheme = the.idTheme"
+ " JOIN Referencement AS ref ON ref.idOuvrage = e.idOuvrage"
+ " JOIN Tag AS tag ON ref.idTag = tag.idTag"
+ " WHERE (ouv.titre like ? OR e.titre like ?)"
+ " OR tag.libelle = ?"
+ " OR aut.nom = ?"
+ " OR rub.libelle like ?"
+ " OR the.libelle like ?"
;
public List<Edition> recherche(ConnexionBean bc, String q) {
List<Edition> list = new ArrayList();
DataSource ds = bc.MaConnexion();
try (Connection c = ds.getConnection()) {
PreparedStatement ps = c.prepareStatement(SQL_RECHERCHE);
ps.setString(1, "%" + q + "%");
ps.setString(2, "%" + q + "%");
ps.setString(3, q);
ps.setString(4, q);
ps.setString(5, "%" + q + "%");
ps.setString(6, "%" + q + "%");
ResultSet rs = ps.executeQuery();
list = list(rs, bc);
} catch (SQLException ex) {
Logger.getLogger(EditionBean.class.getName()).log(Level.SEVERE, null, ex);
}
return list;
}
// public List<Edition> paginate(BeanConnexion bc, int page, int perPage){
// List<Edition> list = findAll(bc);
//
// return list.subList(
// Math.max(page * perPage - perPage, 0),
// Math.min(page * perPage, list.size()));
// }
}
| UTF-8 | Java | 11,607 | java | EditionBean.java | Java | [] | null | [] | package model.beans;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.sql.DataSource;
import model.classes.Editeur;
import model.classes.Edition;
import model.classes.Langue;
import model.classes.Ouvrage;
import model.classes.Promotion;
import model.classes.StatutEdition;
import model.classes.Taxe;
public class EditionBean {
private static final String SQL_FIND_ALL = "SELECT"
+ " idEdition, isbn, idOuvrage, idEditeur, idLangue,"
+ " idStatutEdition, datePubli, prixHt,"
+ " couverture, titre, stock"
+ " FROM Edition";
private static final String SQL_FIND_BY_RUBRIQUE = "SELECT"
+ " e.idEdition, e.isbn, e.idOuvrage, e.idEditeur, e.idLangue,"
+ " e.idStatutEdition, e.datePubli, e.prixHt,"
+ " e.couverture, e.titre, e.stock"
+ " FROM Edition as e"
+ " JOIN MiseEnRubrique AS mer ON mer.idOuvrage = e.idOuvrage"
+ " WHERE mer.idRubrique = ?";
public List<Edition> findAll(ConnexionBean bc) {
List<Edition> list = new ArrayList();
// le nom de méthode commence par une majuscule,
// mais ce n'est pas de mon ressort.
DataSource ds = bc.MaConnexion();
try (Connection c = ds.getConnection()) {
PreparedStatement ps = c.prepareStatement(SQL_FIND_ALL);
ResultSet rs = ps.executeQuery();
list = list(rs, bc);
} catch (SQLException ex) {
Logger.getLogger(EditionBean.class.getName()).log(Level.SEVERE, null, ex);
}
return list;
}
public List<Edition> findByRubrique(ConnexionBean bc, Long idRubrique) {
List<Edition> list = new ArrayList();
DataSource ds = bc.MaConnexion();
try (Connection c = ds.getConnection()) {
PreparedStatement ps = c.prepareStatement(SQL_FIND_BY_RUBRIQUE);
ps.setLong(1, idRubrique);
ResultSet rs = ps.executeQuery();
list = list(rs, bc);
} catch (SQLException ex) {
Logger.getLogger(EditionBean.class.getName()).log(Level.SEVERE, null, ex);
}
return list;
}
private static final String SQL_FIND_BY_ISBN = "SELECT"
+ " idEdition, isbn, idOuvrage, idEditeur, idLangue,"
+ " idStatutEdition, datePubli, prixHt,"
+ " couverture, titre, stock"
+ " FROM Edition"
+ " WHERE isbn=?";
public Edition findByIsbn(ConnexionBean bc, String isbn) {
Edition edition = new Edition();
// le nom de méthode commence par une majuscule,
// mais ce n'est pas de mon ressort.
DataSource ds = bc.MaConnexion();
try (Connection c = ds.getConnection()) {
PreparedStatement ps = c.prepareStatement(SQL_FIND_BY_ISBN);
ps.setString(1, isbn);
ResultSet rs = ps.executeQuery();
//String executedQuery = rs.getStatement().toString();
//System.out.println(executedQuery);
edition = one(rs, bc);
// mettre à jour le prix.
// on ne veut afficher le prix ttc seulement lors de l'affichage de la commande ou du panier ?
// edition.initPrix();
} catch (SQLException ex) {
Logger.getLogger(EditionBean.class.getName()).log(Level.SEVERE, null, ex);
}
System.out.println(edition);
return edition;
}
private Edition map(ResultSet rs, ConnexionBean bc) throws SQLException {
Edition edition = new Edition();
Long idEdition = rs.getLong("idEdition");
Long idOuvrage = rs.getLong("idOuvrage");
Long idEditeur = rs.getLong("idEditeur");
Long idLangue = rs.getLong("idLangue");
Long idStatut = rs.getLong("idStatutEdition");
edition.setId(idEdition);
edition.setIsbn(rs.getString("isbn"));
edition.setDatePublication(rs.getDate("datePubli"));
edition.setPrixHt(rs.getFloat("prixHt"));
edition.setCouverture(rs.getString("couverture"));
edition.setTitre(rs.getString("titre"));
edition.setStock(rs.getInt("stock"));
// recuperer l'editeur.
Editeur editeur = new EditeurBean().findById(bc, idEditeur);
edition.setEditeur(editeur);
// recuperer l'ouvrage.
Ouvrage ouvrage = new OuvrageBean().findById(bc, idOuvrage);
edition.setOuvrage(ouvrage);
// recuperer la langue.
Langue langue = new LangueBean().findById(bc, idLangue);
edition.setLangue(langue);
// recupere le statut edition.
StatutEdition findById = new StatutEditionBean().findById(bc, idStatut);
edition.setStatut(findById);
// recuperer les taxes.
List<Taxe> taxes = new TaxeBean().findByEdition(bc, idEdition);
edition.setTaxes(taxes);
// recuperer les promotions.
List<Promotion> promos = new PromotionBean().findByEdition(bc, idEdition);
edition.setPromotions(promos);
return edition;
}
private List<Edition> list(ResultSet rs, ConnexionBean bc) throws SQLException {
List<Edition> list = new ArrayList();
while (rs.next()) {
list.add(map(rs, bc));
}
return list;
}
private Edition one(ResultSet rs, ConnexionBean bc) throws SQLException {
if (rs.next()) {
return map(rs, bc);
}
return null;
}
private static final String SQL_GET_STOCK = "SELECT"
+ " stock"
+ " FROM Edition"
+ " WHERE isbn = ?";
private static final String SQL_SET_STOCK = "UPDATE Edition"
+ " SET stock = ?"
+ " WHERE isbn = ?";
public void setStockInDB(ConnexionBean bc, Edition e) {
DataSource ds = bc.MaConnexion();
try (Connection c = ds.getConnection()) {
PreparedStatement ps1 = c.prepareStatement(SQL_GET_STOCK);
ps1.setString(1, e.getIsbn());
ResultSet rs1 = ps1.executeQuery();
String leStock = null;
// les entrailles
ResultSetMetaData rsmd = rs1.getMetaData();
int columnsNumber = rsmd.getColumnCount();
while (rs1.next()) {
for (int i = 1; i <= columnsNumber; i++) {
if (i > 1) {
System.out.print(", ");
}
String columnValue = rs1.getString(i);
System.out.print(rsmd.getColumnName(i) + " : " + columnValue);
}
leStock = rs1.getString(1);
System.out.println("");
}
///////////////////////////////////////////////////////
int leStockVersionIntegreSaMere = Integer.parseInt(leStock);
PreparedStatement ps2 = c.prepareStatement(SQL_SET_STOCK);
if(e.getCartQty() > leStockVersionIntegreSaMere)
ps2.setInt(1, 0);
//eventuellement appeler une erreur
else
ps2.setInt(1, leStockVersionIntegreSaMere - e.getCartQty());
ps2.setString(2, e.getIsbn());
ps2.executeUpdate();
} catch (SQLException ex) {
Logger.getLogger(EditionBean.class.getName()).log(Level.SEVERE, null, ex);
}
}
public void setStockInDB(ConnexionBean bc, String isbn, int qty) {
DataSource ds = bc.MaConnexion();
try (Connection c = ds.getConnection()) {
PreparedStatement ps1 = c.prepareStatement(SQL_GET_STOCK);
ps1.setString(1, isbn);
ResultSet rs1 = ps1.executeQuery();
String leStock = null;
// les entrailles
ResultSetMetaData rsmd = rs1.getMetaData();
int columnsNumber = rsmd.getColumnCount();
while (rs1.next()) {
for (int i = 1; i <= columnsNumber; i++) {
if (i > 1) {
System.out.print(", ");
}
String columnValue = rs1.getString(i);
System.out.print(rsmd.getColumnName(i) + " : " + columnValue);
}
leStock = rs1.getString(1);
System.out.println("");
}
///////////////////////////////////////////////////////
int leStockVersionIntegreSaMere = Integer.parseInt(leStock);
PreparedStatement ps2 = c.prepareStatement(SQL_SET_STOCK);
ps2.setInt(1, leStockVersionIntegreSaMere + qty);
ps2.setString(2, isbn);
ps2.executeUpdate();
} catch (SQLException ex) {
Logger.getLogger(EditionBean.class.getName()).log(Level.SEVERE, null, ex);
}
}
// on recherche par
// - le titre ( tout ou partie ) OK
// - mot clef
// - la rubrique
// - le theme
// - le resume ?
// - l'auteur ( nom, prenom )
private static final String SQL_RECHERCHE = "SELECT DISTINCT"
+ " e.idEdition, e.isbn, e.idOuvrage, e.idEditeur, e.idLangue,"
+ " e.idStatutEdition, e.datePubli, e.prixHt,"
+ " e.couverture, e.titre, e.stock"
+ " FROM Edition AS e"
+ " JOIN Ouvrage AS ouv ON ouv.idOuvrage = e.idOuvrage"
+ " JOIN Auteur AS aut ON ouv.idAuteur = aut.idAuteur"
+ " JOIN MiseEnRubrique AS mer ON mer.idOuvrage = e.idOuvrage"
+ " JOIN Rubrique AS rub ON mer.idRubrique = rub.idRubrique"
+ " JOIN Thematique AS thq ON thq.idOuvrage = e.idOuvrage"
+ " JOIN Theme AS the ON thq.idTheme = the.idTheme"
+ " JOIN Referencement AS ref ON ref.idOuvrage = e.idOuvrage"
+ " JOIN Tag AS tag ON ref.idTag = tag.idTag"
+ " WHERE (ouv.titre like ? OR e.titre like ?)"
+ " OR tag.libelle = ?"
+ " OR aut.nom = ?"
+ " OR rub.libelle like ?"
+ " OR the.libelle like ?"
;
public List<Edition> recherche(ConnexionBean bc, String q) {
List<Edition> list = new ArrayList();
DataSource ds = bc.MaConnexion();
try (Connection c = ds.getConnection()) {
PreparedStatement ps = c.prepareStatement(SQL_RECHERCHE);
ps.setString(1, "%" + q + "%");
ps.setString(2, "%" + q + "%");
ps.setString(3, q);
ps.setString(4, q);
ps.setString(5, "%" + q + "%");
ps.setString(6, "%" + q + "%");
ResultSet rs = ps.executeQuery();
list = list(rs, bc);
} catch (SQLException ex) {
Logger.getLogger(EditionBean.class.getName()).log(Level.SEVERE, null, ex);
}
return list;
}
// public List<Edition> paginate(BeanConnexion bc, int page, int perPage){
// List<Edition> list = findAll(bc);
//
// return list.subList(
// Math.max(page * perPage - perPage, 0),
// Math.min(page * perPage, list.size()));
// }
}
| 11,607 | 0.54938 | 0.545243 | 332 | 33.951809 | 25.03944 | 106 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.716867 | false | false | 13 |
9b67bcabc88bb877b82b764ac81fc8ac0094ffbf | 20,718,922,287,774 | 76b74ede933b97440047e444e3c681acad10f9b6 | /src/freelancer/worldvideo/SearchListActivity.java | 351bdf8ba9f00eb6324531a0815f2ac25bf9976c | [] | no_license | jiangbing9293/365AF01 | https://github.com/jiangbing9293/365AF01 | 37b5a75e95d445044049a84a2314f38f77e922f9 | f1359d43e40505f7055186b4afdc37a9cfe90849 | refs/heads/master | 2020-04-15T20:56:18.059000 | 2014-12-30T03:27:37 | 2014-12-30T03:27:37 | 28,616,475 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
* SearchListActivity.java
*/
package freelancer.worldvideo;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import neutral.safe.chinese.R;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import com.tutk.IOTC.Camera;
import com.tutk.IOTC.st_LanSearchInfo;
import freelancer.worldvideo.addipc.AddCam2Activity;
import freelancer.worldvideo.util.DeviceInfo;
import freelancer.worldvideo.view.TitleView;
import freelancer.worldvideo.view.TitleView.OnLeftButtonClickListener;
import freelancer.worldvideo.view.TitleView.OnRightButtonClickListener;
/**
* @function: 内网搜素
* @author jiangbing
* @data: 2014-2-27
*/
public class SearchListActivity extends BaseActivity {
private ProgressDialog loadingDialog;
private TitleView mTitle;
ListView searchlist = null;
MyAdapter adapter;
private View footView = null;
private List<Map<String, Object>> mData = new ArrayList<Map<String,Object>>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_searchlist);
mTitle = (TitleView) findViewById(R.id.searchlist_title);
mTitle.setTitle(getText(R.string.searchlist_activity_title).toString());
mTitle.setLeftButton("", new OnLeftButtonClickListener() {
@Override
public void onClick(View button)
{
SearchListActivity.this.finish();
}
});
mTitle.setRightButtonBg(R.drawable.icon_refresh, new OnRightButtonClickListener() {
@Override
public void onClick(View button) {
refreshThread();
}
});
footView = ((LayoutInflater)this.getSystemService(LAYOUT_INFLATER_SERVICE)).inflate(R.layout.btn_search, null, false);
footView.setVisibility(View.INVISIBLE);
searchlist = (ListView)findViewById(R.id.searchlist);
searchlist.addFooterView(footView);
adapter = new MyAdapter(this);
searchlist.setAdapter(adapter);
searchlist.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
Intent addcam2 = new Intent();
addcam2.setClass(SearchListActivity.this, AddCam2Activity.class);
addcam2.putExtra("serach_resule", (String)mData.get(position).get("text1"));
startActivity(addcam2);
SearchListActivity.this.finish();
}
});
if(UIApplication.arrResp != null && UIApplication.arrResp.length > 0)
{
mData.clear();
for (st_LanSearchInfo resp : UIApplication.arrResp) {
Map<String , Object> info = new HashMap<String, Object>();
info.put("text1", new String(resp.UID).trim());
info.put("text2", new String(resp.IP).trim());
mData.add(info);
adapter.notifyDataSetChanged();
}
}
else
{
refreshThread();
}
}
public void getData()
{
UIApplication.arrResp = Camera.SearchLAN();
if (UIApplication.arrResp != null && UIApplication.arrResp.length > 0) {
mData.clear();
for (st_LanSearchInfo resp : UIApplication.arrResp) {
Map<String , Object> info = new HashMap<String, Object>();
info.put("text1", new String(resp.UID).trim());
info.put("text2", new String(resp.IP).trim());
mData.add(info);
}
}
}
public final class ViewHolder {
public ImageView img;
public TextView title;
public TextView info;
public Button viewBtn;
}
public class MyAdapter extends BaseAdapter {
private LayoutInflater mInflater;
public MyAdapter(Context context) {
this.mInflater = LayoutInflater.from(context);
}
@Override
public int getCount() {
return mData.size();
}
@Override
public Object getItem(int position) {
return mData.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
ViewHolder holder = null;
if (convertView == null) {
holder = new ViewHolder();
convertView = mInflater.inflate(R.layout.adapter_searchlist, null);
holder.img = (ImageView) convertView
.findViewById(R.id.searchlist_img_default);
holder.title = (TextView) convertView
.findViewById(R.id.searchlist_txt_name1);
holder.info = (TextView) convertView
.findViewById(R.id.searchlist_txt_name2);
holder.title.setTextSize(14);
holder.info.setTextSize(14);
holder.viewBtn = (Button) convertView
.findViewById(R.id.searchlist_btn_addvideo);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
boolean is_added = false;
for(int i = 0; i < UIApplication.DeviceList.size();++i)
{
DeviceInfo dev = UIApplication.DeviceList.get(i);
if(dev.UID.equals((String)mData.get(position).get("text1")))
{
is_added = true;
break;
}
}
holder.title.setText((String)mData.get(position).get("text1"));
if(is_added)
{
holder.info.setText((String)mData.get(position).get("text2")+"(Added)");
}
else
{
holder.info.setText((String)mData.get(position).get("text2")+"(Not Add)");
}
holder.viewBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent addcam2 = new Intent();
addcam2.setClass(SearchListActivity.this, AddCam2Activity.class);
addcam2.putExtra("serach_resule", (String)mData.get(position).get("text1"));
startActivity(addcam2);
SearchListActivity.this.finish();
}
});
return convertView;
}
}
private Handler exitHandle = new Handler(){
@Override
public void handleMessage(Message msg){
if(msg.what == 1){
stopLoading();
adapter.notifyDataSetChanged();
}
}
};
/**
* 退出线程
*jiangbing
*2014-3-2
*/
private void refreshThread(){
loading(this); //开始加载
Thread refresh = new Thread(new Runnable() {
@Override
public void run() {
try{
getData();
Message msg = new Message();
msg.what = 1;
exitHandle.sendMessage(msg);
Thread.currentThread().interrupt();
}catch(Exception e)
{
e.printStackTrace();
}
}
});
refresh.start();
}
public void loading(Activity act){
if(loadingDialog == null)
loadingDialog = new ProgressDialog(act);
loadingDialog.setTitle(getText(R.string.searchlist_activity_searching));
loadingDialog.setMessage(getText(R.string.dialog_wait));
loadingDialog.show();
}
public void stopLoading(){
if(loadingDialog != null){
loadingDialog.dismiss();
}
}
}
| UTF-8 | Java | 7,075 | java | SearchListActivity.java | Java | [
{
"context": "ClickListener;\n\n\n/**\n * @function: 内网搜素\n * @author jiangbing\n * @data: 2014-2-27\n */\npublic class SearchListAc",
"end": 1180,
"score": 0.9908410906791687,
"start": 1171,
"tag": "USERNAME",
"value": "jiangbing"
}
] | null | [] | /**
* SearchListActivity.java
*/
package freelancer.worldvideo;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import neutral.safe.chinese.R;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import com.tutk.IOTC.Camera;
import com.tutk.IOTC.st_LanSearchInfo;
import freelancer.worldvideo.addipc.AddCam2Activity;
import freelancer.worldvideo.util.DeviceInfo;
import freelancer.worldvideo.view.TitleView;
import freelancer.worldvideo.view.TitleView.OnLeftButtonClickListener;
import freelancer.worldvideo.view.TitleView.OnRightButtonClickListener;
/**
* @function: 内网搜素
* @author jiangbing
* @data: 2014-2-27
*/
public class SearchListActivity extends BaseActivity {
private ProgressDialog loadingDialog;
private TitleView mTitle;
ListView searchlist = null;
MyAdapter adapter;
private View footView = null;
private List<Map<String, Object>> mData = new ArrayList<Map<String,Object>>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_searchlist);
mTitle = (TitleView) findViewById(R.id.searchlist_title);
mTitle.setTitle(getText(R.string.searchlist_activity_title).toString());
mTitle.setLeftButton("", new OnLeftButtonClickListener() {
@Override
public void onClick(View button)
{
SearchListActivity.this.finish();
}
});
mTitle.setRightButtonBg(R.drawable.icon_refresh, new OnRightButtonClickListener() {
@Override
public void onClick(View button) {
refreshThread();
}
});
footView = ((LayoutInflater)this.getSystemService(LAYOUT_INFLATER_SERVICE)).inflate(R.layout.btn_search, null, false);
footView.setVisibility(View.INVISIBLE);
searchlist = (ListView)findViewById(R.id.searchlist);
searchlist.addFooterView(footView);
adapter = new MyAdapter(this);
searchlist.setAdapter(adapter);
searchlist.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
Intent addcam2 = new Intent();
addcam2.setClass(SearchListActivity.this, AddCam2Activity.class);
addcam2.putExtra("serach_resule", (String)mData.get(position).get("text1"));
startActivity(addcam2);
SearchListActivity.this.finish();
}
});
if(UIApplication.arrResp != null && UIApplication.arrResp.length > 0)
{
mData.clear();
for (st_LanSearchInfo resp : UIApplication.arrResp) {
Map<String , Object> info = new HashMap<String, Object>();
info.put("text1", new String(resp.UID).trim());
info.put("text2", new String(resp.IP).trim());
mData.add(info);
adapter.notifyDataSetChanged();
}
}
else
{
refreshThread();
}
}
public void getData()
{
UIApplication.arrResp = Camera.SearchLAN();
if (UIApplication.arrResp != null && UIApplication.arrResp.length > 0) {
mData.clear();
for (st_LanSearchInfo resp : UIApplication.arrResp) {
Map<String , Object> info = new HashMap<String, Object>();
info.put("text1", new String(resp.UID).trim());
info.put("text2", new String(resp.IP).trim());
mData.add(info);
}
}
}
public final class ViewHolder {
public ImageView img;
public TextView title;
public TextView info;
public Button viewBtn;
}
public class MyAdapter extends BaseAdapter {
private LayoutInflater mInflater;
public MyAdapter(Context context) {
this.mInflater = LayoutInflater.from(context);
}
@Override
public int getCount() {
return mData.size();
}
@Override
public Object getItem(int position) {
return mData.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
ViewHolder holder = null;
if (convertView == null) {
holder = new ViewHolder();
convertView = mInflater.inflate(R.layout.adapter_searchlist, null);
holder.img = (ImageView) convertView
.findViewById(R.id.searchlist_img_default);
holder.title = (TextView) convertView
.findViewById(R.id.searchlist_txt_name1);
holder.info = (TextView) convertView
.findViewById(R.id.searchlist_txt_name2);
holder.title.setTextSize(14);
holder.info.setTextSize(14);
holder.viewBtn = (Button) convertView
.findViewById(R.id.searchlist_btn_addvideo);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
boolean is_added = false;
for(int i = 0; i < UIApplication.DeviceList.size();++i)
{
DeviceInfo dev = UIApplication.DeviceList.get(i);
if(dev.UID.equals((String)mData.get(position).get("text1")))
{
is_added = true;
break;
}
}
holder.title.setText((String)mData.get(position).get("text1"));
if(is_added)
{
holder.info.setText((String)mData.get(position).get("text2")+"(Added)");
}
else
{
holder.info.setText((String)mData.get(position).get("text2")+"(Not Add)");
}
holder.viewBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent addcam2 = new Intent();
addcam2.setClass(SearchListActivity.this, AddCam2Activity.class);
addcam2.putExtra("serach_resule", (String)mData.get(position).get("text1"));
startActivity(addcam2);
SearchListActivity.this.finish();
}
});
return convertView;
}
}
private Handler exitHandle = new Handler(){
@Override
public void handleMessage(Message msg){
if(msg.what == 1){
stopLoading();
adapter.notifyDataSetChanged();
}
}
};
/**
* 退出线程
*jiangbing
*2014-3-2
*/
private void refreshThread(){
loading(this); //开始加载
Thread refresh = new Thread(new Runnable() {
@Override
public void run() {
try{
getData();
Message msg = new Message();
msg.what = 1;
exitHandle.sendMessage(msg);
Thread.currentThread().interrupt();
}catch(Exception e)
{
e.printStackTrace();
}
}
});
refresh.start();
}
public void loading(Activity act){
if(loadingDialog == null)
loadingDialog = new ProgressDialog(act);
loadingDialog.setTitle(getText(R.string.searchlist_activity_searching));
loadingDialog.setMessage(getText(R.string.dialog_wait));
loadingDialog.show();
}
public void stopLoading(){
if(loadingDialog != null){
loadingDialog.dismiss();
}
}
}
| 7,075 | 0.706283 | 0.699901 | 271 | 25.01845 | 22.588482 | 120 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.616236 | false | false | 13 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.