blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
sequencelengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
7014bab75c1fa7184e2b017bce91d5b94868a4a5 | 2cd51fb172ae3beab919879064869ea941140824 | /src/main/java/com/mycompany/myapp/repository/search/BloodSearchRepository.java | aad9d11f37dce6067432908d739fbda1dd62f884 | [] | no_license | dedechandran/jhipster-21-points | 7dfa60e989aa2a6e61d4af19190f096ea6814d85 | 0de03e29503d500875a9cfe21b26dc8d1694aace | refs/heads/master | 2020-04-27T20:44:16.727772 | 2019-03-09T08:33:24 | 2019-03-09T08:33:24 | 176,039,650 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 330 | java | package com.mycompany.myapp.repository.search;
import com.mycompany.myapp.domain.Blood;
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
/**
* Spring Data Elasticsearch repository for the Blood entity.
*/
public interface BloodSearchRepository extends ElasticsearchRepository<Blood, Long> {
}
| [
"[email protected]"
] | |
0bc4d11544ec98e3c2c2e3112e9fda8bf57c1e56 | 09bf3a76211471818bf3fc7f43ac9fada06ab5e6 | /hackathon/catalog/src/main/java/com/hackathon/catalog/utils/exception/InvalidPaginationException.java | 1a2556012cd47489fe7e82eaffc4597a93255784 | [] | no_license | AmanMoglix/moglixGroup | e76febb085af390fb9a76f416b3c602f7eeee186 | 0993801dcbd5a2c6d4476a7cf3b1c7d5af0aa6c2 | refs/heads/master | 2023-08-31T00:55:47.026305 | 2021-10-17T06:35:13 | 2021-10-17T06:35:13 | 408,688,399 | 1 | 6 | null | 2021-09-30T13:34:18 | 2021-09-21T04:35:48 | Java | UTF-8 | Java | false | false | 495 | java | package com.hackathon.catalog.utils.exception;
public class InvalidPaginationException extends RuntimeException {
private static final long serialVersionUID = 5861310537366163L;
public InvalidPaginationException(final String message, final Throwable cause) {
super(message, cause);
}
public InvalidPaginationException(final String message) {
super(message);
}
public InvalidPaginationException(final Throwable cause) {
super(cause);
}
}
| [
"[email protected]"
] | |
c9bb8c38eaf286580957b83ebadc5ca48a621a61 | 96838da3527b4d8bf3b4c6f3916f8a8995a91b53 | /src/main/java/com/selectica/Base/eclm/definitions/CNDABO/CNDASignature/scripts/SetIntSignerEmail.java | 2ea11ddb64230b7affd7f46ed21584f053fdf12d | [] | no_license | LeoSigal/Phil | b5d2c50a07774a93f58a60ccdba6845f4577edc9 | 2e71214fcde15202c52efdcc7ebdfcc418d1730d | refs/heads/master | 2021-01-10T18:38:52.007604 | 2019-04-19T03:59:31 | 2019-04-19T03:59:31 | 36,754,970 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,876 | java | package com.selectica.Base.eclm.definitions.CNDABO.CNDASignature.scripts;
import com.selectica.Base.stubs.ContractInfoComponent;
import com.selectica.config.Config;
import com.selectica.config.ConfigKeys;
import com.selectica.rcfscripts.AbstractDataWriteScript;
import com.selectica.rcfutils.RCFUserWrapper;
/**
* Created by vshilkin on 27.04.2015.
*/
public class SetIntSignerEmail extends AbstractDataWriteScript<String> {
/*
<![CDATA[
result = "";
var ndaIsStandardContract = thisBundle.getParameterValueObjectFromAnyComponent("ReqCNDADetails", "isStandardContract");
var useEsign = Packages.com.selectica.config.Config.getPropertyAsBoolean(Packages.com.selectica.config.ConfigKeys.ESIGNATURE_ENABLED);
if (useEsign != null && ndaIsStandardContract != null &&
(useEsign.toString().equalsIgnoreCase("true") || useEsign.toString().equalsIgnoreCase("yes")) &&
"yes".equalsIgnoreCase(ndaIsStandardContract.toString())) {
result = root.getValue("user").getUserWrapper().getEmail();
}
]]>
*/
@Override
public String process() throws Exception {
String useEsignProp = Config.getProperty(ConfigKeys.ESIGNATURE_ENABLED); //@todo move to RCFHelper !
boolean useEsign = "true".equalsIgnoreCase(useEsignProp);
ContractInfoComponent info = getHelper().getInfoComponentStub();
boolean isStandardContract = "yes".equalsIgnoreCase(info.getIsStandardContract());
if (useEsign && isStandardContract) {
String cpName = info.getCpName();
if (cpName != null && !cpName.isEmpty()) {
RCFUserWrapper userWrapper = getHelper().getRCFUserWrapper();
return userWrapper.getEmail();
}
}
return null;
}
}
| [
"[email protected]"
] | |
21fb1c690ba31d758f7096f571177dbb7a321d99 | 7163c53ca8e57976e43daaa7d592921954f9759c | /task06.Book/src/main/java/by/matmux/dao/query/sort_query/SortTitleQuery.java | 97a3dd04c00bf00fbc62cbe687b03080638cd235 | [] | no_license | Akello32/10_JavaST_2020_Task- | ef516fb8211f3eacda1a42ab1dbee4f904e97e2f | 6913621527f5dfff29b21e8932ebbe0525da58cb | refs/heads/master | 2023-02-03T11:16:43.833394 | 2020-12-03T21:27:36 | 2020-12-03T21:27:36 | 297,306,988 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 674 | java | package by.matmux.dao.query.sort_query;
import by.matmux.beans.Book;
import by.matmux.dao.query.BookQuery;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Set;
public class SortTitleQuery implements BookQuery {
/**
* Implementation of sorting the repository of books by name
* @param storage - book storage
* @return ArrayList with sorted books
*/
@Override
public ArrayList<Book> query(final Set<Book> storage) {
ArrayList<Book> result = new ArrayList<>(storage);
Comparator<Book> comparator = Comparator.comparing(Book::getTitle);
result.sort(comparator);
return result;
}
}
| [
"[email protected]"
] | |
6e64a00249fb8450be4f2d1d712cc4aa9fd389af | 72912736267d698a95b6a67410ee73ae7885cf92 | /iatmi/iatmi-DTO/src/main/java/com/ia/tmi/iatmi/dto/PaseDTO.java | e51cefed9592768b91c2add971bf7f263ff7acba | [] | no_license | Fradantim/IA_PINAMAR | 36885d3561eb01b518756b9e8e25f5b581b0325a | a1762592168296155f51081b30504bc5aca66f32 | refs/heads/master | 2020-08-22T18:54:09.059072 | 2019-10-25T20:43:57 | 2019-10-25T20:43:57 | 216,460,477 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 588 | java | package com.ia.tmi.iatmi.dto;
public class PaseDTO {
private Integer id;
private String nombre;
private Float precio;
public PaseDTO(Integer id, Float precio, String nombre) {
this.id = id;
this.precio = precio;
this.nombre = nombre;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Float getPrecio() {
return precio;
}
public void setPrecio(Float precio) {
this.precio = precio;
}
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
}
| [
"[email protected]"
] | |
88708b6167bd8f3b8489a303bcdb227e80502c40 | 582d7f619b8460c75ed07bbd013ba5165ebd40f3 | /src/arena/BattleBotArena.java | 549c8ecb36a03fcec8d4f125e19a19c34473cc51 | [] | no_license | 1mozolacal/BattleBots3_0Teams | 7d88de0a851f5402722bdde681645d041c59a3a9 | 7da8e6515458a3d762a0d4905d71aa4e8e716b03 | refs/heads/master | 2020-08-10T09:19:51.735839 | 2017-12-11T21:49:35 | 2017-12-11T21:49:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 84,281 | java | package arena;
import java.applet.Applet;
import java.applet.AudioClip;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.awt.event.MouseWheelEvent;
import java.awt.event.MouseWheelListener;
import java.net.URL;
import java.text.DecimalFormat;
import java.util.Iterator;
import java.util.LinkedList;
import java.awt.BasicStroke;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.Timer;
import java.math.*;
import arena.Bullet.BulletType;
import bots.*;
import roles.*;
import java.util.ArrayList;
/**
* <b>Introduction</b>
* <br><br>
* This class implements a multi-agent competitive game application. Players contribute a
* single Java class that defines a "Bot", and these Bots battle each other in a
* multiple round tournament under the control of a BattleBotsArena object. For instructions
* on how to create a Bot, see the documentation in
* the class named <i>Bot</i>. For instructions on how to add Bots to the arena,
* see the documentation for the <i>fullReset()</i> method in this class.<br><br>
*
* <b>The Game Engine</b><br><br>
*
* The Arena attempts to run at 30 frames per second, but the actual frame rate may be
* lower on slower systems. At each frame, the arena does the following for each
* Bot b that is still alive and not <i>overheated</i>:
*
*<ol><li>Gets the team name using <i>b.getTeamName()</i></li>
*
* <li>Gets the next move using <i>b.getMove(BotInfo, boolean, BotInfo[], BotInfo[], Bullet[])</i></li>
*
* <li>Processes the move only if it is legal (i.e. moves are allowed only if no collisions; bullets and messages are allowed only if the max number of bullets is not exceeded)</li>
*
* <li>If the move was SEND_MESSAGE, calls <i>b.outGoingMessage()</i> to get the message from the Bot, then broadcasts it to all live Bots using <i>b.incomingMessage(int, msg)</i></li>
*
* <li>Draws each Bot using <i>b.draw(Graphics)</i></li></ol>
* <br>
* <b>Timing</b><br><br>
*
* The clock records real time in seconds regardless of the actual number of frames
* that have been processed. The clock will run faster when the play is sped up to x2,
* x4, or x8 (do this by mousing over the clock and using the scroll wheel). However, depending
* on the speed of your computer, you may not get 2x, 4x, or 8x as many frames in that time,
* so you should test your Bots at regular speed whenever possible. <br><br>
*
* <b>Bot Movement</b> <br><br>
*
* The arena allows each Bot to move vertically or horizontally at a set speed,
* to fire bullets horizontally or vertically, and to send messages. The speeds
* of the Bots and Bullets are configurable using static constants. The number
* of messages that can be sent is capped, as is the number of bullets that each
* Bot can have on screen at a time (Bot's names show in red when they are
* unable to fire, and a message is broadcast by the referee when a Bot's
* messaging is capped).<br><br>
*
* <b>Info Passed to the Bots</b><br><br>
*
* When asking for a Bot's move, the arena passes an array of Bullets, arrays
* of info concerning live and dead Bots, a boolean indicating whether the Bot
* is currently able to shoot, and a single object containing the public
* information about the Bot itself (see the abstract class Bot for more info
* on all this). No Bot is ever given any access to any internal variables or
* data structures of the arena, the Bullets, or other Bots. <br><br>
*
* <b>Collisions</b> <br><br>
*
* The size of a Bot is defined by the constant <i>Bot.RADIUS</i>. The centre point
* of each Bot is defined as <i>(x+Bot.Radius, y+Bot.RADIUS)</i>, where x and y are
* the top left corner of a square in which the bot is inscribed. The width
* and height of each Bot is <i>Bot.RADIUS * 2</i>. Each Bot has a circular collision
* mask in a radius of Bot.RADIUS from this centre point. Bullets have a single
* point collision mask (the pixel at the front of the Bullet) and are created one
* pixel over from the edge of the Bot that fired them, in the middle of the side
* from which they were fired (i.e. vertical bullets have an x coordinate of
* <i>x+Bot.Radius</i> and horizontal bullets have a y coordinate of <i>y+Bot.RADIUS</i>).
* Two bots have collided if the euclidean distance between their centre points is
* equal to <i>Bot.RADIUS*2</i> or less).<br><br>
*
* <b>Bot CPU Usage</b> <br><br>
*
* Processor time is monitored using calls to <i>System.nanoTime()</i> any time
* a Bot method is used (i.e. for drawing, getting the next move, getting the bot's
* name and team name, message processing, etc.) This is not perfect, but it does
* give an approximate estimate of how
* much CPU each Bot is consuming. A small number of points per round are awarded
* for low CPU usage (see <i>Scoring</i> below). If the cumulative CPU time for any
* Bot exceeds 2 seconds (configurable using the static constants), the Bot will
* <i>overheat</i> and become disabled. At this point, the Bot is replaced by a stock image
* symbol and there will be no more method calls to that particular Bot for
* the remainder of the round.<br><br>
*
* <b>Buggy Bots</b><br><br>
*
* When a Bot throws an exception, the exception is caught by the system and a
* scoring penalty is applied (defined by static constants in this class).<br><br>
*
* <b>Dead Bots</b><br><br>
*
* When a Bot is destroyed, it is replaced with a "dead bot" icon and becomes
* an obstacle on the course. There will be no more method calls to that
* particular Bot for the remainder of the round.<br><br>
*
* <b>Scoring</b><br><br>
*
* Bots are awarded points for each kill (whether or not they are alive when their bullet
* hits), and points for each second they stay alive in the round. The round ends
* after a set time, or after there are 1 or fewer Bots left. If a Bot is left at the
* end of the round, it is awarded time points based for the entire length the round
* would have been if it had continued. Point values are increased each each round.<br><br>
*
* In addition to these base points, there are penalties for each exception thrown, and
* there is a small bonus for low CPU equal to two points minus the number of seconds of
* CPU time used. This bonus allows ties to be broken (e.g. if two Bots each kill four
* other Bots and survive to the end of the round, it is usually possible to declare a
* winner based on CPU time). <br><br>
*
* Five Bots are dropped after each round, until six or fewer Bots are left. So if the
* game starts with 16 Bots(the default) there will be 3 rounds of play. (16 bots, 11 bots,
* and 6 bots respectively).<br><br>
*
* All scoring values and other numbers mentioned in this section can be configured using
* the static constants of this class. In addition, the game can
* be played so that the winning Bot is the one with the highest cumulative score at the
* end of multiple rounds, or it can be the Bot that wins the final round.<br><br>
*
* <b>Debugging Features</b><br><br>
*
* The arena contains a number of features to aid debugging. The screen that comes up
* when the Arena is first run is a "Test Mode" screen that allows you to track CPU time
* and exceptions, view the name and team of each Bot, and check that drawing and
* movement is within the allowed limits. There is also a DEBUG flag that can be
* set to TRUE to view statistics while the game is on. The game can be sped up
* to make it easier to view the outcome of each test match quickly (see the
* notes under <i>Timing</i> above), and pausing the game provides just over one
* second of instant replay to watch your Bots' actions in more detail. Finally,
* there is a "HumanBot" character that you can control with the keyboard to further
* test your Bots' performance.<br><br>
*
*
* @version 1.0 (March 3, 2011) - Initial Release
* @version <br>1.1 (March 10, 2011) - Added correction factor for system.nanoTime(), fixed bug in messaging (was cutting off last character of every message)
* @version <br>1.2 (March 24, 2011) - Added ready flag used in paint and paintBuffer to avoid exceptions from a race condition on startup
* @version <br>1.3 (March 28, 2011) - Load starting team names at beginning of match, icons updated (thanks to Mike Stuart for the new dead bot icon)
* @version <br>1.4 (March 28, 2011) - Improvements in how info is passed to bots: a. Only temp arrays are passed (so bots can't sabotage them); b. A deep copy
* of the BotInfo array for live bots is passed, so that all Bots get the exact same snapshot of where the Bots are (thanks
* to Zong Li for helping uncover the latter issue)
* @version <br>1.5 (March 31, 2011) - Moved bullet processing out of the Bot loop -- now bots are moved first, then bullets are moved (thanks again to Zong Li
* for pointing out this issue)
* @version <br>1.6 (May 30, 2011) - Shuts off sound on stop/destroy now
* @version <br>2.0 (August 9, 2011) - Converted to an application that can be JAR'ed -- the mouse wheel was not working well when embedded in a web page
* @version <br>2.1 (November 30, 2011) - Fixed audio bug
* @author Sam Scott
*
* @version <br>2.2 (April 20, 2015) - Rowbottom added modulus to select extra bots. Sentries excluded.
* Changed BOT_SPEED to 2 to prevent bots hanging on deadBots
*
* @version <br>3.0 (November 15, 2015) - Rowbottom added limited ammo functionality. Bots start out with limited ammo and cannot fire if numBullets < 1
* @version <br>3.1 (November 16, 2015) - Rowbottom extends limited ammo functionality so that liveBots can pickup used ammo off deadBots.
* @version<br>3.2 (November 15, 2015) - Rowbottom changed game parameters to enhance gameplay and extend rounds change scoring
* @version <br>3.3(Mar 2017) - Rowbottom increased bullet size for visibility and made multiple aestetic changes such as showing the round number and cummulative score
* @version <br>3.4(Mar 30 2017) - Rowbottom completed changes and improved stability
* @version <br>4.0(Mar 31 2017) - Added Role class, Roles interface and RoleType enum
* @version <br>4.1(Apr 1 2017) - Added GUI elements
* color ring for teams, arc amount shows health, number shows ammo left
*
*/
public class BattleBotArena extends JPanel implements MouseListener, MouseWheelListener, MouseMotionListener, ActionListener, Runnable {
/**
* Set to TRUE for debugging output
*/
public static final boolean DEBUG = true;
/**
* @author rowbottomn
* used to allow for unlimited distance to use healing and supplying
*/
public static final boolean OMNI_SPECIALS = true;
//***********************************************
// MAIN SET OF CONSTANTS AVAILABLE TO THE BOTS...
//***********************************************
/**
* Rowbottom For bot to request to stay in position
*/
public static final int STAY = 0;
/**
* For bot to request a move up
*/
public static final int UP = 1;
/**
* For bot to request a move down
*/
public static final int DOWN = 2;
/**
* For bot to request a move left
*/
public static final int LEFT = 3;
/**
* For bot to request a move right
*/
public static final int RIGHT = 4;
/**
* For bot to request a bullet fired up
*/
public static final int FIREUP = 5;
/**
* For bot to request a bullet fired down
*/
public static final int FIREDOWN = 6;
/**
* For bot to request a bullet fired left
*/
public static final int FIRELEFT = 7;
/**
* For bot to request a bullet fired right
*/
public static final int FIRERIGHT = 8;
/**
* For bot to request to use its special move
*/
public static final int SPECIAL = 9;
/**
* For bot to request a message send. If allowed, the arena will respond with a call to the bot's outGoingMessage() method.
*/
public static final int SEND_MESSAGE = 10;
/**
* Rowbottom team chat messages are not capped
*/
public static final int SEND_TEAM = 11;
/**
* Rowbottom for send a team messagea bot to request healing, this will send a special message to the
*/
public static final int REQUEST_HEALING = 12;
/**
* Rowbottom for a bot to request ammo
*/
public static final int REQUEST_AMMO = 13;
/**
* Right edge of the screen
*/
public static final int RIGHT_EDGE = 700; // also arena panel width
/**
* Bottom edge of the screen
*/
public static final int BOTTOM_EDGE = 500; // arena panel height is this constant + TEXT_BUFFER
/**
* Left edge of the screen
*/
public static final int LEFT_EDGE = 0;
/**
* Top edge of the screen
*/
public static final int TOP_EDGE = 10;
/**
* The "bot id" that indicates a system message
*/
public static final int SYSTEM_MSG = -1;
//*****************************************
// GAME CONFIGURATION - CHANGE WITH CAUTION
// BOTS ALSO HAVE ACCESS TO THESE CONSTANTS
//*****************************************
/**
* points per kill
*/
public static final int KILL_SCORE = 5;//Rowbottom changed from 5
/**
* survival points
*/
public static final double POINTS_PER_SECOND = 0.05;//Rowbottom changed from 0.1
/**
* healing points
*/
public static final double POINTS_PER_HEAL = 10;//Rowbottom changed from 0.1
/**
* points per unused second of processor time (mostly for breaking ties)
*/
public static final int EFFICIENCY_BONUS = 1;
/**
* points off per exception caught
*/
public static final int ERROR_PENALTY = 1;// Rowbottom changed from 5
/**
* true = scores between rounds are cumulative
* false = highest scoring Bot in last round is declared the winner
*/
public static final boolean CUMULATIVE_SCORING = true;
/**
* Number of bots to drop out per round
*/
public static final int ELIMINATIONS_PER_ROUND = 0;//Rowbottom changed from 5
/**
* Round time, in seconds
*/
public static final int TIME_LIMIT = 100;
/**
* TIME_LIMIT / SECS_PER_MSG = Number of messages allowed per round
*/
public static final double SECS_PER_MSG = 0.5; //
/**
* CPU limit per Bot per round
*/
public static final double PROCESSOR_LIMIT = 2.0;
/**
* Total number of Bots in round 1 (if you have fewer than this, the rest of the spots
* in the array will be filled with Drones, RandBots, and Sentries).
*/
public static final int NUM_BOTS = 16;
/**
* Rowbottom
* Not used*Number of bullets on screen at once for each bot
*/
public static final int NUM_BULLETS = 4;
/**
* Bot speed in pixels/frame
*/
public static final double BOT_SPEED = 2.0;
/**
* Bullet speed in pixels/frame
*/
public static final double BULLET_SPEED = 8;
/**
* Maximum message length
*/
public static final int MAX_MESSAGE_LENGTH = 200;
/**
* Initial ammo as part of limited ammo functionality
* !Passed to the botInfo for its value.
*/
public static final int BULLETS_LEFT = 20;//ROWBOTTOM Ammo!
/**
* When ELIMINATIONS_PER_ROUND is set to 0 then
* NUM_ROUNDS determines the final round
*/
public static final int NUM_ROUNDS = 20;//ROWBOTTOM Rounds will be NUM_ROUNDS
//**************************************
// OTHER ARENA CONSTANTS -- DON'T CHANGE
//**************************************
/**
* Size of message area at bottom of screen.
*/
private static final int TEXT_BUFFER = 100;
/**
* @author Rowbottom
*
*/
public static final int TEAM_SIZE = 4;
/**
* How fast the clock flashes when game paused
*/
private final int PAUSE_FLASH_TIME = 8;
/**
* How fast the red circles flash in test mode
*/
private final int FLASH_TIME = 10;
/**
* State constant to signal we are between rounds
*/
private final int WAIT_TO_START = 1;
/**
* State constant to signal that the game is on
*/
private final int GAME_ON = 2;
/**
* State constant to signal that we are between rounds
*/
private final int GAME_OVER = 3;
/**
* State constant to signal that the game is paused
*/
private final int GAME_PAUSED = 4;
/**
* State constant to signal game over and winner declared
*/
private final int WINNER = 5;
/**
* State constant to signal we are in test mode (starts in this mode)
*/
private final int TEST_MODE = 6;
/**
* Size of the bot names
*/
private final int NAME_FONT = 10;
/**
* Size of the stats font (stats displayed at end of each round)
*/
private final int STATS_FONT = 15;
/**
* Number of frames in the buffer for instant replay (limited by heap size)
*/
private final int NUM_FRAMES = 40;
/**
* Ticks per frame in replay mode. Higher for a slower replay.
*/
private final int REPLAY_SPEED = 2;
/**
* How many frames to hold on the last frame before restarting the instant replay.
*/
private final int END_FRAME_COUNT = 15;
/**
* File name for fanfare sound (plays at start of round)
*/
private final String fanfareSoundFile = "FightLikeARobot.wav";
/**
* File name for shot sound
*/
private final String shotSoundFile = "Shot.wav";
/**
* File name for robot death sound
*/
private final String deathSoundFile = "Death.wav";
/**
* File name for drone sound during game
*/
private final String droneSoundFile = "def_star2.wav";
/**
* File name for opening sound (plays during opening screen)
*/
private final String openSoundFile = "crystalcastles.wav";
/**
* File name for stop sound (plays when pausing game)
*/
private final String stopSoundFile = "qix.wav";
/**
* File name for game over sound
*/
private final String gameOverSoundFile = "GameOver.wav";
/**
* File name for overheat sound
*/
private final String overheatSoundFile = "dp_frogger_squash.wav";
//**************************************
// OTHER ARENA VARIABLES -- DON'T CHANGE
//**************************************
/**
* If set to true, the arena will display Bot Ammo during the game.
*/
private boolean showAmmo = true;
/**
* If set to true, the arena will display Bot scores during the game.
*/
private boolean showScores = false;
/**
* If set to true, the arena will display Bot names during the game.
*/
private boolean showNames = false;
/**
* Rowbottom Teams are displayed by color now so not needed
* If set to true, the arena will display Bot team names during the game.
*/
//private boolean showTeams = false;
/**
* Rowbottom Color array used to store the teams visually
*
*/
Color [] teamColors = new Color[]{Color.GREEN, Color.BLUE, Color.RED, Color.YELLOW};
/**
* Toggles sound effects on and off
*/
private boolean soundOn = true;
/**
* The current speed multiplier
*/
private int speed = 8;//changed from 1
/**
* Controls the flashing if the game is paused
*/
private int pauseCount = 0;
/**
* The winner of the game
*/
private int winnerID = -1;
/**
* Countdown to the start of the game ("Fight like a robot!")
*/
private int countDown = -1;
/**
* Counter for flashing the clock in pause mode
*/
private int flashCounter = 0;
/**
* The bot we are dragging (test mode)
*/
private int gotBot = -1;
/**
* For dragging a bot (test mode)
*/
private int forceBotX, forceBotY, mouseInitialX, mouseInitialY;
/**
* The main state variable - controls what phase of the game we are at (see the State constants)
*/
private int state = WAIT_TO_START; // state variable
/**
* Used when going into test mode - false while bots are being set up, constructors called, etc.
*/
private boolean ready = false;
/**
* The current round
*/
private int round = 0;
/**
* which message is displayed first - for scrolling messages
*/
private int firstMessage = 0;
/**
* Double-buffering
*/
private Image buffer;
/**
* Dead Bot image
*/
private Image deadBot;
/**
* Overheated Bot image
*/
private Image overheated;
/**
* For timing the game length
*/
private long startTime;
/**
* For continuing correct timing after a pause
*/
private long pauseTime;
/**
* On some machines, System.nanoTime() returns incorrect results. For example, on one machine
* System.currentTimeMillis() shows 10 seconds elapsed while System.nanoTime() consistently shows
* 4.5 seconds elapsed for the same time period. The more reliable millisecond timing is used
* for the game clock, however for timing CPU usage of the Bots, we need a higher grain than 1ms.
* So System.nanoTime() is used, but a correction factor is computed in a thread spawned at
* startup time, and this becomes a multiplier for the number of ns that System.nanoTime() reports
* has elapsed.
*/
private double nanoTimeCorrection = 1;
/**
* Total time played
*/
private double timePlayed = 0;
/**
* Object for formatting decimals
*/
private DecimalFormat df = new DecimalFormat("0.0"), df2 = new DecimalFormat("0.000");
/**
* The main game engine timer
*/
private Timer gameTimer;
/**
* Main array of Bot objects. Note that bots, botsInfo, and bullets are related arrays - bullets[i]
* gives the array of bullets owned by bot[i], and botsInfo[i] gives the public info
* for bot[i].
*/
private Bot[] bots = new Bot[NUM_BOTS];
/**
* Array of public info regarding the Bots - this is how information is passed to
* the Bots in getMove(). Done this way so the Bots don't have access to each others'
* internal states. Note that bots, botsInfo, and bullets are related arrays - bullets[i]
* gives the array of bullets owned by bot[i], and botsInfo[i] gives the public info
* for bot[i].
*/
private BotInfo[] botsInfo = new BotInfo[NUM_BOTS];
/**
* The bullets. Note that bots, botsInfo, and bullets are related arrays - bullets[i]
* gives the array of bullets owned by bot[i], and botsInfo[i] gives the public info
* for bot[i].
* V3.0 Rowbottom the array of bullets needs to be as large as the attacks numBullets
*/
private Bullet[][] bullets = new Bullet[NUM_BOTS][Role.ATTACK_BULLETS];
/** @author Rowbottom
* Inner class which supports the roles modification to the bots and the arena code.
* The array is set as copies of the Role reported to the arena by each bot.
* A copy must be made so that the bot does not have access to its role variables and methods.
**/
private Role[] botRoles = new Role[NUM_BOTS];
/**
* Number of bots remaining in the round.
*/
private int botsLeft = NUM_BOTS;
/**
* Message buffer
*/
private LinkedList<String> messages = new LinkedList<String>();
/**
* Team messages let the medic and support know who needs help
*/
private String teamMsg;
/**
* The images to use in instant replay. This is a circular buffer.
*/
private Image[] replayImages = new Image[NUM_FRAMES];
/**
* The latest frame. The head pointer of the circular buffer called replayImages.
*/
private int replayEndFrame = 0;
/**
* In instant replay mode, this is the frame we are currently presenting.
*/
private int replayCurrentFrame = 0;
/**
* Counter for holding on the last frame before resetting the instant replay.
*/
private int endFrameCounter = 0;
/**
* Counter for deciding when to advance the frame during an instant replay.
*/
private int replayCounter = 0;
/**
* This is a buffer that holds the images the Bots are requesting to load.
* Since bots don't have access to the arena as an image observer, the images
* in this list are painted off screen until g.drawImage() returns true. This
* ensures that all images get loaded ASAP whether the Bots are using them
* or not, and that callbacks happen and trigger a repaint when images are
* loaded.
*/
private LinkedList<Image> imagesToLoad = new LinkedList<Image>();
/**
* Holds an audioclip for arena sound.
*/
AudioClip death, fanfare, shot, drone, open, stop, gameOver, overheat;
//***************************************
// METHODS YOU NEED TO CHANGE
//***************************************
/**
* This method is called at the start of each new game, before the test mode
* screen comes up. It creates all the Bots that will participate in the game,
* and resets a few game constants.
*
* NOTE: This is where you add your own bots. See the instructions in the
* method below...
*/
private void fullReset()
{
ready = false; // Signals to the paint methods that the Bots are not set up yet
if (soundOn) open.play(); // Play the fanfare
state = TEST_MODE; // We start in test mode
gameTimer.start(); // start the timer thread if necessary
bots = new Bot[NUM_BOTS]; // the bots
round = 0; // pre-game is round 0
// *** HUMAN TEST BOT CREATION
// *** Comment the next two lines out if you don't want to use the
// *** HumanBot (under user control)
//bots[0] = new HumanBot();
//addKeyListener((HumanBot)bots[0]);
// ******************************
// *** INSERT PLAYER BOTS HERE. Use any array numbers you like
// *** as the bots will be shuffled again later.
// *** Any empty spots will be filled with standard arena bots.
// bots[9] = new AIBot();
//bots[0] = new Bott(); //blend
//bots[1] = new ZuccBot();//ben
//bots[2] = new The4992Bot();//calvin
// *******************************
// Remaining slots filled with Drones, RandBots, and sentryBots.
int c = 1;
for (int i=0; i<NUM_BOTS; i++)
{
//if there is an empty space fill it with sentries
if (bots[i] == null)
{
/**
* @rowbottom
* below places the randbot at different roles to test the effect
*/
if ((i+i/TEAM_SIZE)%TEAM_SIZE ==0)
bots[i] = new RandBot();
// else if (c%2 ==1)
// bots[i] = new RandBot();
else{
// {
bots[i] = new TestBot();
//c=0;
}
c++;
}
}
botRoles = getRoles(bots);//Rowbottom get the roles from the bots
reset(); // calls the between-round reset method
}
//***************************************
// METHODS YOU SHOULD *NOT* CHANGE
//***************************************
/**
* Main method to create and display the arena
* @param args unused
*/
public static void main(String[] args)
{
JFrame frame = new JFrame();//set up the frame
BattleBotArena panel = new BattleBotArena();//instantiate the arena
frame.setContentPane(panel);//create the frame panel
frame.pack();
frame.setTitle("BattleBots");
frame.setResizable(false);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
panel.init();
panel.requestFocusInWindow();
}
/**
* One-time setup for images, sounds, listeners, buffers, and game timer.
**/
public BattleBotArena ()
{
// start the calibration timer (see run method below for more info)
(new Thread(this)).start();
// create the game thread
gameTimer = new Timer(1000/30/speed,this);
// sounds
URL location = getClass().getClassLoader().getResource("sounds/"+fanfareSoundFile);
fanfare = Applet.newAudioClip(location);
location = getClass().getClassLoader().getResource("sounds/"+shotSoundFile);
shot = Applet.newAudioClip(location);
location = getClass().getClassLoader().getResource("sounds/"+deathSoundFile);
death = Applet.newAudioClip(location);
location = getClass().getClassLoader().getResource("sounds/"+droneSoundFile);
drone = Applet.newAudioClip(location);
location = getClass().getClassLoader().getResource("sounds/"+openSoundFile);
open = Applet.newAudioClip(location);
location = getClass().getClassLoader().getResource("sounds/"+stopSoundFile);
stop = Applet.newAudioClip(location);
location = getClass().getClassLoader().getResource("sounds/"+gameOverSoundFile);
gameOver = Applet.newAudioClip(location);
location = getClass().getClassLoader().getResource("sounds/"+overheatSoundFile);
overheat = Applet.newAudioClip(location);
// images
deadBot = Toolkit.getDefaultToolkit ().getImage (getClass().getClassLoader().getResource("images/dead.png"));
overheated = Toolkit.getDefaultToolkit ().getImage (getClass().getClassLoader().getResource("images/overheated.png"));
// Listeners for mouse input
addMouseListener (this);
addMouseMotionListener (this);
addMouseWheelListener (this);
// Set size of panel and make it focusable
setPreferredSize(new Dimension(700, 600));
setFocusable(true);
}
private void init()
{
// Paint buffer and instant replay array
for (int i = 0; i<NUM_FRAMES; i++)
replayImages[i] = createImage(RIGHT_EDGE, BOTTOM_EDGE);
buffer = createImage(RIGHT_EDGE, BOTTOM_EDGE+TEXT_BUFFER);
// Set up the bots and the game
fullReset();
}
/**
* Reset for a new round. Called between rounds, and also after a full reset.
*/
private void reset()
{
HelperMethods.say("reseting");
timePlayed = 0; // reset the clock
round ++; // advance the round
botsLeft = NUM_BOTS; // put all the bots back in the game
messages = new LinkedList<String>();// clear the messag buffer
//Rowbottom No longer needed as positions are set by the team placement
/*// shuffle the bots
for (int i=0; i<NUM_BOTS*10; i++)
{
int b1 = (int)(Math.random()*NUM_BOTS);
int b2 = (int)(Math.random()*NUM_BOTS);
Bot temp = bots[b1];
bots[b1] = bots[b2];
bots[b2] = temp;
BotInfo temp2 = botsInfo[b1];
botsInfo[b1] = botsInfo[b2];
botsInfo[b2] = temp2;
}
*/
// Clear the array of public Bot info. (This is the info given to the Bots when making their moves.)
BotInfo[] newBotsInfo = new BotInfo[NUM_BOTS];
Role[] newBotRoles = new Role[NUM_BOTS];
if (state == TEST_MODE) // we are restarting. everything is reset
{
int xScale = (RIGHT_EDGE-Bot.RADIUS*4)/Math.max(NUM_BOTS-1,1); // this spaces them out so they don't rez on top of each other
int yScale = (BOTTOM_EDGE-Bot.RADIUS*4)/5;
int[][] grid = new int[NUM_BOTS][5];
for (int i = 0; i < NUM_BOTS; i++)
{
//bots[i].assignNumber(i); // assign new numbers
int x = (int)(Math.random()*NUM_BOTS);
int y = (int)(Math.random()*5);
newBotRoles[i] = new Role(botRoles[i].getRole());
newBotsInfo[i] = new BotInfo(x*xScale + Bot.RADIUS, y*yScale + Bot.RADIUS, i, bots[i].getName(), newBotRoles[i]); // create new BotInfo object to keep track of bot's stats
// HelperMethods.say("role"+newBotRoles[i].getRole());
//Rowbottom as of 3.0 teams are no longer newBotsInfo[i].setTeamName(bots[i].getTeamName()); // get start of game team names
newBotsInfo[i].setTeamName("Team"+(i/TEAM_SIZE+1));//Rowbottom teams are set by the order in the bot array
if (grid[x][y] == 1)
i--;
else
grid[x][y] = 1;
}
}
else
{
//Rowbottom placement is by teams now and manual
int[] xs = new int[]{
//team 1 top left corner (3 & 5 right, 7 & 9 down)
3*Bot.RADIUS,7*Bot.RADIUS, 3*Bot.RADIUS,7*Bot.RADIUS,
//team 2 top right corner(7 & 9 left, 3 & 5 down)
RIGHT_EDGE - 19*Bot.RADIUS,RIGHT_EDGE - 15*Bot.RADIUS,
RIGHT_EDGE - 19*Bot.RADIUS,RIGHT_EDGE - 15*Bot.RADIUS,
//team 3 bottom left corner(7 & 9 right, 3 & 5 up)
13*Bot.RADIUS, 17*Bot.RADIUS,13*Bot.RADIUS, 17*Bot.RADIUS,
//team 4 bottom right corner(3 & 5 left, 7 & 9 up)
RIGHT_EDGE - 9*Bot.RADIUS,RIGHT_EDGE - 5*Bot.RADIUS,
RIGHT_EDGE - 9*Bot.RADIUS,RIGHT_EDGE - 5*Bot.RADIUS
};
int[] ys = new int[]{
//team 1 (3 & 5 in, 7 & 9 down)
14*Bot.RADIUS,18*Bot.RADIUS, 18*Bot.RADIUS,14*Bot.RADIUS,
//team 2 (7 & 9 left, 3 & 5 down)
8*Bot.RADIUS, 4*Bot.RADIUS,4*Bot.RADIUS, 8*Bot.RADIUS,
//team 3 bottom left corner(7 & 9 right, 3 & 5 up)
BOTTOM_EDGE - 5*Bot.RADIUS,BOTTOM_EDGE - 9*Bot.RADIUS,
BOTTOM_EDGE - 9*Bot.RADIUS,BOTTOM_EDGE - 5*Bot.RADIUS,
//team 4 bottom right corner(3 & 5 left, 7 & 9 up)
BOTTOM_EDGE - 19*Bot.RADIUS,BOTTOM_EDGE - 15*Bot.RADIUS,
BOTTOM_EDGE - 15*Bot.RADIUS,BOTTOM_EDGE - 19*Bot.RADIUS
};
for (int i = 0; i < NUM_BOTS; i++)
{
//Not needed anymorebots[i].assignNumber(i); // assign new numbers
//make new botInfo objects and roles, note that these will have health and ammo values depending on roles
newBotRoles[i] = new Role(botRoles[i].getRole());
newBotsInfo[i] = new BotInfo(xs[i], ys[i], i, botsInfo[i].getName(), newBotRoles[i]);
//Rowbottom as of 3.0 teams are no longer newBotsInfo[i].setTeamName(bots[i].getTeamName()); // get start of game team names
newBotsInfo[i].setTeamName("Team"+(i/TEAM_SIZE+1));//Rowbottom teams are set by the order in the bot array
if (botsInfo[i] != null && CUMULATIVE_SCORING && round > 1)
newBotsInfo[i].setCumulativeScore(botsInfo[i].getCumulativeScore()+botsInfo[i].getScore());
if (botsInfo[i] != null && (botsInfo[i].isOut() || botsInfo[i].isOutNextRound()))
{
newBotsInfo[i].knockedOut();
botsLeft--;
}
//System.out.println(bots[i].getName()+ " "+newBotsInfo[i].getName()+" "+newBotsInfo[i].isOut());
}
}
botsInfo = newBotsInfo;
botRoles = newBotRoles;
// load the images & call the newRound message for the bots
for (int i = 0; i < NUM_BOTS; i++)
{
loadImages (i);
// BOT METHOD CALL - timed and exceptions caught
long startThink = System.nanoTime();
try {
bots[i].newRound();
}
catch (Exception e)
{
botsInfo[i].exceptionThrown(e);
}
botsInfo[i].setThinkTime((System.nanoTime()-startThink)*nanoTimeCorrection);
// ***********************
}
bullets = new Bullet[NUM_BOTS][Role.ATTACK_BULLETS]; // init the bullets array
ready = true; // tell the paint method we're good to go
// In test mode, spam the message area with these instructions
if (state == TEST_MODE)
{
sendMessage(-1,"Battle Bots 3.0");
sendMessage(-1,"------------------------------------------------");
sendMessage(-1,"Developed in 2011 as a programming challenge for");
sendMessage(-1,"grade 12 (ICS4U) students.");
sendMessage(-1,"Modified in 2015 to add ammo limits ");
sendMessage(-1,"Modified in 2017 to add team roles ");
sendMessage(-1,"Each bot is in its own class, and is under its own control. Bots");
sendMessage(-1,"declare their names once at the beginning, and are assigned into teams");
sendMessage(-1,"they can no longer change allegiances throughout the game.");
sendMessage(-1," ");
sendMessage(-1,"Bots choose their actions 30 times per second. If the action is");
sendMessage(-1,"legal, the arena allows it. The arena processes all collisions and");
sendMessage(-1,"handles all the scoring. Bots do not have direct access to the code ");
sendMessage(-1,"or instance variables of the other bots, the bullets, or the arena.");
sendMessage(-1,"Bots can send broadcast messages to one another, and periodically");
sendMessage(-1,"receive messages from the referee. All messaging appears in this");
sendMessage(-1,"window.");
sendMessage(-1," ");
sendMessage(-1,"All exceptions are caught and counted, with a scoring penalty for");
sendMessage(-1,"each one. CPU use is monitored and bots will overheat and become");
sendMessage(-1,"disabled when they go over the limit. Tie-breaking points are");
sendMessage(-1,"awarded for low CPU use.");
sendMessage(-1," ");
sendMessage(-1,"Use the menu buttons on the right to control the view and the sound.");
sendMessage(-1,"When the game is on, click the clock to pause and view the instant ");
sendMessage(-1,"replay, or mouse over the clock and use the scroll wheel to speed up ");
sendMessage(-1,"and slow down the game. Use the scroll wheel in this message window");
sendMessage(-1,"to view old messages.");
sendMessage(-1," ");
sendMessage(-1,"HAVE FUN!");
sendMessage(-1,"------------------------------------------------");
sendMessage(-1," ");
sendMessage(-1,"Hello. I am your referee.");
sendMessage(-1,"We are currently in test mode.");
sendMessage(-1,"Draw test - Each bot should be in a red circle.");
sendMessage(-1,"Move test - Bots can be dragged with the mouse.");
sendMessage(-1,"Code test - Numbers show exceptions and processor time.");
sendMessage(-1,"Scroll up to see more info and credits.");
}
}
/**
* Loads images for the bots
* @param botNum
*/
private void loadImages(int botNum)
{
String[] imagePaths = null; // file names
Image[] images = null; // images
// 1. get the image names
// BOT METHOD CALL - timed and exceptions caught
long startThink = System.nanoTime();
try {
imagePaths = bots[botNum].imageNames();
} catch (Exception e) {
botsInfo[botNum].exceptionThrown(e);
}
botsInfo[botNum].setThinkTime((System.nanoTime()-startThink)*nanoTimeCorrection);
// ***********************
// 2. load the images if there are any to load
if (imagePaths != null)
{
images = new Image[imagePaths.length];
for (int i=0; i<imagePaths.length; i++)
{
try {
images[i] = Toolkit.getDefaultToolkit ().getImage (getClass().getClassLoader().getResource("images/"+imagePaths[i]));
imagesToLoad.add(images[i]);
} catch (Exception e) {
botsInfo[botNum].exceptionThrown(e);
}
}
// 3. pass the messages to the Bot
// BOT METHOD CALL - timed and exceptions caught
startThink = System.nanoTime();
try {
bots[botNum].loadedImages(images);
} catch (Exception e) {
botsInfo[botNum].exceptionThrown(e);
}
botsInfo[botNum].setThinkTime((System.nanoTime()-startThink)*nanoTimeCorrection);
// ***********************
}
}
/**
* This method is for the thread computes the correction factor for System.nanoTime(). See
* the documentation of the field "nanoTimeCorrection" for more information. The thread is
* spawned by the init() method, and should be complete and no longer running after about 20s.
*/
public void run()
{
//pause for setup
try {Thread.sleep(5000);} catch (InterruptedException e) {e.printStackTrace();}
//repeatedly test ms and ns timers for 1 second intervals and compute the
//correction for System.nanoTime() assuming currentTimeMillis() is accurate
double totalms = 0, totalns = 0;
for (int i=0; i<10; i++)
{
double start = System.currentTimeMillis();
try {Thread.sleep(1000);} catch (InterruptedException e) {e.printStackTrace();}
totalms += (System.currentTimeMillis()-start)/1000.0;
//System.out.println("millisecond timer ... "+totalms);
start = System.nanoTime();
try {Thread.sleep(1000);} catch (InterruptedException e) {e.printStackTrace();}
totalns += (System.nanoTime()-start)/1000000000.0;
//System.out.println("nanosecond timer ... "+totalns);
nanoTimeCorrection = totalms/totalns;
if (DEBUG)
System.out.println("nanoTimeCorrection after "+(i+1)+" seconds = "+nanoTimeCorrection);
}
requestFocus();
}
/**
* The main game method - called by the timer. Handles all the
* mechanics of the game, the replay mode, and the test mode screen.
*/
public void actionPerformed(ActionEvent ace)
{
// **** are we moving bots around?
if (state == GAME_ON && countDown <= 0 || state == TEST_MODE && ready)
{
if (state != TEST_MODE) // advance the timer or...
{
long timeNow = System.currentTimeMillis();
timePlayed += (timeNow - startTime)/1000.0*speed;
startTime = timeNow;
}
else // ...flash the red rings around the bots in test mode
{
flashCounter--;
if (flashCounter < 0)
flashCounter = FLASH_TIME;
}
// **** game over?
if (state != TEST_MODE && (timePlayed >= TIME_LIMIT || botsLeft <= 1))
{
state = GAME_OVER;
//resetGameSpeed();
endFrameCounter = END_FRAME_COUNT; // start the instant replay
replayCurrentFrame = replayEndFrame;
drone.stop(); // stop the sound
if (soundOn)
gameOver.play();
if (botsLeft == 1) // if there is a bot left, update its score
for (int i=0; i<NUM_BOTS; i++)
if (botsInfo[i].isDead() == false && botsInfo[i].isOut() == false)
{
botsInfo[i].setScore(currentScore(i, true));
break;
}
// knock out up to ELIMINATIONS_PER_ROUND bots
int knockedOut = 0;
int totalOut = 0;
BotInfo[] sortedBots = sortedBotInfoArray(false);
for (int i=0; i<NUM_BOTS && knockedOut<ELIMINATIONS_PER_ROUND; i++)
{
if (!sortedBots[i].isOut())
{
sortedBots[i].outNextRound();
knockedOut++;
}
totalOut++;
}
// find the winner
sortedBots = sortedBotInfoArray(true);
winnerID = sortedBots[0].getBotNumber();
if (totalOut >= NUM_BOTS-1 || round >= NUM_ROUNDS) // is this the last round?
{
sendMessage(-1,"Final round complete. "+sortedBots[0].getName()+" is the winner.");
state = WINNER;
}
else
if (CUMULATIVE_SCORING) // different message depending on scoring type
sendMessage(-1,"Round "+round+" complete. "+sortedBots[0].getName()+" is leading.");
//ROWBOTTOM
if (round < NUM_ROUNDS && ELIMINATIONS_PER_ROUND == 0) // clicked on the wait to start message bar
{
if (soundOn)
fanfare.play();
countDown = 60;
startTime = System.currentTimeMillis();
gameTimer.start();
if (round == NUM_ROUNDS)
sendMessage(SYSTEM_MSG,"Final Round starting. Good luck!");
else
sendMessage(SYSTEM_MSG,"Round "+round+" starting. Good luck!");
state = GAME_ON;
reset();
}
else
sendMessage(-1,"Round "+round+" complete. "+sortedBots[0].getName()+" is the winner.");
}
else //**** GAME IS ON
{
// A. increment the circular replay buffer
if (++replayEndFrame == NUM_FRAMES)
replayEndFrame = 0;
// B. create copies of all the bullet and Bot info to pass to each
// Bot when getting their moves
LinkedList<Bullet> bulletList = new LinkedList<Bullet>();
BotInfo[] liveBots = new BotInfo[botsLeft];
Role[] liveRoles = new Role[botsLeft];
int nextLiveBotIndex = 0;
BotInfo[] deadBots = new BotInfo[NUM_BOTS-(round-1)*ELIMINATIONS_PER_ROUND-botsLeft];
int nextDeadBotIndex = 0;
for (int j=0; j<NUM_BOTS; j++)
{
if (!botsInfo[j].isOut())
if (!botsInfo[j].isDead())
liveBots[nextLiveBotIndex++] = botsInfo[j];//copying THE REFERENCES of the alive bots into a smaller array
else
deadBots[nextDeadBotIndex++] = botsInfo[j].copy(); // important to deep copy or else some
// bots will get info about the current move
// for some of the other bots
int bulletCount =0;
for (int k=0; k<botRoles[j].getNumBullet(); k++){
if (bullets[j][k] != null)//l&&bullets[j][k].type == BulletType.BULLET)
{
bulletList.add(bullets[j][k]);
bulletCount++;
}
}
}
// C. process moves for each bot
for (int i = 0; i<NUM_BOTS; i++)
{
// only move bot if it's active
if (!botsInfo[i].isOverheated() && !botsInfo[i].isDead() && !botsInfo[i].isOut())
{
// Update Bot's Score
botsInfo[i].setScore(currentScore(i, false));
// Check think time to see if over limit
if (botsInfo[i].getThinkTime() > PROCESSOR_LIMIT && state != TEST_MODE)
{
botsInfo[i].overheated();
if (soundOn)
overheat.play();
sendMessage(SYSTEM_MSG, botsInfo[i].getName()+" overheated - CPU limit exceeded.");
}
else //bot still alive! Process move
{
long startThink = System.nanoTime();
// 1. Rowbottom No longer supporting changing teamsGet bot team name
/*// BOT METHOD CALL - timed and exceptions caught
try {
botsInfo[i].setTeamName(bots[i].getTeamName());
}
catch(Exception e)
{
botsInfo[i].exceptionThrown(e);
}
botsInfo[i].setThinkTime((System.nanoTime()-startThink)*nanoTimeCorrection);
*/
// ***********************
// 2. set up to get the next move
// 2a. Can the current bot shoot?
BotInfo currentBot = botsInfo[i].copy(); // current Bot
currentBot.setRole(botRoles[i].getRole());
currentBot.setBulletsLeft(botRoles[i].getBulletsLeft());
currentBot.setHealth(botRoles[i].getHealth());
//HelperMethods.say("currentrole"+currentBot.getRole());
//Role currentRole = botRoles[i];
boolean shotOK = false; // can shoot?
boolean specialOK= false;
int bulletCount = 0;
for (int j=0; j<botRoles[i].getNumBullet(); j++)
{
if (bullets[i][j] == null && botRoles[i].getBulletsLeft() > 0){
shotOK = true;
//rowbottom specifiying whether each class can use their special
if (botRoles[i].getRole() == RoleType.MEDIC || botRoles[i].getRole() == RoleType.SUPPORT){
specialOK = true;
}
else if (botRoles[i].getRole() == RoleType.TANK){
bulletCount ++;
}
}
if (bulletCount > 2&&botRoles[i].getRole() == RoleType.TANK){
specialOK = true;
}
}
//System.out.println("Bot"+i+"'s bullets"+currentBot.getBulletsLeft()+","+shotOK);
// 2b. The bots have to be passed temp arrays of bullets so they can't
// mess them up (e.g. by setting array entries to null)
Bullet[] cleanBulletArray = new Bullet[bulletList.size()];
int cleanBAIndex = 0;
Iterator<Bullet> it = bulletList.iterator();
while (it.hasNext())
cleanBulletArray[cleanBAIndex++] = it.next();
// 2c. For the same reason, they must get temp arrays of live and dead bots too.
// We also remove the current bot from the list of livebots here.
BotInfo[] cleanLiveBotsArray = new BotInfo[liveBots.length-1];
int k = 0;
for (int j=0; j<liveBots.length; j++)
if (liveBots[j].getBotNumber() != currentBot.getBotNumber())
cleanLiveBotsArray[k++] = liveBots[j].copy(botRoles[i]);//this ensures the other roles do not get extra info
BotInfo[] cleanDeadBotsArray = new BotInfo[deadBots.length];
for (int j=0; j<deadBots.length; j++)
cleanDeadBotsArray[j] = deadBots[j];
// 3. now, get the move
int move = -1;
// BOT METHOD CALL - timed and exceptions caught
startThink = System.nanoTime();
try {
// HelperMethods.say("currentRole"+currentBot.getRole());
move = bots[i].getMove(currentBot, shotOK, cleanLiveBotsArray, cleanDeadBotsArray, cleanBulletArray);
}
catch(Exception e)
{
botsInfo[i].exceptionThrown(e);
}
botsInfo[i].setThinkTime((System.nanoTime()-startThink)*nanoTimeCorrection);
// ***********************
botsInfo[i].setLastMove(move);
// 4. Process the move
switch(move)
{
case UP:
botsInfo[i].setY(botsInfo[i].getY()-BOT_SPEED);
break;
case DOWN:
botsInfo[i].setY(botsInfo[i].getY()+BOT_SPEED);
break;
case LEFT:
botsInfo[i].setX(botsInfo[i].getX()-BOT_SPEED);
break;
case RIGHT:
botsInfo[i].setX(botsInfo[i].getX()+BOT_SPEED);
break;
case FIREUP:
for (int j=0; j<botRoles[i].getNumBullet(); j++) // looks for the first unused bullet slot
if (bullets[i][j] == null&&botRoles[i].getBulletsLeft()>0)
{
bullets[i][j] = new Bullet(botsInfo[i].getX()+Bot.RADIUS, botsInfo[i].getY()-1, 0, -BULLET_SPEED);
botRoles[i].fireBullet();//reduce the amount of bullets by one.
if (state != TEST_MODE)
if (soundOn)
shot.play();
break;
}
break;
case FIREDOWN:
for (int j=0; j<botRoles[i].getNumBullet(); j++)// looks for the first unused bullet slot
if (bullets[i][j] == null&&botRoles[i].getBulletsLeft()>0)
{
bullets[i][j] = new Bullet(botsInfo[i].getX()+Bot.RADIUS, botsInfo[i].getY()+Bot.RADIUS * 2 + 1, 0, BULLET_SPEED);
botRoles[i].fireBullet();//reduce the amount of bullets by one.
if (state != TEST_MODE)
if (soundOn)
shot.play();
break;
}
break;
case FIRELEFT:
for (int j=0; j<botRoles[i].getNumBullet(); j++)// looks for the first unused bullet slot
if (bullets[i][j] == null&&botRoles[i].getBulletsLeft()>0)
{
bullets[i][j] = new Bullet(botsInfo[i].getX()-1, botsInfo[i].getY()+Bot.RADIUS, -BULLET_SPEED, 0);
botRoles[i].fireBullet();//decreases ammo count
if (state != TEST_MODE)
if (soundOn)
shot.play();
break;
}
break;
case FIRERIGHT:
for (int j=0; j<botRoles[i].getNumBullet(); j++)// looks for the first unused bullet slot
if (bullets[i][j] == null&&botRoles[i].getBulletsLeft()>0)
{
bullets[i][j] = new Bullet(botsInfo[i].getX()+Bot.RADIUS * 2 + 1, botsInfo[i].getY()+Bot.RADIUS, BULLET_SPEED, 0);
botRoles[i].fireBullet();//decreases ammo count
if (state != TEST_MODE)
if (soundOn)
shot.play();
break;
}
break;
case SEND_MESSAGE:
String msg = null;
// get the message
// BOT METHOD CALL - timed and exceptions caught
startThink = System.nanoTime();
try {
msg = bots[i].outgoingMessage();
botsInfo[i].setThinkTime((System.nanoTime()-startThink)*nanoTimeCorrection);
// make sure they are not over the limit
if (botsInfo[i].getNumMessages() < TIME_LIMIT/SECS_PER_MSG && state != TEST_MODE)
sendMessage(i, msg); // send the message
}
catch (Exception e)
{
botsInfo[i].exceptionThrown(e);
botsInfo[i].setThinkTime((System.nanoTime()-startThink)*nanoTimeCorrection);
}
// ***********************
break;
case SPECIAL:
if (!specialOK){
//HelperMethods.say("Bot"+i+botsInfo[i].getName()+" cannot use special");
}
else{
//if tank
if (botRoles[i].getRole() == RoleType.TANK){
int ydir = 0;
int xdir = 0;
if (botsInfo[i].getLastMove()%4 == 1){//up or fire up
ydir = -1;
}
else if (botsInfo[i].getLastMove()%4 == 2){//down or fireDown
ydir = 1;
}
else if (botsInfo[i].getLastMove()%4 == 3){//left or fireright
xdir = -1;
}
else if (botsInfo[i].getLastMove()%4 == 0){//right or fireRight
xdir = 1;
}
for (int f = 0; f < Role.TANK_BULLETS; f++){
bullets[i][f] = new Bullet(botsInfo[i].getX()+Bot.RADIUS+xdir*(Bot.RADIUS+1)+(Bot.RADIUS*(f-1)*Math.abs(ydir)), botsInfo[i].getY()+Bot.RADIUS+ydir*(Bot.RADIUS+1)+(Bot.RADIUS*(f-1)*Math.abs(xdir)), xdir*BULLET_SPEED, ydir*BULLET_SPEED);
botRoles[i].fireBullet();//decreases ammo count
}
}
else if (botRoles[i].getRole() == RoleType.MEDIC){
BotInfo target = bots[i].getTarget() ;
if ( target == null){
HelperMethods.say("WTF");
}
double d = Math.sqrt(Math.pow(botsInfo[i].getX()-target.getX(),2)+Math.pow(botsInfo[i].getY()-target.getY(),2));
if (d <= (double)Bot.RADIUS*Math.sqrt(2)|| OMNI_SPECIALS){
for (int j=0; j<botRoles[i].getNumBullet(); j++){// looks for the first unused bullet slot
if (bullets[i][j] == null&&botRoles[i].getBulletsLeft()>0)
{
//HelperMethods.say("Health before "+botRoles[target.getBotNumber()].getHealth());
botRoles[target.getBotNumber()].heal();
bullets[i][j] = new Bullet(BulletType.HEAL);
botRoles[i].fireBullet();//reduce the amount of bullets by one.
}
//HelperMethods.say("after "+botRoles[target.getBotNumber()].getHealth());
}//end for
}//end if inrange
}
else if (botRoles[i].getRole() == RoleType.SUPPORT){
BotInfo target = bots[i].getTarget();
//HelperMethods.say("Bullets before "+target.getBulletsLeft());
double d = Math.sqrt(Math.pow(botsInfo[i].getX()-target.getX(),2)+Math.pow(botsInfo[i].getY()-target.getY(),2));
if (d <= Bot.RADIUS*Math.sqrt(2)|| OMNI_SPECIALS){
for (int j=0; j<botRoles[i].getNumBullet(); j++){// looks for the first unused bullet slot
if (bullets[i][j] == null&&botRoles[i].getBulletsLeft()>0)
{
HelperMethods.say("Bullets before "+target.getBulletsLeft());
botRoles[target.getBotNumber()].supply();
bullets[i][j] = new Bullet(BulletType.SUPPLY);
botRoles[i].fireBullet();//reduce the amount of bullets by one.
}
}//end for
HelperMethods.say("after "+target.getBulletsLeft());
}//end if inrange
}
}//end else
}//end switch
// 5. Bot collisions
if (move == UP || move == DOWN || move == LEFT || move == RIGHT|| move == SPECIAL) // if a move was made...
{
// 5a. other bots
for (int j=0; j<NUM_BOTS; j++)
{
if (j!=i && !botsInfo[i].isOut()) // don't collide with self or bots that are out
{
double d = Math.sqrt(Math.pow(botsInfo[i].getX()-botsInfo[j].getX(),2)+Math.pow(botsInfo[i].getY()-botsInfo[j].getY(),2));
if (d < Bot.RADIUS*2)
{
//Rowbottom this part handles touching other bots and looting bodies
//left here but modified to allow for classes to use heal and supply
//if (botsInfo[j].getBulletsLeft()>0&&botsInfo[j].isDead()){
//botsInfo[i].setBulletsLeft(botsInfo[i].getBulletsLeft()+botsInfo[j].getBulletsLeft());
// botsInfo[j].setBulletsLeft(0);
// }
// reverse the previous move on collision
if (move == UP)
botsInfo[i].setY(botsInfo[i].getY()+BOT_SPEED);
else if (move == DOWN)
botsInfo[i].setY(botsInfo[i].getY()-BOT_SPEED);
else if (move == LEFT)
botsInfo[i].setX(botsInfo[i].getX()+BOT_SPEED);
else if (move == RIGHT)
botsInfo[i].setX(botsInfo[i].getX()-BOT_SPEED);
break;
}
// else if (d < Bot.RADIUS*2.9 && move == SPECIAL){//allow supply and heal on diagonals
// if (botRoles[i].getRole() == RoleType.MEDIC){
// botRoles[bots[i].getTarget().getBotNumber()].heal();
// }
// else if (botRoles[i].getRole() == RoleType.SUPPORT){
// botRoles[bots[i].getTarget().getBotNumber()].supply();
// }
//
// }
}
}
// 5b. wall collisions - reset the bot to be inside the boundaries
if (botsInfo[i].getX() < LEFT_EDGE)
botsInfo[i].setX(LEFT_EDGE);
if (botsInfo[i].getX() > RIGHT_EDGE-Bot.RADIUS*2)
botsInfo[i].setX(RIGHT_EDGE-Bot.RADIUS*2);
if (botsInfo[i].getY() < TOP_EDGE)
botsInfo[i].setY(TOP_EDGE);
if (botsInfo[i].getY() > BOTTOM_EDGE-Bot.RADIUS*2)
botsInfo[i].setY(BOTTOM_EDGE-Bot.RADIUS*2);
}
}
}
// 6. in test mode, force a bot move
if (state == TEST_MODE && gotBot == i)
{
botsInfo[i].setX(forceBotX);
botsInfo[i].setY(forceBotY);
}
}
// D. Process the bullet moves/collisions
for (int i=0; i<NUM_BOTS; i++)
for (int k=0; k<botRoles[i].getNumBullet(); k++)
{
if (bullets[i][k] != null ){
if (bullets[i][k].type == BulletType.BULLET)
{
bullets[i][k].moveOneStep();
// 6a. destroy bullet if off screen
if (bullets[i][k].getX() < LEFT_EDGE || bullets[i][k].getX() > RIGHT_EDGE ||
bullets[i][k].getY() < TOP_EDGE || bullets[i][k].getY() > BOTTOM_EDGE)
{
bullets[i][k] = null;
}
else // 6b. otherwise, check for bot collisions
{
if (state != TEST_MODE) // not if in test mode
{
for (int j = 0; j<NUM_BOTS; j++)
{
if (!botsInfo[j].isOut() && i != j)
{
double d = Math.sqrt(Math.pow(bullets[i][k].getX()-(botsInfo[j].getX()+Bot.RADIUS),2)+Math.pow(bullets[i][k].getY()-(botsInfo[j].getY()+Bot.RADIUS),2));
if (d < Bot.RADIUS) // hit something
{
bullets[i][k] = null; // no more bullet
if (botsInfo[j].isDead() == false) // kill bot if possible
{
//if the victim has health then subtract 1
if (botRoles[j].getHealth()>1){
botRoles[j].wound();
//HelperMethods.say("Ouch!");
}
else {
if (soundOn){
death.play();
}
botsInfo[i].addKill();
botsInfo[j].killed(botsInfo[i].getName());
botsInfo[j].setTimeOfDeath(timePlayed);
botsInfo[j].setScore(currentScore(j,false)); // final score of dead bot
//botsInfo[i].setScore(currentScore(i,false));
botsLeft--;
sendMessage(SYSTEM_MSG, botsInfo[j].getName()+" destroyed by "+botsInfo[i].getName()+".");
}
}//if the bot was alive
break; // only one collision per bullet
}//if a bot was hit
}
}//end for loop to check for collisions
}//end if not test mode
}//else check collisions
}//if its a bullet
else {
//checks and ticks down the cooldown on the special bullets
bullets[i][k].coolDownTick();
// HelperMethods.say("OMG, this actually works!"+bullets[i][k].getCoolDown());
if (bullets[i][k].coolDownTick()){
// HelperMethods.say("OMG, this actually works!");
bullets[i][k] = null;
}
}//end else its a special
}//end if not null
}//end for loop bullets
}//end active game
// paint the screen
paintBuffer();
}//end active game
// *** paused or instant replay mode?
else if (state == GAME_PAUSED || state == GAME_OVER || state == WINNER)
{
if (--pauseCount <= 0)
pauseCount = PAUSE_FLASH_TIME;
if (++replayCounter >= this.REPLAY_SPEED)
{
replayCounter = 0;
if (replayCurrentFrame == replayEndFrame && endFrameCounter > 0)
endFrameCounter--;
else
{
if (++replayCurrentFrame >= NUM_FRAMES)
replayCurrentFrame = 0;
if (replayCurrentFrame == replayEndFrame)
endFrameCounter = END_FRAME_COUNT;
}
}
// paint the screen
repaint();
}
else // countdown to the start
{
if (++replayEndFrame >= NUM_FRAMES)
replayEndFrame = 0;
countDown--;
if (countDown == 0)
{
startTime = System.currentTimeMillis();
if (soundOn)
drone.loop();
}
// paint the screen
paintBuffer();
}
}
/**
* Sends a broadcast message to the bots.
* @param id Message sender
* @param msg Message
*/
private void sendMessage(int id, String msg)
{
if (msg != null && !msg.equals(""))
{
msg = msg.substring(0,Math.min(MAX_MESSAGE_LENGTH,msg.length()));
// send the message to the bots
for (int i = 0; i<NUM_BOTS; i++)
if (!botsInfo[i].isDead() && !botsInfo[i].isOut() && !botsInfo[i].isOverheated())
{
// BOT METHOD CALL - timed and exceptions caught
long startThink = System.nanoTime();
try {
bots[i].incomingMessage(id, msg);
}
catch(Exception e)
{
botsInfo[i].exceptionThrown(e);
}
botsInfo[i].setThinkTime((System.nanoTime()-startThink)*nanoTimeCorrection);
// ***********************
}
// echo the message to the screen
if (id >= 0)
{
botsInfo[id].sentMessage(); // increment messages sent by bot
messages.addFirst(botsInfo[id].getName()+": "+msg);
// check if over limit
if (botsInfo[id].getNumMessages() >= TIME_LIMIT/SECS_PER_MSG)
sendMessage(-1,"Messages capped for "+botsInfo[id].getName());
}
else
messages.addFirst("Referee: "+msg);
// reset the scroll every time a message sent
firstMessage = 0;
}
}
/**
* Computes the score for a given bot
* @param botNum The bot to compute score for
* @param gameOver Whether or not the game is over (full score alloted in this case)
* @return The score
*/
@SuppressWarnings("unused")
private double currentScore(int botNum, boolean gameOver)
{
double score;
//Rowbottom handling score so that it does not increase bonuses by round
if (ELIMINATIONS_PER_ROUND==0){
score = KILL_SCORE * botsInfo[botNum].getNumKills() - ERROR_PENALTY * botsInfo[botNum].getNumExceptions() + EFFICIENCY_BONUS * (PROCESSOR_LIMIT - botsInfo[botNum].getThinkTime());
if (score < 0)
score = 0;
if (gameOver)
score += TIME_LIMIT * POINTS_PER_SECOND;
else
{
if (botsInfo[botNum].getTimeOfDeath() > 0)
score += botsInfo[botNum].getTimeOfDeath()*POINTS_PER_SECOND;
else
score += timePlayed*POINTS_PER_SECOND;
}
}
else{
score = KILL_SCORE * botsInfo[botNum].getNumKills() * (round+1.0)/2 - ERROR_PENALTY * botsInfo[botNum].getNumExceptions() + EFFICIENCY_BONUS * (PROCESSOR_LIMIT - botsInfo[botNum].getThinkTime());
if (score < 0)
score = 0;
if (gameOver)
score += TIME_LIMIT * POINTS_PER_SECOND * (round+1.0)/2;
else
{
if (botsInfo[botNum].getTimeOfDeath() > 0)
score += botsInfo[botNum].getTimeOfDeath()*POINTS_PER_SECOND*(round+1.0)/2;
else
score += timePlayed*POINTS_PER_SECOND*(round+1.0)/2;
}
}
return score < 0?0:score;
}
/**
* Sorts the botInfo array by score.
* @param descending If true, sorts in descending order. Ascending otherwise
* @return the sorted array
*/
private BotInfo[] sortedBotInfoArray(boolean descending)
{
// Create a new array for sorting
BotInfo[] newInfos = new BotInfo[NUM_BOTS];
for (int i=0; i<NUM_BOTS; i++)
{
newInfos[i] = botsInfo[i];
}
// Bubblesort. I know, I know...
for (int i=NUM_BOTS-1; i>0; i--)
for (int j=1; j<=i; j++)
{
double score1 = newInfos[j].getScore()+newInfos[j].getCumulativeScore();
double score2 = newInfos[j-1].getScore()+newInfos[j-1].getCumulativeScore();
if (descending && score1 > score2
|| !descending && score1 < score2
|| descending && score1 == score2 && !(newInfos[j].isOut()
|| newInfos[j].isOutNextRound()) && (newInfos[j-1].isOut()||newInfos[j-1].isOutNextRound())
)
{
BotInfo temp = newInfos[j-1];
newInfos[j-1] = newInfos[j];
newInfos[j] = temp;
}
}
// return the sorted array
return newInfos;
}
/**
* Increases the game speed (
*/
private void changeGameSpeed()
{
if (speed < 8)
speed *= 2;
gameTimer.setDelay(1000/30/speed);
}
/**
* Decreases the game speed
*/
private void changeGameSpeedDown()
{
if (speed > 1)
speed /= 2;
gameTimer.setDelay(1000/30/speed);
}
/**
* Resets the game speed
*/
private void resetGameSpeed()
{
speed = 1;
gameTimer.setDelay(1000/30/speed);
}
/**
* This method paints the bots and bullets for the game area into
* the instant replay buffer. Then it calls a repaint to trigger
* a call to the paint method which displays this buffer to the
* screen.
*/
private void paintBuffer()
{
//System.out.println("painting");
if (ready) // avoid race condition on startup
{
// get the next image from the rotating instant replay buffer
Graphics g = replayImages[replayEndFrame].getGraphics();
Graphics2D g2D = (Graphics2D)(g); //Rowbottom
// a little trick to get imageobserver callbacks when the bot images are loaded
// may not be necessary any more in 2.0
if (imagesToLoad.size() > 0)
{
LinkedList<Image> newImagesToLoad = new LinkedList<Image>();
Iterator<Image> i = imagesToLoad.iterator();
while (i.hasNext())
{
Image image = i.next();
if (!g.drawImage(image,-10000,-10000,this))
newImagesToLoad.add(image);
}
imagesToLoad = newImagesToLoad;
}
// clear the screen
g.setColor(Color.black);
g.fillRect(0,0,RIGHT_EDGE,BOTTOM_EDGE+TEXT_BUFFER);
// Draw the bots & their bullets
for (int i=0; i<NUM_BOTS; i++)
{
if (!botsInfo[i].isOut()) // skip bots that are out
if (botsInfo[i].isDead()) // dead bot
g.drawImage(deadBot, (int)(botsInfo[i].getX()+0.5), (int)(botsInfo[i].getY()+0.5), Bot.RADIUS*2, Bot.RADIUS*2, this);
else if (botsInfo[i].isOverheated()) // overheated bot
g.drawImage(overheated, (int)(botsInfo[i].getX()+0.5), (int)(botsInfo[i].getY()+0.5), Bot.RADIUS*2, Bot.RADIUS*2, this);
else // active bot
{
// BOT METHOD CALL - timed and exceptions caught
long startThink = System.nanoTime();
try {
if (state == GAME_ON){
//Rowbottom draw the health if active mode
//set the team colour
g2D.setColor(teamColors[i/TEAM_SIZE]);
g2D.setStroke(new BasicStroke(3F)); // set stroke width of 5
g2D.drawArc((int)(botsInfo[i].getX()-2), (int)(botsInfo[i].getY()-2),
Bot.RADIUS*2+4, Bot.RADIUS*2+4,0,(int)(360*(botRoles[i].getHealth()/(double)botRoles[i].getMaxHealth())));
}
bots[i].draw(g, (int)(botsInfo[i].getX()+0.5), (int)(botsInfo[i].getY()+0.5));
}
catch(Exception e)
{
botsInfo[i].exceptionThrown(e);
}
botsInfo[i].setThinkTime((System.nanoTime()-startThink)*nanoTimeCorrection);
// ***********************
// special test mode output
if (state == TEST_MODE)
{
if (flashCounter < FLASH_TIME/2)
{
g.setColor(Color.red);
g.drawOval((int)(botsInfo[i].getX()+0.5)-1, (int)(botsInfo[i].getY()+0.5)-1, Bot.RADIUS*2+2, Bot.RADIUS*2+2);
}
if (state == TEST_MODE)
{
g.setFont(new Font("MonoSpaced",Font.PLAIN,NAME_FONT));
g.setColor(Color.gray);
g.drawString(""+botsInfo[i].getNumExceptions(), (int)(botsInfo[i].getX()+0.5)+Bot.RADIUS*2+2, (int)(botsInfo[i].getY()+0.5)+Bot.RADIUS);
g.drawString(""+df2.format(botsInfo[i].getThinkTime()), (int)(botsInfo[i].getX()+0.5)+Bot.RADIUS*2+2, (int)(botsInfo[i].getY()+0.5)+Bot.RADIUS+NAME_FONT);
}
}
}
// bullets for bot i
for (int j=0; j<botRoles[i].getNumBullet(); j++)
{
if (bullets[i][j] != null){
// bullets[i][j].draw(g);
bullets[i][j].draw(g2D);//rowbottom
}
}
}
// draw the bot titles
// these are drawn last so they're on top of the other bots
for (int i=0; i<NUM_BOTS; i++)
{
if (botsInfo[i].isDead() == false && botsInfo[i].isOut() == false)
{
g.setFont(new Font("MonoSpaced",Font.PLAIN,NAME_FONT));
// default is red, but goes to gray if they can take a shot
g.setColor(new Color (170,42,42));
if (!botsInfo[i].isOverheated())
for (int j=0; j<botRoles[i].getNumBullet(); j++)
if (bullets[i][j] == null)
{
g.setColor(Color.gray);
break;
}
// get and display the bots title
String title = "";
if (showNames)
title = botsInfo[i].getName();
else if (showScores)
title = ""+df.format(botsInfo[i].getCumulativeScore());//Rowbottom
else if (showAmmo)
title = ""+botRoles[i].getBulletsLeft();
// x calculation based on x-width of 0.5 font size with a one pixel spacer between letters
g.drawString(title, (int)(botsInfo[i].getX()+Bot.RADIUS-(title.length()/2.0*(NAME_FONT*0.5+1))+0.5), (int)(botsInfo[i].getY()-1+0.5));
}
}
// trigger a paint event
repaint();
}
}
/**
* This method prints out the stats for each robot in sorted order.
* Used at the end of each round, and also during the game when the
* DEBUG flag is set.
* @param g The Graphics object to draw on
*/
private void printStats(Graphics g)
{
BotInfo[] newInfos = sortedBotInfoArray(true);
int xOffset = 5;
int yOffset = 50;
if (state != WAIT_TO_START)
{
g.setColor(new Color(60,60,60,130));
g.fillRect(0, yOffset-STATS_FONT-5, RIGHT_EDGE, STATS_FONT*(NUM_BOTS+1)+10+24);
g.setColor(Color.white);
g.setFont(new Font("MonoSpaced",Font.BOLD,24));
g.drawString("Stats for Round "+round, (RIGHT_EDGE+LEFT_EDGE)/2-120, yOffset);
yOffset += 24;
g.setFont(new Font("MonoSpaced",Font.PLAIN,STATS_FONT));
g.drawString("Name Team Round Total Time Errors Messages Processor Killed By",xOffset,yOffset);
for (int i=0; i<NUM_BOTS; i++)
{
String output = pad(newInfos[i].getName(), 8, false) + " " + pad(newInfos[i].getTeamName(),8, false)+" ";
output += (newInfos[i].isOut()?" ":pad(df.format(newInfos[i].getScore()),5, true))+" "+pad(df.format(newInfos[i].getScore()+newInfos[i].getCumulativeScore()),5, true)+" ";
if (!newInfos[i].isOut())
{
output += (newInfos[i].isDead()?pad(df.format(newInfos[i].getTimeOfDeath()),5,true):(state == GAME_OVER || state == WINNER?pad(df.format(TIME_LIMIT),5,true):pad(df.format(timePlayed),5,true)))+" ";
output += pad(""+newInfos[i].getNumExceptions(),6,true)+" "+pad(""+newInfos[i].getNumMessages(),4,true)+" ";
output += pad(df2.format(newInfos[i].getThinkTime()),8, true)+" "+pad(newInfos[i].getKilledBy(),8,false);
}
if (newInfos[i].isDead() && state != GAME_OVER && state != WINNER || newInfos[i].isOut() || state == GAME_OVER && newInfos[i].isOutNextRound() || state == WINNER && i != 0)
g.setColor(Color.gray);
else
g.setColor(Color.lightGray);
g.drawString(output,xOffset,yOffset+STATS_FONT+i*STATS_FONT);
}
}
}
/**
* Special string padding method for printStats
* @param s The string to pad
* @param n The target length
* @param rightJust Right justify if true, otherwise left justify.
* @return The padded string
*/
private String pad(String s, int n, boolean rightJust)
{
if (s == null)
s = "";
int l = s.length();
for (int i=l; i < n; i++)
if (rightJust)
s = " " + s;
else
s = s + " ";
l = s.length();
if (l > n)
s = s.substring(0, n);
return s;
}
/**
* Paints the screen. Assumes that paintBuffer() has been called recently
* to paint the current game state into the instant replay buffer.
* @param g The Graphics context
*/
public void paintComponent(Graphics g)
{
super.paintComponent(g);
if (ready) // avoid race condition on startup
{
// switch g to the offline buffer (double-buffering)
//Graphics g2 = g;
//g = buffer.getGraphics();
// black out hte screen
g.setColor(Color.black);
g.fillRect(0,0,getWidth(),getHeight());
// draw the main window
if (state == GAME_PAUSED || state == GAME_OVER || state == WINNER)
g.drawImage(replayImages[replayCurrentFrame], 0, 0, this); // draws from the instant replay buffer
else
g.drawImage(replayImages[replayEndFrame], 0, 0, this); // draws the latest frame if game is on
// Message bars
if (state == GAME_PAUSED)
{
g.setColor(new Color(60,60,60,175));
g.fillRect(0, BOTTOM_EDGE - 30, RIGHT_EDGE, 26);
g.setColor(Color.white);
g.setFont(new Font("MonoSpaced",Font.BOLD, 20));
g.drawString("Game Paused. Showing Instant Replay.",10,BOTTOM_EDGE - 10);
}
else if (state == GAME_OVER)
{
g.setColor(new Color(60,60,60,175));
g.fillRect(0, BOTTOM_EDGE - 30, RIGHT_EDGE, 26);
g.setColor(Color.white);
g.setFont(new Font("MonoSpaced",Font.BOLD, 20));
if (CUMULATIVE_SCORING)
g.drawString(botsInfo[winnerID].getName()+" Leading After "+round+" Round"+(round>1?"s":"")+". Click This Bar to Continue.",10,BOTTOM_EDGE - 10);
else
g.drawString(botsInfo[winnerID].getName()+" Wins Round "+round+". Click This Bar to Continue.",10,BOTTOM_EDGE - 10);
printStats(g);
}
else if (state == WINNER)
{
g.setColor(new Color(60,60,60,175));
g.fillRect(0, BOTTOM_EDGE - 30, RIGHT_EDGE, 26);
g.setColor(Color.white);
g.setFont(new Font("MonoSpaced",Font.BOLD, 20));
if (CUMULATIVE_SCORING)
g.drawString(botsInfo[winnerID].getName()+" Wins after "+round+" Round"+(round>1?"s":"")+"! Click This Bar to Restart.",10,BOTTOM_EDGE - 10);
else
g.drawString(botsInfo[winnerID].getName()+" Wins the Final Round! Click This Bar to Restart.",10,BOTTOM_EDGE - 10);
printStats(g);
}
else if (state == TEST_MODE)
{
g.setColor(new Color(60,60,60,175));
g.fillRect(0, BOTTOM_EDGE - 30, RIGHT_EDGE, 26);
g.setColor(Color.white);
g.setFont(new Font("MonoSpaced",Font.BOLD, 20));
g.drawString("Welcome to Battle Bots. Click This Bar to Start.",10,BOTTOM_EDGE-10);
}
else if (state == WAIT_TO_START)
{
g.setColor(new Color(60,60,60,175));
g.fillRect(0, BOTTOM_EDGE - 30, RIGHT_EDGE, 26);
g.setColor(Color.white);
g.setFont(new Font("MonoSpaced",Font.BOLD, 22));
if (botsLeft <= ELIMINATIONS_PER_ROUND+1)
g.drawString("Click This Bar to Start the Final Round.",10,BOTTOM_EDGE - 10);
else
g.drawString("Click This Bar to Start Round "+round+".",10,BOTTOM_EDGE - 10);
// display the rules
g.setColor(Color.white);
if (round == 1)
{
g.setFont(new Font("MonoSpaced",Font.BOLD, 80));
g.drawString("Battle", RIGHT_EDGE-350, TOP_EDGE+90);
g.drawString("Bots", RIGHT_EDGE-300, TOP_EDGE+160);
}
else
{
g.setFont(new Font("MonoSpaced",Font.BOLD, 80));
if (botsLeft <= ELIMINATIONS_PER_ROUND+1)
{
g.drawString("Final", RIGHT_EDGE-300, TOP_EDGE+90);
g.drawString("Round", RIGHT_EDGE-300, TOP_EDGE+160);
}
else
{
g.drawString("Round", RIGHT_EDGE-300, TOP_EDGE+90);
g.drawString("*"+round+"*", RIGHT_EDGE-250, TOP_EDGE+160);
}
}
g.setFont(new Font("MonoSpaced",Font.BOLD, 22));
int y = (TOP_EDGE+BOTTOM_EDGE)/2;
g.drawString("The Rules", 10, y);
g.setColor(Color.lightGray);
g.setFont(new Font("MonoSpaced",Font.PLAIN, 14));
y+=16;
if (round == 1)
g.drawString("- "+NUM_BOTS+" robots to start",10,y);
else
g.drawString("- "+(NUM_BOTS-ELIMINATIONS_PER_ROUND*(round-1))+" robots left",10,y);
y+=15;
g.drawString("- each round lasts "+TIME_LIMIT+" seconds",10,y);
y+=15;
g.drawString("- "+ELIMINATIONS_PER_ROUND+" robots eliminated each round",10,y);
y+=15;
g.drawString("- each robot can have a limited amount of bullets active at once",10,y);
y+=15;
g.drawString("- each robot can send "+(int)(TIME_LIMIT/SECS_PER_MSG)+" messages per round",10,y);
y+=15;
g.drawString("- each robot has "+PROCESSOR_LIMIT+" seconds of processor time",10,y);
y+=26;
g.setFont(new Font("MonoSpaced",Font.BOLD, 22));
g.setColor(Color.white);
g.drawString("Scoring", 10, y);
g.setFont(new Font("MonoSpaced",Font.PLAIN, 14));
g.setColor(Color.lightGray);
y+=16;
g.drawString("- "+df.format(KILL_SCORE*(round+1.0)/2)+" points per kill, "+df.format(POINTS_PER_SECOND*(round+1.0)/2*10)+" points per 10 seconds of survival",10,y);
y+=15;
g.drawString("- "+EFFICIENCY_BONUS+" point bonus for each unused second of processor time",10,y);
y+=15;
g.drawString("- "+ERROR_PENALTY+" point penalty for each exception thrown",10,y);
y+=15;
if (CUMULATIVE_SCORING)
g.drawString("- scores accumulate from round to round",10,y);
else
g.drawString("- robots' scores are reset between rounds",10,y);
}
// the menu
if (showNames)
{
g.setColor(new Color(60,60,60,175));
g.fillRect(RIGHT_EDGE-125, BOTTOM_EDGE+56, 49, 18);
g.setColor(new Color(40,40,40,175));
g.drawRect(RIGHT_EDGE-125, BOTTOM_EDGE+56, 49, 18);
}
else if (showAmmo)
{
g.setColor(new Color(60,60,60,175));
g.fillRect(RIGHT_EDGE-125, BOTTOM_EDGE+76, 49, 18);
g.setColor(new Color(40,40,40,175));
g.drawRect(RIGHT_EDGE-125, BOTTOM_EDGE+76, 49, 18);
}
else if (showScores)
{
g.setColor(new Color(60,60,60,175));
g.fillRect(RIGHT_EDGE-74, BOTTOM_EDGE+56, 54, 18);
g.setColor(new Color(40,40,40,175));
g.drawRect(RIGHT_EDGE-74, BOTTOM_EDGE+56, 54, 18);
}
if (soundOn)
{
g.setColor(new Color(60,60,60,175));
g.fillRect(RIGHT_EDGE-74, BOTTOM_EDGE+76, 54, 18);
g.setColor(new Color(40,40,40,175));
g.drawRect(RIGHT_EDGE-74, BOTTOM_EDGE+76, 54, 18);
}
g.setColor(Color.gray);
g.setFont(new Font("MonoSpaced",Font.BOLD, 14));
g.drawString("Roles Scores", RIGHT_EDGE-120, BOTTOM_EDGE+69);
g.drawString("Ammo Sounds", RIGHT_EDGE-120, BOTTOM_EDGE+89);
// the time clock
if (state != GAME_PAUSED || pauseCount < PAUSE_FLASH_TIME/2)
{
g.setColor(Color.gray);
g.setFont(new Font("MonoSpaced",Font.BOLD, 30));//rowbottom
g.drawString(""+pad(df.format(Math.abs(TIME_LIMIT-timePlayed)),5,true),RIGHT_EDGE-152,BOTTOM_EDGE+40);
g.setFont(new Font("MonoSpaced",Font.BOLD, 10));//rowbottom
g.drawString("round "+round+" of "+ NUM_ROUNDS,RIGHT_EDGE-100,BOTTOM_EDGE+10);//rowbottom
if (speed != 1)
{
g.setFont(new Font("MonoSpaced",Font.BOLD, 10));
g.drawString("x"+speed,RIGHT_EDGE-12,BOTTOM_EDGE+40);
}
}
// the message area
g.setFont(new Font("MonoSpaced",Font.PLAIN, 12));
int offSet = 14;
int counter = 0;
double fade = 1;
Iterator<String> i = messages.iterator();
while (i.hasNext() && counter < 6 + firstMessage)
{
String msg = i.next();
if (counter >= firstMessage)
{
if (msg.startsWith("Referee"))
g.setColor(new Color((int)(128*fade),(int)(128*fade),(int)(128*fade)));
else
g.setColor(new Color((int)(128*fade),(int)(128*fade),0));
g.drawString(msg.substring(0,Math.min(77,msg.length())),10,BOTTOM_EDGE+TEXT_BUFFER - offSet);
offSet += 14;
//fade /= 1.15;
}
counter++;
}
// print the stats if in debug mode
if (DEBUG && state != TEST_MODE && state != GAME_OVER && state != WINNER )
printStats(g);
// draw the lines to separate screen areas
g.setColor(Color.gray);
g.drawLine(0, BOTTOM_EDGE+1, getWidth(), BOTTOM_EDGE+1);
g.drawLine(0, TOP_EDGE-1, getWidth(), TOP_EDGE-1);
g.drawLine(RIGHT_EDGE-145,BOTTOM_EDGE+1,RIGHT_EDGE-145,getHeight());
g.drawLine(RIGHT_EDGE-145,BOTTOM_EDGE+50,getWidth(),BOTTOM_EDGE+50);
// dump the offline buffer to the screen (double-buffering)
//g2.drawImage(buffer,0,0,this);
}
}
/**
* Handles user's mouse clicks on the menu buttons, the time clock,
* and the "click here" bars.
* @param e The MouseEvent
*/
public void mousePressed(MouseEvent e) {
if (e.getButton() == MouseEvent.BUTTON1) // left button only
{
if (e.getY()<BOTTOM_EDGE) // click is on the playing field
{
if (state == WAIT_TO_START && (e.getY()>BOTTOM_EDGE-30)) // clicked on the wait to start message bar
{
if (soundOn)
fanfare.play();
countDown = 60;//where does this impact?
startTime = System.currentTimeMillis();
gameTimer.start();
if (botsLeft <= ELIMINATIONS_PER_ROUND+1)
sendMessage(SYSTEM_MSG,"Final Round starting. Good luck!");
else
sendMessage(SYSTEM_MSG,"Round "+round+" starting. Good luck!");
state = GAME_ON;
}
else if (state == GAME_OVER && e.getY()>BOTTOM_EDGE-30) // clicked on the click for next round bar
{
if (soundOn)
stop.play();
gameTimer.stop();
timePlayed = 0;
state = WAIT_TO_START;
reset();
}
else if (state == WINNER && e.getY()>BOTTOM_EDGE-30) // clicked on the reset bar
fullReset();
else if (state == TEST_MODE) // in test mode
{
// check for and process bot grabs
gotBot = -1;
for (int i=0; i<NUM_BOTS; i++)
{
if (e.getX() > botsInfo[i].getX() && e.getX() < botsInfo[i].getX()+Bot.RADIUS*2 &&
e.getY() > botsInfo[i].getY() && e.getY() < botsInfo[i].getY()+Bot.RADIUS*2)
{
gotBot = i;
forceBotX = (int)(botsInfo[i].getX()+0.5);
forceBotY = (int)(botsInfo[i].getY()+0.5);
mouseInitialX = e.getX();
mouseInitialY = e.getY();
}
}
// if no bot grab, check if on the "click to start" bar
if (gotBot == -1 && e.getY()>BOTTOM_EDGE-30)
{
if (soundOn)
stop.play();
gameTimer.stop();
state = WAIT_TO_START;
round = 0;
reset();
}
}
}
// click is on the lower message/menu area
else if(e.getX()>=RIGHT_EDGE-145 && e.getY() < BOTTOM_EDGE+50) // click on clock
{
if (state == GAME_PAUSED) // unpause
{
if (soundOn)
drone.loop();
startTime = System.currentTimeMillis();
state = GAME_ON;
}
else if (state == GAME_ON && countDown <= 0) // pause
{
drone.stop();
if (soundOn)
stop.play();
pauseTime = System.nanoTime();
pauseCount = PAUSE_FLASH_TIME;
replayCurrentFrame = replayEndFrame;
endFrameCounter = END_FRAME_COUNT;
state = GAME_PAUSED;
resetGameSpeed();
}
}
else if(e.getX()>=RIGHT_EDGE-125 && e.getX()<=RIGHT_EDGE-125+49)// clicked on names or teams button
{
if (e.getY()>=BOTTOM_EDGE+56)
if (e.getY()>=BOTTOM_EDGE+76) // ammo button
{
if (showAmmo)
showAmmo = false;
else
{
showAmmo = true;
showScores = false;
showNames = false;
}
}
else if (showNames) // names button
showNames = false;
else
{
showNames = true;
showScores = false;
showAmmo = false;
}
}
else if(e.getX()>=RIGHT_EDGE-74 && e.getX()<=RIGHT_EDGE-69+55)// clicked on sound or scores button
{
if (e.getY()>=BOTTOM_EDGE+56)
if (e.getY()>=BOTTOM_EDGE+76) // sound
{
if (soundOn)
{
soundOn = false;
drone.stop();
}
else
{
if (state == GAME_ON)
drone.loop();
soundOn = true;
}
}
else if (showScores) // scores
showScores = false;
else
{
showScores = true;
showNames = false;
showAmmo = false;
}
}
// paint the screen
paintBuffer();
}
}
/**
* @author Rowbottom
* method gets the roles frm the bots
*/
protected Role[] getRoles(Bot[] bots){
Role[] tempRoles = new Role[bots.length];
for (int i = 0 ; i < bots.length; i++){
tempRoles[i] = bots[i].getRole();
if (tempRoles[i] == null){
tempRoles[i] = new Role();
}
}
return tempRoles;
}
/**
* When a mouse button is released, release any grabbed bot.
* @param e The MouseEvent
*/
public void mouseReleased(MouseEvent e) {
gotBot = -1;
}
/**
* Scroll event. Scroll the messages or change game speed depending on
* location of the mouse.
* @param e The MouseWheelEvent
*/
public void mouseWheelMoved(MouseWheelEvent e) {
if (e.getY() >= BOTTOM_EDGE && e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL)
{
if(e.getX()>=RIGHT_EDGE-145 && e.getY() < BOTTOM_EDGE+50) // change game speed
{
if (state == GAME_ON)
if (e.getWheelRotation() < 0)
changeGameSpeed();
else
changeGameSpeedDown();
}
else if (e.getX()< RIGHT_EDGE-145) // message window scroll
{
firstMessage -= e.getWheelRotation();
if (firstMessage < 0)
firstMessage = 0;
else if (firstMessage > messages.size()-6)
firstMessage = Math.max(0,messages.size()-6);
}
}
// paint the screen
paintBuffer();
}
/**
* Drag a grabbed bot if there is one. The actual force move is processed in
* actionPerformed(). Here we just update the offset that the mouse has moved.
* @param e The MouseEvent
*/
public void mouseDragged(MouseEvent e) {
if (state == TEST_MODE)
{
forceBotX += e.getX()-mouseInitialX;
forceBotY += e.getY()-mouseInitialY;
mouseInitialX = e.getX();
mouseInitialY = e.getY();
}
}
/**
* Unused interface method
*/
public void mouseClicked(MouseEvent e) {}
/**
* Unused interface method
*/
public void mouseEntered(MouseEvent e) {}
/**
* Unused interface mthod
*/
public void mouseExited(MouseEvent e) {}
/**
* Unused interface method
*/
public void mouseMoved(MouseEvent arg0) {}
}
| [
"[email protected]"
] | |
dc2ba1d435e6237e92dae840b3d9b97ec78face1 | 77916a24b7c0e6468c34aeb4399263d0317f69d8 | /src/main/java/frc/robot/subsystems/DistanceSensor.java | 28dd16ec2a0f63e154a1432a11ffed619126dd57 | [] | no_license | FRCTeam3543/Robot2020 | 503cc59893a81c3697e8f3e70fe803743eb16678 | 7d171037cc82a843873aa02d8538f64d7bb836dc | refs/heads/master | 2020-12-09T08:55:30.104401 | 2020-03-10T21:00:45 | 2020-03-10T21:00:45 | 233,255,645 | 1 | 0 | null | 2020-03-08T10:50:23 | 2020-01-11T15:47:36 | Java | UTF-8 | Java | false | false | 882 | java | package frc.robot.subsystems;
import edu.wpi.first.wpilibj.AnalogInput;
import edu.wpi.first.wpilibj.command.Subsystem;
import edu.wpi.first.wpilibj.smartdashboard.SendableRegistry;
public class DistanceSensor extends Subsystem {
final AnalogInput leftSensor;
final AnalogInput rightSensor;
public DistanceSensor() {
super();
this.setName("Distance sensor");
leftSensor = new AnalogInput(Config.ULTRASOUND_LEFT);
SendableRegistry.setName(leftSensor, "Left Distance Sensor");
rightSensor = new AnalogInput(Config.ULTRASOUND_RIGHT);
SendableRegistry.setName(rightSensor, "Right Distance Sensor");
}
@Override
protected void initDefaultCommand() {
}
public void initOperatorInterface() {
//LiveWindow.add(this);
addChild(leftSensor);
addChild(rightSensor);
}
}
| [
"[email protected]"
] | |
52778b8b154a28ee4f9f4e0df58806ed46054e78 | cd12861d7bedb820b2440efb42acf8ba1b4f5436 | /FragmentDemo/app/src/main/java/com/nareshit/fragmentdemo/MainActivity.java | 4e15193e39d1b46e6c58d490064c515138597435 | [] | no_license | nagasaimanoj/Android-Coaching-NareshIT | 05ee2000ae48cef502599d768c62524916d1c582 | 378b221b250fdb19ccc1ff574fcaba790aaba89a | refs/heads/master | 2018-11-27T05:04:28.055030 | 2018-09-05T07:37:42 | 2018-09-05T07:37:42 | 96,038,265 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,123 | java | package com.nareshit.fragmentdemo;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import com.nareshit.fragmentdemo.fragments.DetailsFragment;
import com.nareshit.fragmentdemo.fragments.GamesFragment;
import com.nareshit.fragmentdemo.fragments.MoviesFragment;
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
TextView tvMovies,tvGames,tvDetails;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
tvMovies = (TextView) findViewById(R.id.tvMovies);
tvGames = (TextView) findViewById(R.id.tvGames);
tvDetails = (TextView) findViewById(R.id.tvDetails);
tvDetails.setOnClickListener(this);
tvMovies.setOnClickListener(this);
tvGames.setOnClickListener(this);
Fragment fragment = new MoviesFragment();
FragmentManager fragmentManager = getSupportFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
fragmentTransaction.replace(R.id.flContainer,fragment);
fragmentTransaction.commit();
}
@Override
public void onClick(View view)
{
Fragment fragment = null;
switch (view.getId())
{
case R.id.tvMovies:
fragment = new MoviesFragment();
break;
case R.id.tvGames:
fragment = new GamesFragment();
break;
case R.id.tvDetails:
fragment = new DetailsFragment();
break;
}
FragmentManager fragmentManager = getSupportFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
fragmentTransaction.replace(R.id.flContainer,fragment);
fragmentTransaction.commit();
}
}
| [
"[email protected]"
] | |
14fb5337563dbbd5a3f686bd063e3943ee1269c2 | b4719d55c81edc570ef3eb379cbb9dca4916d5d7 | /Assignment1/src/sample/Controller.java | 05361df0188f122e693dc7737f69e828849fcc09 | [] | no_license | musabbirbaki/CSCI2020U_Assignments | bf8425cd831568d070e0bf245aae620f3a779e2c | fc57085fb0235d8af08fcd2ba8928e9b70a157d5 | refs/heads/master | 2021-04-27T10:32:13.670380 | 2018-03-09T19:48:25 | 2018-03-09T19:48:25 | 122,541,428 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,414 | java | package sample;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.stage.DirectoryChooser;
import javafx.stage.Stage;
import java.io.File;
import java.net.URL;
import java.util.ArrayList;
import java.util.Map;
import java.util.ResourceBundle;
public class Controller implements Initializable {
private Stage stage;
private String dataDirectory;
//declare table veiew
@FXML private TableView<TestFile> tableView;
//declare columns
@FXML private TableColumn<TestFile, String> filenameColumn;
// @FXML private TableColumn<TestFile, Double> spamProbabilityColumn;
@FXML private TableColumn<TestFile, String> spamProbabilityColumn;
@FXML private TableColumn<TestFile, String> actualClassColumn;
@FXML private TextField Accuracy;
@FXML private TextField Precision;
@Override
public void initialize(URL location, ResourceBundle resources) {
System.out.println("Starting Program\nWaiting for User to select Data directory.");
String trainFolderDirectory;
String testFolderDirectory;
//user will select the folder which contains the train and test folder
setDataDirectory();
System.out.println("Chosen directory: " + this.dataDirectory);
//get Train folder directory
trainFolderDirectory = dataDirectory + "/train";
//get Test folder directory
testFolderDirectory = dataDirectory + "/test";
//run train on Train Directory
//can read multiple ham and spam folders
Map<String, Double> probSgivenWord = Train.runTrain(trainFolderDirectory);
//run test on Test Directory
//only reads one folder for spam and ham each
//Threshold: 0.7 means a file is only considered spam if the spam probability is greater than 0.7
Test test = new Test(testFolderDirectory, probSgivenWord, 0.7);
test.runTest();
ArrayList<TestFile> tFilesHam = test.gettFilesHam();
ArrayList<TestFile> tFilesSpam = test.gettFilesSpam();
double accuracy = test.getAccuracy();
double precision = test.getPrecision();
//ObservableList<TestFile> getAllFiles = DataSource.getAllFiles(tFilesHam,tFilesSpam);
showData(tFilesHam,tFilesSpam);
this.Accuracy.setText(accuracy + "");
this.Precision.setText(precision + "");
System.out.println("Completed Testing\nShowing Results.\n");
//System.exit(0);
}
public void setStage(Stage stage) {
this.stage = stage;
}
/**
* This function allows the user to select a proper "data" directory,
* if the directory selected doesn't contain files "test" and "train"
* the user has to retry selecting the directory until "test" and "train"
* files have been found. If the user closes the directory selection
* process. The program terminates using System.exit(0).
*/
private void setDataDirectory() {
try {
DirectoryChooser directoryChooser = new DirectoryChooser();
directoryChooser.setInitialDirectory(new File("."));
File mainDirectory = directoryChooser.showDialog(this.stage);
File[] files = mainDirectory.listFiles();
boolean hasSpam = false;
boolean hasHam = false;
for (File f : files) {
if (f.isDirectory()) {
if (f.getName().toLowerCase().contains("test")) {
hasSpam = true;
}
if (f.getName().toLowerCase().contains("train")) {
hasHam = true;
}
}
}
this.dataDirectory = mainDirectory.getAbsolutePath();
if (!hasSpam && !hasHam) {
System.out.println("Please Reselect data directory.");
AlertBox.display("Error",
"This directory doesn't contain test and train files. \nPlease Reselect data directory.",
"Retry");
setDataDirectory();
}
} catch (NullPointerException n) {
AlertBox.display("Null Pointer Error",
"The program faced a Null Pointer error. \n The program will close.",
"Close Program");
System.exit(0);
} catch (Exception e) {
System.out.println(e);
setDataDirectory();
}
System.out.println("Trying Chosen directory: " + dataDirectory);
}
/**
* This method sets the cell values and sets the items in Table view
*/
private void showData(ArrayList<TestFile> tFilesHam, ArrayList<TestFile> tFilesSpam) {
filenameColumn.setCellValueFactory(new PropertyValueFactory<TestFile, String>("filename"));
// spamProbabilityColumn.setCellValueFactory(new PropertyValueFactory<TestFile, Double>("spamProbability"));
actualClassColumn.setCellValueFactory(new PropertyValueFactory<TestFile, String>("actualClass"));
spamProbabilityColumn.setCellValueFactory(new PropertyValueFactory<TestFile, String>("spamProbability"));
tableView.setItems(DataSource.getAllFiles(tFilesHam, tFilesSpam));
}
}
| [
"[email protected]"
] | |
8e5bc0abfc2004a2d4a4aed2929689e41727b578 | 1373cdcc0bdb2c6b061c3188b18ed71659a18fd6 | /src/br/com/cliente/view/ScreenDelete.java | 273dafff3eeb809b52c06799f78868875c3d401b | [] | no_license | gustavomantovane/javacrud | b91c4bab840a2681f2b06960acfa53397a5af404 | d14ab1c320c34f19c2f5aa1ded9270b96bbf18bd | refs/heads/main | 2023-08-23T21:13:44.331067 | 2021-10-17T16:19:05 | 2021-10-17T16:19:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,185 | java | package br.com.cliente.view;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
import br.com.cliente.dao.ClienteDAO;
import br.com.cliente.model.Cliente;
public class ScreenDelete extends JFrame {
ImageIcon img;
JLabel lblNome;
JTextField txtNome;
JLabel lblID;
JTextField txtID;
JButton btnDelete;
JButton btnBack;
public ScreenDelete() {
setTitle("JavaCRUD");
setLayout(null);
setResizable(false);
setSize(430, 420);
img = new ImageIcon(getClass().getResource("logo.png"));
setIconImage(img.getImage());
lblNome = new JLabel("Nome");
lblNome.setBounds(10, 10, 200, 20);
add(lblNome);
txtNome = new JTextField(250);
txtNome.setBounds(220, 10, 200, 20);
add(txtNome);
lblID = new JLabel("ID");
lblID.setBounds(10, 40, 200, 20);
add(lblID);
txtID = new JTextField(9);
txtID.setBounds(220, 40, 200, 20);
add(txtID);
btnDelete = new JButton("Deletar");
btnDelete.setBounds(10, 340, 200, 30);
btnDelete.addActionListener(delete);
add(btnDelete);
btnBack = new JButton("Voltar");
btnBack.setBounds(220, 340, 200, 30);
btnBack.addActionListener(back);
add(btnBack);
setVisible(true);
}
ActionListener delete = new ActionListener() {
public void actionPerformed(ActionEvent e) {
String erros = "";
if (txtNome.getText().equalsIgnoreCase("")) {
erros += "Preencha o campo Nome \n";
}
if (txtID.getText().equalsIgnoreCase("")) {
erros += "Preencha o campo ID \n";
}
if(erros.equalsIgnoreCase("")) {
Cliente c = new Cliente();
c.setNome(txtNome.getText());
c.setID(Integer.parseInt(txtID.getText()));
ClienteDAO cDAO = new ClienteDAO();
cDAO.delete(c);
} else {
JOptionPane.showMessageDialog(null, erros);
}
}
};
ActionListener back = new ActionListener() {
public void actionPerformed(ActionEvent e) {
setVisible(false);
new ScreenCRUD();
}
};
public static void main(String[] args) {
new ScreenDelete();
}
}
| [
"[email protected]"
] | |
62cd5fa4c71f3a3f6cc377a06544f652f5fe1f92 | 5b9e623ef0dfedbd865923fe5709ff7e363581b9 | /gulimall-core/src/main/java/com/atguigu/gulimall/commons/constant/RabbitMQConstant.java | 9468bfbf71b1dd0c0fc238cb291db7be59262d3d | [] | no_license | lywcode/gulimallFinally | d56a010883eded374575a191b144bd1b63d77893 | 1f14b9c5f4050f266e264a04a227ca1ff3094fe6 | refs/heads/master | 2022-10-20T15:53:06.551028 | 2019-09-08T00:47:10 | 2019-09-08T00:47:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,095 | java | package com.atguigu.gulimall.commons.constant;
public class RabbitMQConstant {
public static final String order_exchange = "order-exchange";
public static final String order_create_event_routing_key = "order.create";
public static final String order_dead_event_routing_key = "order.dead";
public static final String order_dead_release_routing_key = "order.release";
public static final String order_pay_success_routing_key = "order.payed";
public static final String order_quick_create_routing_key = "order.quick.create";
public static final Long order_timeout = 1000*60*3L;//分钟为单位
public static final String order_queue_dead = "order-dead-queue";//过期单队列的名字
public static final String order_queue_release = "order-release-queue";//释放订单的队列
public static final String order_queue_payed = "order-payed-queue";//释放订单的队列
public static final String order_queue_qucik_create = "order-quick-create-queue";
public static final String stock_queue_sub = "stock-sub-queue";//库存扣减队列
}
| [
"[email protected]"
] | |
93a83bff34c96a51f48e786bfd2e13b6fea2c52f | 5b01e35d13c9ac8890869a56dd68e64fb921b79d | /exception-handling/src/main/java/spi/services/exhandler/Interface/HandleAble.java | 4a3b61a56058adc0306652e8fddbc646c38558be | [] | no_license | rajeevkedia2003/ExceptionHandling | 520b5d533b1873df32309c272cacc99d4c9b49c3 | 7a9dd555228350314787a71b34d1b4a4601dfc6c | refs/heads/master | 2021-09-05T21:40:22.055554 | 2018-01-31T06:33:05 | 2018-01-31T06:33:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 141 | java | package spi.services.exhandler.Interface;
/**
* Created by masiaban on 6/4/17.
*/
public interface HandleAble {
boolean doHandle();
}
| [
"[email protected]"
] | |
27d9f7ffee9847e72ea55a3543b8716d51c866bf | b4b9e4e1c4bd1ea16a14715fa60a68a08cdd2448 | /app/src/main/java/com/programacionfacil/miappparte2rbl/Comunicacion1.java | a187d848659b80bbd1811f3110c207b8911e3bca | [] | no_license | ricardobendita/MiAppParte2RBL | 81102c4af9b8fcf9ffbe2127e1fc4e631bd92bf9 | 4e80421cd85d5c4d8b3b104e2252bc6396507e7a | refs/heads/master | 2022-12-25T23:23:58.037156 | 2020-10-10T00:11:16 | 2020-10-10T00:11:16 | 302,466,256 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,117 | java | package com.programacionfacil.miappparte2rbl;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
public class Comunicacion1 extends AppCompatActivity {
EditText edtnombre;
EditText edtingresomes;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_comunicacion1);
edtnombre=findViewById(R.id.edtnombre);
edtingresomes=findViewById(R.id.edtingresomes);
}
public void Verificar(View view){
if(edtnombre.getText().length()!=0 && edtingresomes.getText().length()!=0){
Intent intent = new Intent(this, Comunicacion2.class);
intent.putExtra("nombre", edtnombre.getText().toString());
intent.putExtra("ingresomes", Integer.parseInt(edtingresomes.getText().toString()));
startActivityForResult(intent, 1234);
}else{
Toast.makeText(this,"Debes ingresar un nombre y un ingreso mensual",Toast.LENGTH_LONG).show();
}
}
@Override
protected void onActivityResult(int requestCode,
int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
TextView miresultado = findViewById(R.id.txtvalor);
if (requestCode == 1234 && resultCode == RESULT_OK) {
String res = data.getExtras().getString("resultado");
if (res.equals("aceptado"))
miresultado.setText("Esperamos que trabajar con nosotros sea de su agrado");
else
miresultado.setText("Esperemos que cambie de opinion para trabajar con nosotros");
}
if (requestCode == 3500 && resultCode == RESULT_OK) {
miresultado.setText("Visitenos en alguna de nuestras sucursales");
}
}
public void sucursales(View view) {
startActivityForResult(new Intent(this, Comunicacion3.class), 3500);
}
} | [
"[email protected]"
] | |
4a8028f179c276c0fec9d00b2970d8c3ee688d0a | 3a53421aabee5ae306f69b9f6dfcd23a9d501d63 | /communication/assignment3/A3-Android-App/src/vandy/mooc/model/services/WeatherServiceBase.java | 59b45b3f37b2556e5e695d314dad0cb41111d422 | [] | no_license | MarcoFarrier/POSA-16 | a9e8b525d65f99271c6b39b216bcf172fd8d9987 | 0ebc4174b97383eb3971bd7b4910ab266fe232b3 | refs/heads/master | 2020-12-14T09:58:10.950202 | 2016-04-28T01:11:51 | 2016-04-28T01:11:51 | 53,460,706 | 1 | 0 | null | 2016-03-09T02:13:01 | 2016-03-09T02:13:01 | null | UTF-8 | Java | false | false | 5,271 | java | package vandy.mooc.model.services;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URI;
import java.net.URL;
import java.util.List;
import vandy.mooc.common.ExecutorServiceTimeoutCache;
import vandy.mooc.common.GenericSingleton;
import vandy.mooc.common.LifecycleLoggingService;
import vandy.mooc.model.aidl.WeatherData;
import vandy.mooc.model.aidl.WeatherDataJsonParser;
import android.util.Log;
/**
* This is the super class for both WeatherServiceSync and
* WeatherServiceAsync. It factors out fields and methods that are
* shared by both Service implementations.
*/
public class WeatherServiceBase
extends LifecycleLoggingService {
/**
* Appid needed to access the service. TODO -- fill in with your Appid.
*/
private final String mAppid = "";
/**
* URL to the Weather Service web service.
*/
private String mWeatherServiceURL =
"http://api.openweathermap.org/data/2.5/weather?&APPID="
+ mAppid + "&q=";
/**
* Default timeout is 10 seconds, after which the Cache data
* expires. In a production app this value should be much higher
* (e.g., 10 minutes) - we keep it small here to help with
* testing.
*/
private int DEFAULT_CACHE_TIMEOUT = 10;
/**
* Define a class that will cache the WeatherData since it doesn't
* change rapidly. This class is passed to the
* GenericSingleton.instance() method to retrieve the one and only
* instance of the WeatherCache.
*/
public static class WeatherCache
extends ExecutorServiceTimeoutCache<String, List<WeatherData>> {}
/**
* Hook method called when the Service is created.
*/
@Override
public void onCreate() {
super.onCreate();
// TODO -- you fill in here.
}
/**
* Hook method called when the last client unbinds from the
* Service.
*/
@Override
public void onDestroy() {
super.onDestroy();
// TODO -- you fill in here.
}
/**
* Contitionally queries the Weather Service web service to obtain
* a List of WeatherData corresponding to the @a location if it's
* been more than 10 seconds since the last query to the Weather
* Service. Otherwise, simply return the cached results.
*/
protected List<WeatherData> getWeatherResults(String location) {
Log.d(TAG,
"Looking up results in the cache for "
+ location);
// TODO -- you fill in here.
}
/**
* Actually query the Weather Service web service to get the
* current WeatherData. Usually only returns a single element in
* the List, but can return multiple elements if they are sent
* back from the Weather Service.
*/
private List<WeatherData> getResultsFromWeatherService(String location) {
// Create a List that will return the WeatherData obtained
// from the Weather Service web service.
List<WeatherData> returnList = null;
try {
// Create a URL that points to desired location the
// Weather Service.
URL url =
new URL(mWeatherServiceURL + Uri.encode(location));
final URI uri = new URI(url.getProtocol(),
url.getUserInfo(),
url.getHost(),
url.getPort(),
url.getPath(),
url.getQuery(),
url.getRef());
url = uri.toURL();
// Opens a connection to the Weather Service.
HttpURLConnection urlConnection =
(HttpURLConnection) url.openConnection();
// Sends the GET request and returns a stream containing
// the Json results.
try (InputStream in =
new BufferedInputStream(urlConnection.getInputStream())) {
// Create the parser.
final WeatherDataJsonParser parser =
new WeatherDataJsonParser();
// Parse the Json results and create List of
// WeatherData objects.
returnList = parser.parseJsonStream(in);
} finally {
urlConnection.disconnect();
}
} catch (Exception e) {
e.printStackTrace();
return null;
}
// See if we parsed any valid data.
if (returnList == null
|| returnList.size() == 0) {
Log.d(TAG,
"unable to get information about \""
+ location
+ "\"");
return null;
} else if (returnList.get(0).getMessage() != null) {
// The Weather Service returned an error message.
Log.d(TAG,
returnList.get(0).getMessage()
+ " \""
+ location
+ "\"");
return null;
} else
// Return the List of WeatherData.
return returnList;
}
}
| [
"[email protected]"
] | |
855f0ff63b1baf2b7e269bfc2c6f45f14f92d6bf | d241ec43cffec96c4626fb4f681ce2e5c1ca9a84 | /src/smurfRunner.java | 72706ff58fa506bbb91a6e734fb73709d79dd480 | [] | no_license | League-Level1-Student/level1-module2-JoeJoePotato | b6058d8163176250960a1b413ad7e34fc8cb7a68 | f5e654c206894d226a3fc345d65400bdfa58906f | refs/heads/master | 2020-04-09T21:26:49.280508 | 2018-12-20T02:27:19 | 2018-12-20T02:27:19 | 160,602,488 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 430 | java |
public class smurfRunner {
public static void main(String[] args) {
Smurf a= new Smurf("Handy");
a.eat();
System.out.println(a.getName());
Smurf b=new Smurf("Papa");
System.out.println(b.getName());
System.out.println(b.getHatColor());
System.out.println(b.isGirlOrBoy());
Smurf c=new Smurf("Smurfette");
System.out.println(c.getName());
System.out.println(c.getHatColor());
System.out.println(c.isGirlOrBoy());
}
}
| [
"[email protected]"
] | |
554222a8af784451ed6a30c92391033de5145bdb | 0bfdb25f3669384415c7dc232720081a05c06fd7 | /src/main/java/testClass.java | c8acb520db1821ff2ffafbb60b3b7958c00f56af | [] | no_license | ExperitestOfficial/appium-log-java | 052477c37f9b3c2cec7158127c2aa5101c543f11 | 245c7c29564a6cbd95845f0d7c649e1e83f029df | refs/heads/master | 2021-01-15T18:21:40.330140 | 2017-08-09T08:41:31 | 2017-08-09T08:41:31 | 99,779,139 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 27 | java | public class testClass {
}
| [
"[email protected]"
] | |
e73545d31c8abd2d6300cda3b286c6bce0051d04 | 2eb5604c0ba311a9a6910576474c747e9ad86313 | /chado-pg-orm/src/org/irri/iric/chado/so/MonocistronicHome.java | 85b25802800a62ec07328553816fb976c0a31571 | [] | no_license | iric-irri/portal | 5385c6a4e4fd3e569f5334e541d4b852edc46bc1 | b2d3cd64be8d9d80b52d21566f329eeae46d9749 | refs/heads/master | 2021-01-16T00:28:30.272064 | 2014-05-26T05:46:30 | 2014-05-26T05:46:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,580 | java | package org.irri.iric.chado.so;
// Generated 05 26, 14 1:32:32 PM by Hibernate Tools 3.4.0.CR1
import java.util.List;
import javax.naming.InitialContext;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.LockMode;
import org.hibernate.SessionFactory;
import org.hibernate.criterion.Example;
/**
* Home object for domain model class Monocistronic.
* @see org.irri.iric.chado.so.Monocistronic
* @author Hibernate Tools
*/
public class MonocistronicHome {
private static final Log log = LogFactory.getLog(MonocistronicHome.class);
private final SessionFactory sessionFactory = getSessionFactory();
protected SessionFactory getSessionFactory() {
try {
return (SessionFactory) new InitialContext()
.lookup("SessionFactory");
} catch (Exception e) {
log.error("Could not locate SessionFactory in JNDI", e);
throw new IllegalStateException(
"Could not locate SessionFactory in JNDI");
}
}
public void persist(Monocistronic transientInstance) {
log.debug("persisting Monocistronic instance");
try {
sessionFactory.getCurrentSession().persist(transientInstance);
log.debug("persist successful");
} catch (RuntimeException re) {
log.error("persist failed", re);
throw re;
}
}
public void attachDirty(Monocistronic instance) {
log.debug("attaching dirty Monocistronic instance");
try {
sessionFactory.getCurrentSession().saveOrUpdate(instance);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
public void attachClean(Monocistronic instance) {
log.debug("attaching clean Monocistronic instance");
try {
sessionFactory.getCurrentSession().lock(instance, LockMode.NONE);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
public void delete(Monocistronic persistentInstance) {
log.debug("deleting Monocistronic instance");
try {
sessionFactory.getCurrentSession().delete(persistentInstance);
log.debug("delete successful");
} catch (RuntimeException re) {
log.error("delete failed", re);
throw re;
}
}
public Monocistronic merge(Monocistronic detachedInstance) {
log.debug("merging Monocistronic instance");
try {
Monocistronic result = (Monocistronic) sessionFactory
.getCurrentSession().merge(detachedInstance);
log.debug("merge successful");
return result;
} catch (RuntimeException re) {
log.error("merge failed", re);
throw re;
}
}
public Monocistronic findById(org.irri.iric.chado.so.MonocistronicId id) {
log.debug("getting Monocistronic instance with id: " + id);
try {
Monocistronic instance = (Monocistronic) sessionFactory
.getCurrentSession().get(
"org.irri.iric.chado.so.Monocistronic", id);
if (instance == null) {
log.debug("get successful, no instance found");
} else {
log.debug("get successful, instance found");
}
return instance;
} catch (RuntimeException re) {
log.error("get failed", re);
throw re;
}
}
public List findByExample(Monocistronic instance) {
log.debug("finding Monocistronic instance by example");
try {
List results = sessionFactory.getCurrentSession()
.createCriteria("org.irri.iric.chado.so.Monocistronic")
.add(Example.create(instance)).list();
log.debug("find by example successful, result size: "
+ results.size());
return results;
} catch (RuntimeException re) {
log.error("find by example failed", re);
throw re;
}
}
}
| [
"[email protected]"
] | |
99247982ec9923c3e4f434d341e1e8b388fb5a6c | 9f7be45f62fe27a5cce4f8b45dd13d719259c73d | /src/main/java/com/deo/thymeleafdbdemo/entity/Employee.java | 9c5adcc58f5c0ed87d362e487fe0c2ef8fb5ba05 | [] | no_license | deolexx/thymeleaf-db-demo | 242a5eb13496b08de43c1d469717dfac6c270a30 | 5a950280f7398638270ffa41b6d986f7e6784f58 | refs/heads/main | 2023-02-11T07:42:58.237321 | 2021-01-07T21:16:26 | 2021-01-07T21:16:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,181 | java | package com.deo.thymeleafdbdemo.entity;
import javax.persistence.*;
@Entity
@Table(name = "employee")
public class Employee {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private int id;
@Column(name = "first_name")
private String firstName;
@Column(name = "last_name")
private String lastName;
@Column(name = "email")
private String email;
public Employee(){}
public Employee(String firstName, String lastName, String email) {
this.firstName = firstName;
this.lastName = lastName;
this.email = email;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
}
| [
"[email protected]"
] | |
86bfa2e9e23784094f04c71cd0ce35124279aecf | bf6744aecaf573c6e028005d119fc1d922777b9b | /src/main/java/com/sapestore/service/ReviewService.java | 7d4709349eec8c398dde663f2c46e9c7a82dcadd | [] | no_license | gursharan1512/SapeStore | b2f45ec55d3b1e7509434afd9381ea5858923d20 | 8b39a794f61488674ffc07efe018d79297cf6d05 | refs/heads/master | 2021-09-24T14:22:55.653754 | 2018-10-10T10:25:49 | 2018-10-10T10:25:49 | 152,405,260 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,411 | java | package com.sapestore.service;
import java.util.List;
import com.sapestore.exception.SapeStoreException;
import com.sapestore.hibernate.entity.BookRatingComments;
import com.sapestore.vo.BookRatingCommentVO;
// TODO: Auto-generated Javadoc
/**
* Service interface for rating and comment functionality.
*
* @author shadab
*
*/
public interface ReviewService {
/**
* Performs adding reviews.
*
* @param reviewVO the review vo
* @throws SapeStoreException Handling exception
*/
public void addBookReview(BookRatingCommentVO reviewVO) throws SapeStoreException;
/**
* Performs adding AVERAGE rating.
*
* @param bookRating the book rating
* @param isbn the isbn
* @throws SapeStoreException Handling exception
*/
public void addAverageBookRating(Integer bookRating, String isbn) throws SapeStoreException;
/**
* Returns list of reviews of the book.
*
* @param isbn the isbn
* @return ReviewList
* @throws SapeStoreException Handling exception
*/
public List<BookRatingComments> getReviewlist(String isbn) throws SapeStoreException;
/**
* Returns list of three reviews of the book.
*
* @param isbn the isbn
* @return threeReviewList
* @throws SapeStoreException Handling exception
*/
public List<BookRatingComments> getThreeReviewslist(String isbn) throws SapeStoreException;
}
| [
"[email protected]"
] | |
b03f51db75c4e2fe3511f51e91e9d4666daca74f | 76e6ee98ae2b08190cdf5bfef14668b1d039812d | /dmd-admin/src/main/java/com/dmd/mall/service/impl/PmsProductAttributeServiceImpl.java | 111f1b81eadb5e0b052660f3b18461545429076e | [
"Apache-2.0"
] | permissive | qhl0505/dmd | 5853af47eaa9f24d07c2bdaf24eb482bcd1b4820 | e9b3ca850d3f53cc56f0efba30ff3dde5c65138a | refs/heads/master | 2022-06-29T10:22:34.372066 | 2019-10-10T10:05:38 | 2019-10-10T10:05:38 | 214,320,664 | 2 | 0 | Apache-2.0 | 2022-06-21T02:01:19 | 2019-10-11T01:53:24 | Java | UTF-8 | Java | false | false | 4,671 | java | package com.dmd.mall.service.impl;
import com.dmd.mall.dto.PmsProductAttributeParam;
import com.dmd.mall.dto.ProductAttrInfo;
import com.dmd.mall.mapper.PmsProductAttributeCategoryMapper;
import com.dmd.mall.mapper.PmsProductAttributeDao;
import com.dmd.mall.mapper.PmsProductAttributeMapper;
import com.dmd.mall.model.PmsProductAttribute;
import com.dmd.mall.model.PmsProductAttributeCategory;
import com.dmd.mall.model.PmsProductAttributeExample;
import com.dmd.mall.service.PmsProductAttributeService;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 商品属性Service实现类
* Created by macro on 2018/4/26.
*/
@Service
public class PmsProductAttributeServiceImpl implements PmsProductAttributeService {
@Autowired
private PmsProductAttributeMapper productAttributeMapper;
@Autowired
private PmsProductAttributeCategoryMapper productAttributeCategoryMapper;
@Autowired
private PmsProductAttributeDao productAttributeDao;
@Override
public List<PmsProductAttribute> getList(Long cid, Integer type, Integer pageSize, Integer pageNum) {
PageHelper.startPage(pageNum, pageSize);
PmsProductAttributeExample example = new PmsProductAttributeExample();
example.setOrderByClause("sort desc");
example.createCriteria().andProductAttributeCategoryIdEqualTo(cid).andTypeEqualTo(type);
return productAttributeMapper.selectByExample(example);
}
@Override
public int create(PmsProductAttributeParam pmsProductAttributeParam) {
PmsProductAttribute pmsProductAttribute = new PmsProductAttribute();
BeanUtils.copyProperties(pmsProductAttributeParam, pmsProductAttribute);
int count = productAttributeMapper.insertSelective(pmsProductAttribute);
//新增商品属性以后需要更新商品属性分类数量
PmsProductAttributeCategory pmsProductAttributeCategory = productAttributeCategoryMapper.selectByPrimaryKey(pmsProductAttribute.getProductAttributeCategoryId());
if(pmsProductAttribute.getType()==0){
pmsProductAttributeCategory.setAttributeCount(pmsProductAttributeCategory.getAttributeCount()+1);
}else if(pmsProductAttribute.getType()==1){
pmsProductAttributeCategory.setParamCount(pmsProductAttributeCategory.getParamCount()+1);
}
productAttributeCategoryMapper.updateByPrimaryKey(pmsProductAttributeCategory);
return count;
}
@Override
public int update(Long id, PmsProductAttributeParam productAttributeParam) {
PmsProductAttribute pmsProductAttribute = new PmsProductAttribute();
pmsProductAttribute.setId(id);
BeanUtils.copyProperties(productAttributeParam, pmsProductAttribute);
return productAttributeMapper.updateByPrimaryKeySelective(pmsProductAttribute);
}
@Override
public PmsProductAttribute getItem(Long id) {
return productAttributeMapper.selectByPrimaryKey(id);
}
@Override
public int delete(List<Long> ids) {
//获取分类
PmsProductAttribute pmsProductAttribute = productAttributeMapper.selectByPrimaryKey(ids.get(0));
Integer type = pmsProductAttribute.getType();
PmsProductAttributeCategory pmsProductAttributeCategory = productAttributeCategoryMapper.selectByPrimaryKey(pmsProductAttribute.getProductAttributeCategoryId());
PmsProductAttributeExample example = new PmsProductAttributeExample();
example.createCriteria().andIdIn(ids);
int count = productAttributeMapper.deleteByExample(example);
//删除完成后修改数量
if(type==0){
if(pmsProductAttributeCategory.getAttributeCount()>=count){
pmsProductAttributeCategory.setAttributeCount(pmsProductAttributeCategory.getAttributeCount()-count);
}else{
pmsProductAttributeCategory.setAttributeCount(0);
}
}else if(type==1){
if(pmsProductAttributeCategory.getParamCount()>=count){
pmsProductAttributeCategory.setParamCount(pmsProductAttributeCategory.getParamCount()-count);
}else{
pmsProductAttributeCategory.setParamCount(0);
}
}
productAttributeCategoryMapper.updateByPrimaryKey(pmsProductAttributeCategory);
return count;
}
@Override
public List<ProductAttrInfo> getProductAttrInfo(Long productCategoryId) {
return productAttributeDao.getProductAttrInfo(productCategoryId);
}
}
| [
"dslcfjz06"
] | dslcfjz06 |
2c00aa2ec5e4918d15614d3dee843c31a2059fc2 | b755a269f733bc56f511bac6feb20992a1626d70 | /model/model-util/src/main/java/com/qiyun/util/Ascii2NativeUtil.java | 45d893afa50ac5dcc0ae434acfb47b729610a0e4 | [] | no_license | yysStar/dubbo-zookeeper-SSM | 55df313b58c78ab2eaa3d021e5bb201f3eee6235 | e3f85dea824159fb4c29207cc5c9ccaecf381516 | refs/heads/master | 2022-12-21T22:50:33.405116 | 2020-05-09T09:20:41 | 2020-05-09T09:20:41 | 125,301,362 | 2 | 0 | null | 2022-12-16T10:51:09 | 2018-03-15T02:27:17 | Java | UTF-8 | Java | false | false | 7,961 | java | package com.qiyun.util;
/**
* 编码转换工具类
*/
public class Ascii2NativeUtil {
/**
* prefix of ascii string of native character
*/
private static String PREFIX = "\\u";
/**
* Native to ascii string. It's same as execut native2ascii.exe.
* @param str native string
* @return ascii string
*/
public static String native2Ascii(String str) {
char[] chars = str.toCharArray();
StringBuilder sb = new StringBuilder();
for (int i = 0; i < chars.length; i++) {
sb.append(char2Ascii(chars[i]));
}
return sb.toString();
}
/**
* Native character to ascii string.
* @param c native character
* @return ascii string
*/
private static String char2Ascii(char c) {
if (c > 255) {
StringBuilder sb = new StringBuilder();
sb.append(PREFIX);
int code = (c >> 8);
String tmp = Integer.toHexString(code);
if (tmp.length() == 1) {
sb.append("0");
}
sb.append(tmp);
code = (c & 0xFF);
tmp = Integer.toHexString(code);
if (tmp.length() == 1) {
sb.append("0");
}
sb.append(tmp);
return sb.toString();
} else {
return Character.toString(c);
}
}
/**
* Ascii to native string. It's same as execut native2ascii.exe -reverse.
* @param str ascii string
* @return native string
*/
public static String ascii2Native(String str) {
StringBuilder sb = new StringBuilder();
int begin = 0;
int index = str.indexOf(PREFIX);
while (index != -1) {
sb.append(str.substring(begin, index));
sb.append(ascii2Char(str.substring(index, index + 6)));
begin = index + 6;
index = str.indexOf(PREFIX, begin);
}
sb.append(str.substring(begin));
return sb.toString();
}
/**
* Ascii to native character.
* @param str ascii string
* @return native character
*/
private static char ascii2Char(String str) {
if (str.length() != 6) {
throw new IllegalArgumentException(
"Ascii string of a native character must be 6 character.");
}
if (!PREFIX.equals(str.substring(0, 2))) {
throw new IllegalArgumentException(
"Ascii string of a native character must start with \"\\u\".");
}
String tmp = str.substring(2, 4);
int code = Integer.parseInt(tmp, 16) << 8;
tmp = str.substring(4, 6);
code += Integer.parseInt(tmp, 16);
return (char) code;
}
// public static void main(String[] args) {
// String s = "cphData({\"data\":[{\"data\":\"1-\\u5df4\\u897f-\\u5f00\\u552e-2.95-0%-19.27%-4671301-equal-467130-1-417-http:\\/\\/static.sporttery.cn\\/sinaimg\\/football\\/wcp2018\\/417.png|2-\\u5fb7\\u56fd-\\u5f00\\u552e-3.50-0%-16.24%-4671302-equal-467130-2-377-http:\\/\\/static.sporttery.cn\\/sinaimg\\/football\\/wcp2018\\/377.png|3-\\u897f\\u73ed\\u7259-\\u5f00\\u552e-4.10-0%-13.86%-4671303-equal-467130-3-23-http:\\/\\/static.sporttery.cn\\/sinaimg\\/football\\/wcp2018\\/23.png|4-\\u963f\\u6839\\u5ef7-\\u5f00\\u552e-4.50-0%-12.63%-4671304-equal-467130-4-413-http:\\/\\/static.sporttery.cn\\/sinaimg\\/football\\/wcp2018\\/413.png|5-\\u6cd5\\u56fd-\\u5f00\\u552e-5.00-0%-11.37%-4671305-equal-467130-5-375-http:\\/\\/static.sporttery.cn\\/sinaimg\\/football\\/wcp2018\\/375.png|6-\\u6bd4\\u5229\\u65f6-\\u5f00\\u552e-10.00-0%-5.68%-4671306-equal-467130-6-363-http:\\/\\/static.sporttery.cn\\/sinaimg\\/football\\/wcp2018\\/363.png|7-\\u8461\\u8404\\u7259-\\u5f00\\u552e-15.00-0%-3.79%-4671307-equal-467130-7-1044-http:\\/\\/static.sporttery.cn\\/sinaimg\\/football\\/wcp2018\\/1044.png|8-\\u82f1\\u683c\\u5170-\\u5f00\\u552e-14.00-0%-4.06%-4671308-equal-467130-8-370-http:\\/\\/static.sporttery.cn\\/sinaimg\\/football\\/wcp2018\\/370.png|9-\\u4e4c\\u62c9\\u572d-\\u5f00\\u552e-22.00-0%-2.58%-4671309-equal-467130-9-414-http:\\/\\/static.sporttery.cn\\/sinaimg\\/football\\/wcp2018\\/414.png|10-\\u54e5\\u4f26\\u6bd4\\u4e9a-\\u5f00\\u552e-25.00-0%-2.27%-46713010-equal-467130-10-410-http:\\/\\/static.sporttery.cn\\/sinaimg\\/football\\/wcp2018\\/410.png|11-\\u514b\\u7f57\\u5730\\u4e9a-\\u5f00\\u552e-35.00-0%-1.62%-46713011-equal-467130-11-366-http:\\/\\/static.sporttery.cn\\/sinaimg\\/football\\/wcp2018\\/366.png|12-\\u4fc4\\u7f57\\u65af-\\u5f00\\u552e-55.00-0%-1.03%-46713012-equal-467130-12-396-http:\\/\\/static.sporttery.cn\\/sinaimg\\/football\\/wcp2018\\/396.png|13-\\u58a8\\u897f\\u54e5-\\u5f00\\u552e-70.00-0%-0.81%-46713013-equal-467130-13-416-http:\\/\\/static.sporttery.cn\\/sinaimg\\/football\\/wcp2018\\/416.png|14-\\u6ce2\\u5170-\\u5f00\\u552e-65.00-0%-0.87%-46713014-equal-467130-14-392-http:\\/\\/static.sporttery.cn\\/sinaimg\\/football\\/wcp2018\\/392.png|15-\\u745e\\u58eb-\\u5f00\\u552e-110.0-0%-0.52%-46713015-equal-467130-15-403-http:\\/\\/static.sporttery.cn\\/sinaimg\\/football\\/wcp2018\\/403.png|16-\\u4e39\\u9ea6-\\u5f00\\u552e-100.0-0%-0.57%-46713016-equal-467130-16-369-http:\\/\\/static.sporttery.cn\\/sinaimg\\/football\\/wcp2018\\/369.png|17-\\u585e\\u5c14\\u7ef4\\u4e9a-\\u5f00\\u552e-175.0-0%-0.32%-46713017-equal-467130-17-399-http:\\/\\/static.sporttery.cn\\/sinaimg\\/football\\/wcp2018\\/399.png|18-\\u745e\\u5178-\\u5f00\\u552e-200.0-0%-0.28%-46713018-equal-467130-18-402-http:\\/\\/static.sporttery.cn\\/sinaimg\\/football\\/wcp2018\\/402.png|19-\\u79d8\\u9c81-\\u5f00\\u552e-200.0-0%-0.28%-46713019-equal-467130-19-409-http:\\/\\/static.sporttery.cn\\/sinaimg\\/football\\/wcp2018\\/409.png|20-\\u65e5\\u672c-\\u5f00\\u552e-250.0-0%-0.23%-46713020-equal-467130-20-438-http:\\/\\/static.sporttery.cn\\/sinaimg\\/football\\/wcp2018\\/438.png|21-\\u5c3c\\u65e5\\u5229\\u4e9a-\\u5f00\\u552e-250.0-0%-0.23%-46713021-equal-467130-21-773-http:\\/\\/static.sporttery.cn\\/sinaimg\\/football\\/wcp2018\\/773.png|22-\\u585e\\u5185\\u52a0\\u5c14-\\u5f00\\u552e-200.0-0%-0.28%-46713022-equal-467130-22-774-http:\\/\\/static.sporttery.cn\\/sinaimg\\/football\\/wcp2018\\/774.png|23-\\u57c3\\u53ca-\\u5f00\\u552e-250.0-0%-0.23%-46713023-equal-467130-23-543-http:\\/\\/static.sporttery.cn\\/sinaimg\\/football\\/wcp2018\\/543.png|24-\\u51b0\\u5c9b-\\u5f00\\u552e-250.0-0%-0.23%-46713024-equal-467130-24-380-http:\\/\\/static.sporttery.cn\\/sinaimg\\/football\\/wcp2018\\/380.png|25-\\u7a81\\u5c3c\\u65af-\\u5f00\\u552e-700.0-0%-0.08%-46713025-equal-467130-25-425-http:\\/\\/static.sporttery.cn\\/sinaimg\\/football\\/wcp2018\\/425.png|26-\\u6fb3\\u5927\\u5229\\u4e9a-\\u5f00\\u552e-600.0-0%-0.09%-46713026-equal-467130-26-421-http:\\/\\/static.sporttery.cn\\/sinaimg\\/football\\/wcp2018\\/421.png|27-\\u6469\\u6d1b\\u54e5-\\u5f00\\u552e-500.0-0%-0.11%-46713027-equal-467130-27-424-http:\\/\\/static.sporttery.cn\\/sinaimg\\/football\\/wcp2018\\/424.png|28-\\u97e9\\u56fd-\\u5f00\\u552e-600.0-0%-0.09%-46713028-equal-467130-28-430-http:\\/\\/static.sporttery.cn\\/sinaimg\\/football\\/wcp2018\\/430.png|29-\\u4f0a\\u6717-\\u5f00\\u552e-600.0-0%-0.09%-46713029-equal-467130-29-440-http:\\/\\/static.sporttery.cn\\/sinaimg\\/football\\/wcp2018\\/440.png|30-\\u54e5\\u65af\\u8fbe\\u9ece\\u52a0-\\u5f00\\u552e-500.0-0%-0.11%-46713030-equal-467130-30-420-http:\\/\\/static.sporttery.cn\\/sinaimg\\/football\\/wcp2018\\/420.png|31-\\u5df4\\u62ff\\u9a6c-\\u5f00\\u552e-800.0-0%-0.07%-46713031-equal-467130-31-524-http:\\/\\/static.sporttery.cn\\/sinaimg\\/football\\/wcp2018\\/524.png|32-\\u6c99\\u7279-\\u5f00\\u552e-1000-0%-0.06%-46713032-equal-467130-32-434-http:\\/\\/static.sporttery.cn\\/sinaimg\\/football\\/wcp2018\\/434.png\",\"id\":\"104895\",\"p_id\":\"467130\",\"name\":\"2018\\u4e16\\u754c\\u676f\",\"odds_type\":\"CHP\"}]})";
// System.out.println(Ascii2NativeUtil.ascii2Native(s));
// }
}
| [
"[email protected]"
] | |
9db1b8f7de258ca6d8ecb1c692c29ac3df2b2e79 | acb05378f7d584b0a57bfd6beab8bad54fdac154 | /source/com/jonasreese/sound/sg/midi/Metronome.java | ebf8622d8b2e4201c7b9a47ae89d0f8156f5575c | [] | no_license | jonasreese/soundsgood | 83f5b403cf53e153f97ec24e6064c794794e9ccd | f658b5c98302a23393169d28e448cbd7d52e35e1 | refs/heads/master | 2021-01-20T22:28:51.539018 | 2013-06-10T10:03:03 | 2013-06-10T10:03:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,037 | java | /*
* Created on 10.07.2005
*
* To change this generated comment go to
* Window>Preferences>Java>Code Generation>Code Template
*/
package com.jonasreese.sound.sg.midi;
import javax.sound.midi.Receiver;
/**
* <p>
* This interface shall be implemented by classes that perform metronome functionality.
* </p>
* @author jonas.reese
* @see com.jonasreese.sound.sg.midi.MidiRecorder
*/
public interface Metronome {
/**
* Adds a MIDI output receiver to this <code>MidiRecorder</code>. An output
* MIDI receiver receives all MIDI events that are sent to any output device.
* @param midiOutputReceiver The <code>Receiver</code> that shall receive MIDI
* events after being sent to an output device. If the given
* <code>MidiOutputReceiver</code> has already been added, this method does nothing.
*/
public void addMidiOutputReceiver( Receiver midiOutputReceiver );
/**
* Removes the given MIDI output receiver from this <code>MidiRecorder</code>.
* @param midiOutputReceiver The MIDI output receiver that shall no longer
* receive any MIDI events after being sent to an output device. If the given
* <code>Receiver</code> is not registered as MIDI output receiver, this method
* does nothing.
*/
public void removeMidiOutputReceiver( Receiver midiOutputReceiver );
/**
* Enables/disables the default MIDI click device output.
* @param defaultDeviceOutput <code>true</code> if the default device output
* shall be enabled, <code>false</code> otherwise.
*/
public void setDefaultDeviceOutputEnabled( boolean defaultDeviceOutputEnabled );
/**
* Gets the current default device output enabled state.
* @return <code>true</code> if the click is sent to the default click devices
* configured, <code>false</code> otherwise. Default value is <code>false</code>.
*/
public boolean isDefaultDeviceOutputEnabled();
/**
* Enables/disables the sending of MIDI clock events (also known as MIDI beat clock,
* MIDI timing clock).
* @param sendMidiClockEnabled Enables/disables the sending MIDI clock events.
*/
public void setSendMidiClockEnabled(boolean sendMidiClockEnabled);
/**
* Gets the MIDI clock enabled state.
* @return <code>true</code> if and only if sending of MIDI clock events is enabled.
*/
public boolean isSendMidiClockEnabled();
/**
* Starts the metronome click.
*/
public void start();
/**
* Stops the metronome click.
*/
public void stop();
/**
* Synchronizes the metronome click.
*/
public void sync();
/**
* Sets the number of beats per tact.
*/
public void setBeatsPerTact( int beatsPerTact );
/**
* Gets the number of beats per tact.
* @return The beats per tact.
*/
public int getBeatsPerTact();
/**
* Gets the tact counter. The tact counter is incremented with each tact.
* @return The tact counter.
*/
public int getTactCounter();
/**
* Gets the metronome click's running state.
* @return <code>true</code> if the metronome is running, <code>false</code>
* otherwise.
*/
public boolean isRunning();
/**
* Sets the tempo in beats per minute.
* @param tempoInBpm The metronome tempo.
*/
public void setTempoInBpm( float tempoInBpm );
/**
* Gets the tempo in beats per minute.
* @return The current tempo.
*/
public float getTempoInBpm();
/**
* Sets the tempo in microseconds per quarternote.
* @param tempoInMpq The metronome tempo.
*/
public void setTempoInMpq( float tempoInMpq );
/**
* Gets the tempo in microseconds per quarternote.
* @return The current tempo.
*/
public float getTempoInMpq();
}
| [
"[email protected]"
] | |
39ad403d7b2ff0d7d1598d869d7b96abeee7a537 | db37c937b7aa01491ab6d0bbca369e7c24dc9638 | /geotracker/server/src/main/java/ch/rasc/geotracker/GeoController.java | 553e880af360b6034485f6d7068affeda1ef03fd | [
"MIT"
] | permissive | ralscha/blog | a7fc489ec7f09d2f566873262690364c0ea05b19 | 42b117db20a5a654d7d76e11912304dcdca8fe3d | refs/heads/master | 2023-08-03T10:58:09.694000 | 2023-07-31T18:42:35 | 2023-07-31T18:42:35 | 78,191,118 | 242 | 308 | MIT | 2022-11-19T17:09:51 | 2017-01-06T08:59:53 | TypeScript | UTF-8 | Java | false | false | 2,731 | java | package ch.rasc.geotracker;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import ch.rasc.sse.eventbus.SseEvent;
import ch.rasc.sse.eventbus.SseEventBus;
import jakarta.servlet.http.HttpServletResponse;
@RestController
@CrossOrigin
public class GeoController {
private final ApplicationEventPublisher publisher;
private final List<Position> positions;
private final ObjectMapper objectMapper;
private final SseEventBus eventBus;
public GeoController(ApplicationEventPublisher publisher, ObjectMapper objectMapper,
SseEventBus eventBus) {
this.publisher = publisher;
this.positions = new ArrayList<>();
this.objectMapper = objectMapper;
this.eventBus = eventBus;
}
@GetMapping("/positions")
public List<Position> fetchPositions() {
return this.positions;
}
@GetMapping("/register/{id}")
public SseEmitter eventbus(@PathVariable("id") String id,
HttpServletResponse response) {
response.setHeader("Cache-Control", "no-store");
return this.eventBus.createSseEmitter(id, "pos", "clear");
}
@DeleteMapping(path = "/clear")
@ResponseStatus(value = HttpStatus.NO_CONTENT)
public void clear() {
this.positions.clear();
this.publisher.publishEvent(SseEvent.ofEvent("clear"));
}
@PostMapping(path = "/pos")
@ResponseStatus(value = HttpStatus.NO_CONTENT)
public void handleLocation(@RequestBody Position position)
throws JsonProcessingException {
SseEvent event = SseEvent.of("pos",
this.objectMapper.writeValueAsString(Collections.singleton(position)));
this.publisher.publishEvent(event);
this.positions.add(position);
if (this.positions.size() > 100) {
this.positions.remove(0);
}
}
@PostMapping(path = "/clienterror")
@ResponseStatus(value = HttpStatus.NO_CONTENT)
public void handleError(@RequestBody String errorMessage) {
Application.logger.error(errorMessage);
}
}
| [
"[email protected]"
] | |
64a9f5d64ef23f021c392837f377de2267d482c6 | 570367b3b35e724ed5279c7f34b9e776536ca871 | /Ciphers/src/sample/Main.java | bcc3e4e4d2a7719ed530c22f2ea8491f406b93d6 | [] | no_license | ysfgouicem/java_projects | b1c46b793cc1bdfc2117fa3ed166157ab8a6d27e | f8e69d45f4c436b6e7288983c8ab13455b43b775 | refs/heads/master | 2021-04-26T23:20:32.656421 | 2019-06-10T22:44:06 | 2019-06-10T22:44:06 | 123,967,855 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,762 | java | /* Vigenere / Vernam / Ceasar Ciphers -
Functions for encrypting and decrypting data messages. Then send them to a friend.
*/
package sample;
import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextArea;
import javafx.scene.layout.*;
import javafx.stage.Stage;
import java.util.Vector;
public class Main extends Application {
private Button buttonenc;
private Button buttondec;
private Button buttonclr;
@Override
public void start(Stage primaryStage) throws Exception{
//Parent root = FXMLLoader.load(getClass().getResource("sample.fxml"));
primaryStage.setTitle("Ciphers");
VBox centermenu = new VBox();
Label lab = new Label("Enter text below : ") ;
centermenu.setPrefWidth(100);
TextArea textArea = new TextArea();
textArea.setPrefHeight(350);
textArea.setPrefWidth(300);
textArea.setStyle("-fx-font-size: 1.5em;");
buttonenc = new Button("ENCRYPT") ;
buttondec = new Button("DECRYPT");
buttonclr = new Button("CLEAR");
buttonclr.setMinWidth(100);
buttondec.setMinWidth(100);
buttonenc.setMinWidth(100);
buttonclr.setPadding(new Insets(3));
buttonenc.setPadding(new Insets(3));
buttondec.setPadding(new Insets(3));
buttonclr.setOnAction(e->textArea.clear());
// check if textarea is not empty
buttonenc.setOnAction(e->{
if(textArea.getText().length()<1){
// alert box here cuz empty text area prompt ( enter some text )
AlertBox.display(" ALERT !", "Empty textarea !! , please enter some text");
}
else {
Encryptionwin.display(textArea.getText()); }
});
// check if textarea is not empty
buttondec.setOnAction(e->{
if(textArea.getText().length()<1){
// alert box here cuz empty text area prompt ( enter some text )
AlertBox.display(" ALERT !", "Empty textarea !! , please enter some text");
}
else {
Decryptionwin.display(textArea.getText()); }
});
centermenu.getChildren().addAll(lab,textArea,buttonenc,buttondec,buttonclr);
centermenu.setAlignment(Pos.CENTER);
centermenu.setSpacing(5);
BorderPane bp = new BorderPane();
bp.setCenter(centermenu);
Scene scene = new Scene(bp, 600, 500);
primaryStage.setScene(scene);
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}
| [
"[email protected]"
] | |
34ca4e83369b8d62b3602b79918d3793af94c03f | 7cb7d11a26f978cf2230ba2da0140c9beb0c9f06 | /src/test/java/com/udpimplementation/comp445a3/PacketTest.java | f5eb5048ad56fe95d76a4ac26c311440c75d9baa | [] | no_license | sunyanl1236/UDPImplementation | 43ba2cc5efe245165b232d48c760855102682ef6 | 24e4542749db63f232a538d851e2d83d6011e21d | refs/heads/main | 2023-01-24T09:20:42.944942 | 2020-12-06T20:06:57 | 2020-12-06T20:06:57 | 314,935,887 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,142 | java | package com.udpimplementation.comp445a3;
import junitparams.JUnitParamsRunner;
import junitparams.Parameters;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import java.net.InetAddress;
import java.util.Arrays;
import java.util.Collection;
import static org.assertj.core.api.Assertions.assertThat;
@RunWith(JUnitParamsRunner.class)
public class PacketTest {
@Test
@Parameters(method = "packets")
public void testWritePacket(Packet p, int[] expectInts) throws Exception {
byte[] expectBytes = new byte[expectInts.length];
for(int i = 0; i < expectBytes.length; i++){
expectBytes[i] = (byte)expectInts[i];
}
assertThat(p.toBytes())
.isEqualTo(expectBytes);
}
@Test
@Parameters(method = "packets")
public void testParseValidPackets(Packet expectPacket, int[] inputInts) throws Exception {
byte[] inputBytes = new byte[inputInts.length];
for(int i = 0; i < inputBytes.length; i++){
inputBytes[i] = (byte)inputInts[i];
}
Packet p = Packet.fromBytes(inputBytes);
assertThat(p.toBytes())
.isEqualTo(inputBytes);
assertThat(p.toBytes())
.isEqualTo(expectPacket.toBytes());
}
public static InetAddress addr(int ...vals) throws Exception{
assert vals.length == 4;
byte[] bytes = new byte[4];
for(int i = 0; i < vals.length; i++){
bytes[i] = (byte)vals[i];
}
return InetAddress.getByAddress(bytes);
}
@Parameterized.Parameters
public static Collection<Object[]> packets() throws Exception{
return Arrays.asList(new Object[][]{
{
new Packet.Builder()
.setType(1)
.setSequenceNumber(45)
.setPeerAddress(addr(127, 0, 0, 1))
.setPortNumber(2100)
.setPayload("Hello World".getBytes())
.create(),
new int[]{
1,
0, 0, 0, 45,
127, 0, 0, 1,
8, 52,
72,101,108,108,111,32,87,111,114,108,100
}
},
{
new Packet.Builder()
.setType(29)
.setSequenceNumber(2992122123L) //unsigned int
.setPeerAddress(addr(192, 168, 2, 125))
.setPortNumber(53201)
.setPayload("".getBytes())
.create(),
new int[]{
29,
178, 88, 41, 11,
192, 168, 2, 125,
207, 209,
}
},
});
}
} | [
"[email protected]"
] | |
1498c4e8d48fb74b92ffef3a0d58562511956882 | 67c2a85a9225c5f41ca1effaec1caa2abb3f9e32 | /yytj_java/dal/src/main/java/com/hongbao/dal/config/JedisConfig.java | 1c619191bff915a1acfae004a750be2a796e1737 | [] | no_license | qinbo89/yytj_java | 789a31e1f3d17ad16f05b63b70306b171ffd144e | 4de9e02e49dbbb5d58f55fdb37ff6c8e43c313e3 | refs/heads/master | 2021-01-18T22:11:42.721730 | 2016-09-27T02:21:53 | 2016-09-27T02:21:53 | 69,311,520 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,656 | java | package com.hongbao.dal.config;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;
import redis.clients.jedis.ShardedJedisPool;
import com.hongbao.dal.redis.JedisUtil;
import com.hongbao.utils.DateUtil;
/**
* 类JedisConfig.java的实现描述:TODO 类实现描述
*
* @author tatos 2014年9月23日 下午3:27:33
*/
@Configuration
@ImportResource("classpath:/META-INF/applicationContext-jedis-dataSource.xml")
public class JedisConfig {
private static Logger LOG = LoggerFactory.getLogger(JedisConfig.class);
@Autowired
private ShardedJedisPool shardedJedisPool;
/**
* 应用的名字作用域
*/
@Value("${appName}")
private String appName;
@Bean
public JedisUtil jedisUtil() {
JedisUtil jedisUtil = new JedisUtil();
jedisUtil.setAppName(appName);
jedisUtil.setNameSpace("jedisUtil");
jedisUtil.setShardedJedisPool(shardedJedisPool);
return jedisUtil;
}
@Bean(name = "hongbaoCache")
public JedisUtil hongbaoCache() {
JedisUtil jedisUtil = new JedisUtil();
jedisUtil.setAppName(appName);
jedisUtil.setPeriod(DateUtil.HOUR_SECONDS);
jedisUtil.setNameSpace("hongbaoCache");
jedisUtil.setShardedJedisPool(shardedJedisPool);
return jedisUtil;
}
@Bean(name = "userByLoginNameCache")
public JedisUtil userByLoginNameCache() {
JedisUtil jedisUtil = new JedisUtil();
jedisUtil.setAppName(appName);
jedisUtil.setPeriod(DateUtil.HOUR_SECONDS);
jedisUtil.setNameSpace("userByLoginNameCache");
jedisUtil.setShardedJedisPool(shardedJedisPool);
return jedisUtil;
}
@Bean(name = "userByIdCache")
public JedisUtil userByIdCache() {
JedisUtil jedisUtil = new JedisUtil();
jedisUtil.setAppName(appName);
jedisUtil.setPeriod(DateUtil.HOUR_SECONDS);
jedisUtil.setNameSpace("userByIdCache");
jedisUtil.setShardedJedisPool(shardedJedisPool);
return jedisUtil;
}
@Bean(name = "userScoreTopTenCache")
public JedisUtil userScoreTopTenCache() {
JedisUtil jedisUtil = new JedisUtil();
jedisUtil.setAppName(appName);
jedisUtil.setPeriod(DateUtil.HOUR_SECONDS);
jedisUtil.setNameSpace("userScoreTopTenCache");
jedisUtil.setShardedJedisPool(shardedJedisPool);
return jedisUtil;
}
@Bean(name = "accessTokenCacheShike")
public JedisUtil accessTokenCacheShike() {
JedisUtil jedisUtil = new JedisUtil();
jedisUtil.setAppName(appName);
jedisUtil.setPeriod(DateUtil.HOUR_SECONDS);
jedisUtil.setNameSpace("accessTokenCacheShike");
jedisUtil.setShardedJedisPool(shardedJedisPool);
return jedisUtil;
}
@Bean(name = "userHeadImgCache")
public JedisUtil userHeadImgCache() {
JedisUtil jedisUtil = new JedisUtil();
jedisUtil.setAppName(appName);
jedisUtil.setPeriod(DateUtil.HOUR_SECONDS);
jedisUtil.setNameSpace("userHeadImgCache");
jedisUtil.setShardedJedisPool(shardedJedisPool);
return jedisUtil;
}
@Bean(name = "qrCodeTicketCache")
public JedisUtil qrCodeTicketCache() {
JedisUtil jedisUtil = new JedisUtil();
jedisUtil.setAppName(appName);
jedisUtil.setPeriod(DateUtil.HOUR_SECONDS);
jedisUtil.setNameSpace("qrCodeTicketCache");
jedisUtil.setShardedJedisPool(shardedJedisPool);
return jedisUtil;
}
@Bean(name = "qrTicketUserIdCache")
public JedisUtil qrTicketUserIdCache() {
JedisUtil jedisUtil = new JedisUtil();
jedisUtil.setAppName(appName);
jedisUtil.setPeriod(DateUtil.HOUR_SECONDS);
jedisUtil.setNameSpace("qrTicketUserIdCache");
jedisUtil.setShardedJedisPool(shardedJedisPool);
return jedisUtil;
}
@Bean(name = "loginSiginCache")
public JedisUtil loginSiginCache() {
JedisUtil jedisUtil = new JedisUtil();
jedisUtil.setAppName(appName);
jedisUtil.setPeriod(DateUtil.HOUR_SECONDS);
jedisUtil.setNameSpace("loginSiginCache");
jedisUtil.setShardedJedisPool(shardedJedisPool);
return jedisUtil;
}
@Bean(name = "ticketCache")
public JedisUtil ticketCache() {
JedisUtil jedisUtil = new JedisUtil();
jedisUtil.setAppName(appName);
jedisUtil.setPeriod(DateUtil.HOUR_SECONDS);
jedisUtil.setNameSpace("ticketCache");
jedisUtil.setShardedJedisPool(shardedJedisPool);
return jedisUtil;
}
@Bean(name = "countAddCache")
public JedisUtil countAddCache() {
JedisUtil jedisUtil = new JedisUtil();
jedisUtil.setAppName(appName);
jedisUtil.setPeriod(DateUtil.HOUR_SECONDS);
jedisUtil.setNameSpace("countAddCache");
jedisUtil.setShardedJedisPool(shardedJedisPool);
return jedisUtil;
}
}
| [
"[email protected]"
] | |
72eda4c278a2101fc7895b15e52b3d601cb1d6b8 | e2cd2d66a27dd8661810ef80785e683bdc7817f6 | /nzsproject/src/main/java/com/needmall/common/vo/Category1depVO.java | 6fd8f80c2aee7bd77bd1f2fc4b879cc745b01cdc | [] | no_license | needmall/data | 3d2aed5ea45303bcc824b17c13857198cadb2f39 | f646aec46e927ddbaa666e4f280dbe654f1f2196 | refs/heads/master | 2020-03-26T07:42:40.778859 | 2018-09-17T04:35:11 | 2018-09-17T04:35:11 | 144,667,138 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 492 | java | package com.needmall.common.vo;
public class Category1depVO {
private int c1_num;
private String c1_name;
public int getC1_num() {
return c1_num;
}
public void setC1_num(int c1_num) {
this.c1_num = c1_num;
}
public String getC1_name() {
return c1_name;
}
public void setC1_name(String c1_name) {
this.c1_name = c1_name;
}
@Override
public String toString() {
return "Category1depVO [c1_num=" + c1_num + ", c1_name=" + c1_name + "]";
}
}
| [
"[email protected]"
] | |
ee6b3256261580d3e9c69b1f58f60b1febc603d9 | eec9aa71fca1d12cfeda08affdb8c5ef032f5c39 | /app/src/main/java/com/pinkump3/musiconline/adapter/FragmentAdapter.java | 4978dc6514eaa1229f1b0e65cd744a0806eb4878 | [] | no_license | fandofastest/yopylagi | 5ba4ba581613fc52497093ac53f2dec99e787255 | 257c57740b3cd54240f3d2be438e588ba1ab5205 | refs/heads/master | 2020-11-30T04:58:20.155481 | 2019-12-28T07:34:57 | 2019-12-28T07:34:57 | 230,306,195 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 988 | java | package com.pinkump3.musiconline.adapter;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;
import java.util.ArrayList;
import java.util.List;
public class FragmentAdapter extends FragmentPagerAdapter {
private final List<Fragment> mFragmentList = new ArrayList<>();
private final List<String> mFragmentTitleList = new ArrayList<>();
public FragmentAdapter(FragmentManager fragment) {
super(fragment);
}
@Override
public Fragment getItem(int position) {
return mFragmentList.get(position);
}
@Override
public int getCount() {
return mFragmentList.size();
}
public void addFragment(Fragment fragment, String title) {
mFragmentList.add(fragment);
mFragmentTitleList.add(title);
}
@Override
public CharSequence getPageTitle(int position) {
return mFragmentTitleList.get(position);
}
}
| [
"[email protected]"
] | |
a50413def426227eac0accd24dc426bf10cb8ac5 | 7d6c71900be4ca6bdc2029fda4bdeb1db771cf23 | /app/src/main/java/com/mythmayor/mvvmarchitecture/utils/net/APIService.java | 4eeff9922aa47e65b9ff8017447986bbc93d0941 | [
"Apache-2.0"
] | permissive | mythmayor/MvvmArchitecture | 433bb308b2790867d5ec35b351ee061f4224c386 | e5d5c6a3b6a5adf57ccc3bbe94fc3129c3ffa31a | refs/heads/master | 2022-11-11T23:03:20.970261 | 2020-07-01T04:14:55 | 2020-07-01T04:14:55 | 276,071,086 | 4 | 3 | null | null | null | null | UTF-8 | Java | false | false | 625 | java | package com.mythmayor.mvvmarchitecture.utils.net;
import com.mythmayor.mvvmarchitecture.response.LoginResponse;
import io.reactivex.rxjava3.core.Observable;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.POST;
/**
* Created by mythmayor on 2020/6/30.
* 接口请求方法类
*/
public interface APIService {
/**
* 登录
*
* @param username 账号
* @param password 密码
* @return
*/
@FormUrlEncoded
@POST("user/login")
Observable<LoginResponse> login(@Field("username") String username, @Field("password") String password);
}
| [
"[email protected]"
] | |
607a43cb8d89f32c9d660d09646632f22f65b6b9 | b907f692c0cdd412a6c0d1c947196e0ecd1747bb | /springboot/datasource/dynamic/src/main/java/alvin/study/springboot/ds/conf/DataSourceConfig.java | 993541467c227f63d3884f4d6978c6f7066ce8b1 | [] | no_license | alvin-qh/study-java | 64af09464325ab9de09cde6ce6240cf8d3e1653d | 63b9580f56575aa9d7b271756713a06c7e375c1a | refs/heads/master | 2023-08-22T05:53:39.790527 | 2023-08-20T16:06:11 | 2023-08-20T16:06:11 | 150,560,041 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,828 | java | package alvin.study.springboot.ds.conf;
import alvin.study.springboot.ds.core.data.DataSourceFactory;
import alvin.study.springboot.ds.core.data.DynamicDataSource;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import javax.sql.DataSource;
/**
* 配置数据源
*
* <p>
* {@link EnableTransactionManagement @EnableTransactionManagement}
* 注解表示启动默认的事务管理器
* </p>
*/
@Configuration("conf/datasource")
@EnableTransactionManagement
public class DataSourceConfig {
/**
* 创建动态数据源对象
*
* <p>
* 动态数据源 {@link DynamicDataSource} 类型是一个能够根据线程上下文中存储的数据库名称动态进行数据源切换的特殊数据源类型
* </p>
*
* <p>
* 动态数据源中的实际数据源对象是通过 {@link DataSourceFactory} 对象创建的
* </p>
*
* <p>
* 本例中有两类数据源, 默认数据源存储配置信息, 即不同组织代码所要访问的目标数据库, 该数据库共有一个; 业务数据库是根据组织代码对应的数据库,
* 该数据库有多个
* </p>
*
* @param defaultDbName 默认的数据库名称
* @param dataSourceFactory 数据源工厂对象
* @return 动态数据源对象
*/
@Bean
@Primary
DataSource dynamicDataSource(
@Value("${spring.datasource-template.default-db-name}") String defaultDbName,
DataSourceFactory dataSourceFactory) {
return new DynamicDataSource(defaultDbName, dataSourceFactory);
}
}
| [
"[email protected]"
] | |
c54fc4a4a4c5f7d1a76fccafb5c18a0dfb1d386f | c6716b711914670345d4718ea00ff36e71d844b5 | /src/brbad/Meth.java | 8a72fd98f708ffa2bdbc8780a77c55d71aab2ecb | [] | no_license | CesarRubenAlejandro/BreakingBad-game | aa7fa7f095733c8f4d7a42f035cff81397db2ec5 | 56c306b20c85d8ebbbf65c7ec445314f6123e46a | refs/heads/master | 2021-01-13T14:19:57.441875 | 2014-03-10T20:27:36 | 2014-03-10T20:27:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,509 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package brbad;
/**
*
* @author Angela Romo, Cesar Rdz
*/
import java.awt.Image;
import java.awt.Toolkit;
import java.net.URL;
public class Meth extends Base {
public Meth(int posX, int posY) {
super(posX, posY);
URL bURL = this.getClass().getResource("ImagesMeth/meth_100.jpg");
Image pic0 = Toolkit.getDefaultToolkit().getImage(bURL);
URL b1URL = this.getClass().getResource("ImagesMeth/meth_101.jpg");
Image pic1 = Toolkit.getDefaultToolkit().getImage(b1URL);
URL b2URL = this.getClass().getResource("ImagesMeth/meth_102.jpg");
Image pic2 = Toolkit.getDefaultToolkit().getImage(b2URL);
URL b3URL = this.getClass().getResource("ImagesMeth/meth_103.jpg");
Image pic3 = Toolkit.getDefaultToolkit().getImage(b3URL);
URL b4URL = this.getClass().getResource("ImagesMeth/meth_104.jpg");
Image pic4 = Toolkit.getDefaultToolkit().getImage(b4URL);
URL b5URL = this.getClass().getResource("ImagesMeth/meth_105.jpg");
Image pic5 = Toolkit.getDefaultToolkit().getImage(b5URL);
URL b6URL = this.getClass().getResource("ImagesMeth/meth_106.jpg");
Image pic6 = Toolkit.getDefaultToolkit().getImage(b6URL);
URL b7URL = this.getClass().getResource("ImagesMeth/meth_107.jpg");
Image pic7 = Toolkit.getDefaultToolkit().getImage(b7URL);
URL b8URL = this.getClass().getResource("ImagesMeth/meth_108.jpg");
Image pic8 = Toolkit.getDefaultToolkit().getImage(b8URL);
URL b9URL = this.getClass().getResource("ImagesMeth/meth_109.jpg");
Image pic9 = Toolkit.getDefaultToolkit().getImage(b9URL);
URL b10URL = this.getClass().getResource("ImagesMeth/meth_110.jpg");
Image pic10 = Toolkit.getDefaultToolkit().getImage(b10URL);
anima = new Animacion();
anima.sumaCuadro(pic0, 200);
anima.sumaCuadro(pic1, 200);
anima.sumaCuadro(pic2, 200);
anima.sumaCuadro(pic3, 200);
anima.sumaCuadro(pic4, 200);
anima.sumaCuadro(pic5, 200);
anima.sumaCuadro(pic6, 200);
anima.sumaCuadro(pic7, 200);
anima.sumaCuadro(pic8, 200);
anima.sumaCuadro(pic9, 200);
anima.sumaCuadro(pic10, 200);
}
}
| [
"[email protected]"
] | |
7f78e69bb4dc634a35ff0c70b10752cad7634339 | 36c6f117ec12d4916cf6625dd45563394b3d8ba7 | /app/src/main/java/hp/harsh/projectbrain/util/RxUtil.java | 41e495f37d12129d0771d672f42368112d62db84 | [] | no_license | hp-harsh/ProjectBrainAndroid | fb11d19ec3817318a1f8f1576680d3bad14a173e | b5b7819dc96a86b96f05e0245fa06c0033391686 | refs/heads/master | 2022-11-20T00:35:14.422545 | 2020-07-19T01:03:44 | 2020-07-19T01:03:44 | 278,514,658 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,616 | java | package hp.harsh.projectbrain.util;
import android.app.Activity;
import java.util.concurrent.TimeUnit;
import javax.inject.Inject;
import hp.harsh.projectbrain.R;
import hp.harsh.projectbrain.interfaces.SplashInterface;
import io.reactivex.Single;
import io.reactivex.SingleObserver;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;
public class RxUtil {
public static String TAG = RxUtil.class.getSimpleName();
private static boolean mDoubleBackToExitPressedOnce = false;
private ResourceUtil mResourceUtil;
@Inject
public RxUtil(ResourceUtil resourceUtil) {
this.mResourceUtil = resourceUtil;
}
public void waitForSplashTimeOut(final SplashInterface mSplashInterface) {
Single.just(new Object())
.delay(3, TimeUnit.SECONDS)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new SingleObserver<Object>() {
@Override
public void onSubscribe(Disposable d) {
}
@Override
public void onSuccess(Object o) {
mSplashInterface.onSplashTimeOver();
}
@Override
public void onError(Throwable e) {
}
});
}
public void quitApp(Activity activity) {
if (activity == null) {
return;
}
if (mDoubleBackToExitPressedOnce) {
activity.finish();
}
if (!mDoubleBackToExitPressedOnce) {
mDoubleBackToExitPressedOnce = true;
ToastUtil.show(activity, mResourceUtil.getString(R.string.toast_press_to_close));
}
checkDoubleBackPressTime();
}
private void checkDoubleBackPressTime() {
Single.just(new Object())
.delay(2, TimeUnit.SECONDS)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(getObserver());
}
private SingleObserver<Object> getObserver() {
return new SingleObserver<Object>() {
@Override
public void onSubscribe(Disposable d) {
}
@Override
public void onSuccess(Object o) {
mDoubleBackToExitPressedOnce = false;
}
@Override
public void onError(Throwable e) {
}
};
}
}
| [
"[email protected]"
] | |
9825a7ee396fad2286103ca82b2bd059e68ee569 | 765bfeb8631e38a3469c012b1b106986756bd56d | /src/design/EmployeeInfo.java | 72b9a5c1752cb98b55983234701972aa2ff163f5 | [] | no_license | AbiralSwar/Midterm2019AbiralSwar | 099e72c27b6d42fe29d52dab78ec63412592c08f | 0f61d153270c01b5b51574eee7d0ebedd6e55c9f | refs/heads/master | 2020-07-22T11:56:02.308696 | 2019-09-09T03:14:01 | 2019-09-09T03:14:01 | 207,193,299 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,070 | java | package design;
import java.util.Scanner;
public class EmployeeInfo extends AbstractClass{
/*This class can be implemented from Employee interface then add additional methods in EmployeeInfo class.
* Also, Employee interface can be implemented into an abstract class.So create an Abstract class
* then inherit that abstract class into EmployeeInfo class.Once you done with designing EmployeeInfo class,
* go to FortuneEmployee class to apply all the fields and attributes.
*
* Important: YOU MUST USE the
* OOP(abstraction,Encapsulation, Inheritance and Polymorphism) concepts in every level possible.
* Use all kind of keywords(super,this,static,final........)
* Implement Nested class.
* Use Exception Handling.
*
*/
/*
* declare few static and final fields and some non-static fields
*/
static String companyName;
private String name;
private int employeeId;
private String deptName;
private static double salary;
private static int numberOfYears;
/*
* You must implement the logic for below 2 methods and
* following 2 methods are prototype as well for other methods need to be design,
* as you will come up with the new ideas.
*/
/*
* you must have multiple constructor.
* Must implement below constructor.
*/
public EmployeeInfo(int employeeId){
this.employeeId=employeeId;
}
public EmployeeInfo(String name, int employeeId){
this.name = name;
this.employeeId = employeeId;
}
public EmployeeInfo(String name, int employeeId, String deptName, double salary) {
this.name = name;
this.employeeId = employeeId;
this.deptName = deptName;
this.salary=salary;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getEmployeeId() {
return employeeId;
}
public void setEmployeeId(int employeeId) {
this.employeeId = employeeId;
}
public String getdeptName() {
return deptName;
}
public void setdeptName(String deptName) {
this.deptName = deptName;
}
public double getSalary() {
return salary;
}
public void setSalary(double salary) {
this.salary = salary;
}
public int getnumberOfYears() {
return numberOfYears;
}
public void setnumberOfYears(int numberOfYears) {
this.numberOfYears = numberOfYears;
}
/*
* This methods should calculate Employee bonus based on salary and performance.
* Then it will return the total yearly bonus. So you need to implement the logic.
* Hints: 10% of the salary for best performance, 8% of the salary for average performance and so on.
* You can set arbitrary number for performance.
* So you probably need to send 2 arguments.
*
*/
public static int calculateEmployeeBonus(int numberOfYearsWithCompany, double yearlySalary){
double yearlyBonus = 0.00;
if (numberOfYearsWithCompany >5) {
yearlyBonus = yearlySalary* 0.1;
} else if (numberOfYearsWithCompany <3) {
yearlyBonus = yearlySalary * 0.08;
} else {
yearlyBonus = 0;
}
return (int) yearlyBonus;
}
/*
* This methods should calculate Employee Pension based on salary and numbers of years with the company.
* Then it will return the total pension. So you need to implement the logic.
* Hints: pension will be 5% of the salary for 1 year, 10% for 2 years with the company and so on.
*
*/
public static int calculateEmployeePension(){
int total=0;
Scanner sc = new Scanner(System.in);
System.out.println("Please enter start date in format (example: May,2015): ");
String joiningDate = sc.nextLine();
System.out.println("Please enter today's date in format (example: August,2017): ");
String todaysDate = sc.nextLine();
String convertedJoiningDate = DateConversion.convertDate(joiningDate);
String convertedTodaysDate = DateConversion.convertDate(todaysDate);
//implement numbers of year from above two dates
String startYear = convertedJoiningDate.substring(convertedJoiningDate.length() - 4, convertedJoiningDate.length());
String currentYear = convertedTodaysDate.substring(convertedTodaysDate.length() - 4, convertedTodaysDate.length());
int start = Integer.parseInt(startYear);
int current = Integer.parseInt(currentYear);
//Calculate pension
numberOfYears = current - start;
if (numberOfYears >= 5) {
total = (int) (salary * .25);
} else if (numberOfYears == 4) {
total = (int) (salary * .20);
} else if (numberOfYears == 3) {
total = (int) (salary * .15);
} else if (numberOfYears == 2) {
total = (int) (salary * .10);
} else if (numberOfYears == 1) {
total = (int) (salary * .05);
} else if (numberOfYears == 0) {
total = 0;
}
System.out.println("Total pension: $" + total);
return total;
}
@Override
public int employeeId() {
return 0;
}
@Override
public String employeeName() {
return null;
}
@Override
public void assignDepartment() {
}
@Override
public int calculateSalary() {
return 0;
}
@Override
public void benefitLayout() {
}
private static class DateConversion {
public DateConversion(Months months){}
public static String convertDate(String date) {
String [] extractMonth = date.split(",");
String givenMonth = extractMonth[0];
int monthDate = whichMonth(givenMonth);
String actualDate = monthDate + "/" + extractMonth[1];
return actualDate;
}
public static int whichMonth(String givenMonth) {
Months months = Months.valueOf(givenMonth);
int date = 0;
switch (months) {
case January:
date = 1;
break;
case February:
date = 2;
break;
case March:
date = 3;
break;
case April:
date = 4;
break;
case May:
date = 5;
break;
case June:
date = 6;
break;
case July:
date = 1;
break;
case August:
date = 1;
break;
case September:
date = 1;
break;
case October:
date = 1;
break;
case November:
date = 1;
break;
case December:
date = 1;
break;
default:
date = 0;
break;
}
return date;
}
}
}
| [
"[email protected]"
] | |
486c4197519ce8c292aba14e1ccf0d02608dbcc9 | e38a26dc54daf3a87f78021dc4764cdcdc7c2e98 | /redis/src/main/java/com/sungang/day3/operate/RedisController.java | 6a5b096e6ac46819bb2bff3b7cfc97bc87949797 | [] | no_license | sungang521/springcloud | dda72b7baf2e0cca85ba8de6d49c9d9f1677e838 | 776e1551e5e6ecdb6619ed40ebf55f50add18c52 | refs/heads/master | 2022-07-03T14:52:54.651517 | 2019-12-02T07:32:33 | 2019-12-02T07:32:33 | 189,856,384 | 0 | 0 | null | 2022-06-17T02:44:09 | 2019-06-02T14:27:54 | Java | UTF-8 | Java | false | false | 1,384 | java | package com.sungang.day3.operate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.BoundHashOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import redis.clients.jedis.Jedis;
import java.util.HashMap;
import java.util.Map;
@RestController
public class RedisController {
@Autowired
private RedisTemplate redisTemplate;
@Autowired
private StringRedisTemplate stringRedisTemplate;
@PostMapping("/testMap")
public String test() {
redisTemplate.opsForValue().set("key1", "value1");
stringRedisTemplate.opsForValue().set("int", "1");
stringRedisTemplate.opsForValue().increment("int", 1);
Jedis jedis = (Jedis) stringRedisTemplate.getConnectionFactory().getConnection().getNativeConnection();
jedis.decr("int");
Map<String, String> hash = new HashMap<>();
hash.put("filed1", "1");
hash.put("filed2", "2");
stringRedisTemplate.opsForHash().putAll("hash", hash);
BoundHashOperations hashOperations = stringRedisTemplate.boundHashOps("hash");
hashOperations.put("filed3", "2");
return "success";
}
}
| [
"[email protected]"
] | |
170c70f154364113f2d817945530d29808e91f1f | d27377cbc47756a318d30417d6d637debbe7321a | /src/main/java/wzd/util/TableOfMysqlUtil.java | 869ce7b97bbb3aec7e608c80880529faa7c3412b | [] | no_license | zdwang0317/imt | 9b7ff832365c2ecba55b68d1458e1961b5d22735 | 233ad9557beddc63d558db9a7b4fab6785906331 | refs/heads/master | 2020-05-22T09:31:27.902941 | 2019-01-15T01:20:35 | 2019-01-15T01:32:05 | 39,880,712 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,135 | java | package wzd.util;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
public class TableOfMysqlUtil {
public static int createTableToCpWipHistory(Connection conn,String tableName){
PreparedStatement pst = null;
int fd = -1;
if (conn != null) {
try {
pst = conn
.prepareStatement("CREATE TABLE "+tableName+"("
+ "Id int(11) NOT NULL AUTO_INCREMENT,"
+ "pn varchar(50) DEFAULT NULL,"
+ "cpn varchar(50) DEFAULT NULL,"
+ "ipn varchar(50) DEFAULT NULL,"
+ "lid varchar(50) DEFAULT NULL,"
+ "qty int(11) DEFAULT NULL,"
+ "wid varchar(255) DEFAULT NULL,"
+ "startDate date DEFAULT NULL,"
+ "stage varchar(100) DEFAULT NULL,"
+ "status varchar(100) DEFAULT NULL,"
+ "foTime date DEFAULT NULL,"
+ "remLayer varchar(200) DEFAULT NULL,"
+ "holdDate date DEFAULT NULL,"
+ "holdRemark mediumtext,"
+ "location varchar(100) DEFAULT NULL,"
+ "sendDate datetime DEFAULT NULL,"
+ "firm varchar(100) DEFAULT NULL,"
+ "fileName varchar(100) DEFAULT NULL,"
+ "erpDate varchar(50) DEFAULT NULL,"
+ "tpnFlow varchar(100) DEFAULT NULL,"
+ "productNo varchar(100) DEFAULT NULL,"
+ "PRIMARY KEY (Id)"
+ ") ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;");
fd = pst.executeUpdate();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally{
ConnUtil.closePst(pst);
}
}
return fd;
}
public static boolean checkTableExist(Connection conn,String tableName){
boolean hasTable = false;
DatabaseMetaData meta;
try {
meta = (DatabaseMetaData) conn.getMetaData();
ResultSet hasRst = meta.getTables (null, null,tableName, null);
while (hasRst.next()) {
hasTable =true;
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return hasTable;
}
}
| [
"[email protected]"
] | |
b33d7603457f9357d2c4ca5c8adf41679e0ba461 | d1ef93899f5a5264e26000043c8388b200b9a19f | /src/test/java/de/detecmedia/checkaccountnumber/Method61Test.java | 03ee56f11197f740ebeef65ed4d9ab1b8ba4483e | [] | no_license | detecmedia/check-account-number | 7ebc298a9ce6f7cec8c55a152c10cebfe091bc77 | d9c463217fc073ade33bac1b326f854c5e73e2dd | refs/heads/develop | 2021-06-25T14:00:20.253824 | 2017-09-12T18:39:19 | 2017-09-12T18:39:19 | 90,244,415 | 0 | 0 | null | 2017-09-12T18:39:20 | 2017-05-04T09:16:43 | Java | UTF-8 | Java | false | false | 1,725 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package de.detecmedia.checkaccountnumber;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* @author Markus Potthast <[email protected]>
*/
public class Method61Test {
public Method61Test() {
}
@BeforeClass
public static void setUpClass() {
}
@AfterClass
public static void tearDownClass() {
}
@Before
public void setUp() {
}
@After
public void tearDown() {
}
/**
* Test of check method, of class Method61.
*/
@Test
public void testTest() {
System.out.println("check");
Method61 instance = new Method61();
instance.setAccountNumber("2063099200");
boolean expResult = true;
boolean result = instance.test();
assertEquals(expResult, result);
}
@Test
public void testCheck1() {
System.out.println("check");
Method61 instance = new Method61();
instance.setAccountNumber("0260760481");
boolean expResult = true;
boolean result = instance.test();
assertEquals(expResult, result);
}
/**
* Test of getFlag method, of class Method61.
*/
@Test
public void testGetFlag() {
System.out.println("getFlag");
Method61 instance = new Method61();
char[] expResult = "61".toCharArray();
char[] result = instance.getFlag();
assertArrayEquals(expResult, result);
}
}
| [
"[email protected]"
] | |
afeb5573b7b46bbf2a0b79ebdf7711f70026150d | 33f0b85ce1aac9fa7148bc22c2fa6012e1eee7c3 | /ezwel_project/ezwel_if/src/main/java/com/ezwel/htl/interfaces/service/data/cancelFeeAmt/CancelFeeAmtOutSDO.java | 87332c69ec02458252bb8c111c74162f6a74ac2a | [
"Apache-2.0"
] | permissive | ezwelapi/ezwel-api | d3a8faf7fa8c3ecc6b6cc7e9f1c79d1e9e8c82a3 | edffc2473326f11df145a1eb0457120b4ae5ba6a | refs/heads/master | 2020-04-06T08:28:06.500385 | 2019-02-19T12:02:43 | 2019-02-19T12:02:43 | 157,305,633 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,391 | java | package com.ezwel.htl.interfaces.service.data.cancelFeeAmt;
import com.ezwel.htl.interfaces.commons.abstracts.AbstractSDO;
import com.ezwel.htl.interfaces.commons.annotation.APIModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import com.ezwel.htl.interfaces.commons.annotation.APIFields;
/**
* <pre>
*
* </pre>
*
* @author [email protected]
* @date 2018. 11. 13.
*/
@APIModel
@Data
@EqualsAndHashCode(callSuper=true)
public class CancelFeeAmtOutSDO extends AbstractSDO {
@APIFields(description = "취소수수료계산 output code", required=true, maxLength=4)
private String code;
@APIFields(description = "취소수수료계산 output message", maxLength=100)
private String message;
@APIFields(description = "RestAPI URI")
private String restURI;
public String getRestURI() {
return restURI;
}
public void setRestURI(String restURI) {
this.restURI = restURI;
}
@APIFields(description = "취소수수료계산 output data")
private CancelFeeAmtDataOutSDO data;
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public CancelFeeAmtDataOutSDO getData() {
return data;
}
public void setData(CancelFeeAmtDataOutSDO data) {
this.data = data;
}
}
| [
"[email protected]"
] | |
ca3c9f55e067dce1caa0d9f06c015f6d913f2022 | 49e87616264ba3ade189c2b08a45bba0a20950d9 | /app/src/main/java/com/repayment/money/ui/activity/PayScheduleActivity.java | e9d5724fc42083dcf54c4e4eec13aaa8c8af52c8 | [] | no_license | sfysfy/HuanKuan | c5c6342ecfc1ce7e3a82621acebb4e7be96f03d1 | e716d9db141ef7986f9838f968ea93b642ada1d5 | refs/heads/master | 2021-01-22T18:33:21.581133 | 2017-08-29T02:37:06 | 2017-08-29T02:37:06 | 100,764,244 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,057 | java | package com.repayment.money.ui.activity;
import com.example.mylibrary.base.BaseActivityWithNet;
import com.repayment.money.R;
import com.repayment.money.common.Constant;
import com.repayment.money.entity.BillDetailEntity;
public class PayScheduleActivity extends BaseActivityWithNet<BillDetailEntity> {
@Override
protected void initNetData() {
}
@Override
protected void initLocalData() {
}
@Override
protected void success(BillDetailEntity entity) {
}
@Override
protected void failed(Throwable throwable) {
}
@Override
protected String gerUrl() {
// http://101.200.128.107:10028/repayment/order/findHuankuan?orderNo=2017082316215303710001
//还款状态1-已还款,0-未还款,3-还款处理中,4-还款失败
return Constant.BILL_DETAIL_URL;
}
@Override
protected int addRootView() {
return R.layout.activity_pay_schedule;
}
@Override
protected void initView() {
}
@Override
protected void initListener() {
}
}
| [
"[email protected]"
] | |
2e5c38abc6adfdbd859f339ff1ff37feaa56909d | f5748681631f5685a9d8a1bcc8b757ce39f3bdd2 | /src/com/savi/show/dto/DeviceInfo.java | f131cb53b0ba367d099304bd8247913f079d7bd7 | [] | no_license | AlexanderChou/neteye | a573e921f8868aa2420956993451037e98dbcf9a | 772f40477251477f6b865bc2c13ff4ec30237061 | refs/heads/master | 2021-01-13T00:49:13.397622 | 2016-05-08T07:31:31 | 2016-05-08T07:31:31 | 54,363,134 | 1 | 1 | null | 2016-03-31T07:43:08 | 2016-03-21T05:50:11 | Java | UTF-8 | Java | false | false | 3,062 | java | package com.savi.show.dto;
/**
* Switchbasicinfo entity. @author MyEclipse Persistence Tools
*/
public class DeviceInfo {
// Fields
private Long id;
private String name;
private String equipmentType;
private String ipv4address;
private String ipv6address;
private String description;
private String snmpVersion;
private String readCommunity;
private String writeCommunity;
private String authKey;
private String privateKey;
private Integer status;
// Constructors
/** default constructor */
public DeviceInfo() {
}
public DeviceInfo(Long id,String name,String equipmentType,String ipv4address,String ipv6address,String subnetName,Long subnetId,Integer status,
String description,String snmpVersion,String readCommunity,String writeCommunity,String authKey,
String privateKey) {
this.id = id;
this.name = name;
this.equipmentType = equipmentType;
this.ipv4address = ipv4address;
this.ipv6address = ipv6address;
this.status = status;
this.description=description;
this.snmpVersion=snmpVersion;
this.readCommunity=readCommunity;
this.writeCommunity=writeCommunity;
this.authKey=authKey;
this.privateKey=privateKey;
}
// Property accessors
public Long getId() {
return this.id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
public String getEquipmentType() {
return this.equipmentType;
}
public void setEquipmentType(String equipmentType) {
this.equipmentType = equipmentType;
}
public String getIpv4address() {
return this.ipv4address;
}
public void setIpv4address(String ipv4address) {
this.ipv4address = ipv4address;
}
public String getIpv6address() {
return this.ipv6address;
}
public void setIpv6address(String ipv6address) {
this.ipv6address = ipv6address;
}
public String getDescription() {
return this.description;
}
public void setDescription(String description) {
this.description = description;
}
public String getSnmpVersion() {
return this.snmpVersion;
}
public void setSnmpVersion(String snmpVersion) {
this.snmpVersion = snmpVersion;
}
public String getReadCommunity() {
return this.readCommunity;
}
public void setReadCommunity(String readCommunity) {
this.readCommunity = readCommunity;
}
public String getWriteCommunity() {
return this.writeCommunity;
}
public void setWriteCommunity(String writeCommunity) {
this.writeCommunity = writeCommunity;
}
public String getAuthKey() {
return this.authKey;
}
public void setAuthKey(String authKey) {
this.authKey = authKey;
}
public String getPrivateKey() {
return this.privateKey;
}
public void setPrivateKey(String privateKey) {
this.privateKey = privateKey;
}
public Integer getStatus() {
return this.status;
}
public void setStatus(Integer status) {
this.status = status;
}
} | [
"[email protected]"
] | |
33dca71ddf5c70345f354e7716741d5018c7eebb | 658669457cabfdfc1c7259144d82e40450d6bf93 | /model/DTO/ci/validator/UploadInDTOValidator.java | 5cfda66e0d873fe3c06fd63fa002f2acd4085e5b | [] | no_license | urexmails/android | 0de5132be55e5c5d7eda9db878ae4d59e336979a | 4cedcdc658a8861ec4388f81b82ff084d7fc734e | refs/heads/master | 2020-03-21T08:44:05.773405 | 2018-06-23T01:21:22 | 2018-06-23T01:21:22 | 138,361,360 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,810 | java | package com.contactpoint.model.DTO.ci.validator;
import java.util.HashMap;
import com.contactpoint.model.DTO.ci.UploadInDTO;
public class UploadInDTOValidator extends Validator {
//public final static int DEFAULT_SIG_LENGTH = 1136;
public static boolean validateServiceDetail(HashMap<String, String> param) {
if (param.get(UploadInDTO.P_Q1_TIME_ATTENDING) == null) {
return false;
}
if (param.get(UploadInDTO.P_Q1_SERVICE_ORDERED) == null) {
return false;
}
if (param.get(UploadInDTO.P_Q2_PROVIDER_CONFIRM) == null) {
return false;
}
if (param.get(UploadInDTO.P_Q2_PROVIDER_CONFIRM).compareTo(UploadInDTO.YES) == 0 &&
param.get(UploadInDTO.P_Q2C_TIME_MET) == null) {
return false;
}
return true;
}
public static boolean validateProviderService1(HashMap<String, String> param) {
if (param.get(UploadInDTO.P_Q3C_NO_OF_CREW) == null) {
return false;
}
if (param.get(UploadInDTO.P_Q3C_PROVIDER_LOGO_DISPLAYED) == null) {
return false;
}
if (param.get(UploadInDTO.P_Q3C_1_PRESENTATION_CREW) == null) {
return false;
}
if (param.get(UploadInDTO.P_Q3C_2_CUST_SERVICE_SKILL) == null) {
return false;
}
if (param.get(UploadInDTO.P_Q3C_3_COND_OF_VEHICLE) == null) {
return false;
}
if (param.get(UploadInDTO.P_Q3C_4_COND_OF_PACKAGING) == null) {
return false;
}
if (param.get(UploadInDTO.P_Q3C_5_STANDING_CONTAINER) == null) {
return false;
}
/*
if (param.get(UploadInDTO.P_Q3C_6_REMLST_ON_TIME) == null) {
return false;
}
if (param.get(UploadInDTO.P_Q3C_7_REMLST_PROFESSIONAL) == null) {
return false;
}
if (param.get(UploadInDTO.P_Q3C_8_REM_CONDUCTED_TIMELY) == null) {
return false;
}*/
return true;
}
public static boolean validateProviderService2(HashMap<String, String> param) {
/*
if (param.get(UploadInDTO.P_Q3C_9_SPEC_PACKAGING) == null) {
return false;
}
if (param.get(UploadInDTO.P_Q3C_9_SPEC_PACKAGING).compareTo(UploadInDTO.YES) == 0 &&
param.get(UploadInDTO.P_Q3C_9A_SPEC_MATLS_PROVIDED)== null) {
return false;
}
if (param.get(UploadInDTO.P_Q3C_9_SPEC_PACKAGING).compareTo(UploadInDTO.YES) == 0 &&
param.get(UploadInDTO.P_Q3C_9B_PLASMA_REAR_PROJ) == null &&
param.get(UploadInDTO.P_Q3C_9B_BIKE) == null &&
param.get(UploadInDTO.P_Q3C_9B_PAINTING) == null &&
param.get(UploadInDTO.P_Q3C_9B_OTHER) == null) {
return false;
}
if (param.get(UploadInDTO.P_Q3C_10_REMOVAL_AS_REQD) == null) {
return false;
}
if (param.get(UploadInDTO.P_Q3C_11_ICR) == null) {
return false;
}
if (param.get(UploadInDTO.P_Q3C_11_ICR).compareTo(UploadInDTO.YES) == 0 &&
param.get(UploadInDTO.P_Q3C_11A_ICR_CORRECT) == null) {
return false;
}
if (param.get(UploadInDTO.P_Q3C_12_REMLST_VEH_POS) == null) {
return false;
}
if (param.get(UploadInDTO.P_Q3C_12_REMLST_VEH_POS).compareTo(UploadInDTO.NO) == 0 &&
param.get(UploadInDTO.P_Q3C_12A_TRUCK_IN_DRIVEWAY) == null &&
param.get(UploadInDTO.P_Q3C_12A_TRUCK_DBL_PARKED) == null &&
param.get(UploadInDTO.P_Q3C_12A_TRUCK_ON_VERGE) == null) {
return false;
}*/
return true;
}
public static boolean validateProviderService3(HashMap<String, String> param) {
/*
if (param.get(UploadInDTO.P_Q3C_13_REMLST_FE_RESP) == null) {
return false;
}
if (param.get(UploadInDTO.P_Q3C_14_REMLST_TREATING_RESID) == null) {
return false;
}
if (param.get(UploadInDTO.P_Q3C_15_PROVIDER_OHS_COMP) == null) {
return false;
}
if (param.get(UploadInDTO.P_Q3C_15_PROVIDER_OHS_COMP).compareTo(UploadInDTO.NO) == 0 &&
param.get(UploadInDTO.P_Q3C_15A_NO_SAFETY_GEAR) == null &&
param.get(UploadInDTO.P_Q3C_15A_TRUCK_LOAD) == null &&
param.get(UploadInDTO.P_Q3C_15A_UNSAFE_LIFT_CARRY) == null &&
param.get(UploadInDTO.P_Q3C_15A_PACKING) == null &&
param.get(UploadInDTO.P_Q3C_15A_TRUCK_LOCATION) == null) {
return false;
}*/
return true;
}
public static boolean validateMemberRating(HashMap<String, String> param) {
if (param.get(UploadInDTO.P_Q4U_8_RATING) == null &&
param.get(UploadInDTO.P_Q6D_4_RATING) == null) {
return false;
}
/*
if (param.get(UploadInDTO.P_Q4U_7_REMLST_COMMS) == null &&
param.get(UploadInDTO.P_Q4U_7_OVERALL_IMPRESSION) == null &&
param.get(UploadInDTO.P_Q4U_7_NO_OF_CREW_INSUFF) == null &&
param.get(UploadInDTO.P_Q4U_7_TREAT_SPEC_ITEMS) == null &&
param.get(UploadInDTO.P_Q4U_7_ICR_COMPLETED) == null) {
return false;
}*/
return true;
}
public static boolean validateTollRating(HashMap<String, String> param) {
if (param.get(UploadInDTO.P_Q8_1_RATING) == null) {
return false;
}
if (!isNotEmpty(param.get(UploadInDTO.P_Q8_2_TIME_ON_SITE))) {
return false;
}
return true;
}
public static boolean validateVolume(HashMap<String, String> param) {
if (!isNotEmpty(param.get(UploadInDTO.P_Q5U_VOLUME)) &&
!isNotEmpty(param.get(UploadInDTO.P_Q7D_VOLUME))) {
return false;
}
return true;
}
public static boolean validateDelivery(HashMap<String, String> param) {
if (param.get(UploadInDTO.P_Q6D_1_MEM_ADVISED_PAID) == null) {
return false;
}
if (param.get(UploadInDTO.P_Q6D_2_MEM_TOLL_WARR) == null) {
return false;
}
if (param.get(UploadInDTO.P_Q6D_3_DELIVERY_COMPLETED) == null) {
return false;
}
if (param.get(UploadInDTO.P_Q6D_4_MEM_REM_DEBRIS) == null) {
return false;
}
if (param.get(UploadInDTO.P_Q7D_1_REM_UNPACK) == null) {
return false;
}
if (param.get(UploadInDTO.P_Q7D_2_PACK_MATL) == null) {
return false;
}
if (param.get(UploadInDTO.P_Q7D_3_ANYTHING_OFF_LOAD) == null) {
return false;
}
if (param.get(UploadInDTO.P_Q7D_3_ANYTHING_OFF_LOAD)
.compareTo(UploadInDTO.YES) == 0) {
if (!isNotEmpty(param.get(UploadInDTO.P_Q7D_3A_VOLUME))) {
return false;
}
if (param.get(UploadInDTO.P_Q7D_3A_VOLUME) == null) {
return false;
}
}
return true;
}
public static boolean validateUplift(HashMap<String, String> param) {
if (param.get(UploadInDTO.P_Q4U_1_CARTON_KIT_REQD) == null) {
return false;
}
if (param.get(UploadInDTO.P_Q4U_1_CARTON_KIT_REQD).compareTo(UploadInDTO.YES) == 0 &&
param.get(UploadInDTO.P_Q4U_1A_REVD_IN_TIMELY_MANNER) == null) {
return false;
}
if (param.get(UploadInDTO.P_Q4U_2_MEM_REVD_GUIDE) == null) {
return false;
}
if (param.get(UploadInDTO.P_Q4U_3_MEM_AWARE_OF_ITEMS) == null) {
return false;
}
if (param.get(UploadInDTO.P_Q4U_4_MEM_AWARE_ICR) == null) {
return false;
}
if (param.get(UploadInDTO.P_Q4U_5_MEM_AWARE_OF_WARR) == null) {
return false;
}
if (param.get(UploadInDTO.P_Q4U_6_MEM_AWARE_OF_CHANGES) == null) {
return false;
}
if (param.get(UploadInDTO.P_Q4U_6_MEM_AWARE_OF_CHANGES)
.compareTo(UploadInDTO.YES) == 0) {
if (param.get(UploadInDTO.P_Q4_7_CASE_MAN_AWARE_OF_CHANG) == null) {
return false;
}
if (param.get(UploadInDTO.P_Q4_8_CASE_MANAGER_APPROVAL) == null) {
return false;
}
if (param.get(UploadInDTO.P_Q4U_7_PROV_CHANGES_MEM_INV) == null) {
return false;
}
}
return true;
}
public static boolean validateSignature(HashMap<String, String> param) {
if (param.get(UploadInDTO.TT) == null ||
/*param.get(UploadInDTO.TT).length() == DEFAULT_SIG_LENGTH*/
(param.get(UploadInDTO.Member) == null &&
param.get(UploadInDTO.Agent) == null)) {
return false;
}
return true;
}
}
| [
"[email protected]"
] | |
d5e820d9dc5f23ddee67fed4235aa0d3a9fa6871 | 076bdf2c9cd8a4038ab59231f7dd34d5b4330149 | /powerjob-server/src/main/java/com/github/kfcfans/powerjob/server/service/instance/InstanceTimeWheelService.java | 10a0c9d3720c12e049158eeb3af3966e20f16bb2 | [
"Apache-2.0"
] | permissive | qitao321/PowerJob | 0f975e72fbb7157eba2f406dd43f5c2e398720fa | 34ee79ca0631481595fa754490ef38dc5bf87778 | refs/heads/master | 2023-03-22T16:17:39.530484 | 2021-03-18T01:02:57 | 2021-03-18T01:02:57 | 283,451,421 | 0 | 0 | Apache-2.0 | 2020-07-29T09:08:05 | 2020-07-29T09:08:04 | null | UTF-8 | Java | false | false | 1,662 | java | package com.github.kfcfans.powerjob.server.service.instance;
import com.github.kfcfans.powerjob.server.common.utils.timewheel.HashedWheelTimer;
import com.github.kfcfans.powerjob.server.common.utils.timewheel.TimerFuture;
import com.github.kfcfans.powerjob.server.common.utils.timewheel.TimerTask;
import com.google.common.collect.Maps;
import java.util.Map;
import java.util.concurrent.TimeUnit;
/**
* 定时调度任务实例
*
* @author tjq
* @since 2020/7/25
*/
public class InstanceTimeWheelService {
private static final Map<Long, TimerFuture> CARGO = Maps.newConcurrentMap();
// 精确时间轮,每 1S 走一格
private static final HashedWheelTimer TIMER = new HashedWheelTimer(1, 4096, Runtime.getRuntime().availableProcessors() * 4);
// 支持取消的时间间隔,低于该阈值则不会放进 CARGO
private static final long MIN_INTERVAL_MS = 1000;
/**
* 定时调度
* @param uniqueId 唯一 ID,必须是 snowflake 算法生成的 ID
* @param delayMS 延迟毫秒数
* @param timerTask 需要执行的目标方法
*/
public static void schedule(Long uniqueId, Long delayMS, TimerTask timerTask) {
TimerFuture timerFuture = TIMER.schedule(() -> {
CARGO.remove(uniqueId);
timerTask.run();
}, delayMS, TimeUnit.MILLISECONDS);
if (delayMS > MIN_INTERVAL_MS) {
CARGO.put(uniqueId, timerFuture);
}
}
/**
* 获取 TimerFuture
* @param uniqueId 唯一 ID
* @return TimerFuture
*/
public static TimerFuture fetchTimerFuture(Long uniqueId) {
return CARGO.get(uniqueId);
}
}
| [
"[email protected]"
] | |
5ea5e07c2358a84584132acd88b2454b910a4d5f | f4f6f68f956b9f0107877397a6cecbf1177e45ca | /AttDEMO/app/src/main/java/com/aiwinn/faceattendance/ui/m/MainActivity.java | 97d0a1ded8a10915ab2d422a5ab8776276437859 | [] | no_license | P79N6A/RecognitionDemo | a07183e0b8d20d74fb8e20d93ae670ab833b3025 | c91f988a5aad3daee33f338cc0403b67deab9e0c | refs/heads/master | 2020-04-08T00:32:56.743535 | 2018-11-23T16:28:21 | 2018-11-23T16:28:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,636 | java | package com.aiwinn.faceattendance.ui.m;
import android.Manifest;
import android.annotation.SuppressLint;
import android.hardware.Camera;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.KeyEvent;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
import com.aiwinn.base.activity.BaseActivity;
import com.aiwinn.base.util.AppUtils;
import com.aiwinn.base.util.FileUtils;
import com.aiwinn.base.util.PermissionUtils;
import com.aiwinn.base.util.ToastUtils;
import com.aiwinn.faceattendance.AttApp;
import com.aiwinn.faceattendance.R;
import com.aiwinn.faceattendance.adapter.ActivityAdapter;
import com.aiwinn.faceattendance.common.AttConstants;
import com.aiwinn.facedetectsdk.FaceDetectManager;
import com.aiwinn.facedetectsdk.common.ConfigLib;
import com.aiwinn.facedetectsdk.common.Constants;
import com.chad.library.adapter.base.BaseQuickAdapter;
import java.util.ArrayList;
import java.util.List;
/**
* com.aiwinn.faceattendance.ui.m
* SDK_ATT
* 2018/08/29
* Created by LeoLiu on User
*/
public class MainActivity extends BaseActivity implements View.OnClickListener ,PermissionUtils.FullCallback{
TextView mVersion;
TextView mName;
RecyclerView mRecyclerView;
ArrayList<String> mStringArrayList;
private String[] permissions = new String[]{
Manifest.permission.CAMERA,
Manifest.permission.READ_PHONE_STATE,
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.READ_EXTERNAL_STORAGE
};
private boolean mIsGranted;
private ActivityAdapter mActivityAdapter;
@Override
public int getLayoutId() {
return R.layout.activity_main;
}
@SuppressLint("WrongViewCast")
@Override
public void initViews() {
mVersion = findViewById(R.id.version);
mName = findViewById(R.id.name);
mRecyclerView = findViewById(R.id.activity);
}
@Override
public void initData() {
mVersion.setText("APP V_"+getVersionName());
mName.setText(getResources().getString(R.string.app_name));
mIsGranted = true;
for (int i = 0; i < permissions.length; i++) {
if (!PermissionUtils.isGranted(permissions[i])) {
mIsGranted = false;
break;
}
}
GridLayoutManager lm = new GridLayoutManager(MainActivity.this, 2);
mRecyclerView.setLayoutManager(lm);
mStringArrayList = new ArrayList<>();
mStringArrayList.clear();
mActivityAdapter = new ActivityAdapter(mStringArrayList);
mRecyclerView.setAdapter(mActivityAdapter);
prepareActivityString();
}
private void prepareActivityString() {
mStringArrayList.add(getResources().getString(R.string.yuvregist));//相机注册
mStringArrayList.add(getResources().getString(R.string.bmpregist));//图片注册
mStringArrayList.add(getResources().getString(R.string.detect));//探测
mStringArrayList.add(getResources().getString(R.string.config));//配置
mStringArrayList.add(getResources().getString(R.string.list));//注册列表
mStringArrayList.add(getResources().getString(R.string.bulkregist));//批量注册
mStringArrayList.add(getResources().getString(R.string.authorization));//授权
mActivityAdapter.replaceData(mStringArrayList);
}
@Override
public void initListeners() {
mActivityAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
@Override
public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
switch (position){
case 0:
if (checkInitState()) {
mIntent.setClass(MainActivity.this, YuvRegistActivity.class);
startActivity(mIntent);
}
break;
case 1:
if (checkInitState()) {
mIntent.setClass(MainActivity.this, BmpRegistActvity.class);
startActivity(mIntent);
}
break;
case 2:
if (checkInitState()) {
mIntent.setClass(MainActivity.this, DetectActivity.class);
startActivity(mIntent);
}
break;
case 3:
if (checkInitState()) {
mIntent.setClass(MainActivity.this, ConfigActivity.class);
startActivity(mIntent);
}
break;
case 4:
if (checkInitState()) {
mIntent.setClass(MainActivity.this, RegisterListActivity.class);
startActivity(mIntent);
}
break;
case 5:
if (checkInitState()) {
mIntent.setClass(MainActivity.this, BulkRegistActivity.class);
startActivity(mIntent);
}
break;
case 6:
if (Constants.SDK_AUTHORIZATION_VERSION) {
mIntent.setClass(MainActivity.this, AuthorizationActivity.class);
startActivity(mIntent);
}else {
ToastUtils.showLong(getResources().getString(R.string.authorization_not));
}
break;
}
}
});
}
private long mExitTime;
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
if ((System.currentTimeMillis() - mExitTime) > 3000) {
Toast.makeText(this, getResources().getString(R.string.press_exit), Toast.LENGTH_SHORT).show();
mExitTime = System.currentTimeMillis();
} else {
FaceDetectManager.release();
AppUtils.exitApp();
}
return true;
}
return super.onKeyDown(keyCode, event);
}
@Override
protected void onResume() {
super.onResume();
if (mIsGranted) {
if (!AttConstants.INIT_STATE) {
FileUtils.createOrExistsDir(AttConstants.PATH_AIWINN);
FileUtils.createOrExistsDir(AttConstants.PATH_ATTENDANCE);
FileUtils.createOrExistsDir(AttConstants.PATH_BULK_REGISTRATION);
FileUtils.createOrExistsDir(AttConstants.PATH_CARD);
Camera.CameraInfo cameraInfo = new Camera.CameraInfo();
int cameraCount = Camera.getNumberOfCameras();
for (int i = 0; i < cameraCount; i++) {
if (cameraInfo.facing == Camera.CameraInfo.CAMERA_FACING_BACK) {
AttConstants.hasBackCamera = true;
}else if (cameraInfo.facing == Camera.CameraInfo.CAMERA_FACING_FRONT){
AttConstants.hasFrontCamera = true;
}
}
AttConstants.cameraCount = cameraCount;
if (AttConstants.hasBackCamera) {
AttConstants.CAMERA_ID = AttConstants.CAMERA_BACK_ID;
AttConstants.CAMERA_DEGREE = AttConstants.CAMERA_BACK_DEGREE;
}
if (!AttConstants.hasBackCamera && AttConstants.hasFrontCamera) {
AttConstants.CAMERA_ID = AttConstants.CAMERA_FRONT_ID;
AttConstants.CAMERA_DEGREE = AttConstants.CAMERA_FRONT_DEGREE;
}
AttConstants.CAMERA_PREVIEW_HEIGHT = AttApp.sp.getInt(AttConstants.PREFS_CAMERA_PREVIEW_SIZE,AttConstants.CAMERA_PREVIEW_HEIGHT);
ConfigLib.picScaleSize = AttApp.sp.getFloat(AttConstants.PREFS_TRACKER_SIZE,ConfigLib.picScaleSize);
ConfigLib.picScaleRate = AttApp.sp.getFloat(AttConstants.PREFS_DETECT_RATE,ConfigLib.picScaleRate);
ConfigLib.Nv21ToBitmapScale = AttApp.sp.getInt(AttConstants.PREFS_FEATURE_SIZE,ConfigLib.Nv21ToBitmapScale);
FaceDetectManager.setFaceMinRect(AttApp.sp.getInt(AttConstants.PREFS_DETECT_SIZE,FaceDetectManager.getFaceMinRect()));
AttConstants.CAMERA_ID = AttApp.sp.getInt(AttConstants.PREFS_CAMERA_ID,AttConstants.CAMERA_ID);
AttConstants.CAMERA_DEGREE = AttApp.sp.getInt(AttConstants.PREFS_CAMERA_DEGREE,AttConstants.CAMERA_DEGREE);
AttConstants.PREVIEW_DEGREE = AttApp.sp.getInt(AttConstants.PREFS_PREVIEW_DEGREE,AttConstants.PREVIEW_DEGREE);
AttConstants.LEFT_RIGHT = AttApp.sp.getBoolean(AttConstants.PREFS_LR,AttConstants.LEFT_RIGHT);
AttConstants.TOP_BOTTOM = AttApp.sp.getBoolean(AttConstants.PREFS_TB,AttConstants.TOP_BOTTOM);
ConfigLib.detectWithRecognition = AttApp.sp.getBoolean(AttConstants.PREFS_RECOGNITION,ConfigLib.detectWithRecognition);
ConfigLib.detectWithLiveness = AttApp.sp.getBoolean(AttConstants.PREFS_LIVENESS,ConfigLib.detectWithLiveness);
ConfigLib.featureThreshold = AttApp.sp.getFloat(AttConstants.PREFS_UNLOCK,ConfigLib.featureThreshold);
ConfigLib.livenessThreshold = AttApp.sp.getFloat(AttConstants.PREFS_LIVENESST,ConfigLib.livenessThreshold);
ConfigLib.registerPicRect = AttApp.sp.getInt(AttConstants.PREFS_FACEMINIMA,ConfigLib.registerPicRect);
ConfigLib.maxRegisterBrightness = AttApp.sp.getFloat(AttConstants.PREFS_MAXREGISTERBRIGHTNESS,ConfigLib.maxRegisterBrightness);
ConfigLib.minRegisterBrightness = AttApp.sp.getFloat(AttConstants.PREFS_MINREGISTERBRIGHTNESS,ConfigLib.minRegisterBrightness);
ConfigLib.blurRegisterThreshold = AttApp.sp.getFloat(AttConstants.PREFS_BLURREGISTERTHRESHOLD,ConfigLib.blurRegisterThreshold);
ConfigLib.maxRecognizeBrightness = AttApp.sp.getFloat(AttConstants.PREFS_MAXRECOGNIZEBRIGHTNESS,ConfigLib.maxRecognizeBrightness);
ConfigLib.minRecognizeBrightness = AttApp.sp.getFloat(AttConstants.PREFS_MINRECOGNIZEBRIGHTNESS,ConfigLib.minRecognizeBrightness);
ConfigLib.blurRecognizeThreshold = AttApp.sp.getFloat(AttConstants.PREFS_BLURECOGNIZETHRESHOLD,ConfigLib.blurRecognizeThreshold);
ConfigLib.blurRecognizeNewThreshold = AttApp.sp.getFloat(AttConstants.PREFS_BLURECOGNIZENEWTHRESHOLD,ConfigLib.blurRecognizeNewThreshold);
Constants.DEBUG_SAVE_BLUR = AttApp.sp.getBoolean(AttConstants.PREFS_SAVEBLURDATA,Constants.DEBUG_SAVE_BLUR);
Constants.DEBUG_SAVE_NOFACE = AttApp.sp.getBoolean(AttConstants.PREFS_SAVENOFACEDATA,Constants.DEBUG_SAVE_NOFACE);
Constants.DEBUG_SAVE_SIMILARITY_SMALL = AttApp.sp.getBoolean(AttConstants.PREFS_SAVESSDATA,Constants.DEBUG_SAVE_SIMILARITY_SMALL);
AttConstants.DEBUG = AttApp.sp.getBoolean(AttConstants.PREFS_DEBUG,AttConstants.DEBUG);
Constants.TRACKER_MODE = AttApp.sp.getInt(AttConstants.PREFS_TRACKER_MODE,Constants.TRACKER_MODE);
FaceDetectManager.setDetectFaceMode(AttApp.sp.getInt(AttConstants.PREFS_DETECT_MODE,FaceDetectManager.getDetectFaceMode()));
AttApp.initSDK();
}
}else{
PermissionUtils.permission(permissions).callback(this).request();
}
}
@Override
public void onClick(View v) {
switch (v.getId()){
default:break;
}
}
boolean checkInitState(){
if (!AttConstants.INIT_STATE) {
ToastUtils.showLong(getResources().getString(R.string.init_fail)+" : "+ AttConstants.INIT_STATE_ERROR);
return false;
}else {
return true;
}
}
@Override
public void onGranted(List<String> list) {
mIsGranted = true;
}
@Override
public void onDenied(List<String> list, List<String> list1) {
mIsGranted = false;
}
}
| [
"[email protected]"
] | |
9647eb752f12577e12b2b7a773e34b52dff24f99 | 65a09e9f4450c6133e6de337dbba373a5510160f | /leanCrm/src/main/java/co/simasoft/view/ActivitiesTypesBean.java | d2d34413499c5c9c478b09e864b5c25bdb521406 | [] | no_license | nelsonjava/simasoft | c0136cdf0c208a5e8d01ab72080330e4a15b1261 | be83eb8ef67758be82bbd811b672572eff1910ee | refs/heads/master | 2021-01-23T15:21:01.981277 | 2017-04-27T12:46:16 | 2017-04-27T12:46:16 | 27,980,384 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,876 | java | package co.simasoft.view;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Resource;
import javax.ejb.SessionContext;
import javax.ejb.Stateful;
import javax.enterprise.context.Conversation;
import javax.enterprise.context.ConversationScoped;
import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.inject.Inject;
import javax.inject.Named;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.PersistenceContextType;
import javax.persistence.TypedQuery;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import co.simasoft.models.ActivitiesTypes;
import co.simasoft.models.Activities;
import java.util.Iterator;
/**
* Backing bean for ActivitiesTypes entities.
* <p/>
* This class provides CRUD functionality for all ActivitiesTypes entities. It
* focuses purely on Java EE 6 standards (e.g. <tt>@ConversationScoped</tt>
* for state management, <tt>PersistenceContext</tt> for persistence,
* <tt>CriteriaBuilder</tt> for searches) rather than introducing a CRUD
* framework or custom base class.
*/
@Named
@Stateful
@ConversationScoped
public class ActivitiesTypesBean implements Serializable {
private static final long serialVersionUID = 1L;
/*
* Support creating and retrieving ActivitiesTypes entities
*/
private Long id;
public Long getId() {
return this.id;
}
public void setId(Long id) {
this.id = id;
}
private ActivitiesTypes activitiesTypes;
public ActivitiesTypes getActivitiesTypes() {
return this.activitiesTypes;
}
public void setActivitiesTypes(ActivitiesTypes activitiesTypes) {
this.activitiesTypes = activitiesTypes;
}
@Inject
private Conversation conversation;
@PersistenceContext(unitName = "leanCrmPU-JTA", type = PersistenceContextType.EXTENDED)
private EntityManager entityManager;
public String create() {
this.conversation.begin();
this.conversation.setTimeout(1800000L);
return "create?faces-redirect=true";
}
public void retrieve() {
if (FacesContext.getCurrentInstance().isPostback()) {
return;
}
if (this.conversation.isTransient()) {
this.conversation.begin();
this.conversation.setTimeout(1800000L);
}
if (this.id == null) {
this.activitiesTypes = this.example;
} else {
this.activitiesTypes = findById(getId());
}
}
public ActivitiesTypes findById(Long id) {
return this.entityManager.find(ActivitiesTypes.class, id);
}
/*
* Support updating and deleting ActivitiesTypes entities
*/
public String update() {
this.conversation.end();
try {
if (this.id == null) {
this.entityManager.persist(this.activitiesTypes);
return "search?faces-redirect=true";
} else {
this.entityManager.merge(this.activitiesTypes);
return "view?faces-redirect=true&id="
+ this.activitiesTypes.getId();
}
} catch (Exception e) {
FacesContext.getCurrentInstance().addMessage(null,
new FacesMessage(e.getMessage()));
return null;
}
}
public String delete() {
this.conversation.end();
try {
ActivitiesTypes deletableEntity = findById(getId());
Iterator<Activities> iterActivities = deletableEntity
.getActivities().iterator();
for (; iterActivities.hasNext();) {
Activities nextInActivities = iterActivities.next();
nextInActivities.setActivitiesTypes(null);
iterActivities.remove();
this.entityManager.merge(nextInActivities);
}
this.entityManager.remove(deletableEntity);
this.entityManager.flush();
return "search?faces-redirect=true";
} catch (Exception e) {
FacesContext.getCurrentInstance().addMessage(null,
new FacesMessage(e.getMessage()));
return null;
}
}
/*
* Support searching ActivitiesTypes entities with pagination
*/
private int page;
private long count;
private List<ActivitiesTypes> pageItems;
private ActivitiesTypes example = new ActivitiesTypes();
public int getPage() {
return this.page;
}
public void setPage(int page) {
this.page = page;
}
public int getPageSize() {
return 10;
}
public ActivitiesTypes getExample() {
return this.example;
}
public void setExample(ActivitiesTypes example) {
this.example = example;
}
public String search() {
this.page = 0;
return null;
}
public void paginate() {
CriteriaBuilder builder = this.entityManager.getCriteriaBuilder();
// Populate this.count
CriteriaQuery<Long> countCriteria = builder.createQuery(Long.class);
Root<ActivitiesTypes> root = countCriteria.from(ActivitiesTypes.class);
countCriteria = countCriteria.select(builder.count(root)).where(
getSearchPredicates(root));
this.count = this.entityManager.createQuery(countCriteria)
.getSingleResult();
// Populate this.pageItems
CriteriaQuery<ActivitiesTypes> criteria = builder
.createQuery(ActivitiesTypes.class);
root = criteria.from(ActivitiesTypes.class);
TypedQuery<ActivitiesTypes> query = this.entityManager
.createQuery(criteria.select(root).where(
getSearchPredicates(root)));
query.setFirstResult(this.page * getPageSize()).setMaxResults(
getPageSize());
this.pageItems = query.getResultList();
}
private Predicate[] getSearchPredicates(Root<ActivitiesTypes> root) {
CriteriaBuilder builder = this.entityManager.getCriteriaBuilder();
List<Predicate> predicatesList = new ArrayList<Predicate>();
String alias = this.example.getAlias();
if (alias != null && !"".equals(alias)) {
predicatesList.add(builder.like(
builder.lower(root.<String> get("alias")),
'%' + alias.toLowerCase() + '%'));
}
String observations = this.example.getObservations();
if (observations != null && !"".equals(observations)) {
predicatesList.add(builder.like(
builder.lower(root.<String> get("observations")),
'%' + observations.toLowerCase() + '%'));
}
String name = this.example.getName();
if (name != null && !"".equals(name)) {
predicatesList.add(builder.like(
builder.lower(root.<String> get("name")),
'%' + name.toLowerCase() + '%'));
}
return predicatesList.toArray(new Predicate[predicatesList.size()]);
}
public List<ActivitiesTypes> getPageItems() {
return this.pageItems;
}
public long getCount() {
return this.count;
}
/*
* Support listing and POSTing back ActivitiesTypes entities (e.g. from
* inside an HtmlSelectOneMenu)
*/
public List<ActivitiesTypes> getAll() {
CriteriaQuery<ActivitiesTypes> criteria = this.entityManager
.getCriteriaBuilder().createQuery(ActivitiesTypes.class);
return this.entityManager.createQuery(
criteria.select(criteria.from(ActivitiesTypes.class)))
.getResultList();
}
@Resource
private SessionContext sessionContext;
public Converter getConverter() {
final ActivitiesTypesBean ejbProxy = this.sessionContext
.getBusinessObject(ActivitiesTypesBean.class);
return new Converter() {
@Override
public Object getAsObject(FacesContext context,
UIComponent component, String value) {
return ejbProxy.findById(Long.valueOf(value));
}
@Override
public String getAsString(FacesContext context,
UIComponent component, Object value) {
if (value == null) {
return "";
}
return String.valueOf(((ActivitiesTypes) value).getId());
}
};
}
/*
* Support adding children to bidirectional, one-to-many tables
*/
private ActivitiesTypes add = new ActivitiesTypes();
public ActivitiesTypes getAdd() {
return this.add;
}
public ActivitiesTypes getAdded() {
ActivitiesTypes added = this.add;
this.add = new ActivitiesTypes();
return added;
}
}
| [
"[email protected]"
] | |
c7d17652b6a3dd32df02f6f2827b5c0fae2f3f84 | 8d5c6c8242fa60d99abc73b4b90f3d7f61e013a1 | /src/main/java/com/acme/livroservice/LoadDatabase.java | ad033222f6a0e9e1ac3facae51f9da86243d7e5d | [] | no_license | tiagolpadua/msc-livro-microservice | 004f994687fbb3d932a8138d1e8aa34af10f795e | a88b94ef2a07f4a180f5cde10c499ab586a8ae1d | refs/heads/master | 2020-04-17T13:20:39.383754 | 2019-02-08T02:45:10 | 2019-02-08T02:45:10 | 166,611,686 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 942 | java | package com.acme.livroservice;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.CommandLineRunner;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
class LoadDatabase {
Logger logger = LoggerFactory.getLogger(LoadDatabase.class);
@Bean
public CommandLineRunner initDatabase(LivroRepository repository) {
return args -> {
logger.info("Preloading " + repository.save(new Livro("Miguel de Cervantes", "Don Quixote", 144.0)));
logger.info("Preloading " + repository.save(new Livro("J. R. R. Tolkien", "O Senhor dos Anéis", 123.0)));
logger.info("Preloading "
+ repository.save(new Livro("Antoine de Saint-Exupéry", "O Pequeno Príncipe", 152.0)));
logger.info(
"Preloading " + repository.save(new Livro("Charles Dickens", "Um Conto de Duas Cidades", 35.0)));
};
}
}
| [
"[email protected]"
] | |
b0f476aa84743ceda755679876faf686e536bd17 | 1f4d669dc6e56aa8d74342a0f35dfac47ac7eb8d | /Test/src/java/controller/TransactionSvl.java | 9bd382c0850be9feb2871c0295b28d18f8b9ac34 | [] | no_license | aoeminh/ASM-Webservice-Client | 01990fefc57279ccccb585e80b1345948a8ad057 | 062c724c883811feff50b0998404be86fe69bf71 | refs/heads/master | 2020-03-27T04:58:22.707380 | 2018-08-24T11:42:54 | 2018-08-24T11:42:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,735 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package controller;
import com.example.service.CheckPartnerService_Service;
import com.example.service.Partner;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Date;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.ws.rs.client.Client;
import javax.xml.ws.WebServiceRef;
/**
*
* @author apple
*/
public class TransactionSvl extends HttpServlet {
@WebServiceRef(wsdlLocation = "WEB-INF/wsdl/localhost_8080/ASMWebservice-war/CheckPartnerService.wsdl")
private CheckPartnerService_Service service;
/**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
* methods.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
try (PrintWriter out = response.getWriter()) {
/* TODO output your page here. You may use following sample code. */
}
}
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/**
* Handles the HTTP <code>GET</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Handles the HTTP <code>POST</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
//processRequest(request, response);
HttpSession session = request.getSession();
com.example.service.Partner partnerSes = (Partner) session.getAttribute("partner");
String clientID = request.getParameter("clientid");
String password = request.getParameter("cpassword");
String checkFee = request.getParameter("check");
String transName = request.getParameter("transname");
//money of partner before transaction
Date date = new Date();
try {
int moneyofPartner = partnerSes.getPartnermoney();
int money = Integer.parseInt(request.getParameter("money"));
com.example.service.Client client = new com.example.service.Client();
client = checkClient(clientID, password);
//money of client before transaction
boolean checkUpdateClient = false;
boolean checkUpdatePartner = false;
int moneyOfClient = client.getCmoney();
int fee = caculateFee(money);
if (client != null) {
if (checkFee != null) {
//money of client and partner before transaction
int clientMoneyChange = moneyOfClient - (fee + money);
int partnerMoneyChange = moneyofPartner + money;
//transaction
//update money for client and partner;
updateCLientMoney(clientID, clientMoneyChange);
updatePartnerMoney(partnerSes.getPartneraccount(), partnerMoneyChange);
userHis(transName, money, -fee, client.getClienid());
partnerHis(transName, money, 0, partnerSes.getPartnerid());
} else {
//money of client and partner before transaction
int clientMoneyChange = moneyOfClient - money;
int partnerMoneyChange = moneyofPartner + (money - fee);
//transaction
//update money for client and partner;
checkUpdateClient = updateCLientMoney(clientID, clientMoneyChange);
checkUpdatePartner = updatePartnerMoney(partnerSes.getPartneraccount(), partnerMoneyChange);
userHis(transName, money, 0, client.getClienid());
partnerHis(transName, money, -fee, partnerSes.getPartnerid());
}
// if (checkUpdateClient && checkUpdatePartner) {
// request.getRequestDispatcher("success.jsp").forward(request, response);
// } else {
// request.getRequestDispatcher("error.jsp").forward(request, response);
// }
request.getRequestDispatcher("success.jsp").forward(request, response);
} else {
request.getRequestDispatcher("error.jsp").forward(request, response);
}
} catch (Exception ex) {
request.getRequestDispatcher("error.jsp").forward(request, response);
}
}
/**
* Returns a short description of the servlet.
*
* @return a String containing servlet description
*/
@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>
private boolean updateCLientMoney(java.lang.String clienid, int money) {
// Note that the injected javax.xml.ws.Service reference as well as port objects are not thread safe.
// If the calling of port operations may lead to race condition some synchronization is required.
com.example.service.CheckPartnerService port = service.getCheckPartnerServicePort();
return port.updateCLientMoney(clienid, money);
}
private boolean updatePartnerMoney(java.lang.String partnerid, int money) {
// Note that the injected javax.xml.ws.Service reference as well as port objects are not thread safe.
// If the calling of port operations may lead to race condition some synchronization is required.
com.example.service.CheckPartnerService port = service.getCheckPartnerServicePort();
return port.updatePartnerMoney(partnerid, money);
}
public int caculateFee(int money) {
if (money <= 100000) {
return 10000;
} else if (money > 100000 && money <= 500000) {
return money * 4 / 100;
} else if (money > 500000 && money <= 1000000) {
return (money * 3) / 100;
} else if (money > 1000000 && money <= 5000000) {
return (money * 2) / 100;
} else if (money > 5000000) {
return money / 100;
} else {
return 0;
}
}
private com.example.service.Client checkClient(java.lang.String id, java.lang.String password) {
// Note that the injected javax.xml.ws.Service reference as well as port objects are not thread safe.
// If the calling of port operations may lead to race condition some synchronization is required.
com.example.service.CheckPartnerService port = service.getCheckPartnerServicePort();
return port.checkClient(id, password);
}
private boolean partnerHis(java.lang.String transname, int money, int fee, java.lang.String partnerid) {
// Note that the injected javax.xml.ws.Service reference as well as port objects are not thread safe.
// If the calling of port operations may lead to race condition some synchronization is required.
com.example.service.CheckPartnerService port = service.getCheckPartnerServicePort();
return port.partnerHis(transname, money, fee, partnerid);
}
private boolean userHis(java.lang.String transname, int money, int fee, java.lang.String clientid) {
// Note that the injected javax.xml.ws.Service reference as well as port objects are not thread safe.
// If the calling of port operations may lead to race condition some synchronization is required.
com.example.service.CheckPartnerService port = service.getCheckPartnerServicePort();
return port.userHis(transname, money, fee, clientid);
}
}
| [
"[email protected]"
] | |
2f4fffde0515134c235df0382347c912026c21de | f1ed4776e7e2f6fc3dfe4355b86e1ffb7a5daf3d | /C9Alarm/src/com/tavx/C9Alarm/bean/PointCountBean.java | 04a0b76b6f6b2205b9cf2ad102fb5d6924c83d80 | [] | no_license | laoda512/dhie | 05cc3e4ee674c58af99d12d5b63bd9ef520edd27 | ef7b1fb5d81c85058b2aa8d5c1561d1d4fedca3b | refs/heads/master | 2021-01-10T18:30:20.610318 | 2015-02-13T02:03:33 | 2015-02-13T02:03:33 | 30,735,040 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,055 | java | /**
*
*/
package com.tavx.C9Alarm.bean;
import com.tavx.C9Alam.connector.MyLogger;
import com.tavx.C9Alarm.AlarmApplication;
import com.tavx.C9Alarm.Symbol;
import com.tavx.C9Alarm.Manager.NumberManager;
import android.content.Context;
import util.readWriteAbleBean;
/**
* @author Administrator
*
*/
public class PointCountBean extends readWriteAbleBean{
private String count;
private Long date;
private String MAX_COUNT ;
/**
* @param c
* @param _tag
*/
public PointCountBean(Context c, String _tag) {
super(c, _tag);
MyLogger.e("aaa", _tag+" "+toString());
}
@Override
public String toString() {
return "ClickBean [count=" + count + ", date=" + date + ", MAX_COUNT="
+ MAX_COUNT + "]";
}
/* (non-Javadoc)
* @see util.readWriteAbleBean#iniParam()
*/
@Override
public void iniParam() {
count = "0";
date =0l;
MAX_COUNT = "200";
}
public boolean hasOverMax(){
NumberManager nm = NumberManager.getInstance();
refixTime(nm);
if(nm.isLargerEqual(getCount(), MAX_COUNT)) return true;
return false;
}
public String getCount() {
return count;
}
public Long getDate() {
return date;
}
public void setCount(String count) {
this.count = count;
writeData(AlarmApplication.getApp(), "count");
}
public void setDate(Long date) {
this.date = date;
writeData(AlarmApplication.getApp(), "date");
}
public boolean addCount(String howMuch){
NumberManager nm = NumberManager.getInstance();
refixTime(nm);
if(nm.isLargerEqual(getCount(), MAX_COUNT)) return false;
setCount(nm.add(getCount(), howMuch));
return true;
//setCount(getCount()+1);
}
private void refixTime(NumberManager nm ){
Long time = System.currentTimeMillis();
if(checkIsTimeOverMax()){
setDate(time);
setCount(nm.getMixedString(0));
};
}
private boolean checkIsTimeOverMax(){
Long time = System.currentTimeMillis();
if(time>getDate()+getTimeInterval()){
return true;
};
return false;
}
private long getTimeInterval(){
return Symbol.INTERVAL_DAY/24*20;
}
}
| [
"[email protected]"
] | |
3552a1d55931beb5ef4c832619b0eb0907ae89c6 | 51973ce0cb415b94546301936cd99c44ce04c761 | /src/main/java/cn/wsq/util/JsonUtils.java | dcaebeca33e0547ee435c1e82f3f49da431da768 | [] | no_license | qin501/testtest | 4aac60d559167d677ca702221f65387275f6962a | 2311be17134b1e64439133353d545cf52e27645b | refs/heads/master | 2020-04-09T10:53:44.527088 | 2018-12-16T07:38:18 | 2018-12-16T07:38:18 | 160,286,662 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,715 | java | package cn.wsq.util;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.util.List;
/**
* 自定义响应结构, 转换类
*/
public class JsonUtils {
// 定义jackson对象
private static final ObjectMapper MAPPER = new ObjectMapper();
/**
* 将对象转换成json字符串。
* <p>Title: pojoToJson</p>
* <p>Description: </p>
* @param data
* @return
*/
public static String objectToJson(Object data) {
try {
String string = MAPPER.writeValueAsString(data);
return string;
} catch (JsonProcessingException e) {
e.printStackTrace();
}
return null;
}
/**
* 将json结果集转化为对象
*
* @param jsonData json数据
* @param clazz 对象中的object类型
* @return
*/
public static <T> T jsonToPojo(String jsonData, Class<T> beanType) {
try {
T t = MAPPER.readValue(jsonData, beanType);
return t;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* 将json数据转换成pojo对象list
* <p>Title: jsonToList</p>
* <p>Description: </p>
* @param jsonData
* @param beanType
* @return
*/
public static <T>List<T> jsonToList(String jsonData, Class<T> beanType) {
JavaType javaType = MAPPER.getTypeFactory().constructParametricType(List.class, beanType);
try {
List<T> list = MAPPER.readValue(jsonData, javaType);
return list;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
}
| [
"[email protected]"
] | |
88168c6c9a8de271062940ffa2143d163d0d1e69 | 6c4135cc07753b8348a07e17dba571c32990ff73 | /flowable/src/main/java/com/example/flowable/demo/Demo.java | 7a8345aaf4fc8c4d2c03bf088a3099a9c3d6f455 | [] | no_license | 17671367716/demo | 07b89c083a09febc9d096ca2489becabbccbbeb6 | d8dd60127ddfc56ed60c01533b82e36f629c5cc2 | refs/heads/master | 2023-06-26T07:57:33.467379 | 2021-08-02T06:22:34 | 2021-08-02T06:22:34 | 387,984,386 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 82 | java | package com.example.flowable.demo;
public class Demo {
private String Id;
}
| [
"[email protected]"
] | |
122a37be9e5a54e833d712e8b6b899768f246627 | 12b788074006cccc45e9b448a6cf164a24bd7e67 | /app/build/generated/not_namespaced_r_class_sources/debug/processDebugResources/r/android/support/drawerlayout/R.java | 0a869596d69cfd6216dc6d966e175781e0e48c06 | [] | no_license | Akabo027/ProductCatalog | d9389d520e15f683b008c642b1c193b94aeb24d2 | 1cdf8143f83a2e5672a0d96bded777430f7a7e63 | refs/heads/master | 2020-04-05T01:58:07.677397 | 2018-11-06T23:41:05 | 2018-11-06T23:41:05 | 156,458,346 | 0 | 0 | null | 2018-11-06T22:43:21 | 2018-11-06T22:43:20 | null | UTF-8 | Java | false | false | 10,459 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* gradle plugin from the resource data it found. It
* should not be modified by hand.
*/
package android.support.drawerlayout;
public final class R {
private R() {}
public static final class attr {
private attr() {}
public static final int alpha = 0x7f020027;
public static final int font = 0x7f02007a;
public static final int fontProviderAuthority = 0x7f02007c;
public static final int fontProviderCerts = 0x7f02007d;
public static final int fontProviderFetchStrategy = 0x7f02007e;
public static final int fontProviderFetchTimeout = 0x7f02007f;
public static final int fontProviderPackage = 0x7f020080;
public static final int fontProviderQuery = 0x7f020081;
public static final int fontStyle = 0x7f020082;
public static final int fontVariationSettings = 0x7f020083;
public static final int fontWeight = 0x7f020084;
public static final int ttcIndex = 0x7f02013c;
}
public static final class color {
private color() {}
public static final int notification_action_color_filter = 0x7f04003f;
public static final int notification_icon_bg_color = 0x7f040040;
public static final int ripple_material_light = 0x7f04004b;
public static final int secondary_text_default_material_light = 0x7f04004d;
}
public static final class dimen {
private dimen() {}
public static final int compat_button_inset_horizontal_material = 0x7f05004b;
public static final int compat_button_inset_vertical_material = 0x7f05004c;
public static final int compat_button_padding_horizontal_material = 0x7f05004d;
public static final int compat_button_padding_vertical_material = 0x7f05004e;
public static final int compat_control_corner_material = 0x7f05004f;
public static final int compat_notification_large_icon_max_height = 0x7f050050;
public static final int compat_notification_large_icon_max_width = 0x7f050051;
public static final int notification_action_icon_size = 0x7f05005b;
public static final int notification_action_text_size = 0x7f05005c;
public static final int notification_big_circle_margin = 0x7f05005d;
public static final int notification_content_margin_start = 0x7f05005e;
public static final int notification_large_icon_height = 0x7f05005f;
public static final int notification_large_icon_width = 0x7f050060;
public static final int notification_main_column_padding_top = 0x7f050061;
public static final int notification_media_narrow_margin = 0x7f050062;
public static final int notification_right_icon_size = 0x7f050063;
public static final int notification_right_side_padding_top = 0x7f050064;
public static final int notification_small_icon_background_padding = 0x7f050065;
public static final int notification_small_icon_size_as_large = 0x7f050066;
public static final int notification_subtext_size = 0x7f050067;
public static final int notification_top_pad = 0x7f050068;
public static final int notification_top_pad_large_text = 0x7f050069;
}
public static final class drawable {
private drawable() {}
public static final int notification_action_background = 0x7f060054;
public static final int notification_bg = 0x7f060055;
public static final int notification_bg_low = 0x7f060056;
public static final int notification_bg_low_normal = 0x7f060057;
public static final int notification_bg_low_pressed = 0x7f060058;
public static final int notification_bg_normal = 0x7f060059;
public static final int notification_bg_normal_pressed = 0x7f06005a;
public static final int notification_icon_background = 0x7f06005b;
public static final int notification_template_icon_bg = 0x7f06005c;
public static final int notification_template_icon_low_bg = 0x7f06005d;
public static final int notification_tile_bg = 0x7f06005e;
public static final int notify_panel_notification_icon_bg = 0x7f06005f;
}
public static final class id {
private id() {}
public static final int action_container = 0x7f07000e;
public static final int action_divider = 0x7f070010;
public static final int action_image = 0x7f070011;
public static final int action_text = 0x7f070017;
public static final int actions = 0x7f070018;
public static final int async = 0x7f070020;
public static final int blocking = 0x7f070023;
public static final int chronometer = 0x7f07002e;
public static final int forever = 0x7f070045;
public static final int icon = 0x7f07004b;
public static final int icon_group = 0x7f07004c;
public static final int info = 0x7f07004f;
public static final int italic = 0x7f070051;
public static final int line1 = 0x7f070053;
public static final int line3 = 0x7f070054;
public static final int normal = 0x7f07005e;
public static final int notification_background = 0x7f07005f;
public static final int notification_main_column = 0x7f070060;
public static final int notification_main_column_container = 0x7f070061;
public static final int right_icon = 0x7f07006a;
public static final int right_side = 0x7f07006b;
public static final int tag_transition_group = 0x7f07008c;
public static final int tag_unhandled_key_event_manager = 0x7f07008d;
public static final int tag_unhandled_key_listeners = 0x7f07008e;
public static final int text = 0x7f07008f;
public static final int text2 = 0x7f070090;
public static final int time = 0x7f070096;
public static final int title = 0x7f070097;
}
public static final class integer {
private integer() {}
public static final int status_bar_notification_info_maxnum = 0x7f080005;
}
public static final class layout {
private layout() {}
public static final int notification_action = 0x7f09001e;
public static final int notification_action_tombstone = 0x7f09001f;
public static final int notification_template_custom_big = 0x7f090026;
public static final int notification_template_icon_group = 0x7f090027;
public static final int notification_template_part_chronometer = 0x7f09002b;
public static final int notification_template_part_time = 0x7f09002c;
}
public static final class string {
private string() {}
public static final int status_bar_notification_info_overflow = 0x7f0b0032;
}
public static final class style {
private style() {}
public static final int TextAppearance_Compat_Notification = 0x7f0c00ec;
public static final int TextAppearance_Compat_Notification_Info = 0x7f0c00ed;
public static final int TextAppearance_Compat_Notification_Line2 = 0x7f0c00ef;
public static final int TextAppearance_Compat_Notification_Time = 0x7f0c00f2;
public static final int TextAppearance_Compat_Notification_Title = 0x7f0c00f4;
public static final int Widget_Compat_NotificationActionContainer = 0x7f0c015d;
public static final int Widget_Compat_NotificationActionText = 0x7f0c015e;
}
public static final class styleable {
private styleable() {}
public static final int[] ColorStateListItem = { 0x10101a5, 0x101031f, 0x7f020027 };
public static final int ColorStateListItem_android_color = 0;
public static final int ColorStateListItem_android_alpha = 1;
public static final int ColorStateListItem_alpha = 2;
public static final int[] FontFamily = { 0x7f02007c, 0x7f02007d, 0x7f02007e, 0x7f02007f, 0x7f020080, 0x7f020081 };
public static final int FontFamily_fontProviderAuthority = 0;
public static final int FontFamily_fontProviderCerts = 1;
public static final int FontFamily_fontProviderFetchStrategy = 2;
public static final int FontFamily_fontProviderFetchTimeout = 3;
public static final int FontFamily_fontProviderPackage = 4;
public static final int FontFamily_fontProviderQuery = 5;
public static final int[] FontFamilyFont = { 0x1010532, 0x1010533, 0x101053f, 0x101056f, 0x1010570, 0x7f02007a, 0x7f020082, 0x7f020083, 0x7f020084, 0x7f02013c };
public static final int FontFamilyFont_android_font = 0;
public static final int FontFamilyFont_android_fontWeight = 1;
public static final int FontFamilyFont_android_fontStyle = 2;
public static final int FontFamilyFont_android_ttcIndex = 3;
public static final int FontFamilyFont_android_fontVariationSettings = 4;
public static final int FontFamilyFont_font = 5;
public static final int FontFamilyFont_fontStyle = 6;
public static final int FontFamilyFont_fontVariationSettings = 7;
public static final int FontFamilyFont_fontWeight = 8;
public static final int FontFamilyFont_ttcIndex = 9;
public static final int[] GradientColor = { 0x101019d, 0x101019e, 0x10101a1, 0x10101a2, 0x10101a3, 0x10101a4, 0x1010201, 0x101020b, 0x1010510, 0x1010511, 0x1010512, 0x1010513 };
public static final int GradientColor_android_startColor = 0;
public static final int GradientColor_android_endColor = 1;
public static final int GradientColor_android_type = 2;
public static final int GradientColor_android_centerX = 3;
public static final int GradientColor_android_centerY = 4;
public static final int GradientColor_android_gradientRadius = 5;
public static final int GradientColor_android_tileMode = 6;
public static final int GradientColor_android_centerColor = 7;
public static final int GradientColor_android_startX = 8;
public static final int GradientColor_android_startY = 9;
public static final int GradientColor_android_endX = 10;
public static final int GradientColor_android_endY = 11;
public static final int[] GradientColorItem = { 0x10101a5, 0x1010514 };
public static final int GradientColorItem_android_color = 0;
public static final int GradientColorItem_android_offset = 1;
}
}
| [
"[email protected]"
] | |
bd1438590d1bacdce6fe2a65d27f93adb21f72f5 | 0c6d9fd1148156cc4bf33ddce09e33aab79d5d75 | /src/ViewController/ReportController.java | 49ab4f8b48506e227670f5943534d21554eeb351 | [] | no_license | astall1/DesktopSchedulingWizard | 14b91f0ccd9a171eaf3f079d2b4ce4d78630f562 | b20bd210f7f933a22ee585798d4fd84492579bd5 | refs/heads/master | 2022-11-16T03:18:43.573119 | 2020-07-03T06:09:50 | 2020-07-03T06:09:50 | 276,819,532 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,561 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package ViewController;
import com.mysql.jdbc.Connection;
import javafx.scene.layout.AnchorPane;
import javafx.stage.Stage;
import Scheduler.ScheduleWiz;
import java.io.IOException;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
/**
* FXML Controller class
*
* @author remin
*/
public class ReportController {
@FXML
private AnchorPane reportScreenPane;
@FXML
void ConsultantReportScreen(ActionEvent event) throws IOException {
System.out.println("Open Consultant Report");
Stage main = ScheduleWiz.loadStage("/ViewController/ReportConsultant.fxml");
main.show();
}
@FXML
void CustomerReportScreen(ActionEvent event) throws IOException {
System.out.println("Open Customer Report");
Stage main = ScheduleWiz.loadStage("/ViewController/ReportCust.fxml");
main.show();
}
@FXML
void MonthlyReportScreen(ActionEvent event) throws IOException {
System.out.println("Open Monthly Report");
Stage main = ScheduleWiz.loadStage("/ViewController/ReportMonthly.fxml");
main.show();
}
@FXML
void RevertMain(ActionEvent event) throws IOException {
System.out.println("Open Main");
Stage main = ScheduleWiz.loadStage("/ViewController/Main.fxml");
main.show();
}
}
| [
"[email protected]"
] | |
47394d81ed6d371945fa5da3dc5f874255e567f1 | 57f2121b660d91717e771c6b198fbbff52408d71 | /exchangechallenge/src/main/java/com/mysite/exchangechallenge/module/Person.java | 74a1ad4de9db2d17c4f94b02e87de00b6727d3b4 | [] | no_license | mpusio/JavaDojo | c414022774fc74c7981f515e21ed4177773e1415 | 8f220d7007fbac36e19e92ca2fc6fa1df4a881e1 | refs/heads/master | 2020-04-14T18:16:48.215104 | 2019-05-19T21:22:53 | 2019-05-19T21:22:53 | 164,012,665 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 382 | java | package com.mysite.exchangechallenge.module;
import java.util.UUID;
public class Person {
private final UUID id;
private final String name;
public Person(UUID id, String name) {
this.id = id;
this.name = name;
}
public UUID getId() {
return id;
}
public String getName() {
return name;
}
}
| [
"[email protected]"
] | |
6fe0fdfbf164a1944c7a2f3265d61cb3717d56d7 | 63e238d255d696cc9af997ec57f11dd4e6079f1a | /backend/src/main/java/com/rahul/ibcsprimax/controller/EmployeeController.java | 56c4174711410064e05a89ea2dc2ee83061c6dac | [] | no_license | rahul-cse/payroll | c0113523c36a25b59b90e81c46bd2771f65e5b5d | cae18ff4db359c239b4eaaaef52f4d9e63877fc1 | refs/heads/main | 2023-01-11T14:17:35.501227 | 2020-11-20T21:36:22 | 2020-11-20T21:36:22 | 314,246,980 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,808 | java | package com.rahul.ibcsprimax.controller;
import java.util.List;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.rahul.ibcsprimax.entity.Employee;
import com.rahul.ibcsprimax.service.EmployeeService;
@CrossOrigin("*")
@RestController
@RequestMapping("/emp")
@Transactional
public class EmployeeController {
@Autowired
EmployeeService employeeService;
@GetMapping("")
public List<Employee> getAllEmployees() {
return employeeService.getAll();
}
@GetMapping("/{strId}")
public Employee getEmployee(@PathVariable String strId) throws Exception {
Long id = null;
try {
id = Long.parseLong(strId);
}
catch(Exception ex) {
throw new Exception();
}
return employeeService.getById(id);
}
@PostMapping("/create")
public ResponseEntity<?> saveEmployee(@RequestBody @Valid Employee employee) {
employeeService.save(employee);
return ResponseEntity.ok(HttpStatus.CREATED);
}
@PutMapping("/update")
public ResponseEntity<?> updateEmployee(@RequestBody @Valid Employee employee){
employeeService.update(employee);
return ResponseEntity.ok(HttpStatus.OK);
}
}
| [
"[email protected]"
] | |
ace1280206e99ca74c09169a6754b4b986a0c710 | 3e21a4608bc5d468a9f45197154f75ce4b3db70c | /jlox/src/com/craftinginterpreters/lox/Environment.java | b2d04a5ce9fd098ca49551c0a774e6d9238082d3 | [] | no_license | prateekkumarweb/lox | 6134b4bb89c41d004544ec0ab5700a6d5da8d636 | 69f339759b1a7f419b341d38dd33a88ad8a24096 | refs/heads/master | 2022-06-03T17:46:30.308103 | 2020-05-01T05:59:11 | 2020-05-01T10:43:28 | 260,390,635 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,386 | java | package com.craftinginterpreters.lox;
import java.util.HashMap;
import java.util.Map;
class Environment {
final Environment enclosing;
private final Map<String, Object> values = new HashMap<>();
Environment() {
enclosing = null;
}
Environment(Environment enclosing) {
this.enclosing = enclosing;
}
Object get(Token name) {
if (values.containsKey(name.lexeme)) {
return values.get(name.lexeme);
}
if (enclosing != null)
return enclosing.get(name);
throw new RuntimeError(name, "Undefined variable '" + name.lexeme + "'.");
}
void assign(Token name, Object value) {
if (values.containsKey(name.lexeme)) {
values.put(name.lexeme, value);
return;
}
if (enclosing != null) {
enclosing.assign(name, value);
return;
}
throw new RuntimeError(name, "Undefined variable '" + name.lexeme + "'.");
}
void define(String name, Object value) {
values.put(name, value);
}
Environment ancestor(int distance) {
Environment environment = this;
for (int i = 0; i < distance; i++) {
environment = environment.enclosing;
}
return environment;
}
Object getAt(int distance, String name) {
return ancestor(distance).values.get(name);
}
void assignAt(int distance, Token name, Object value) {
ancestor(distance).values.put(name.lexeme, value);
}
} | [
"[email protected]"
] | |
e82d0d3adb133afbf36fee4376a2e193f3f4d17c | 743971fe05db7479c1ff94648c941ce80621dee3 | /app/src/test/java/com/something/kumaranurag/ggsipusyllabus/somethingUnitTest.java | 2241ecbb2ad31589901318760f9738a8b4ac94c8 | [
"BSD-3-Clause"
] | permissive | kmranrg/IPU_Syllabus | aa26ed3e28bbc8071627610e3bed4cfce73b0ed2 | 56eb9f543f2d3fd0f18e55d1be777bc6c21b09e0 | refs/heads/master | 2020-05-02T03:50:15.721549 | 2019-10-22T05:24:14 | 2019-10-22T05:24:14 | 177,737,535 | 0 | 0 | BSD-3-Clause | 2019-10-20T18:44:07 | 2019-03-26T07:37:43 | Java | UTF-8 | Java | false | false | 422 | java | package com.something.kumaranurag.ggsipusyllabus;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* something local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class somethingUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"[email protected]"
] | |
29463bc249042abea43959bf2751238070330b6c | 62517f9cc72c594784c583b21ab93e060eed4e60 | /app/src/main/java/cn/com/tcsl/mvptest/ui/down/DownPresenter.java | 594da623cd989a7bac7565f727535d8839d82c89 | [] | no_license | kailaisi/MVPTest | 5833f050582d34c0a783c1880965bc5ef52e929f | 995653da87deb7bc5c9ab2a9860950f473531054 | refs/heads/master | 2023-05-02T17:48:55.824146 | 2016-08-01T10:47:40 | 2016-08-01T10:47:40 | 63,403,411 | 0 | 0 | null | 2023-04-15T12:35:09 | 2016-07-15T08:02:19 | Java | UTF-8 | Java | false | false | 1,591 | java | package cn.com.tcsl.mvptest.ui.down;
import java.io.File;
import cn.com.tcsl.mvptest.http.RetrofitHttpUtils;
import cn.com.tcsl.mvptest.http.interfaces.DownProgressListener;
import okhttp3.ResponseBody;
import rx.Subscriber;
/**
* Created by wjx on 2016/7/23.
*/
public class DownPresenter implements DownContract.Presenter {
DownContract.View view;
DownContract.Model model;
public DownPresenter(DownContract.View view) {
this.view = view;
model=new DownModel();
}
@Override
public void downLoad(String url) {
view.showProgress();
DownProgressListener mListeren=new DownProgressListener() {
@Override
public void update(long current, long total, boolean isCompleted) {
view.updateProgress((int)(100l*current/total));
}
};
Subscriber<ResponseBody> subscriber=new Subscriber<ResponseBody>() {
@Override
public void onCompleted() {
}
@Override
public void onError(Throwable e) {
}
@Override
public void onNext(ResponseBody responseBody) {
view.dismisProgress();
File file=model.writeToSD(responseBody.byteStream());
view.intallAPK(file);
}
};
RetrofitHttpUtils.getDownInstance(mListeren).downLoad(subscriber,"http://hengdawb-app.oss-cn-hangzhou.aliyuncs.com/app-debug.apk");
}
@Override
public void start() {
}
@Override
public void onDestroy() {
}
}
| [
"[email protected]"
] | |
aa07ea6fb3da51741a3c9c74bac1b4148dbcb443 | 26c70c7531203df0fb914c18c9df94e7720183a5 | /src/JavaAssignment_PartA/ExceptionHandling.java | 57b6423c919862ab7730837cf0b0c9409da0b85f | [] | no_license | Misspelled-it/JerryMieles-JavaAssignment | c3ff6ce1b5c544da028f91bb1b46dda6724ff6ae | afb8c631c8f3f4d3ef4c1f738589050fa0f7b34c | refs/heads/master | 2021-01-20T09:14:07.602616 | 2017-08-29T01:27:39 | 2017-08-29T01:27:39 | 101,585,481 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,333 | java | package JavaAssignment_PartA;
import java.util.*;
public class ExceptionHandling {
public static void main(String[] args) throws ArrayIndexOutOfBoundsException {
//Prompt the user for an array size
System.out.println("Enter the number of elements in the array:");
Scanner scanner = new Scanner(System.in);
try {
int size = scanner.nextInt();
//if the size is less than 1 then prompt for a valid size
if(size <1) {
boolean validSize = false;
while(!validSize) {
System.out.println("Number of elements must be greater than 0, reenter:");
size = scanner.nextInt();
if(size>0) {
validSize = true;
}
}
}
//receive integers from the user
int[] array = new int[size];
System.out.println("Enter the elements in the array:");
for(int i = 0; i<size; i++) {
array[i] = scanner.nextInt();
}
//prompt for the index to output
System.out.println("Enter the index of the array element you want to access:");
int index = scanner.nextInt();
System.out.println("The array element at index " + index
+ " = " +array[index] +
"\nThe array element successfully accessed");
} catch(ArrayIndexOutOfBoundsException e) {
System.out.println("IndexOutOfRangeException");
} finally {
scanner.close();
}
}
}
| [
"[email protected]"
] | |
b532539b3698567d0351efbb29dbdcc3f244fb34 | a32557b99e4b25900c0abaa94987eea932fe7d04 | /signal-data/src/main/java/com/skr/signal/data/websocket/handler/WebSocketHandler.java | 8748d7aa7389b6cd59b065f3aec773f9cdebfc1c | [] | no_license | EchoFish/netty-stroll | 2c67b13a9914531f32f940e90e4362944176ff42 | 21c41c81683045bceef90195ed1608c051c838be | refs/heads/master | 2022-12-04T12:34:41.021495 | 2020-09-01T05:52:49 | 2020-09-01T05:52:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,441 | java | package com.skr.signal.data.websocket.handler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import io.netty.handler.codec.http.websocketx.TextWebSocketFrame;
import java.time.LocalDateTime;
/**
* @author mqw
* @create 2020-06-12-11:28
*/
public class WebSocketHandler extends SimpleChannelInboundHandler<TextWebSocketFrame> {
@Override
protected void channelRead0(ChannelHandlerContext ctx, TextWebSocketFrame msg) {
//回复消息
System.err.println(msg.text());
ctx.channel().writeAndFlush(new TextWebSocketFrame("服务器时间" + LocalDateTime.now() + " "));
}
//当web客户端连接后
@Override
public void handlerAdded(ChannelHandlerContext ctx) throws Exception {
//id 表示唯一的值,LongText 是唯一的 ShortText 不是唯一
System.out.println("handlerAdded 被调用" + ctx.channel().id().asLongText());
System.out.println("handlerAdded 被调用" + ctx.channel().id().asShortText());
}
@Override
public void handlerRemoved(ChannelHandlerContext ctx) throws Exception {
System.out.println("handlerRemoved 被调用" + ctx.channel().id().asLongText());
}
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
System.out.println("异常发生 " + cause.getMessage());
ctx.close();
}
}
| [
"[email protected]"
] | |
f87560a87adc6327bc69f68c8083c6d926129fd4 | 8456a184d4f5964b19d6c1b3a1a1b9f5addc395f | /Software_Development/BattleShip_Game/part2/src/main/java/edu/neu/ccs/cs5004/model/fleet/AbstractFleet.java | 2148bbafb71a12a6365607439dd4e63574f7ca63 | [] | no_license | bohraAnkur/Project_All | f39e1c14736cbb4fbd9b9660559271e40a47547d | f1524c336198c8aab9076e8effd2b08db137dca7 | refs/heads/master | 2021-07-09T12:34:05.122026 | 2020-04-03T21:38:18 | 2020-04-03T21:38:18 | 201,547,699 | 0 | 0 | null | 2020-10-13T20:54:34 | 2019-08-09T22:19:58 | Jupyter Notebook | UTF-8 | Java | false | false | 2,645 | java | package edu.neu.ccs.cs5004.model.fleet;
import edu.neu.ccs.cs5004.model.ships.Ship;
import java.util.ArrayList;
/**
* abstract class for the fleet.
*/
public abstract class AbstractFleet implements FleetInterface {
/**
* the list of ships representing the fleet.
*/
protected ArrayList<Ship> fleet;
/**
* constructor for the abstract fleet.
*/
public AbstractFleet() {
this.fleet = new ArrayList<Ship>();
}
protected abstract void initializeFleet();
/**
* Getter for the fleet of the fleet.
*
* @return the fleet of the map.
*/
public ArrayList<Ship> getFleet() {
return this.fleet;
}
/**
* Getter for the size of the fleet.
*
* @return an Integer representing the number of ships in the fleet
*/
public Integer getListSize() {
return this.fleet.size();
}
/**
* Implementation of the property if the fleet contains this ship.
*
* @param thisShip thisShip represents the InputSHip
* @return a Boolean representing true or false if the ship is there inside the fleet or not
*/
public Boolean containsShip(Ship thisShip) {
return this.fleet.contains(thisShip);
}
/**
* Implementation of the property if the fleet is empty.
*
* @return A boolean if the fleet is empty
*/
public Boolean isEmpty() {
return this.fleet.isEmpty();
}
/**
* Implementation of the property getIndex of, returns the last Index of the occurrence of the.
* ship at which it is.
*
* @param thisShip theShip whom's Index is to be looked upon
* @return An Integer which represents the index of the position of the list
*/
public Integer getIndexOf(Ship thisShip) {
return this.fleet.lastIndexOf(thisShip);
}
/**
* Implementation of the property get ship at a given index from the ship.
*
* @param index represents an Integer
* @return A ship
*/
public Ship getShip(Integer index) {
return this.fleet.get(index);
}
@Override
public Boolean isFleetSunk() {
for (int i = 0; i < this.fleet.size(); i++) {
if (!this.getShip(i).isSunk()) {
return false;
}
}
return true;
}
/**
* checks that two objects are equal.
* @param obj the object to be compared
* @return true if they are equal, false otherwise
*/
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null || getClass() != obj.getClass()) {
return false;
}
AbstractFleet other = (AbstractFleet) obj;
return other.getFleet().equals(this.getFleet());
}
public int hashCode() {
return fleet.hashCode();
}
}
| [
"[email protected]"
] | |
eee8f8a626d50ab986a7ada3a11188fa15480e39 | b82dd1df2ae52e66766cea189efab7ecd5585ac3 | /achilles-core/src/main/java/info/archinnov/achilles/internals/codegen/meta/EntityMetaColumnsForFunctionsCodeGen.java | f1cf5f6738f4495fc3868d824144b7224565fa04 | [
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | romolodevito/Achilles | 34ce40fbcdcc7ebfedf74935f4569c18cb08e136 | 8b04609f42f2b7c83c48a69b55773f3b4bc3411a | refs/heads/master | 2020-04-10T13:18:43.069016 | 2018-12-09T14:36:57 | 2018-12-09T14:36:57 | 155,694,647 | 0 | 0 | Apache-2.0 | 2018-11-01T09:53:11 | 2018-11-01T09:53:11 | null | UTF-8 | Java | false | false | 3,592 | java | /*
* Copyright (C) 2012-2018 DuyHai DOAN
*
* 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 info.archinnov.achilles.internals.codegen.meta;
import static info.archinnov.achilles.internals.parser.TypeUtils.*;
import java.util.List;
import javax.lang.model.element.Modifier;
import com.squareup.javapoet.CodeBlock;
import com.squareup.javapoet.FieldSpec;
import com.squareup.javapoet.TypeName;
import com.squareup.javapoet.TypeSpec;
import info.archinnov.achilles.internals.metamodel.columns.ColumnType;
import info.archinnov.achilles.internals.parser.FieldParser.FieldMetaSignature;
import info.archinnov.achilles.internals.parser.TypeUtils;
import info.archinnov.achilles.internals.strategy.naming.SnakeCaseNaming;
public class EntityMetaColumnsForFunctionsCodeGen {
private static final SnakeCaseNaming SNAKE_CASE_NAMING = new SnakeCaseNaming();
public static final TypeSpec createColumnsClassForFunctionParam(List<FieldMetaSignature> parsingResults) {
final TypeSpec.Builder builder = TypeSpec.classBuilder(COLUMNS_FOR_FUNCTIONS_CLASS)
.addJavadoc("Utility class to expose all fields with their CQL type for function call")
.addModifiers(Modifier.PUBLIC, Modifier.STATIC, Modifier.FINAL);
parsingResults
.stream()
.filter(x -> x.context.columnType != ColumnType.COMPUTED)
.forEach(parsingResult -> builder.addField(buildField(parsingResult)));
return builder.build();
}
private static final FieldSpec buildField(FieldMetaSignature fieldMetaSignature) {
final TypeName typeNameForFunctionParam = TypeUtils.determineTypeForFunctionParam(fieldMetaSignature.sourceType);
final String fieldName = SNAKE_CASE_NAMING.apply(fieldMetaSignature.context.fieldName).toUpperCase();
final String cqlColumn = fieldMetaSignature.context.quotedCqlColumn;
return FieldSpec.builder(typeNameForFunctionParam, fieldName, Modifier.PUBLIC, Modifier.FINAL)
.addJavadoc("<br/>\n")
.addJavadoc("Field to be used for <em>manager.dsl().select().function(...)</em> call\n")
.addJavadoc("<br/>\n")
.addJavadoc("This is an alias for the field <strong>$S</strong>", fieldMetaSignature.context.fieldName)
.initializer(CodeBlock
.builder()
.add("new $T($T.empty()){\n", typeNameForFunctionParam, OPTIONAL)
.add(" @$T\n", OVERRIDE_ANNOTATION)
.beginControlFlow(" protected String cqlColumn()")
.addStatement(" return $S", cqlColumn)
.endControlFlow()
.add(" @$T\n", OVERRIDE_ANNOTATION)
.beginControlFlow(" public boolean isFunctionCall()")
.addStatement(" return false")
.endControlFlow()
.add(" }\n")
.build()
)
.build();
}
}
| [
"[email protected]"
] | |
4a9807b71deea2324cb57801fd6c29ffa21f1e85 | 5e12a12323d3401578ea2a7e4e101503d700b397 | /branches/fitnesse/src/main/java/fitnesse/slimTables/HtmlTableScanner.java | a8f329deba71f5a2989ef77daefd4ab1a0aafe55 | [] | no_license | xiangyong/jtester | 369d4b689e4e66f25c7217242b835d1965da3ef8 | 5f4b3948cd8d43d3e8fea9bc34e5bd7667f4def9 | refs/heads/master | 2021-01-18T21:02:05.493497 | 2013-10-08T01:48:18 | 2013-10-08T01:48:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,783 | java | // Copyright (C) 2003-2009 by Object Mentor, Inc. All rights reserved.
// Released under the terms of the CPL Common Public License version 1.0.
package fitnesse.slimTables;
import org.htmlparser.Node;
import org.htmlparser.Parser;
import org.htmlparser.lexer.Lexer;
import org.htmlparser.lexer.Page;
import org.htmlparser.tags.TableTag;
import org.htmlparser.util.NodeList;
import org.htmlparser.util.ParserException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Random;
public class HtmlTableScanner implements TableScanner {
private List<Table> tables = new ArrayList<Table>();
private NodeList htmlTree;
public HtmlTableScanner(String page) throws ParserException {
if (page == null || page.equals(""))
page = "<i>This page intentionally left blank.</i>";
Parser parser = new Parser(new Lexer(new Page(page)));
htmlTree = parser.parse(null);
scanForTables(htmlTree);
}
private void scanForTables(NodeList nodes) {
for (int i = 0; i < nodes.size(); i++) {
Node node = nodes.elementAt(i);
if (node instanceof TableTag) {
TableTag tableTag = (TableTag) node;
guaranteeThatAllTablesAreUnique(tableTag);
tables.add(new HtmlTable(tableTag));
} else {
NodeList children = node.getChildren();
if (children != null)
scanForTables(children);
}
}
}
private void guaranteeThatAllTablesAreUnique(TableTag tagTable) {
tagTable.setAttribute("_TABLENUMBER", "" + Math.abs((new Random()).nextLong()));
}
public int getTableCount() {
return tables.size();
}
public Table getTable(int i) {
return tables.get(i);
}
public Iterator<Table> iterator() {
return tables.iterator();
}
public String toWikiText() {
StringBuffer b = new StringBuffer();
for (Table t : tables) {
b.append("\n");
for (int row = 0; row < t.getRowCount(); row++) {
b.append("|");
if (t.getColumnCountInRow(row) == 0)
b.append("|");
for (int col = 0; col < t.getColumnCountInRow(row); col++) {
b.append(t.getCellContents(col, row));
b.append("|");
}
b.append("\n");
}
}
return b.toString();
}
public String toHtml(Table startTable, Table endBeforeTable) {
String allHtml = htmlTree.toHtml();
int startIndex = 0;
int endIndex = allHtml.length();
if (startTable != null) {
String startText = startTable.toHtml();
int nodeIndex = allHtml.indexOf(startText);
if (nodeIndex > 0) {
startIndex = nodeIndex;
}
}
if (endBeforeTable != null) {
String stopText = endBeforeTable.toHtml();
int nodeIndex = allHtml.indexOf(stopText);
if (nodeIndex > 0) {
endIndex = nodeIndex;
}
}
return htmlTree.toHtml().substring(startIndex, endIndex);
}
public String toHtml() {
return htmlTree.toHtml();
}
}
| [
"darui.wu@9ac485da-fb45-aad8-5227-9c360d3c5fad"
] | darui.wu@9ac485da-fb45-aad8-5227-9c360d3c5fad |
ebdc875fd58e45cb057f228133a9d9e6dbbbc3b3 | 99f891f10705463169559e4cba3b852eedd73613 | /week-meeting/src/main/java/com/hirain/mapper/PlanMapper.java | a2eb7650b729cd9ad6ff4a1f9957ac2f034415f8 | [] | no_license | Chaves-z/week-meeting | e1b524c7ae1bfaeb80343b40ebcb4a3b711c401d | 947c087ac8d4e700421f2d78cef5161ef3b713f8 | refs/heads/master | 2020-03-21T04:21:30.054316 | 2018-06-21T11:10:38 | 2018-06-21T11:10:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 728 | java | package com.hirain.mapper;
import java.util.Map;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import com.hirain.pojo.Plan;
public interface PlanMapper {
@Insert("insert into plan (userId,lastWeek,currentWeek,problem,date) values(#{userid},#{lastweek},#{currentweek},#{problem},#{date})")
int insert(Plan plan);
@Select("select * from plan where userId=#{userid} and date=#{date}")
Plan findPlanByUserIdAndData(Map<String, Object> map);
@Update("update plan set userId=#{userid},lastWeek=#{lastweek},currentWeek=#{currentweek},problem=#{problem},date=#{date} where userId=#{userid} and date=#{date}")
int update(Plan plan);
} | [
"[email protected]"
] | |
1b88748a949aa6712ddc4253ce7f22526cf8a76d | 52abb3f9d6f5747ba9a7abeda455767f524a0898 | /sp/src/main/java/com/sp/web/alexa/coachme/AbstractIntentHander.java | c0d8246c374a7d28bbae8d6df168fc8df7b22776 | [] | no_license | srayapatipolarits/ECSandCFN | 251e474be9e76126bdd9244a480087eb9e28c039 | 1c16f7eebc6856afc47ad712fe7c1d160ffd3e84 | refs/heads/master | 2020-03-17T06:32:43.155453 | 2018-05-01T13:19:34 | 2018-05-01T13:19:34 | 133,360,061 | 1 | 0 | null | 2018-05-14T12:51:34 | 2018-05-14T12:51:34 | null | UTF-8 | Java | false | false | 7,639 | java | package com.sp.web.alexa.coachme;
import com.amazon.speech.slu.Slot;
import com.amazon.speech.speechlet.IntentRequest;
import com.amazon.speech.speechlet.Session;
import com.amazon.speech.speechlet.SpeechletResponse;
import com.amazon.speech.ui.PlainTextOutputSpeech;
import com.amazon.speech.ui.Reprompt;
import com.amazon.speech.ui.SimpleCard;
import com.sp.web.alexa.AlexaIntentHandler;
import com.sp.web.alexa.AlexaIntentType;
import com.sp.web.alexa.SPIntentRequest;
import com.sp.web.alexa.insights.InsightsSteps;
import com.sp.web.model.User;
import com.sp.web.user.UserFactory;
import com.sp.web.utils.MessagesHelper;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import java.util.List;
public abstract class AbstractIntentHander implements AlexaIntentHandler {
private static final Logger log = Logger.getLogger(AbstractIntentHander.class);
@Override
public SpeechletResponse execute(SPIntentRequest intentRequest) {
Session session = intentRequest.getSession();
// validate intent
switch (intentRequest.getAlexaIntentType()) {
case No:
case Yes:
Slot slot = intentRequest.getIntentRequest().getIntent().getSlot("Literal");
String value = slot.getValue();
if (StringUtils.isEmpty(value)
|| !(StringUtils.containsIgnoreCase(value, "absolutely")
|| StringUtils.containsIgnoreCase(value, "of course")
|| StringUtils.containsIgnoreCase(value, "not now")
|| StringUtils.containsIgnoreCase(value, "no thank you")
|| StringUtils.containsIgnoreCase(value, "nope")
|| StringUtils.containsIgnoreCase(value, "no")
|| StringUtils.containsIgnoreCase(value, "yup")
|| StringUtils.containsIgnoreCase(value, "I don't know")
|| StringUtils.containsIgnoreCase(value, "yup")
|| StringUtils.containsIgnoreCase(value, "please") || StringUtils.containsIgnoreCase(
value, "yes"))) {
log.info("Invalid , yes or no intent , slot value " + value);
String speechText = MessagesHelper.getMessage("alexa.yes.no.validate", intentRequest
.getUser().getFirstName());
// Create reprompt
PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
speech.setText(speechText);
Reprompt reprompt = new Reprompt();
reprompt.setOutputSpeech(speech);
return SpeechletResponse.newAskResponse(speech, reprompt);
}
break;
case AskName:
/* check if correct intent is requsted */
switch (intentRequest.getActionType()) {
case CoachMe:
String stepString = (String) session.getAttribute("nextStep");
CoacheMeSteps step;
if (stepString == null) {
step = CoacheMeSteps.WelcomeStep;
session.setAttribute("nextStep", step.toString());
} else {
step = CoacheMeSteps.valueOf(stepString);
}
AlexaIntentType[] intentInocation = step.getIntentInocation();
if (!ArrayUtils.contains(intentInocation, AlexaIntentType.AskName)) {
String speechText = MessagesHelper.getMessage("alexa.yes.no.validate", intentRequest
.getUser().getFirstName());
// Create reprompt
PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
speech.setText(speechText);
Reprompt reprompt = new Reprompt();
reprompt.setOutputSpeech(speech);
return SpeechletResponse.newAskResponse(speech, reprompt);
}
break;
case Insights:
String stepInsightsString = (String) session.getAttribute("nextStep");
InsightsSteps insightStep;
if (stepInsightsString == null) {
insightStep = InsightsSteps.WelcomeStep;
session.setAttribute("nextStep", insightStep.toString());
} else {
insightStep = InsightsSteps.valueOf(stepInsightsString);
}
AlexaIntentType[] intentInsightsInocation = insightStep.getAlexaIntentTypes();
if (!ArrayUtils.contains(intentInsightsInocation, AlexaIntentType.AskName)) {
String speechText = MessagesHelper.getMessage("alexa.yes.no.validate", intentRequest
.getUser().getFirstName());
// Create reprompt
PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
speech.setText(speechText);
Reprompt reprompt = new Reprompt();
reprompt.setOutputSpeech(speech);
return SpeechletResponse.newAskResponse(speech, reprompt);
}
default:
break;
}
default:
break;
}
// Validate correct request.
return executeHandler(intentRequest);
}
/**
* Creates a {@code SpeechletResponse} for the help intent.
*
* @return SpeechletResponse spoken and visual response for the given intent
*/
protected SpeechletResponse getAskCollegueName(Session session, User user) {
String collegeAskCountString = (String) session.getAttribute("nameAskCount");
int collegeAskCount;
if (collegeAskCountString == null) {
collegeAskCount = 1;
} else {
collegeAskCount = Integer.valueOf(collegeAskCountString);
}
String key = "alexa.relationship.welcome.nointent." + collegeAskCount;
if (collegeAskCount < 3) {
collegeAskCount += 1;
}
session.setAttribute("nameAskCount", String.valueOf(collegeAskCount));
String speechText = MessagesHelper.getMessage(key, user.getFirstName());
// Create the Simple card content.
SimpleCard card = new SimpleCard();
card.setTitle("Ask College Name ");
card.setContent(speechText);
// Create the plain text output.
PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
speech.setText(speechText);
// Create reprompt
Reprompt reprompt = new Reprompt();
reprompt.setOutputSpeech(speech);
return SpeechletResponse.newAskResponse(speech, reprompt, card);
}
/**
* isFullOrPartialEvent method tells whether the intent is full or partial intent.
*
* @param user
* logged in user.
* @param request
* alexa request.
* @param alexaIntentType
* alexaIntent type.
* @param session
* session.
* @return true or false;
*/
protected boolean isFullOrPartialEvent(User user, final IntentRequest request,
AlexaIntentType alexaIntentType, Session session, UserFactory userFactory) {
switch (alexaIntentType) {
case CoachMe:
case Insights:
case AskName:
Slot slot = request.getIntent().getSlot("Name");
if (slot != null) {
String value = slot.getValue();
if (value == null) {
return false;
}
log.info("check value " + value);
List<User> users = userFactory.findUserByName(value, user.getCompanyId());
log.info("Total users" + users + ",: user " + user.getCompanyId());
if (CollectionUtils.isEmpty(users)) {
return false;
} else if (users.size() > 1) {
return false;
} else {
User user2 = users.get(0);
session.setAttribute("userid", user2.getId());
return true;
}
} else {
return false;
}
default:
return false;
}
}
protected abstract SpeechletResponse executeHandler(SPIntentRequest intentRequest);
}
| [
"[email protected]"
] | |
b1f8c5b161a228e3197b9e67f596cad1dcae03d3 | f38d8e69234d6004086c832f7b2265fabed8fba4 | /src/main/java/com/jeecg/z_entry/controller/ZEntryController.java | 06cea5c1674525d941fc0fb7d4088670a8819cc5 | [] | no_license | qpy1992/20180626 | befd1eae204b741b7e5dbc46027163efe301a49c | ebf8dfefc4676ddd2f58b964c74eaff6f51f38af | refs/heads/master | 2020-04-04T08:46:11.980490 | 2018-11-02T09:02:42 | 2018-11-02T09:02:42 | 155,793,891 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 17,360 | java | package com.jeecg.z_entry.controller;
import com.jeecg.z_entry.entity.ZEntryEntity;
import com.jeecg.z_entry.service.ZEntryServiceI;
import com.jeecg.z_entry.page.ZEntryPage;
import com.jeecg.z_entrydetail.entity.ZEntrydetailEntity;
import java.util.ArrayList;
import java.util.List;
import java.text.SimpleDateFormat;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import org.jeecgframework.core.common.controller.BaseController;
import org.jeecgframework.core.common.exception.BusinessException;
import org.jeecgframework.core.common.hibernate.qbc.CriteriaQuery;
import org.jeecgframework.core.common.model.json.AjaxJson;
import org.jeecgframework.core.common.model.json.DataGrid;
import org.jeecgframework.core.constant.Globals;
import org.jeecgframework.core.util.ExceptionUtil;
import org.jeecgframework.core.util.ResourceUtil;
import org.jeecgframework.core.util.StringUtil;
import org.jeecgframework.tag.core.easyui.TagUtil;
import org.jeecgframework.web.system.pojo.base.TSDepart;
import org.jeecgframework.web.system.service.SystemService;
import org.jeecgframework.core.util.MyBeanUtils;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.entity.vo.NormalExcelConstants;
import org.springframework.ui.ModelMap;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import java.io.IOException;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.jeecgframework.jwt.util.GsonUtil;
import org.jeecgframework.jwt.util.ResponseMessage;
import org.jeecgframework.jwt.util.Result;
import com.alibaba.fastjson.JSONArray;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.jeecgframework.core.beanvalidator.BeanValidators;
import java.util.Set;
import javax.validation.ConstraintViolation;
import javax.validation.Validator;
import java.net.URI;
import org.springframework.http.MediaType;
import org.springframework.web.util.UriComponentsBuilder;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
/**
* @Title: Controller
* @Description: 入库
* @author onlineGenerator
* @date 2018-08-08 13:44:54
* @version V1.0
*
*/
@Api(value="ZEntry",description="入库",tags="zEntryController")
@Controller
@RequestMapping("/zEntryController")
public class ZEntryController extends BaseController {
/**
* Logger for this class
*/
private static final Logger logger = Logger.getLogger(ZEntryController.class);
@Autowired
private ZEntryServiceI zEntryService;
@Autowired
private SystemService systemService;
@Autowired
private Validator validator;
/**
* 入库列表 页面跳转
*
* @return
*/
@RequestMapping(params = "list")
public ModelAndView list(HttpServletRequest request) {
return new ModelAndView("com/jeecg/z_entry/zEntryList");
}
/**
* easyui AJAX请求数据
*
* @param request
* @param response
* @param dataGrid
* @param user
*/
@RequestMapping(params = "datagrid")
public void datagrid(ZEntryEntity zEntry,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
CriteriaQuery cq = new CriteriaQuery(ZEntryEntity.class, dataGrid);
//查询条件组装器
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, zEntry);
try{
//自定义追加查询条件
}catch (Exception e) {
throw new BusinessException(e.getMessage());
}
cq.add();
this.zEntryService.getDataGridReturn(cq, true);
TagUtil.datagrid(response, dataGrid);
}
/**
* 删除入库
*
* @return
*/
@RequestMapping(params = "doDel")
@ResponseBody
public AjaxJson doDel(ZEntryEntity zEntry, HttpServletRequest request) {
AjaxJson j = new AjaxJson();
zEntry = systemService.getEntity(ZEntryEntity.class, zEntry.getId());
String message = "入库删除成功";
try{
zEntryService.delMain(zEntry);
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
}catch(Exception e){
e.printStackTrace();
message = "入库删除失败";
throw new BusinessException(e.getMessage());
}
j.setMsg(message);
return j;
}
/**
* 批量删除入库
*
* @return
*/
@RequestMapping(params = "doBatchDel")
@ResponseBody
public AjaxJson doBatchDel(String ids,HttpServletRequest request){
AjaxJson j = new AjaxJson();
String message = "入库删除成功";
try{
for(String id:ids.split(",")){
ZEntryEntity zEntry = systemService.getEntity(ZEntryEntity.class,
id
);
zEntryService.delMain(zEntry);
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
}
}catch(Exception e){
e.printStackTrace();
message = "入库删除失败";
throw new BusinessException(e.getMessage());
}
j.setMsg(message);
return j;
}
/**
* 添加入库
*
* @param ids
* @return
*/
@RequestMapping(params = "doAdd")
@ResponseBody
public AjaxJson doAdd(ZEntryEntity zEntry,ZEntryPage zEntryPage, HttpServletRequest request) {
List<ZEntrydetailEntity> zEntrydetailList = zEntryPage.getZEntrydetailList();
AjaxJson j = new AjaxJson();
String message = "添加成功";
try{
zEntryService.addMain(zEntry, zEntrydetailList);
systemService.addLog(message, Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO);
}catch(Exception e){
e.printStackTrace();
message = "入库添加失败";
throw new BusinessException(e.getMessage());
}
j.setMsg(message);
return j;
}
/**
* 更新入库
*
* @param ids
* @return
*/
@RequestMapping(params = "doUpdate")
@ResponseBody
public AjaxJson doUpdate(ZEntryEntity zEntry,ZEntryPage zEntryPage, HttpServletRequest request) {
List<ZEntrydetailEntity> zEntrydetailList = zEntryPage.getZEntrydetailList();
AjaxJson j = new AjaxJson();
String message = "更新成功";
try{
zEntryService.updateMain(zEntry, zEntrydetailList);
systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
}catch(Exception e){
e.printStackTrace();
message = "更新入库失败";
throw new BusinessException(e.getMessage());
}
j.setMsg(message);
return j;
}
/**
* 入库新增页面跳转
*
* @return
*/
@RequestMapping(params = "goAdd")
public ModelAndView goAdd(ZEntryEntity zEntry, HttpServletRequest req) {
if (StringUtil.isNotEmpty(zEntry.getId())) {
zEntry = zEntryService.getEntity(ZEntryEntity.class, zEntry.getId());
req.setAttribute("zEntryPage", zEntry);
}
return new ModelAndView("com/jeecg/z_entry/zEntry-add");
}
/**
* 入库编辑页面跳转
*
* @return
*/
@RequestMapping(params = "goUpdate")
public ModelAndView goUpdate(ZEntryEntity zEntry, HttpServletRequest req) {
if (StringUtil.isNotEmpty(zEntry.getId())) {
zEntry = zEntryService.getEntity(ZEntryEntity.class, zEntry.getId());
req.setAttribute("zEntryPage", zEntry);
}
return new ModelAndView("com/jeecg/z_entry/zEntry-update");
}
/**
* 加载明细列表[入库明细表]
*
* @return
*/
@RequestMapping(params = "zEntrydetailList")
public ModelAndView zEntrydetailList(ZEntryEntity zEntry, HttpServletRequest req) {
//===================================================================================
//获取参数
Object id0 = zEntry.getId();
//===================================================================================
//查询-入库明细表
String hql0 = "from ZEntrydetailEntity where 1 = 1 AND z_ID = ? ";
try{
List<ZEntrydetailEntity> zEntrydetailEntityList = systemService.findHql(hql0,id0);
req.setAttribute("zEntrydetailList", zEntrydetailEntityList);
}catch(Exception e){
logger.info(e.getMessage());
}
return new ModelAndView("com/jeecg/z_entrydetail/zEntrydetailList");
}
/**
* 导出excel
*
* @param request
* @param response
*/
@RequestMapping(params = "exportXls")
public String exportXls(ZEntryEntity zEntry,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid,ModelMap map) {
CriteriaQuery cq = new CriteriaQuery(ZEntryEntity.class, dataGrid);
//查询条件组装器
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, zEntry);
try{
//自定义追加查询条件
}catch (Exception e) {
throw new BusinessException(e.getMessage());
}
cq.add();
List<ZEntryEntity> list=this.zEntryService.getListByCriteriaQuery(cq, false);
List<ZEntryPage> pageList=new ArrayList<ZEntryPage>();
if(list!=null&&list.size()>0){
for(ZEntryEntity entity:list){
try{
ZEntryPage page=new ZEntryPage();
MyBeanUtils.copyBeanNotNull2Bean(entity,page);
Object id0 = entity.getId();
String hql0 = "from ZEntrydetailEntity where 1 = 1 AND z_ID = ? ";
List<ZEntrydetailEntity> zEntrydetailEntityList = systemService.findHql(hql0,id0);
page.setZEntrydetailList(zEntrydetailEntityList);
pageList.add(page);
}catch(Exception e){
logger.info(e.getMessage());
}
}
}
map.put(NormalExcelConstants.FILE_NAME,"入库");
map.put(NormalExcelConstants.CLASS,ZEntryPage.class);
map.put(NormalExcelConstants.PARAMS,new ExportParams("入库列表", "导出人:Jeecg",
"导出信息"));
map.put(NormalExcelConstants.DATA_LIST,pageList);
return NormalExcelConstants.JEECG_EXCEL_VIEW;
}
/**
* 通过excel导入数据
* @param request
* @param
* @return
*/
@RequestMapping(params = "importExcel", method = RequestMethod.POST)
@ResponseBody
public AjaxJson importExcel(HttpServletRequest request, HttpServletResponse response) {
AjaxJson j = new AjaxJson();
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
MultipartFile file = entity.getValue();// 获取上传文件对象
ImportParams params = new ImportParams();
params.setTitleRows(2);
params.setHeadRows(2);
params.setNeedSave(true);
try {
List<ZEntryPage> list = ExcelImportUtil.importExcel(file.getInputStream(), ZEntryPage.class, params);
ZEntryEntity entity1=null;
for (ZEntryPage page : list) {
entity1=new ZEntryEntity();
MyBeanUtils.copyBeanNotNull2Bean(page,entity1);
zEntryService.addMain(entity1, page.getZEntrydetailList());
}
j.setMsg("文件导入成功!");
} catch (Exception e) {
j.setMsg("文件导入失败!");
logger.error(ExceptionUtil.getExceptionMessage(e));
}finally{
try {
file.getInputStream().close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return j;
}
/**
* 导出excel 使模板
*/
@RequestMapping(params = "exportXlsByT")
public String exportXlsByT(ModelMap map) {
map.put(NormalExcelConstants.FILE_NAME,"入库");
map.put(NormalExcelConstants.CLASS,ZEntryPage.class);
map.put(NormalExcelConstants.PARAMS,new ExportParams("入库列表", "导出人:"+ ResourceUtil.getSessionUser().getRealName(),
"导出信息"));
map.put(NormalExcelConstants.DATA_LIST,new ArrayList());
return NormalExcelConstants.JEECG_EXCEL_VIEW;
}
/**
* 导入功能跳转
*
* @return
*/
@RequestMapping(params = "upload")
public ModelAndView upload(HttpServletRequest req) {
req.setAttribute("controller_name", "zEntryController");
return new ModelAndView("common/upload/pub_excel_upload");
}
@RequestMapping(method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value="入库列表信息",produces="application/json",httpMethod="GET")
public ResponseMessage<List<ZEntryPage>> list() {
List<ZEntryEntity> list= zEntryService.getList(ZEntryEntity.class);
List<ZEntryPage> pageList=new ArrayList<ZEntryPage>();
if(list!=null&&list.size()>0){
for(ZEntryEntity entity:list){
try{
ZEntryPage page=new ZEntryPage();
MyBeanUtils.copyBeanNotNull2Bean(entity,page);
Object id0 = entity.getId();
String hql0 = "from ZEntrydetailEntity where 1 = 1 AND z_ID = ? ";
List<ZEntrydetailEntity> zEntrydetailOldList = this.zEntryService.findHql(hql0,id0);
page.setZEntrydetailList(zEntrydetailOldList);
pageList.add(page);
}catch(Exception e){
logger.info(e.getMessage());
}
}
}
return Result.success(pageList);
}
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value="根据ID获取入库信息",notes="根据ID获取入库信息",httpMethod="GET",produces="application/json")
public ResponseMessage<?> get(@ApiParam(required=true,name="id",value="ID")@PathVariable("id") String id) {
ZEntryEntity task = zEntryService.get(ZEntryEntity.class, id);
if (task == null) {
return Result.error("根据ID获取入库信息为空");
}
ZEntryPage page = new ZEntryPage();
try {
MyBeanUtils.copyBeanNotNull2Bean(task, page);
Object id0 = task.getId();
String hql0 = "from ZEntrydetailEntity where 1 = 1 AND z_ID = ? ";
List<ZEntrydetailEntity> zEntrydetailOldList = this.zEntryService.findHql(hql0,id0);
page.setZEntrydetailList(zEntrydetailOldList);
} catch (Exception e) {
e.printStackTrace();
}
return Result.success(page);
}
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
@ApiOperation(value="创建入库")
public ResponseMessage<?> create(@ApiParam(name="入库对象")@RequestBody ZEntryPage zEntryPage, UriComponentsBuilder uriBuilder) {
//调用JSR303 Bean Validator进行校验,如果出错返回含400错误码及json格式的错误信息.
Set<ConstraintViolation<ZEntryPage>> failures = validator.validate(zEntryPage);
if (!failures.isEmpty()) {
return Result.error(JSONArray.toJSONString(BeanValidators.extractPropertyAndMessage(failures)));
}
//保存
List<ZEntrydetailEntity> zEntrydetailList = zEntryPage.getZEntrydetailList();
ZEntryEntity zEntry = new ZEntryEntity();
try{
MyBeanUtils.copyBeanNotNull2Bean(zEntryPage,zEntry);
}catch(Exception e){
logger.info(e.getMessage());
return Result.error("保存入库失败");
}
zEntryService.addMain(zEntry, zEntrydetailList);
return Result.success(zEntry);
}
@RequestMapping(value = "/{id}", method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
@ApiOperation(value="更新入库",notes="更新入库")
public ResponseMessage<?> update(@RequestBody ZEntryPage zEntryPage) {
//调用JSR303 Bean Validator进行校验,如果出错返回含400错误码及json格式的错误信息.
Set<ConstraintViolation<ZEntryPage>> failures = validator.validate(zEntryPage);
if (!failures.isEmpty()) {
return Result.error(JSONArray.toJSONString(BeanValidators.extractPropertyAndMessage(failures)));
}
//保存
List<ZEntrydetailEntity> zEntrydetailList = zEntryPage.getZEntrydetailList();
ZEntryEntity zEntry = new ZEntryEntity();
try{
MyBeanUtils.copyBeanNotNull2Bean(zEntryPage,zEntry);
}catch(Exception e){
logger.info(e.getMessage());
return Result.error("入库更新失败");
}
zEntryService.updateMain(zEntry, zEntrydetailList);
//按Restful约定,返回204状态码, 无内容. 也可以返回200状态码.
return Result.success();
}
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.NO_CONTENT)
@ApiOperation(value="删除入库")
public ResponseMessage<?> delete(@ApiParam(name="id",value="ID",required=true)@PathVariable("id") String id) {
logger.info("delete[{}]" + id);
// 验证
if (StringUtils.isEmpty(id)) {
return Result.error("ID不能为空");
}
try {
ZEntryEntity zEntry = zEntryService.get(ZEntryEntity.class, id);
zEntryService.delMain(zEntry);
} catch (Exception e) {
e.printStackTrace();
return Result.error("入库删除失败");
}
return Result.success();
}
}
| [
"[email protected]"
] | |
bd1ff0ce98033e0353f37fec40c08363f2f5e99e | d58ca055992c5ce7813ecce136a06014f3221999 | /src/main/java/lib/duolingoproject/hibernate/dao/UserShopDaoImpl.java | 452b80a8ac0af10aa82779cdd97f80b005891938 | [] | no_license | ProyectoDuolingo/lib | 88b7092cfa5c6365d501d7bfcb892517583a8606 | 1849c9c1f2f483655081f9e96ddff44e9aa01d27 | refs/heads/master | 2023-02-02T12:35:15.818996 | 2020-12-17T19:11:37 | 2020-12-17T19:11:37 | 314,102,730 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,358 | java | package lib.duolingoproject.hibernate.dao;
import java.util.List;
import org.hibernate.Session;
import org.hibernate.Transaction;
import lib.duolingoproject.hibernate.dao.i.IUserShopDao;
import lib.duolingoproject.hibernate.model.association.UserShop;
import lib.duolingoproject.hibernate.util.HibernateUtil;
public class UserShopDaoImpl implements IUserShopDao{
// saveUserShop
// getAllUserShops
// getUserShopById
// updateUserShop
// deleteUserShopById
public UserShop getUserShopById(long userId, long shopId) {
Transaction transaction = null;
UserShop userShop = null;
try (Session session = HibernateUtil.getSessionFactory().openSession()) {
// Start the transaction
transaction = session.beginTransaction();
// Get UserShop object
userShop = session.get(UserShop.class, userShop.new UserShopId(userId, shopId));
// Commit the transaction
transaction.commit();
} catch (Exception e) {
if (transaction != null) {
transaction.rollback();
}
}
return userShop;
}
public List<UserShop> getAllUserShopsById(long userId) {
Transaction transaction = null;
List<UserShop> userShopsList = null;
try (Session session = HibernateUtil.getSessionFactory().openSession()) {
// Start the transaction
transaction = session.beginTransaction();
// Get UserShops list
userShopsList = session.createQuery("from user_shop where user_id = '" + userId + "'").list();
// Commit the transaction
transaction.commit();
} catch (Exception e) {
if (transaction != null) {
transaction.rollback();
}
}
return userShopsList;
}
public void saveUserShop(UserShop userShop) {
Transaction transaction = null;
try (Session session = HibernateUtil.getSessionFactory().openSession()) {
// Start the transaction
transaction = session.beginTransaction();
// Save UserShop object
session.save(userShop);
// Commit the transaction
transaction.commit();
} catch (Exception e) {
if (transaction != null) {
transaction.rollback();
}
}
}
public void updateUserShop(UserShop userShop) {
Transaction transaction = null;
try (Session session = HibernateUtil.getSessionFactory().openSession()) {
// Start the transaction
transaction = session.beginTransaction();
// Save UserShop object
session.saveOrUpdate(userShop);
// Commit the transaction
transaction.commit();
} catch (Exception e) {
if (transaction != null) {
transaction.rollback();
}
}
}
public void deleteUserShopById(long userId, long shopId) {
Transaction transaction = null;
UserShop userShop = null;
try (Session session = HibernateUtil.getSessionFactory().openSession()) {
// Start the transaction
transaction = session.beginTransaction();
// Get UserShop object
userShop = session.get(UserShop.class, userShop.new UserShopId(userId, shopId));
// Delete UserShop object
session.delete(userShop);
// Commit the transaction
transaction.commit();
} catch (Exception e) {
if (transaction != null) {
transaction.rollback();
}
}
}
}
| [
"[email protected]"
] | |
dfabedd43a5ed302c2aa8e5a065ab25afb59a7b1 | d7fe4c81e5f38bcc78f796add444cf09e035e005 | /app/src/main/java/com/example/user/thingstodo/MainActivity.java | 01c22b4518e6366ff99f3749360fd15212c21742 | [] | no_license | lhw1357/Android-Studio_Things-to-do-restart | 05451cce101dc24a44686a71a0fff0b287384541 | 6a55b9c639ad55f6f47ca69192f2a0716dafdfa5 | refs/heads/master | 2021-01-25T07:41:03.058451 | 2017-06-14T12:51:56 | 2017-06-14T12:51:56 | 93,654,615 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,227 | java | package com.example.user.thingstodo;
import android.content.Intent;
import android.media.Image;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
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.ImageView;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
FloatingActionButton add;
Toolbar toolbar;
TextView first;
ImageView ifempty;
TextView ifempty2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
toolbar = (Toolbar) findViewById(R.id.toolbar);
add = (FloatingActionButton) findViewById(R.id.add);
setSupportActionBar(toolbar);
first = (TextView)findViewById(R.id.first);
ifempty = (ImageView)findViewById(R.id.ifempty);
ifempty2 = (TextView)findViewById(R.id.ifempty2);
first.setVisibility(View.INVISIBLE);
add.setOnClickListener(this);
Intent save = getIntent();
String todo = save.getStringExtra("todo");
int count=save.getIntExtra("1",0);
first.setText(todo);
if(count==1){
ifempty.setVisibility(View.INVISIBLE);
ifempty2.setVisibility(View.INVISIBLE);
first.setVisibility(View.VISIBLE);
}
}
@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, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
return super.onOptionsItemSelected(item);
}
@Override
public void onClick(View v) {
Intent addtodo = new Intent(this,addtodo.class);
switch (v.getId()){
case R.id.add :
startActivity(addtodo);
finish();
break;
}
}
}
| [
"[email protected]"
] | |
8eca47682ceccef7b803577d52bcaabf92c6db30 | 65eea008ef58ac86559af0d87c8957a0965f56dc | /src/XmlParser.java | 9a0ac440254cc73177199eca7d19170cbd462943 | [] | no_license | mir-jalal/CurrencyConverter | ab8d4c1ce89a470bc38436acb09740564d16baf1 | 279c000c34ec754bf5b89fccf294142870c76903 | refs/heads/master | 2022-11-17T18:44:01.697825 | 2020-07-16T21:33:05 | 2020-07-16T21:33:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,007 | java | import javax.xml.stream.XMLEventReader;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.events.Attribute;
import javax.xml.stream.events.EndElement;
import javax.xml.stream.events.StartElement;
import javax.xml.stream.events.XMLEvent;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public class XmlParser {
static final String VALUTE = "Valute";
static final String CODE = "Code";
static final String NAME = "Name";
static final String VALUE = "Value";
static final String NOMINAL = "Nominal";
static final String DESCRIPTION = "Description";
static final String VALCURS = "ValCurs";
public List<Currency> readCurrencies(String currencyURL) {
List<Currency> currencies = new ArrayList<Currency>();
try {
XMLInputFactory inputFactory = XMLInputFactory.newInstance();
InputStream inputStream = new URL(currencyURL).openStream();
XMLEventReader eventReader = inputFactory.createXMLEventReader(inputStream);
Currency currency = null;
String description = null;
while (eventReader.hasNext()) {
XMLEvent event = eventReader.nextEvent();
if (event.isStartElement()) {
StartElement startElement = event.asStartElement();
String elementName = startElement.getName().getLocalPart();
switch (elementName) {
case VALCURS:
Iterator<Attribute> att = startElement.getAttributes();
while (att.hasNext()) {
Attribute attribute = att.next();
if (attribute.getName().toString().equals(DESCRIPTION)) {
description = attribute.getValue();
}
}
break;
case VALUTE:
currency = new Currency(description);
Iterator<Attribute> attributes = startElement.getAttributes();
while (attributes.hasNext()) {
Attribute attribute = attributes.next();
if (attribute.getName().toString().equals(CODE)) {
currency.setCode(attribute.getValue());
}
}
break;
case NOMINAL:
event = eventReader.nextEvent();
currency.setNominal(event.asCharacters().getData());
break;
case NAME:
event = eventReader.nextEvent();
currency.setName(event.asCharacters().getData());
break;
case VALUE:
event = eventReader.nextEvent();
currency.setChangeRate(event.asCharacters().getData());
break;
}
}
if (event.isEndElement()) {
EndElement endElement = event.asEndElement();
if (endElement.getName().getLocalPart().equals(VALUTE)) {
currencies.add(currency);
}
}
}
} catch (FileNotFoundException | XMLStreamException e) {
e.printStackTrace();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return currencies;
}
}
| [
"[email protected]"
] | |
cef42d6a4a35ddc73954ae589bb7d927a402ad4d | 5937ebcce79ee1ce937967597a3e884a27cd7ddd | /src/info/photoorganizer/database/xml/elementhandlers/DatabaseHandler.java | bb79781464bc2a9c4f70c997a8e55521f3f3b158 | [] | no_license | mikaelsvensson/photoorganizer-core | 97cf323d6203a74a35c5863257459ff6b404733f | 462471f7ecb95ee9e6a5df6e5ae35c7edbf5bf91 | refs/heads/master | 2020-12-25T19:03:45.577597 | 2011-10-01T20:03:15 | 2011-10-01T20:03:15 | 1,772,899 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,774 | java | package info.photoorganizer.database.xml.elementhandlers;
import info.photoorganizer.database.Database;
import info.photoorganizer.database.DatabaseStorageException;
import info.photoorganizer.database.xml.StorageContext;
import info.photoorganizer.database.xml.XMLDatabaseStorageStrategy;
import info.photoorganizer.util.XMLUtilities;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
public class DatabaseHandler extends DatabaseObjectHandler<Database>
{
private static final String ATTRIBUTENAME_NAME = "name";
public static final String ELEMENTNAME_TAGDEFINITIONS = "TagDefinitions";
public static final String ELEMENTNAME_PHOTOS = "Photos";
public static final String ELEMENTNAME_INDEXINGCONFIGURATIONS = "IndexingConfigurations";
public DatabaseHandler(StorageContext context)
{
super(Database.class, context);
}
@Override
public void readElement(Database o, Element el)
{
o.setName(XMLUtilities.getTextAttribute(el, ATTRIBUTENAME_NAME, "untitled"));
// readTagDefinitionElements(o, el);
// readImageElements(o, el);
// Iterator<KeywordTagDefinition> keywords = _converter.fromElementChildren(el, KeywordTagDefinition.class).iterator();
// if (keywords.hasNext())
// {
// o.setRootKeyword(keywords.next());
// }
super.readElement(o, el);
}
// private void readTagDefinitionElements(Database o, Element el)
// {
// Iterator<TagDefinition> i = _converter.fromElementChildren(XMLUtilities.getNamedChild(el, ELEMENTNAME_TAGDEFINITIONS), TagDefinition.class).iterator();
// while (i.hasNext())
// {
// o.getTagDefinitions().add(i.next());
// }
// }
// private void readImageElements(Database o, Element el)
// {
// Iterator<Image> i = _converter.fromElementChildren(XMLUtilities.getNamedChild(el, ELEMENTNAME_IMAGES), Image.class).iterator();
// while (i.hasNext())
// {
// o.getImages().add(i.next());
// }
// }
@Override
public void writeElement(Database o, Element el)
{
XMLDatabaseStorageStrategy.setUUIDAttribute(el, ATTRIBUTENAME_NAME, o.getId());
Document owner = el.getOwnerDocument();
Element tagDefinitionsEl = createElement(ELEMENTNAME_TAGDEFINITIONS, owner);
el.appendChild(tagDefinitionsEl);
XMLUtilities.appendChildren(tagDefinitionsEl, _context.toElements(o.getTagDefinitions()));
Element keywordTranslatorsEl = createElement(ELEMENTNAME_INDEXINGCONFIGURATIONS, owner);
el.appendChild(keywordTranslatorsEl);
XMLUtilities.appendChildren(keywordTranslatorsEl, _context.toElements(o.getIndexingConfigurations()));
Element imagesEl = createElement(ELEMENTNAME_PHOTOS, owner);
el.appendChild(imagesEl);
XMLUtilities.appendChildren(imagesEl, _context.toElements(o.getPhotos()));
// KeywordTagDefinition rootKeyword = o.getRootKeyword();
// if (null != rootKeyword)
// {
// el.appendChild(_converter.toElement(owner, rootKeyword));
// }
super.writeElement(o, el);
}
@Override
public Database createObject(Element el)
{
return new Database(_context.getStrategy());
}
@Override
public void storeElement(Database o) throws DatabaseStorageException
{
throw new DatabaseStorageException("Feature to store database not implemented. Store each database item, such as keyword definitions and images, separately.");
}
}
| [
"[email protected]"
] | |
e27c0809cb3924bc42f380522948fce165a660f3 | 9873d41fb45ddc470d9471e40981694838b8d0b0 | /app/src/main/java/com/mj/gpsclient/adapter/DeviceAdapter.java | 5067ff4a69b2ef6d80fb1e28e53b14e228bb0de9 | [] | no_license | al0ng/gpsclient | de10a1fa515f50795a648a1b4cb7b1d18eeae3e7 | 2385b25c2dcc12554a624289a0e0c572195a7f9c | refs/heads/master | 2020-12-30T02:13:10.206744 | 2018-01-18T06:47:51 | 2018-01-18T06:47:51 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,024 | java | package com.mj.gpsclient.adapter;
import android.content.Context;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Filter;
import android.widget.Filterable;
import android.widget.ImageView;
import android.widget.TextView;
import com.mj.gpsclient.Activity.PubUtil;
import com.mj.gpsclient.R;
import com.mj.gpsclient.Utils.PublicUtils;
import com.mj.gpsclient.global.DebugLog;
import com.mj.gpsclient.model.Devices;
import java.util.ArrayList;
import java.util.List;
public class DeviceAdapter extends BaseAdapter implements Filterable {
public List<Devices> array;
public List<Devices> devicelist;
public Context context;
private LayoutInflater mLayoutInfalater;
private MyFilter mFilter;
private boolean selected;// 是否需要将iv_item_device控件显示
private String Tag = "DeviceAdapter";
public DeviceAdapter(Context Context) {
this.context = Context;
mLayoutInfalater = LayoutInflater.from(Context);
}
public void setOriginalData(List<Devices> List) {
devicelist = List;
}
public void setData(List<Devices> List) {
array = List;
notifyDataSetChanged();
}
public void setLayout(boolean selected) {
this.selected = selected;
}
@Override
public int getCount() {
DebugLog.e("sgsfgdfgdf=");
return array == null ? 0 : array.size();
}
@Override
public Object getItem(int arg0) {
// TODO Auto-generated method stub
return array.get(arg0);
}
@Override
public long getItemId(int arg0) {
// TODO Auto-generated method stub
return arg0;
}
@Override
public View getView(int arg0, View convertView, ViewGroup arg2) {
ViewHolder viewHolder = null;
final Devices bean = array.get(arg0);
if (convertView == null) {
convertView = mLayoutInfalater.inflate(R.layout.item_list_devices,
null);
viewHolder = new ViewHolder(convertView);
convertView.setTag(viewHolder);
} else {
viewHolder = (ViewHolder) convertView.getTag();
}
final ImageView iv_item_device = (ImageView) convertView
.findViewById(R.id.iv_item_device);
if (selected) {// select为true,表示进入编辑状态
// 跟踪列表选择编辑状态
iv_item_device.setVisibility(View.VISIBLE);
iv_item_device.setBackgroundResource(R.drawable.check);
} else {
iv_item_device.setVisibility(View.GONE);
iv_item_device.setBackgroundResource(R.drawable.check);
}
if (!PubUtil.followHash.isEmpty()) {
if (PubUtil.followHash.containsKey(bean.getIMEI())) {
iv_item_device.setBackgroundResource(R.drawable.checked);
} else {
iv_item_device.setBackgroundResource(R.drawable.check);
}
}
if (!PubUtil.split_sHash.isEmpty()) {
if (PubUtil.split_sHash.containsKey(bean.getIMEI())) {
iv_item_device.setBackgroundResource(R.drawable.checked);
} else {
iv_item_device.setBackgroundResource(R.drawable.check);
}
}
if (!PubUtil.followHash2.isEmpty()) {
if (PubUtil.followHash2.containsKey(bean.getIMEI())) {
iv_item_device.setBackgroundResource(R.drawable.checked);
} else {
iv_item_device.setBackgroundResource(R.drawable.check);
}
}
if (!PubUtil.split_sHash2.isEmpty()) {
if (PubUtil.split_sHash2.containsKey(bean.getIMEI())) {
iv_item_device.setBackgroundResource(R.drawable.checked);
} else {
iv_item_device.setBackgroundResource(R.drawable.check);
}
}
Devices devices = array.get(arg0);
if (devices != null) {
viewHolder.mTextName.setText(devices.getName());
if (devices.getLineStatus().equals("离线")) {
viewHolder.mOnoffline.setText("离线");
viewHolder.mHeard.setImageDrawable(context.getResources()
.getDrawable(R.drawable.carofflineimage));
} else {
viewHolder.mOnoffline.setText("在线");
viewHolder.mHeard.setImageDrawable(context.getResources()
.getDrawable(R.drawable.carstaticimage));
}
}
return convertView;
}
static class ViewHolder {
TextView mTextName;
ImageView mHeard;
TextView mOnoffline;
ViewHolder(View view) {
mTextName = (TextView) view.findViewById(R.id.device_name);
mHeard = (ImageView) view.findViewById(R.id.heard_icon);
mOnoffline = (TextView) view.findViewById(R.id.devices_onoffline);
}
}
@Override
public Filter getFilter() {
if (null == mFilter) {
mFilter = new MyFilter();
}
return mFilter;
}
// 自定义Filter类
class MyFilter extends Filter {
@Override
// 该方法在子线程中执行
// 自定义过滤规则
protected FilterResults performFiltering(CharSequence constraint) {
FilterResults results = new FilterResults();
DebugLog.e("performFiltering=" + constraint);
List<Devices> newValues = new ArrayList<Devices>();
String filterString = constraint.toString().trim().toLowerCase();
Log.i(Tag, filterString + "++++++++++++");
newValues.clear();
// 如果搜索框内容为空,就恢复原始数据
if (TextUtils.isEmpty(filterString)) {
newValues.addAll(devicelist);
Log.i(Tag, devicelist.size() + "---------------");
} else {
// 过滤出新数据
for (Devices devices : devicelist) {
// DebugLog.e("devices.getName()=" + devices.getName());
if (-1 != devices.getName().trim().toLowerCase()
.indexOf(filterString)) {
newValues.add(devices);
}
}
}
results.values = newValues;
results.count = newValues.size();
return results;
}
@Override
protected void publishResults(CharSequence constraint,
FilterResults results) {
// devicesList = (List<Devices>) results.values;
array.clear();
array.addAll((List<Devices>) results.values);
array = PublicUtils.SetOrderForDevices(array);
DebugLog.e("publishResults=" + results.count);
notifyDataSetChanged();
}
}
}
| [
"[email protected]"
] | |
4754c51479348baf5c183eb7c25eda1141ce2ef3 | 3d794c33bcdbedea05712444950be4f72f4ecd70 | /android/app/src/main/java/com/andrewbrook/nghbrly/MainActivity.java | 3eb31b6754d29741b99c9350bd60d9d92a2c7f22 | [] | no_license | fourthbrook/nghbrly | 0af0ee082f5538abbce780a3734aaace6edf98b0 | 9211bfffce8269c7b79b6bca6bc5186ec0ec3b19 | refs/heads/master | 2022-06-18T01:07:09.662056 | 2020-05-16T01:30:40 | 2020-05-16T01:30:40 | 261,613,697 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 353 | java | package com.andrewbrook.nghbrly;
import com.facebook.react.ReactActivity;
public class MainActivity extends ReactActivity {
/**
* Returns the name of the main component registered from JavaScript. This is used to schedule
* rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "nghbrly";
}
}
| [
"[email protected]"
] | |
46d1c1b3254a49e4f30aa6004b3ed90b37741573 | de09f920de3a0a884afa9ef851c9c22db99c9ca6 | /src/main/java/xin/dztyh/personal/SpringAop/ArchivesLogAspect.java | a3f4083ac5ff79b17f8df8b1db0bf83098232d39 | [] | no_license | fluoritess/blogsphere | ee7d24b77001e1e5c9c55822b08b0bb866407bbd | 01e8d651863a02b68a56d843001ec27e91ea6c69 | refs/heads/master | 2020-06-18T19:37:39.239150 | 2019-08-20T13:49:58 | 2019-08-20T13:49:58 | 196,421,822 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,621 | java | package xin.dztyh.personal.SpringAop;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;
import xin.dztyh.personal.util.LogInfo;
import java.lang.reflect.Method;
import java.text.SimpleDateFormat;
/**
* @author tyh
* @Package xin.dztyh.personal.SpringAop
* @Description:
* @date 19-5-20 下午3:53
*/
@Component
@Aspect
public class ArchivesLogAspect {
private long startTimeMillis = 0; // 开始时间
private long endTimeMillis = 0; // 结束时间
@Pointcut("execution(* xin.dztyh.personal.controller..*Controller.*(..)) && !execution(* xin.dztyh.personal.controller.MainController.get*(..))")
public void userLog(){}
@Before("userLog()")
public void before(){
//记录时间
startTimeMillis=System.currentTimeMillis();
}
@After("userLog()")
public void after(JoinPoint joinPoint){
//获取类名
String targetName=joinPoint.getTarget().getClass().getName();
//获取方法名
String methodName=joinPoint.getSignature().getName();
Object[] arguments=joinPoint.getArgs();
Class targetClass=null;
try {
targetClass=Class.forName(targetName);
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
//获得方法列表
Method[] methods=targetClass.getMethods();
String operationName="";
//遍历方法列表,取得方法对象
for(Method method:methods){
if(method.getName().equals(methodName)){
//获得方法的形参类型
Class[] classes=method.getParameterTypes();
//验证是否符合要求
if(classes!=null&&classes.length==arguments.length&&method.getAnnotation(ArchivesLog.class)!=null){
//取得注释
operationName=method.getAnnotation(ArchivesLog.class).operationName();
break;
}
}
}
endTimeMillis=System.currentTimeMillis();
//格式化开始时间
String startTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(startTimeMillis);
//格式化结束时间
String endTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(endTimeMillis);
LogInfo.logger.info(" 操作方法: "+operationName+" 操作开始时间: "+startTime +" 操作结束时间: "+endTime);
}
}
| [
"[email protected]"
] | |
94f46c5eac0b511ceab34615df417468181c8959 | 30a619d2ccfd60d44f8aa8f52be02e1fb98a184c | /Qualyzer_2.0/main/ca.mcgill.cs.swevo.qualyzer/src/ca/mcgill/cs/swevo/qualyzer/providers/CodeBarChart.java | 9a311ff526c38d164cfecea36b64e6fbd703f826 | [] | no_license | hchuphal/Javac | 84ce9bd2a73ec3f6247d9c3ebc29636671b73251 | 130ef558d3f16c6fa7390ef7c2d616fe73bca7fa | refs/heads/master | 2020-09-06T16:26:42.476456 | 2019-12-18T21:46:09 | 2019-12-18T21:46:09 | 220,478,324 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,766 | java | package ca.mcgill.cs.swevo.qualyzer.providers;
import ca.mcgill.cs.swevo.qualyzer.editors.MarkTextAction;
import ca.mcgill.cs.swevo.qualyzer.editors.RTFSourceViewer;
import ca.mcgill.cs.swevo.qualyzer.editors.inputs.CodeEditorInput;
import ca.mcgill.cs.swevo.qualyzer.editors.inputs.CodeTableInput;
import ca.mcgill.cs.swevo.qualyzer.editors.inputs.CodeTableInput.CodeTableRow;
import ca.mcgill.cs.swevo.qualyzer.model.Code;
import ca.mcgill.cs.swevo.qualyzer.model.PersistenceManager;
import ca.mcgill.cs.swevo.qualyzer.model.Project;
import ca.mcgill.cs.swevo.qualyzer.providers.Barchart;
import java.awt.*;
import javax.swing.*;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.forms.editor.FormEditor;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import java.awt.event.*;
public class CodeBarChart {
public CodeBarChart(Project project, CodeTableRow[] row) {
JFrame frame = new JFrame();
frame.setSize(600, 500);
Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
frame.setLocation(dim.width/2-frame.getSize().width/2, dim.height/2-frame.getSize().height/2);
double[] codeFrequency = new double[row.length];
String[] codeName = new String[row.length];
Color[] color = new Color [row.length];
//Random random = new Random();
for (int i = 0; i < row.length; i++) {
codeFrequency[i] = row[i].getFrequency();
codeName[i] = row[i].getName();
//float r = random.nextFloat();
//float g = random.nextFloat();
//float b = random.nextFloat();
Code currentCode = row[i].getCode();
ArrayList<Integer> codeColour = RTFSourceViewer.getCodes().get(currentCode);
//Color randomColor = new Color(r, g, b);
//color[i] = randomColor;
if (codeColour != null) {
System.out.println("Not null");
float fR = codeColour.get(0) / 255.0F;
float fG = codeColour.get(1) / 255.0F;
float fB = codeColour.get(2) / 255.0F;
Color randomColor = new Color(fR, fG, fB);
color[i] = randomColor;
} else {
System.out.println("Null");
Color randomColor = new Color(1, 0, 0);
color[i] = randomColor;
}
}
frame.getContentPane().add(new Barchart(codeFrequency, codeName, color, "Code Barchart"));
WindowListener winListener = new WindowAdapter() {
public void windowClosing(WindowEvent event) {
}
};
frame.addWindowListener(winListener);
frame.setVisible(true);
}
}
| [
"[email protected]"
] | |
f8578bfee3ebdf88240bd62508dfcc4ae08cec89 | fc8f75ad0d09004398e97a29027ab9acda690306 | /ArtistCms/src/main/java/com/artist/cms/jms/WithoutTMJmsConfiguration.java | 473108960bff799eae71fc1368bc08767df25a8a | [] | no_license | hackerbetter/artist | 34dfa19ccacb9558fd0d80d7d55a4549412f9b83 | d512922b3910e67c8412079f226b84bf50c978a3 | refs/heads/master | 2022-12-23T14:04:09.045702 | 2014-10-10T04:24:16 | 2014-10-10T04:24:16 | 19,810,237 | 0 | 0 | null | 2022-12-16T00:39:57 | 2014-05-15T07:22:35 | JavaScript | UTF-8 | Java | false | false | 33,141 | java | /**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.artist.cms.jms;
import org.apache.camel.RuntimeCamelException;
import org.apache.camel.component.jms.*;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.task.TaskExecutor;
import org.springframework.jms.connection.JmsTransactionManager;
import org.springframework.jms.core.JmsOperations;
import org.springframework.jms.core.JmsTemplate;
import org.springframework.jms.listener.DefaultMessageListenerContainer;
import org.springframework.jms.support.converter.MessageConverter;
import org.springframework.jms.support.destination.DestinationResolver;
import org.springframework.transaction.PlatformTransactionManager;
import javax.jms.*;
import static org.apache.camel.component.jms.JmsMessageHelper.normalizeDestinationName;
/**
* @version
*/
public class WithoutTMJmsConfiguration extends JmsConfiguration {
public static final String QUEUE_PREFIX = "queue:";
public static final String TOPIC_PREFIX = "topic:";
public static final String TEMP_QUEUE_PREFIX = "temp:queue:";
public static final String TEMP_TOPIC_PREFIX = "temp:topic:";
private static final transient Logger LOG = LoggerFactory.getLogger(WithoutTMJmsConfiguration.class);
private JmsOperations jmsOperations;
private DestinationResolver destinationResolver;
private ConnectionFactory connectionFactory;
private ConnectionFactory templateConnectionFactory;
private ConnectionFactory listenerConnectionFactory;
private int acknowledgementMode = -1;
private String acknowledgementModeName;
// Used to configure the spring Container
private ExceptionListener exceptionListener;
private boolean autoStartup = true;
private boolean acceptMessagesWhileStopping;
private String clientId;
private String durableSubscriptionName;
private boolean subscriptionDurable;
private boolean exposeListenerSession = true;
private TaskExecutor taskExecutor;
private boolean pubSubNoLocal;
private int concurrentConsumers = 1;
private int maxMessagesPerTask = -1;
private int cacheLevel = -1;
private String cacheLevelName;
private long recoveryInterval = -1;
private long receiveTimeout = -1;
private long requestTimeout = 20000L;
private int idleTaskExecutionLimit = 1;
private int maxConcurrentConsumers;
// JmsTemplate only
private Boolean explicitQosEnabled;
private boolean deliveryPersistent = true;
private boolean replyToDeliveryPersistent = true;
private long timeToLive = -1;
private MessageConverter messageConverter;
private boolean mapJmsMessage = true;
private boolean messageIdEnabled = true;
private boolean messageTimestampEnabled = true;
private int priority = -1;
// Transaction related configuration
private boolean transacted;
private boolean transactedInOut;
private boolean lazyCreateTransactionManager = true;
private PlatformTransactionManager transactionManager;
private String transactionName;
private int transactionTimeout = -1;
private boolean preserveMessageQos;
private boolean disableReplyTo;
private boolean eagerLoadingOfProperties;
// Always make a JMS message copy when it's passed to Producer
private boolean alwaysCopyMessage;
private boolean useMessageIDAsCorrelationID;
private JmsProviderMetadata providerMetadata = new JmsProviderMetadata();
private JmsOperations metadataJmsOperations;
private String replyToDestination;
private String replyToDestinationSelectorName;
private JmsMessageType jmsMessageType;
private JmsKeyFormatStrategy jmsKeyFormatStrategy;
private boolean transferExchange;
private boolean transferException;
private boolean testConnectionOnStartup;
// if the message is a JmsMessage and mapJmsMessage=false, force the
// producer to send the javax.jms.Message body to the next JMS destination
private boolean forceSendOriginalMessage;
// to force disabling time to live (works in both in-only or in-out mode)
private boolean disableTimeToLive;
public WithoutTMJmsConfiguration() {
LOG.info("use WithoutTMJmsConfiguration");
}
public WithoutTMJmsConfiguration(ConnectionFactory connectionFactory) {
this.connectionFactory = connectionFactory;
}
/**
* Returns a copy of this configuration
*/
public JmsConfiguration copy() {
try {
return (JmsConfiguration) clone();
} catch (CloneNotSupportedException e) {
throw new RuntimeCamelException(e);
}
}
/**
* Creates a {@link org.springframework.jms.core.JmsOperations} object used for request/response using a request timeout value
*/
public JmsOperations createInOutTemplate(JmsEndpoint endpoint, boolean pubSubDomain, String destination, long requestTimeout) {
JmsOperations answer = createInOnlyTemplate(endpoint, pubSubDomain, destination);
if (answer instanceof JmsTemplate && requestTimeout > 0) {
JmsTemplate jmsTemplate = (JmsTemplate) answer;
jmsTemplate.setExplicitQosEnabled(true);
// prefer to use timeToLive over requestTimeout if both specified
long ttl = timeToLive > 0 ? timeToLive : requestTimeout;
if (ttl > 0 && !isDisableTimeToLive()) {
// only use TTL if not disabled
jmsTemplate.setTimeToLive(ttl);
}
jmsTemplate.setSessionTransacted(isTransactedInOut());
if (isTransactedInOut()) {
jmsTemplate.setSessionAcknowledgeMode(Session.SESSION_TRANSACTED);
} else {
if (acknowledgementMode >= 0) {
jmsTemplate.setSessionAcknowledgeMode(acknowledgementMode);
} else if (acknowledgementModeName != null) {
jmsTemplate.setSessionAcknowledgeModeName(acknowledgementModeName);
} else {
// default to AUTO
jmsTemplate.setSessionAcknowledgeMode(Session.AUTO_ACKNOWLEDGE);
}
}
}
return answer;
}
/**
* Creates a {@link org.springframework.jms.core.JmsOperations} object used for one way messaging
*/
public JmsOperations createInOnlyTemplate(JmsEndpoint endpoint, boolean pubSubDomain, String destination) {
if (jmsOperations != null) {
return jmsOperations;
}
ConnectionFactory factory = getTemplateConnectionFactory();
JmsTemplate template = new CamelJmsTemplate(this, factory);
template.setPubSubDomain(pubSubDomain);
if (destinationResolver != null) {
template.setDestinationResolver(destinationResolver);
if (endpoint instanceof DestinationEndpoint) {
LOG.debug("You are overloading the destinationResolver property on a DestinationEndpoint; are you sure you want to do that?");
}
} else if (endpoint instanceof DestinationEndpoint) {
DestinationEndpoint destinationEndpoint = (DestinationEndpoint) endpoint;
template.setDestinationResolver(createDestinationResolver(destinationEndpoint));
}
template.setDefaultDestinationName(destination);
template.setExplicitQosEnabled(isExplicitQosEnabled());
template.setDeliveryPersistent(deliveryPersistent);
if (messageConverter != null) {
template.setMessageConverter(messageConverter);
}
template.setMessageIdEnabled(messageIdEnabled);
template.setMessageTimestampEnabled(messageTimestampEnabled);
if (priority >= 0) {
template.setPriority(priority);
}
template.setPubSubNoLocal(pubSubNoLocal);
if (receiveTimeout >= 0) {
template.setReceiveTimeout(receiveTimeout);
}
// only set TTL if we have a positive value and it has not been disabled
if (timeToLive >= 0 && !isDisableTimeToLive()) {
template.setTimeToLive(timeToLive);
}
template.setSessionTransacted(transacted);
if (transacted) {
template.setSessionAcknowledgeMode(Session.SESSION_TRANSACTED);
} else {
// This is here for completeness, but the template should not get
// used for receiving messages.
if (acknowledgementMode >= 0) {
template.setSessionAcknowledgeMode(acknowledgementMode);
} else if (acknowledgementModeName != null) {
template.setSessionAcknowledgeModeName(acknowledgementModeName);
}
}
return template;
}
public DefaultMessageListenerContainer createMessageListenerContainer(JmsEndpoint endpoint) throws Exception {
DefaultMessageListenerContainer container = new JmsMessageListenerContainer(endpoint);
configureMessageListenerContainer(container, endpoint);
return container;
}
// Properties
// -------------------------------------------------------------------------
public ConnectionFactory getConnectionFactory() {
if (connectionFactory == null) {
connectionFactory = createConnectionFactory();
}
return connectionFactory;
}
/**
* Sets the default connection factory to be used if a connection factory is
* not specified for either
* {@link #setTemplateConnectionFactory(javax.jms.ConnectionFactory)} or
* {@link #setListenerConnectionFactory(javax.jms.ConnectionFactory)}
*
* @param connectionFactory the default connection factory to use
*/
public void setConnectionFactory(ConnectionFactory connectionFactory) {
this.connectionFactory = connectionFactory;
}
public ConnectionFactory getListenerConnectionFactory() {
if (listenerConnectionFactory == null) {
listenerConnectionFactory = createListenerConnectionFactory();
}
return listenerConnectionFactory;
}
/**
* Sets the connection factory to be used for consuming messages
*
* @param listenerConnectionFactory the connection factory to use for
* consuming messages
*/
public void setListenerConnectionFactory(ConnectionFactory listenerConnectionFactory) {
this.listenerConnectionFactory = listenerConnectionFactory;
}
public ConnectionFactory getTemplateConnectionFactory() {
if (templateConnectionFactory == null) {
templateConnectionFactory = createTemplateConnectionFactory();
}
return templateConnectionFactory;
}
/**
* Sets the connection factory to be used for sending messages via the
* {@link org.springframework.jms.core.JmsTemplate} via {@link #createInOnlyTemplate(org.apache.camel.component.jms.JmsEndpoint,boolean, String)}
*
* @param templateConnectionFactory the connection factory for sending messages
*/
public void setTemplateConnectionFactory(ConnectionFactory templateConnectionFactory) {
this.templateConnectionFactory = templateConnectionFactory;
}
public boolean isAutoStartup() {
return autoStartup;
}
public void setAutoStartup(boolean autoStartup) {
this.autoStartup = autoStartup;
}
public boolean isAcceptMessagesWhileStopping() {
return acceptMessagesWhileStopping;
}
public void setAcceptMessagesWhileStopping(boolean acceptMessagesWhileStopping) {
this.acceptMessagesWhileStopping = acceptMessagesWhileStopping;
}
public String getClientId() {
return clientId;
}
public void setClientId(String consumerClientId) {
this.clientId = consumerClientId;
}
public String getDurableSubscriptionName() {
return durableSubscriptionName;
}
public void setDurableSubscriptionName(String durableSubscriptionName) {
this.durableSubscriptionName = durableSubscriptionName;
}
public ExceptionListener getExceptionListener() {
return exceptionListener;
}
public void setExceptionListener(ExceptionListener exceptionListener) {
this.exceptionListener = exceptionListener;
}
@Deprecated
public boolean isSubscriptionDurable() {
return subscriptionDurable;
}
@Deprecated
public void setSubscriptionDurable(boolean subscriptionDurable) {
this.subscriptionDurable = subscriptionDurable;
}
public String getAcknowledgementModeName() {
return acknowledgementModeName;
}
public void setAcknowledgementModeName(String consumerAcknowledgementMode) {
this.acknowledgementModeName = consumerAcknowledgementMode;
this.acknowledgementMode = -1;
}
public boolean isExposeListenerSession() {
return exposeListenerSession;
}
public void setExposeListenerSession(boolean exposeListenerSession) {
this.exposeListenerSession = exposeListenerSession;
}
public TaskExecutor getTaskExecutor() {
return taskExecutor;
}
public void setTaskExecutor(TaskExecutor taskExecutor) {
this.taskExecutor = taskExecutor;
}
public boolean isPubSubNoLocal() {
return pubSubNoLocal;
}
public void setPubSubNoLocal(boolean pubSubNoLocal) {
this.pubSubNoLocal = pubSubNoLocal;
}
public int getConcurrentConsumers() {
return concurrentConsumers;
}
public void setConcurrentConsumers(int concurrentConsumers) {
this.concurrentConsumers = concurrentConsumers;
}
public int getMaxMessagesPerTask() {
return maxMessagesPerTask;
}
public void setMaxMessagesPerTask(int maxMessagesPerTask) {
this.maxMessagesPerTask = maxMessagesPerTask;
}
public int getCacheLevel() {
return cacheLevel;
}
public void setCacheLevel(int cacheLevel) {
this.cacheLevel = cacheLevel;
}
public String getCacheLevelName() {
return cacheLevelName;
}
public void setCacheLevelName(String cacheName) {
this.cacheLevelName = cacheName;
}
public long getRecoveryInterval() {
return recoveryInterval;
}
public void setRecoveryInterval(long recoveryInterval) {
this.recoveryInterval = recoveryInterval;
}
public long getReceiveTimeout() {
return receiveTimeout;
}
public void setReceiveTimeout(long receiveTimeout) {
this.receiveTimeout = receiveTimeout;
}
public PlatformTransactionManager getTransactionManager() {
if (transactionManager == null && isTransacted() && isLazyCreateTransactionManager()) {
transactionManager = createTransactionManager();
}
return transactionManager;
}
public void setTransactionManager(PlatformTransactionManager transactionManager) {
this.transactionManager = transactionManager;
}
public String getTransactionName() {
return transactionName;
}
public void setTransactionName(String transactionName) {
this.transactionName = transactionName;
}
public int getTransactionTimeout() {
return transactionTimeout;
}
public void setTransactionTimeout(int transactionTimeout) {
this.transactionTimeout = transactionTimeout;
}
public int getIdleTaskExecutionLimit() {
return idleTaskExecutionLimit;
}
public void setIdleTaskExecutionLimit(int idleTaskExecutionLimit) {
this.idleTaskExecutionLimit = idleTaskExecutionLimit;
}
public int getMaxConcurrentConsumers() {
return maxConcurrentConsumers;
}
public void setMaxConcurrentConsumers(int maxConcurrentConsumers) {
this.maxConcurrentConsumers = maxConcurrentConsumers;
}
public boolean isExplicitQosEnabled() {
return explicitQosEnabled != null ? explicitQosEnabled : false;
}
public void setExplicitQosEnabled(boolean explicitQosEnabled) {
this.explicitQosEnabled = explicitQosEnabled;
}
public boolean isDeliveryPersistent() {
return deliveryPersistent;
}
public void setDeliveryPersistent(boolean deliveryPersistent) {
this.deliveryPersistent = deliveryPersistent;
configuredQoS();
}
public boolean isReplyToDeliveryPersistent() {
return replyToDeliveryPersistent;
}
public void setReplyToDeliveryPersistent(boolean replyToDeliveryPersistent) {
this.replyToDeliveryPersistent = replyToDeliveryPersistent;
}
public long getTimeToLive() {
return timeToLive;
}
public void setTimeToLive(long timeToLive) {
this.timeToLive = timeToLive;
configuredQoS();
}
public MessageConverter getMessageConverter() {
return messageConverter;
}
public void setMessageConverter(MessageConverter messageConverter) {
this.messageConverter = messageConverter;
}
public boolean isMapJmsMessage() {
return mapJmsMessage;
}
public void setMapJmsMessage(boolean mapJmsMessage) {
this.mapJmsMessage = mapJmsMessage;
}
public boolean isMessageIdEnabled() {
return messageIdEnabled;
}
public void setMessageIdEnabled(boolean messageIdEnabled) {
this.messageIdEnabled = messageIdEnabled;
}
public boolean isMessageTimestampEnabled() {
return messageTimestampEnabled;
}
public void setMessageTimestampEnabled(boolean messageTimestampEnabled) {
this.messageTimestampEnabled = messageTimestampEnabled;
}
public int getPriority() {
return priority;
}
public void setPriority(int priority) {
this.priority = priority;
configuredQoS();
}
public int getAcknowledgementMode() {
return acknowledgementMode;
}
public void setAcknowledgementMode(int consumerAcknowledgementMode) {
this.acknowledgementMode = consumerAcknowledgementMode;
this.acknowledgementModeName = null;
}
public boolean isTransacted() {
return transacted;
}
public void setTransacted(boolean consumerTransacted) {
this.transacted = consumerTransacted;
}
/**
* Should InOut operations (request reply) default to using transacted mode?
* <p/>
* By default this is false as you need to commit the outgoing request before you can consume the input
*/
@Deprecated
public boolean isTransactedInOut() {
return transactedInOut;
}
@Deprecated
public void setTransactedInOut(boolean transactedInOut) {
this.transactedInOut = transactedInOut;
}
public boolean isLazyCreateTransactionManager() {
return lazyCreateTransactionManager;
}
public void setLazyCreateTransactionManager(boolean lazyCreating) {
this.lazyCreateTransactionManager = lazyCreating;
}
public boolean isEagerLoadingOfProperties() {
return eagerLoadingOfProperties;
}
/**
* Enables eager loading of JMS properties as soon as a message is loaded
* which generally is inefficient as the JMS properties may not be required
* but sometimes can catch early any issues with the underlying JMS provider
* and the use of JMS properties
*
* @param eagerLoadingOfProperties whether or not to enable eager loading of
* JMS properties on inbound messages
*/
public void setEagerLoadingOfProperties(boolean eagerLoadingOfProperties) {
this.eagerLoadingOfProperties = eagerLoadingOfProperties;
}
public boolean isDisableReplyTo() {
return disableReplyTo;
}
/**
* Disables the use of the JMSReplyTo header for consumers so that inbound
* messages are treated as InOnly rather than InOut requests.
*
* @param disableReplyTo whether or not to disable the use of JMSReplyTo
* header indicating an InOut
*/
public void setDisableReplyTo(boolean disableReplyTo) {
this.disableReplyTo = disableReplyTo;
}
/**
* Set to true if you want to send message using the QoS settings specified
* on the message. Normally the QoS settings used are the one configured on
* this Object.
*/
public void setPreserveMessageQos(boolean preserveMessageQos) {
this.preserveMessageQos = preserveMessageQos;
}
public JmsOperations getJmsOperations() {
return jmsOperations;
}
public void setJmsOperations(JmsOperations jmsOperations) {
this.jmsOperations = jmsOperations;
}
public DestinationResolver getDestinationResolver() {
return destinationResolver;
}
public void setDestinationResolver(DestinationResolver destinationResolver) {
this.destinationResolver = destinationResolver;
}
public JmsProviderMetadata getProviderMetadata() {
return providerMetadata;
}
/**
* Allows the provider metadata to be explicitly configured. Typically this is not required
* and Camel will auto-detect the provider metadata from the underlying provider.
*/
public void setProviderMetadata(JmsProviderMetadata providerMetadata) {
this.providerMetadata = providerMetadata;
}
public JmsOperations getMetadataJmsOperations(JmsEndpoint endpoint) {
if (metadataJmsOperations == null) {
metadataJmsOperations = getJmsOperations();
if (metadataJmsOperations == null) {
metadataJmsOperations = createInOnlyTemplate(endpoint, false, null);
}
}
return metadataJmsOperations;
}
/**
* Sets the {@link org.springframework.jms.core.JmsOperations} used to deduce the {@link org.apache.camel.component.jms.JmsProviderMetadata} details which if none
* is customized one is lazily created on demand
*/
public void setMetadataJmsOperations(JmsOperations metadataJmsOperations) {
this.metadataJmsOperations = metadataJmsOperations;
}
// Implementation methods
// -------------------------------------------------------------------------
public static DestinationResolver createDestinationResolver(final DestinationEndpoint destinationEndpoint) {
return new DestinationResolver() {
public Destination resolveDestinationName(Session session, String destinationName, boolean pubSubDomain) throws JMSException {
return destinationEndpoint.getJmsDestination(session);
}
};
}
protected void configureMessageListenerContainer(DefaultMessageListenerContainer container,
JmsEndpoint endpoint) throws Exception {
container.setConnectionFactory(getListenerConnectionFactory());
if (endpoint instanceof DestinationEndpoint) {
container.setDestinationResolver(createDestinationResolver((DestinationEndpoint) endpoint));
} else if (destinationResolver != null) {
container.setDestinationResolver(destinationResolver);
}
container.setAutoStartup(autoStartup);
if (durableSubscriptionName != null) {
container.setDurableSubscriptionName(durableSubscriptionName);
container.setSubscriptionDurable(true);
}
if (clientId != null) {
container.setClientId(clientId);
}
if (exceptionListener != null) {
container.setExceptionListener(exceptionListener);
}
container.setAcceptMessagesWhileStopping(acceptMessagesWhileStopping);
container.setExposeListenerSession(exposeListenerSession);
container.setSessionTransacted(transacted);
if (endpoint.getSelector() != null && endpoint.getSelector().length() != 0) {
container.setMessageSelector(endpoint.getSelector());
}
if (concurrentConsumers >= 0) {
container.setConcurrentConsumers(concurrentConsumers);
}
if (cacheLevel >= 0) {
container.setCacheLevel(cacheLevel);
} else if (cacheLevelName != null) {
container.setCacheLevelName(cacheLevelName);
} else {
container.setCacheLevel(defaultCacheLevel(endpoint));
}
if (idleTaskExecutionLimit >= 0) {
container.setIdleTaskExecutionLimit(idleTaskExecutionLimit);
}
if (maxConcurrentConsumers > 0) {
if (maxConcurrentConsumers < concurrentConsumers) {
throw new IllegalArgumentException("Property maxConcurrentConsumers: " + maxConcurrentConsumers
+ " must be higher than concurrentConsumers: " + concurrentConsumers);
}
container.setMaxConcurrentConsumers(maxConcurrentConsumers);
}
if (maxMessagesPerTask >= 0) {
container.setMaxMessagesPerTask(maxMessagesPerTask);
}
container.setPubSubNoLocal(pubSubNoLocal);
if (receiveTimeout >= 0) {
container.setReceiveTimeout(receiveTimeout);
}
if (recoveryInterval >= 0) {
container.setRecoveryInterval(recoveryInterval);
}
if (taskExecutor != null) {
container.setTaskExecutor(taskExecutor);
}
if (transactionName != null) {
container.setTransactionName(transactionName);
}
if (transactionTimeout >= 0) {
container.setTransactionTimeout(transactionTimeout);
}
}
public void configure(EndpointMessageListener listener) {
if (isDisableReplyTo()) {
listener.setDisableReplyTo(true);
}
if (isEagerLoadingOfProperties()) {
listener.setEagerLoadingOfProperties(true);
}
if (getReplyTo() != null) {
listener.setReplyToDestination(getReplyTo());
}
// TODO: REVISIT: We really ought to change the model and let JmsProducer
// and JmsConsumer have their own JmsConfiguration instance
// This way producer's and consumer's QoS can differ and be
// independently configured
JmsOperations operations = listener.getTemplate();
if (operations instanceof JmsTemplate) {
JmsTemplate template = (JmsTemplate) operations;
template.setDeliveryPersistent(isReplyToDeliveryPersistent());
}
}
/**
* Defaults the JMS cache level if none is explicitly specified.
* <p/>
* Will return <tt>CACHE_AUTO</tt> which will pickup and use <tt>CACHE_NONE</tt>
* if transacted has been enabled, otherwise it will use <tt>CACHE_CONSUMER</tt>
* which is the most efficient.
*
* @param endpoint the endpoint
* @return the cache level
*/
protected int defaultCacheLevel(JmsEndpoint endpoint) {
return DefaultMessageListenerContainer.CACHE_AUTO;
}
/**
* Factory method which allows derived classes to customize the lazy
* creation
*/
protected ConnectionFactory createConnectionFactory() {
ObjectHelper.notNull(connectionFactory, "connectionFactory");
return null;
}
/**
* Factory method which allows derived classes to customize the lazy
* creation
*/
protected ConnectionFactory createListenerConnectionFactory() {
return getConnectionFactory();
}
/**
* Factory method which allows derived classes to customize the lazy
* creation
*/
protected ConnectionFactory createTemplateConnectionFactory() {
return getConnectionFactory();
}
/**
* Factory method which which allows derived classes to customize the lazy
* transcationManager creation
*/
protected PlatformTransactionManager createTransactionManager() {
JmsTransactionManager answer = new JmsTransactionManager();
answer.setConnectionFactory(getConnectionFactory());
return answer;
}
public boolean isPreserveMessageQos() {
return preserveMessageQos;
}
/**
* When one of the QoS properties are configured such as {@link #setDeliveryPersistent(boolean)},
* {@link #setPriority(int)} or {@link #setTimeToLive(long)} then we should auto default the
* setting of {@link #setExplicitQosEnabled(boolean)} if its not been configured yet
*/
protected void configuredQoS() {
if (explicitQosEnabled == null) {
explicitQosEnabled = true;
}
}
public boolean isAlwaysCopyMessage() {
return alwaysCopyMessage;
}
public void setAlwaysCopyMessage(boolean alwaysCopyMessage) {
this.alwaysCopyMessage = alwaysCopyMessage;
}
public boolean isUseMessageIDAsCorrelationID() {
return useMessageIDAsCorrelationID;
}
public void setUseMessageIDAsCorrelationID(boolean useMessageIDAsCorrelationID) {
this.useMessageIDAsCorrelationID = useMessageIDAsCorrelationID;
}
public long getRequestTimeout() {
return requestTimeout;
}
/**
* Sets the timeout in milliseconds which requests should timeout after
*/
public void setRequestTimeout(long requestTimeout) {
this.requestTimeout = requestTimeout;
}
public String getReplyTo() {
return replyToDestination;
}
public void setReplyTo(String replyToDestination) {
this.replyToDestination = normalizeDestinationName(replyToDestination);
}
public String getReplyToDestinationSelectorName() {
return replyToDestinationSelectorName;
}
public void setReplyToDestinationSelectorName(String replyToDestinationSelectorName) {
this.replyToDestinationSelectorName = replyToDestinationSelectorName;
// in case of consumer -> producer and a named replyTo correlation selector
// message pass through is impossible as we need to set the value of selector into
// outgoing message, which would be read-only if pass through were to remain enabled
if (replyToDestinationSelectorName != null) {
setAlwaysCopyMessage(true);
}
}
public JmsMessageType getJmsMessageType() {
return jmsMessageType;
}
public void setJmsMessageType(JmsMessageType jmsMessageType) {
if (jmsMessageType == JmsMessageType.Blob && !supportBlobMessage()) {
throw new IllegalArgumentException("BlobMessage is not supported by this implementation");
}
this.jmsMessageType = jmsMessageType;
}
/**
* Should get overridden by implementations which support BlobMessages
*
* @return false
*/
protected boolean supportBlobMessage() {
return false;
}
public JmsKeyFormatStrategy getJmsKeyFormatStrategy() {
if (jmsKeyFormatStrategy == null) {
jmsKeyFormatStrategy = new DefaultJmsKeyFormatStrategy();
}
return jmsKeyFormatStrategy;
}
public void setJmsKeyFormatStrategy(JmsKeyFormatStrategy jmsKeyFormatStrategy) {
this.jmsKeyFormatStrategy = jmsKeyFormatStrategy;
}
public boolean isTransferExchange() {
return transferExchange;
}
public void setTransferExchange(boolean transferExchange) {
this.transferExchange = transferExchange;
}
public boolean isTransferException() {
return transferException;
}
public void setTransferException(boolean transferException) {
this.transferException = transferException;
}
public boolean isTestConnectionOnStartup() {
return testConnectionOnStartup;
}
public void setTestConnectionOnStartup(boolean testConnectionOnStartup) {
this.testConnectionOnStartup = testConnectionOnStartup;
}
public void setForceSendOriginalMessage(boolean forceSendOriginalMessage) {
this.forceSendOriginalMessage = forceSendOriginalMessage;
}
public boolean isForceSendOriginalMessage() {
return forceSendOriginalMessage;
}
public boolean isDisableTimeToLive() {
return disableTimeToLive;
}
public void setDisableTimeToLive(boolean disableTimeToLive) {
this.disableTimeToLive = disableTimeToLive;
}
}
| [
"[email protected]"
] | |
213d63904fdd60c871bc421db5580de503777437 | c0bd30b9543d61c01354dda07b59afc7743b707a | /src/test/java/com/example/LearnABirdServer/LearnABirdServerApplicationTests.java | 523ea22c169edf0b4d7c265c65cf0d551f44b774 | [] | no_license | hiranthaA/LearnABirdServer | 527eeabe8e228dcedd04a8511627430094d94258 | e22072fed9b3669afe7967557d986091219fa7e2 | refs/heads/master | 2020-05-20T05:00:01.829650 | 2019-05-07T12:20:34 | 2019-05-07T12:20:34 | 185,393,730 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 355 | java | package com.example.LearnABirdServer;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class LearnABirdServerApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"[email protected]"
] | |
1ffbf7ae45132a43b2ef0e1dec92b3fc80f9e553 | bfa6fb8df3ece919ecdc0f199dd59cd471436175 | /Terminado.java | a11f4f9f52febd559b56aef5e674d025edba5e13 | [] | no_license | Nereyda97/facultad | 566f1d9973ca363f2174749e2ada13ed5874590d | a88b48a49fc10dd3d2f86c64571223364f5a72bb | refs/heads/master | 2021-07-20T14:44:59.672306 | 2017-10-30T02:43:59 | 2017-10-30T02:43:59 | 108,431,474 | 0 | 4 | null | 2017-10-26T17:23:31 | 2017-10-26T15:38:45 | Java | UTF-8 | Java | false | false | 2,089 | java |
package Alumnos;
import java.util.Scanner;
public class Terminado {
public static void main(String[] args) {
String[] Alumno = {"Lidia","Alexis","Edgar", "Jorge", "Alejandro", "Victoria", "Guadalupe", "Rachel", "Jose",
"Beatriz", "Paola", "Anna", "Alfonso", "Ricardo", "Martha", "Maria", "Fernanda", "Jessica", "Carlos",
"Roberto","Araceli", "Agus", "Elizabeth", "Sandra", "Vannesa", "Claudia", "Maribel", "Edgar", "René",
"Fabiola", "Irán", "Antonio","Luis", "Paloma", "Karla", "Larissa" };
int[] A = {2013, 2012, 1999, 2005,2013, 2012, 1999, 2005,2013, 2012, 1999, 2005,2013, 2012,
1999, 2005,2013, 2012, 1999, 2005,2013, 2012, 1999, 2005,2013, 2012, 1999, 2005,2013,
2012, 1999, 2005,2013, 2012, 1999, 2005 };
int[] B = {2018, 2017, 2003, 2013,2018, 2017, 2003, 2013,2018, 2017, 2003, 2013,2018, 2017, 2003,
2013,2018, 2017, 2003, 2013,2018, 2017, 2003, 2013,2018, 2017, 2003, 2013,2018, 2017, 2003,
2013,2018, 2017, 2003, 2013};
int[] C = {1999, 1997, 1996, 1980,1999, 1997, 1996, 1980,1999, 1997, 1996, 1980,1999, 1997, 1996,
1980,1999, 1997, 1996, 1980,1999, 1997, 1996, 1980,1999, 1997, 1996, 1980,1999, 1997, 1996,
1980,1999, 1997, 1996, 1980};
int[] D = {123456, 654321, 234561, 789531,123456, 654321, 234561, 789531,123456, 654321, 234561,
789531,123456, 654321, 234561, 789531,123456, 654321, 234561, 789531,123456, 654321, 234561,
789531,123456, 654321, 234561, 789531,123456, 654321, 234561, 789531,123456, 654321, 234561, 789531};
Scanner T = new Scanner(System.in);
System.out.println("Ingrese un nombre: ");
String x = T.nextLine();
for( int i=0; i<36; i++){
if ( x.equals(Alumno[i])){
System.out.println("EL nombre es " + Alumno[i] +" \n " + A[i] + " " + B[i] + " " + C[i] + " " +D[i]);
}
}
}
}
| [
"[email protected]"
] | |
802214ec36af498ff5f9656f9dc46b92e8bd356d | 34f8d4ba30242a7045c689768c3472b7af80909c | /JDK10-Java SE Development Kit 10/src/jdk.localedata/sun/util/resources/cldr/ext/CurrencyNames_seh.java | b5a4743a8c8d3ecaf04ada7400f8d66fb69dc76a | [
"Apache-2.0"
] | permissive | lovelycheng/JDK | 5b4cc07546f0dbfad15c46d427cae06ef282ef79 | 19a6c71e52f3ecd74e4a66be5d0d552ce7175531 | refs/heads/master | 2023-04-08T11:36:22.073953 | 2022-09-04T01:53:09 | 2022-09-04T01:53:09 | 227,544,567 | 0 | 0 | null | 2019-12-12T07:18:30 | 2019-12-12T07:18:29 | null | UTF-8 | Java | false | false | 6,305 | java | /*
* Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* COPYRIGHT AND PERMISSION NOTICE
*
* Copyright (C) 1991-2016 Unicode, Inc. All rights reserved.
* Distributed under the Terms of Use in
* http://www.unicode.org/copyright.html.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of the Unicode data files and any associated documentation
* (the "Data Files") or Unicode software and any associated documentation
* (the "Software") to deal in the Data Files or Software
* without restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, and/or sell copies of
* the Data Files or Software, and to permit persons to whom the Data Files
* or Software are furnished to do so, provided that
* (a) this copyright and permission notice appear with all copies
* of the Data Files or Software,
* (b) this copyright and permission notice appear in associated
* documentation, and
* (c) there is clear notice in each modified Data File or in the Software
* as well as in the documentation associated with the Data File(s) or
* Software that the data or software has been modified.
*
* THE DATA FILES AND SOFTWARE ARE 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 OF THIRD PARTY RIGHTS.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS
* NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL
* DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THE DATA FILES OR SOFTWARE.
*
* Except as contained in this notice, the name of a copyright holder
* shall not be used in advertising or otherwise to promote the sale,
* use or other dealings in these Data Files or Software without prior
* written authorization of the copyright holder.
*/
package sun.util.resources.cldr.ext;
import sun.util.resources.OpenListResourceBundle;
public class CurrencyNames_seh extends OpenListResourceBundle {
@Override
protected final Object[][] getContents() {
final Object[][] data = new Object[][] {
{ "MZN", "MTn" },
{ "aed", "Dir\u00e9m dos Emirados \u00c1rabes Unidos" },
{ "aoa", "Cuanza angolano" },
{ "aud", "D\u00f3lar australiano" },
{ "bhd", "Dinar bareinita" },
{ "bif", "Franco do Burundi" },
{ "bwp", "Pula botsuanesa" },
{ "cad", "D\u00f3lar canadense" },
{ "cdf", "Franco congol\u00eas" },
{ "chf", "Franco su\u00ed\u00e7o" },
{ "cny", "Yuan Renminbi chin\u00eas" },
{ "cve", "Escudo cabo-verdiano" },
{ "djf", "Franco do Djibuti" },
{ "dzd", "Dinar argelino" },
{ "egp", "Libra eg\u00edpcia" },
{ "ern", "Nakfa da Eritr\u00e9ia" },
{ "etb", "Birr et\u00edope" },
{ "eur", "Euro" },
{ "gbp", "Libra brit\u00e2nica" },
{ "ghc", "Cedi de Gana (1979\u20132007)" },
{ "gmd", "Dalasi de G\u00e2mbia" },
{ "gns", "Syli da Guin\u00e9" },
{ "inr", "R\u00fapia indiana" },
{ "jpy", "Iene japon\u00eas" },
{ "kes", "Xelim queniano" },
{ "kmf", "Franco de Comores" },
{ "lrd", "D\u00f3lar liberiano" },
{ "lsl", "Loti do Lesoto" },
{ "lyd", "Dinar l\u00edbio" },
{ "mad", "Dir\u00e9m marroquino" },
{ "mga", "Franco de Madagascar" },
{ "mro", "Ouguiya da Maurit\u00e2nia" },
{ "mur", "Rupia de Maur\u00edcio" },
{ "mwk", "Cuacha do Mal\u00e1ui" },
{ "mzm", "Metical antigo de Mo\u00e7ambique" },
{ "mzn", "Metical de Mo\u00e7ambique" },
{ "nad", "D\u00f3lar da Nam\u00edbia" },
{ "ngn", "Naira nigeriana" },
{ "rwf", "Franco ruand\u00eas" },
{ "sar", "Rial saudita" },
{ "scr", "Rupia das Seychelles" },
{ "sdg", "Dinar sudan\u00eas" },
{ "sdp", "Libra sudanesa antiga" },
{ "shp", "Libra de Santa Helena" },
{ "sll", "Leone de Serra Leoa" },
{ "sos", "Xelim somali" },
{ "std", "Dobra de S\u00e3o Tom\u00e9 e Pr\u00edncipe" },
{ "szl", "Lilangeni da Suazil\u00e2ndia" },
{ "tnd", "Dinar tunisiano" },
{ "tzs", "Xelim da Tanz\u00e2nia" },
{ "ugx", "Xelim ugandense (1966\u20131987)" },
{ "usd", "D\u00f3lar norte-americano" },
{ "xaf", "Franco CFA BEAC" },
{ "xof", "Franco CFA BCEAO" },
{ "zar", "Rand sul-africano" },
{ "zmk", "Cuacha zambiano (1968\u20132012)" },
{ "zmw", "Cuacha zambiano" },
{ "zwd", "D\u00f3lar do Zimb\u00e1bue" },
};
return data;
}
}
| [
"[email protected]"
] | |
e2b73cb04ac02a4121af9ca7205834923e0f5e02 | ab286d8308766b202abce27452919cf972a7730d | /src/com/tony/selene/util/SqliteUtils.java | 8f12a04b5fe68a9462d42f1593b621daa5805d03 | [] | no_license | solaris0403/Selene | 146c538a9ba42bbe98db753d8ca7a831d477d243 | 8de7608887081399475f4c846fda181c791ee4c8 | refs/heads/master | 2021-01-10T21:53:27.317932 | 2015-10-08T09:41:35 | 2015-10-08T09:41:35 | 39,326,366 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 903 | java | package com.tony.selene.util;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
/**
* SqliteUtils
*
* @author <a href="http://www.trinea.cn" target="_blank">Trinea</a> 2013-10-21
*/
public class SqliteUtils {
private static volatile SqliteUtils instance;
private DbHelper dbHelper;
private SQLiteDatabase db;
private SqliteUtils(Context context) {
dbHelper = new DbHelper(context);
db = dbHelper.getWritableDatabase();
}
public static SqliteUtils getInstance(Context context) {
if (instance == null) {
synchronized (SqliteUtils.class) {
if (instance == null) {
instance = new SqliteUtils(context);
}
}
}
return instance;
}
public SQLiteDatabase getDb() {
return db;
}
}
| [
"[email protected]"
] | |
55cbd9b345c89837525a350bc32e6bcfbb550226 | a26e3bbcced5dafe2966fa771634dca2b9901827 | /src/main/java/edu/miu/authserver/util/payload/response/UserAccessResponse.java | 4cca6458f6744dfab1070ebeb380a8ad708024b1 | [] | no_license | MintuTF/Authservice-CICD | e3fbd545e7f15cf502f90fab6ff26c037ce106a7 | 022a5e6f04c270d4ad3bfee876de902009a6a8cf | refs/heads/main | 2023-07-17T12:33:47.766502 | 2021-08-31T00:12:13 | 2021-08-31T00:12:13 | 401,151,580 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 522 | java | package edu.miu.authserver.util.payload.response;
import lombok.Data;
@Data
public class UserAccessResponse {
private long id;
private String username;
private String name;
private String password;
private String email;
// private String role;
public UserAccessResponse(long id,String username, String name, String password, String email) {
this.id=id;
this.username = username;
this.name = name;
this.password = password;
this.email = email;
}
}
| [
"[email protected]"
] | |
276a6f41b610bf3b69376e46bb2773ad0e5d9afa | 82d520573d0b44c4458c68e21e4ad37707bd99bd | /src/com/gamer/core/service/impl/CollectionServiceImpl.java | cb6658780a6c03925b42483f662ce417c41d2658 | [] | no_license | MrRaindrop8289/RetinaProject | 7b98b7240c963e1d8d1721bf52af912ea9906db0 | e1bca31084268ac55e91c77f291d25f89e4ebf49 | refs/heads/master | 2020-04-23T21:08:58.523385 | 2019-02-19T11:13:14 | 2019-02-19T11:13:14 | 171,460,771 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,602 | java | package com.gamer.core.service.impl;
import java.util.Date;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.gamer.common.utils.DateFormat;
import com.gamer.core.dao.CollectionDao;
import com.gamer.core.dao.PictureDao;
import com.gamer.core.po.*;
import com.gamer.core.service.CollectionService;
@Service("CollectionService")
@Transactional
public class CollectionServiceImpl implements CollectionService {
@Autowired
private CollectionDao dao;
@Autowired
private PictureDao PDao;
@Override
public List<Picture> findAllCollection(Integer UserId) {
// TODO Auto-generated method stub
List<Collections> lPictureId = dao.findAllCollectionByPicture(UserId);
List<Picture> lPicture = new ArrayList<Picture>();
for (Collections i:lPictureId) {
Picture p = this.PDao.findPictureById(i.getPicture_id());
p.setDateS(DateFormat.Transform(i.getDate()));
lPicture.add(p);
}
return lPicture;
}
@Override
public void addCollection(Integer UserId, Integer PictureId) {
// TODO Auto-generated method stub
this.dao.addCollection(UserId, PictureId,new Date());
}
@Override
public void removeCollection(Integer UserId, Integer PictureId) {
// TODO Auto-generated method stub
this.dao.removeCollection(UserId, PictureId);
}
@Override
public List<Integer> findPictureByUserId(Integer userid) {
// TODO Auto-generated method stub
return dao.findPictureByUserId(userid);
}
}
| [
"[email protected]"
] | |
86bdd5544b9d1b5205280bb153fddd6b917e0729 | 0a78fae5bf256306f9496217d843ff6a2aa27595 | /src/client/MapleBuffStat.java | 694a076bba9d29ab53bea3aeee5ef09f2e3757e2 | [] | no_license | seizethegap/msheroes | e75f17d2613ed91638b33f54faf010ea7ca96c17 | 3d74bd3081cca16f833b74448c1e41ce89766e4b | refs/heads/master | 2022-12-01T01:58:57.257181 | 2020-08-12T20:53:38 | 2020-08-12T20:53:38 | 287,114,351 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,728 | java | package client;
import java.io.Serializable;
import net.LongValueHolder;
public enum MapleBuffStat implements LongValueHolder, Serializable {
MORPH(0x2),
RECOVERY(0x4),
MAPLE_WARRIOR(0x8),
STANCE(0x10),
SHARP_EYES(0x20),
MANA_REFLECTION(0x40),
SHADOW_CLAW(0x100),
INFINITY(0x200),
HOLY_SHIELD(0x400),
HAMSTRING(0x800),
BLIND(0x1000),
CONCENTRATE(0x2000), // another no op buff
ECHO_OF_HERO(0x8000),
GHOST_MORPH(0x20000), // ??? Morphs you into a ghost - no idea what for
MONSTER_RIDING(0x40000000),
WATK(0x100000000L),
WDEF(0x200000000L),
MATK(0x400000000L),
MDEF(0x800000000L),
ACC(0x1000000000L),
AVOID(0x2000000000L),
HANDS(0x4000000000L),
SPEED(0x8000000000L),
JUMP(0x10000000000L),
MAGIC_GUARD(0x20000000000L),
DARKSIGHT(0x40000000000L), // also used by gm hide
BOOSTER(0x80000000000L),
POWERGUARD(0x100000000000L),
HYPERBODYHP(0x200000000000L),
HYPERBODYMP(0x400000000000L),
INVINCIBLE(0x800000000000L),
SOULARROW(0x1000000000000L),
STUN(0x2000000000000L),
POISON(0x4000000000000L),
SEAL(0x8000000000000L),
DARKNESS(0x10000000000000L),
COMBO(0x20000000000000L),
SUMMON(0x20000000000000L), //hack buffstat for summons
WK_CHARGE(0x40000000000000L),
DRAGONBLOOD(0x80000000000000L), // another funny buffstat
HOLY_SYMBOL(0x100000000000000L),
MESOUP(0x200000000000000L),
SHADOWPARTNER(0x400000000000000L),
PICKPOCKET(0x800000000000000L),
PUPPET(0x800000000000000L), // shares buffmask with pickpocket
MESOGUARD(0x1000000000000000L),
WEAKEN(0x4000000000000000L),
DASH(0x30000000),
AURA(0x40000),
;
static final long serialVersionUID = 0L;
private final long i;
private MapleBuffStat(long i) {
this.i = i;
}
@Override
public long getValue() {
return i;
}
}
| [
"[email protected]"
] | |
f8cb2ee351ac418f3dc7054a92a0dee6ef31bb14 | 72b5fcaf14d5af5f20c19126347d76c752f6b7e1 | /SmartCityPlatform/src/main/java/org/gs1/source/tsd/StringRangeType.java | 18874e41295e612fd5d9fae628fb7188add4d7f5 | [] | no_license | hyeeunzz/smartcity | b836d7abbeb08320fbabb240c943b9ef62057469 | 922774ed1f1523fdc072abe39dc3f71c24b5f7d0 | refs/heads/master | 2021-01-11T02:39:47.670132 | 2017-01-13T02:13:41 | 2017-01-13T02:13:41 | 70,913,693 | 0 | 1 | null | null | null | null | UHC | Java | false | false | 2,477 | java | //
// 이 파일은 JAXB(JavaTM Architecture for XML Binding) 참조 구현 2.2.8-b130911.1802 버전을 통해 생성되었습니다.
// <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>를 참조하십시오.
// 이 파일을 수정하면 소스 스키마를 재컴파일할 때 수정 사항이 손실됩니다.
// 생성 날짜: 2015.07.30 시간 02:38:18 PM KST
//
package org.gs1.source.tsd;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
/**
* <p>StringRangeType complex type에 대한 Java 클래스입니다.
*
* <p>다음 스키마 단편이 이 클래스에 포함되는 필요한 콘텐츠를 지정합니다.
*
* <pre>
* <complexType name="StringRangeType">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="maximumValue" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="minimumValue" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "StringRangeType", propOrder = {
"maximumValue",
"minimumValue"
})
public class StringRangeType {
protected String maximumValue;
protected String minimumValue;
/**
* maximumValue 속성의 값을 가져옵니다.
*
* @return
* possible object is
* {@link String }
*
*/
public String getMaximumValue() {
return maximumValue;
}
/**
* maximumValue 속성의 값을 설정합니다.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setMaximumValue(String value) {
this.maximumValue = value;
}
/**
* minimumValue 속성의 값을 가져옵니다.
*
* @return
* possible object is
* {@link String }
*
*/
public String getMinimumValue() {
return minimumValue;
}
/**
* minimumValue 속성의 값을 설정합니다.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setMinimumValue(String value) {
this.minimumValue = value;
}
}
| [
"[email protected]"
] | |
33b8bda890ef53206337b3ed0b754fb809a14bde | 7e86d160d32b8388f6c7094c7b905cffae19d5bb | /src/main/java/br/com/polovinskycode/strategy/Calculator.java | e480253fc56e109507398bacaad424f2ae114810 | [] | no_license | diegorramos/ObjectOriented | ba48fbf2409e21da76de17c6202f54fa58936170 | 5c46ad30f4587bd93b51438a39ea19313b256b47 | refs/heads/master | 2021-05-30T12:23:24.932344 | 2016-02-17T03:16:11 | 2016-02-17T03:16:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 121 | java | package br.com.polovinskycode.strategy;
public interface Calculator {
Long calc(Long numberOne, Long numberTwo);
}
| [
"[email protected]"
] | |
fa23b02948c706f2385f0232b22b0ed260b8aa1e | 1d928c3f90d4a0a9a3919a804597aa0a4aab19a3 | /java/scribejava/2017/12/DefaultApi10a.java | b7167a86e722e0826064b0de653b7f7b6fad3533 | [] | no_license | rosoareslv/SED99 | d8b2ff5811e7f0ffc59be066a5a0349a92cbb845 | a062c118f12b93172e31e8ca115ce3f871b64461 | refs/heads/main | 2023-02-22T21:59:02.703005 | 2021-01-28T19:40:51 | 2021-01-28T19:40:51 | 306,497,459 | 1 | 1 | null | 2020-11-24T20:56:18 | 2020-10-23T01:18:07 | null | UTF-8 | Java | false | false | 4,780 | java | package com.github.scribejava.core.builder.api;
import com.github.scribejava.core.extractors.BaseStringExtractor;
import com.github.scribejava.core.extractors.BaseStringExtractorImpl;
import com.github.scribejava.core.extractors.HeaderExtractor;
import com.github.scribejava.core.extractors.HeaderExtractorImpl;
import com.github.scribejava.core.extractors.OAuth1AccessTokenExtractor;
import com.github.scribejava.core.extractors.OAuth1RequestTokenExtractor;
import com.github.scribejava.core.model.OAuthConfig;
import com.github.scribejava.core.model.Verb;
import com.github.scribejava.core.oauth.OAuth10aService;
import com.github.scribejava.core.services.HMACSha1SignatureService;
import com.github.scribejava.core.services.SignatureService;
import com.github.scribejava.core.services.TimestampService;
import com.github.scribejava.core.services.TimestampServiceImpl;
import com.github.scribejava.core.extractors.TokenExtractor;
import com.github.scribejava.core.model.OAuth1AccessToken;
import com.github.scribejava.core.model.OAuth1RequestToken;
/**
* Default implementation of the OAuth protocol, version 1.0a
*
* This class is meant to be extended by concrete implementations of the API, providing the endpoints and
* endpoint-http-verbs.
*
* If your Api adheres to the 1.0a protocol correctly, you just need to extend this class and define the getters for
* your endpoints.
*
* If your Api does something a bit different, you can override the different extractors or services, in order to
* fine-tune the process. Please read the javadocs of the interfaces to get an idea of what to do.
*
*/
public abstract class DefaultApi10a implements BaseApi<OAuth10aService> {
/**
* Returns the access token extractor.
*
* @return access token extractor
*/
public TokenExtractor<OAuth1AccessToken> getAccessTokenExtractor() {
return OAuth1AccessTokenExtractor.instance();
}
/**
* Returns the base string extractor.
*
* @return base string extractor
*/
public BaseStringExtractor getBaseStringExtractor() {
return new BaseStringExtractorImpl();
}
/**
* Returns the header extractor.
*
* @return header extractor
*/
public HeaderExtractor getHeaderExtractor() {
return new HeaderExtractorImpl();
}
/**
* Returns the request token extractor.
*
* @return request token extractor
*/
public TokenExtractor<OAuth1RequestToken> getRequestTokenExtractor() {
return OAuth1RequestTokenExtractor.instance();
}
/**
* Returns the signature service.
*
* @return signature service
*/
public SignatureService getSignatureService() {
return new HMACSha1SignatureService();
}
/**
* @return the signature type, choose between header, querystring, etc. Defaults to Header
*/
public OAuth1SignatureType getSignatureType() {
return OAuth1SignatureType.Header;
}
/**
* Returns the timestamp service.
*
* @return timestamp service
*/
public TimestampService getTimestampService() {
return new TimestampServiceImpl();
}
/**
* Returns the verb for the access token endpoint (defaults to POST)
*
* @return access token endpoint verb
*/
public Verb getAccessTokenVerb() {
return Verb.POST;
}
/**
* Returns the verb for the request token endpoint (defaults to POST)
*
* @return request token endpoint verb
*/
public Verb getRequestTokenVerb() {
return Verb.POST;
}
/**
* Returns the URL that receives the request token requests.
*
* @return request token URL
*/
public abstract String getRequestTokenEndpoint();
/**
* Returns the URL that receives the access token requests.
*
* @return access token URL
*/
public abstract String getAccessTokenEndpoint();
/**
* Returns the URL where you should redirect your users to authenticate your application.
*
* @param requestToken the request token you need to authorize
* @return the URL where you should redirect your users
*/
public abstract String getAuthorizationUrl(OAuth1RequestToken requestToken);
@Override
public OAuth10aService createService(OAuthConfig config) {
return new OAuth10aService(this, config);
}
/**
* http://tools.ietf.org/html/rfc5849 says that "The client MAY omit the empty "oauth_token" protocol parameter from
* the request", but not all oauth servers are good boys.
*
* @return whether to inlcude empty oauth_token param to the request
*/
public boolean isEmptyOAuthTokenParamIsRequired() {
return false;
}
}
| [
"[email protected]"
] | |
f6ded3f0020190eca7d8e9b6efee74002a9acdf8 | 11708f8be96adefb20eda1d26272b607ca2e38ff | /Spring 12day/Spring-Boot-Communiy-web2/src/main/java/com/kwangmin/domain/User.java | 80ab829c2111dbf50776dfcff6d98d5441fdddd9 | [] | no_license | rhkd4560/Study-SpringBoot | a90538f0bd44f83cc5618ce9e8ac1f3ef391111d | 1552672d8b015a0cb6e610c3fd2cd9612f77f62d | refs/heads/master | 2020-04-15T04:42:08.176736 | 2019-03-12T20:16:24 | 2019-03-12T20:16:24 | 164,392,778 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 913 | java | package com.kwangmin.domain;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import javax.persistence.*;
import java.io.Serializable;
import java.time.LocalDateTime;
@Getter
@NoArgsConstructor
@Entity
@Table
public class User implements Serializable {
@Id
@Column
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long idx;
@Column
private String name;
@Column
private String password;
@Column
private String email;
@Column
private LocalDateTime createdDate;
@Column
private LocalDateTime updatedDate;
@Builder
public User(String name, String password, String email, LocalDateTime createdDate, LocalDateTime updatedDate) {
this.name = name;
this.password = password;
this.email = email;
this.createdDate = createdDate;
this.updatedDate = updatedDate;
}
}
| [
"[email protected]"
] | |
d8982705545be308decefca67306294dc1f07680 | 0e82f3892c807bbd7fb9fdcdcda28ca36486b3af | /src/main/java/com/xqn/controller/CommentController.java | 5e58f79d9ebc23c94dfa1a454e7e9999cd1e588c | [] | no_license | guowei1st/xqndemo | 65a71217b7249848136a80526d9015bd2c6bc1ac | 396ba5d02f5a87e1ea287e025275eea579658ea4 | refs/heads/main | 2023-08-21T15:45:41.051734 | 2021-10-28T08:42:17 | 2021-10-28T08:42:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,334 | java | package com.xqn.controller;
import com.xqn.Dao.CommentMapper;
import com.xqn.Dto.ReturnDto;
import com.xqn.component.Myfunction;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.text.SimpleDateFormat;
import java.util.*;
@Api(tags = "留言相关接口")
@Controller
public class CommentController {
@Autowired
CommentMapper commentMapper;
@ApiOperation("添加留言")
@ResponseBody
@PostMapping("/uploadly")
public ReturnDto uploadly(@RequestParam("username") String username,
@RequestParam("comment") String comment
) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
String date = sdf.format(new Date());
Integer re=commentMapper.upLoadComment(username,comment,date);
if(re==1) {
return new ReturnDto(200, "success", "添加留言成功");
}else {
return new ReturnDto(400, "error", "更新失败,re="+re);
}
}
@ApiOperation("查找用户的留言")
@ResponseBody
@GetMapping("/findlybyusername")
public ReturnDto findlybyusername(@RequestParam("username") String username
) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
String date = sdf.format(new Date());
return new ReturnDto(200, commentMapper.findCommentByUsername(username), "查找用户的留言");
}
@ApiOperation("查找孩子的家长留言")
@ResponseBody
@GetMapping("/findlybychild")
public ReturnDto findlybychild(@RequestParam("username") String username
) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
String date = sdf.format(new Date());
return new ReturnDto(200, commentMapper.findCommentByChild(username), "查找用户的留言");
}
}
| [
"[email protected]"
] | |
a2c6635470e2912cf6e4ae46b6d51f3ecab57a6e | 1f90f71802f67bd789d161a352c172d7a81aa9a8 | /lib-app-volley/src/main/java/com/android/volley/toolbox/OkHttpStack.java | 75c96b68c65a5e83f9a1f9925150ab050c688cc1 | [] | no_license | hayukleung/app | c4fd75c6932df6d58eb4d0a4cdade2cd1ae8d4ce | a15962a984d00b712090eac47ddd965c8faa55ff | refs/heads/master | 2021-01-14T02:29:52.201441 | 2017-03-30T09:57:48 | 2017-03-30T09:57:48 | 41,923,161 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 4,286 | java | package com.android.volley.toolbox;
import com.android.volley.AuthFailureError;
import com.android.volley.NetworkTask;
import com.android.volley.http.HttpEntityEnclosingRequest;
import com.android.volley.http.HttpRequestBase;
import com.android.volley.http.HttpResponse;
import com.android.volley.http.entity.Header;
import com.android.volley.http.entity.HttpEntity;
import com.android.volley.http.entity.InputStreamEntity;
import com.squareup.okhttp.OkHttpClient;
import com.squareup.okhttp.OkUrlFactory;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.util.HashMap;
import java.util.Map;
public class OkHttpStack implements HttpStack {
private OkUrlFactory mUrlFactory;
public OkHttpStack() {
mUrlFactory = new OkUrlFactory(new OkHttpClient());
}
@Override
public HttpResponse performRequest(NetworkTask httprequest, Map<String, String> additionalHeaders)
throws IOException, AuthFailureError {
HttpRequestBase request = httprequest.getRequest();
HttpURLConnection connection = mUrlFactory.open(request.getURL());
int timeoutMs = httprequest.getTimeoutMs();
connection.setConnectTimeout(timeoutMs);
connection.setReadTimeout(timeoutMs);
HashMap<String, String> map = new HashMap<String, String>();
map.putAll(additionalHeaders);
map.putAll(httprequest.getHeaders());
for (String headerName : map.keySet()) {
connection.addRequestProperty(headerName, map.get(headerName));
}
connection.setRequestMethod(request.getMethod());
for (Header header : request.getAllHeaders()) {
connection.addRequestProperty(header.getName(), header.getValue());
}
// Stream the request body.
if (request instanceof HttpEntityEnclosingRequest) {
HttpEntity entity = ((HttpEntityEnclosingRequest) request).getEntity();
if (entity != null) {
connection.setDoOutput(true);
Header type = entity.getContentType();
if (type != null) {
connection.addRequestProperty(type.getName(), type.getValue());
}
Header encoding = entity.getContentEncoding();
if (encoding != null) {
connection.addRequestProperty(encoding.getName(), encoding.getValue());
}
if (entity.getContentLength() < 0) {
connection.setChunkedStreamingMode(0);
} else if (entity.getContentLength() <= 8192) {
// Buffer short, fixed-length request bodies. This costs memory, but permits the request
// to be transparently retried if there is a connection failure.
connection.addRequestProperty("Content-Length", Long.toString(entity.getContentLength()));
} else {
connection.setFixedLengthStreamingMode((int) entity.getContentLength());
}
entity.writeTo(connection.getOutputStream());
}
}
// Read the response headers.
int responseCode = connection.getResponseCode();
String message = connection.getResponseMessage();
HttpResponse response = new HttpResponse(responseCode, message);
// Get the response body ready to stream.
InputStream responseBody = responseCode < HttpURLConnection.HTTP_BAD_REQUEST ? connection.getInputStream()
: connection.getErrorStream();
InputStreamEntity entity = new InputStreamEntity(responseBody, connection.getContentLength());
for (int i = 0; true; i++) {
String name = connection.getHeaderFieldKey(i);
if (name == null) {
break;
}
Header header = new Header(name, connection.getHeaderField(i));
response.addHeader(header);
if (name.equalsIgnoreCase("Content-Type")) {
entity.setContentType(header);
} else if (name.equalsIgnoreCase("Content-Encoding")) {
entity.setContentEncoding(header);
}
}
response.setEntity(entity);
return response;
}
}
| [
"[email protected]"
] | |
40f618ccd183d2baad41d7a3ed01ec6dc5af5867 | bc2d8fa7526b5b036f55f94b3704c231662a90e2 | /src/tetris/Tetris.java | 4a4209920d2df70b791733a626aa91ebd6d9be9e | [] | no_license | pepa99/tetris_game | ff94048d16de0e88606c92c9ca5b8d7d81cac6e0 | d1aadad4c9c32e4c28fe081733712d2d94556e23 | refs/heads/main | 2023-01-03T22:38:56.455628 | 2020-11-05T21:08:41 | 2020-11-05T21:08:41 | 310,417,584 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,493 | java | package tetris;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.InputEvent;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import tetris.Pozicija.Smer;
public class Tetris extends Frame implements ActionListener {
Label poeni=new Label("Ponei: ");
Label figure=new Label("Figura: ");
private Tabla tabla;
private Panel panel;
private Panel p2;
private Button kreni=new Button("Kreni");
private Button stani=new Button("Stani");
private Label xy=new Label("x, y");
private TextField x=new TextField();
private TextField y=new TextField();
private int m=5;
private int n=10;
private boolean utoku;
private Menu akcija=new Menu("Akcija");
public Tetris() {
super("Tetris");
setSize(500,800);
dodajKompon();
addWindowListener(new WindowAdapter () {public void windowClosing(WindowEvent e) {dispose();}});
tabla.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
if(e.getKeyCode()==KeyEvent.VK_RIGHT) {
tabla.pomeri(Smer.DESNO);
}
if(e.getKeyCode()==KeyEvent.VK_LEFT) {
tabla.pomeri(Smer.LEVO);
}
if(e.getKeyCode()==KeyEvent.VK_DOWN) {
tabla.pomeri(Smer.DOLE);
}
}
});
setVisible(true);
}
public void dodajKompon() {
panel=new Panel();
panel.setBounds(0, 0, 400, 600);
tabla=new Tabla(10,20);
panel.add(tabla);
add(panel);
p2=new Panel();
figure=tabla.figure;
poeni=tabla.poenil;
p2.add(kreni);
p2.add(poeni);
p2.add(figure);
p2.add(stani);
p2.add(xy);
p2.add(x);
p2.add(y);
MenuBar traka=new MenuBar();
traka.add(akcija);
akcija.add("Nova Igra");
akcija.add("Zavrsi");
akcija.addActionListener(this);
setMenuBar(traka);
x.addActionListener(this);
y.addActionListener(this);
add(p2,"South");
kreni.addActionListener(this);
stani.addActionListener(this);
}
public static void main(String[] args) {
new Tetris();
}
@Override
public void actionPerformed(ActionEvent e) {
if(e.getSource()==kreni) {
tabla.kreni();
utoku=true;
}
if(e.getSource()==stani) {
tabla.zaustavi();
utoku=false;
}
if(e.getSource()==x) {
if(!utoku) {
m=Integer.parseInt(x.getText());
//tabla.postavim(Integer.parseInt(x.getText()));
}
}
if(e.getSource()==y) {
if(!utoku) {
n=Integer.parseInt(y.getText());
//tabla.postavim(Integer.parseInt(y.getText()));
}
}
if(e.getActionCommand().equals("Nova Igra")) {
panel.remove(tabla);
tabla=new Tabla(m,n);
p2.remove(figure);
p2.remove(poeni);
figure=tabla.figure;
poeni=tabla.poenil;
p2.add(figure);
p2.add(poeni);
panel.add(tabla);
tabla.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
if(e.getKeyCode()==KeyEvent.VK_RIGHT) {
tabla.pomeri(Smer.DESNO);
}
if(e.getKeyCode()==KeyEvent.VK_LEFT) {
tabla.pomeri(Smer.LEVO);
}
if(e.getKeyCode()==KeyEvent.VK_DOWN) {
tabla.pomeri(Smer.DOLE);
}
}
});
revalidate();
}
}
}
| [
"[email protected]"
] | |
b45d8bf14187c75a28e95a709d5bcbf04b3879ae | dc5189c7f3a89ddc48319a34d977feccb6619227 | /BackendCENS/censbackend/src/main/java/com/cens/backend/censbackend/dto/user/CreateUserRequestDTO.java | 7a70e3d16aca31a265b93acf338eba2163c91b58 | [] | no_license | mauricioandrango/UISRAEL_CENS | f3c8f345ea04b2bc7d3fa2d9fb6e3ae0aeb88a87 | 8374e3296a467e4694d72d4655c0fa24b257d7c4 | refs/heads/master | 2023-03-26T16:34:52.370010 | 2021-03-23T21:26:42 | 2021-03-23T21:26:42 | 350,859,709 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,086 | java | package com.cens.backend.censbackend.dto.user;
import java.io.Serializable;
public class CreateUserRequestDTO implements Serializable {
private static final long serialVersionUID = -1960540553108217628L;
private Integer id;
private String username;
private String password;
private String nombres;
private String apellidos;
private String mail;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getNombres() {
return nombres;
}
public void setNombres(String nombres) {
this.nombres = nombres;
}
public String getApellidos() {
return apellidos;
}
public void setApellidos(String apellidos) {
this.apellidos = apellidos;
}
public String getMail() {
return mail;
}
public void setMail(String mail) {
this.mail = mail;
}
}
| [
"[email protected]"
] | |
55c2129bbd928e1202ddbd420aa1b75783bac638 | 52f0658086402b602758008a0cfe2c4db5569f67 | /app/src/androidTest/java/fr/esilv/lagrange_nguyen_finalproject/ExampleInstrumentedTest.java | 6db1e8d87ae8cfb0de17fffd849f3cb58fcb4782 | [] | no_license | justinelgr/LAGRANGE_NGUYEN_FinalProject | e61ff0a3840b8a7be14f5b2dd24ba70e6b2bd709 | 18864eac072112078edad746be772a3896a6732e | refs/heads/master | 2021-02-10T13:43:04.911935 | 2020-03-24T22:19:09 | 2020-03-24T22:19:09 | 244,386,968 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 790 | java | package fr.esilv.lagrange_nguyen_finalproject;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("fr.esilv.lagrange_nguyen_finalproject", appContext.getPackageName());
}
}
| [
"[email protected]"
] | |
614913ee549a3b6842b27138c71c891a90e5aa24 | a0b7a10bf03d3062542b45d7f35b43c426ed9fda | /src/ApiJar/src/facturoporti/api/cfdi/EmisorCFDI.java | cda67166b07aabf5495aa55c6370a1b694942e77 | [] | no_license | facturoporti/factura-electronica-Dll-Java-Jar-Api-Rest | 360e06f7d4b56a9a578c298783c8c5d2dceb9949 | 4950520aa056a2df53555ea24ee6e0c8402c4fbc | refs/heads/master | 2021-07-13T11:49:14.248510 | 2021-03-08T18:54:08 | 2021-03-08T18:54:08 | 237,715,288 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 812 | java | package facturoporti.api.cfdi;
import java.util.*;
public class EmisorCFDI
{
private String RFC;
public final String getRFC()
{
return RFC;
}
public final void setRFC(String value)
{
RFC = value;
}
private String NombreRazonSocial;
public final String getNombreRazonSocial()
{
return NombreRazonSocial;
}
public final void setNombreRazonSocial(String value)
{
NombreRazonSocial = value;
}
private String RegimenFiscal;
public final String getRegimenFiscal()
{
return RegimenFiscal;
}
public final void setRegimenFiscal(String value)
{
RegimenFiscal = value;
}
private ArrayList<DireccionCFDI> Direccion;
public final ArrayList<DireccionCFDI> getDireccion()
{
return Direccion;
}
public final void setDireccion(ArrayList<DireccionCFDI> value)
{
Direccion = value;
}
} | [
"aorozco-at-480905434626"
] | aorozco-at-480905434626 |
870c1ad5f3f3c112b5ab6635b01c3e63eed20f4f | f31600ea214d09d8b594b6d97bef9677812f254b | /jan20sec/src/Strings/togglechars.java | 836b39c3b79b48e6d6601eeae54ab9dfce32eebf | [] | no_license | GauravChauhan37/Eclipse | 0272555ed7961d17e647c8d937b778068c8aeec6 | db12d634ea941ef18669df6c988ef569653b2d16 | refs/heads/master | 2020-03-16T21:14:30.985317 | 2018-10-03T03:56:51 | 2018-10-03T03:56:51 | 132,990,516 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 561 | java | package Strings;
import java.util.Scanner;
public class togglechars {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s = sc.nextLine();
StringBuilder a = new StringBuilder();
char c;
for (int i = 0; i < s.length(); i++) {
if (s.charAt(i) >= 'A' && s.charAt(i) <= 'Z') {
c = (char) (s.charAt(i) + 'a' - 'A');
a.append(c);
} else if (s.charAt(i) >= 'a' && s.charAt(i) <= 'z') {
c = (char) (s.charAt(i) + 'A' - 'a');
a.append(c);
}
}
System.out.println(a);
}
}
| [
"Gaurav Chauhan@Gaurav"
] | Gaurav Chauhan@Gaurav |
19e7349a4aa2e0b199f8821735b3bc5252c419bd | af773926947e79f4135c95fa477e4ce3c7208ceb | /src/main/java/br/com/cinq/spring/data/sample/resource/SampleCountries.java | cab67f70664a48e272004ee599c650ae54824d3f | [] | no_license | gabrielandr/spring-jpa-jersey | bb938e4b45bfb375dc48e59d5ebee86d2d9b54b2 | f959480ca5cec0f2607c18a47977dd5efc1b6def | refs/heads/master | 2020-06-02T20:23:25.402896 | 2017-06-12T14:48:37 | 2017-06-12T14:48:37 | 94,105,477 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,540 | java | package br.com.cinq.spring.data.sample.resource;
import java.util.List;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import br.com.cinq.spring.data.sample.entity.Country;
import br.com.cinq.spring.data.sample.service.CountryService;
/**
* Sample class implementing a Jersey webservice
*
* @author AndradeGabriel
*
*/
@Path("/")
public class SampleCountries {
static Logger logger = LoggerFactory.getLogger(SampleCountries.class);
@Autowired
private CountryService countryService;
@Path("countries")
@GET
@Produces(MediaType.APPLICATION_JSON)
public Response findCities() {
List<Country> result = null;
try {
logger.info("Retrieving countries");
result = countryService.listCountries();
} catch (Exception e) {
logger.error("An exception occurred while retrieving cities", e);
return Response.status(Status.INTERNAL_SERVER_ERROR).entity("exception").build();
}
return Response.ok().entity(result).build();
}
public CountryService getCountryService() {
return countryService;
}
public void setCountryService(CountryService countryService) {
this.countryService = countryService;
}
}
| [
"[email protected]"
] | |
1a3cf3bd1f4adfd23cc68dd16fdd395c2586f052 | 07405736e7393e446cc99c9744eb14fcd5f3dfe9 | /src/main/java/org/aeonbits/owner/Reloadable.java | b0555ff7a9b5be598c438f4e2f88223e685e6ae5 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | mikeChampagne/owner | 7e15bfe64e6f4b38a40105db8d21a8e39e57d127 | 70216f401e6df54455d224e280c043e80bd43055 | refs/heads/master | 2021-01-18T16:40:20.483873 | 2013-09-18T21:42:26 | 2013-09-18T23:14:13 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,889 | java | /*
* Copyright (c) 2013, Luigi R. Viggiano
* All rights reserved.
*
* This software is distributable under the BSD license.
* See the terms of the BSD license in the documentation provided with this software.
*/
package org.aeonbits.owner;
import org.aeonbits.owner.event.ReloadListener;
/**
* <p>Allows a <tt>Config</tt> object to implement the reloading of the properties at runtime.</p>
*
* <p>Example:</p>
*
* <pre>
* public interface MyConfig extends Config, Reloadable {
* int someProperty();
* }
*
* public void doSomething() {
*
* // loads the properties from the files for the first time.
* MyConfig cfg = ConfigFactory.create(MyConfig.class);
* int before = cfg.someProperty();
*
* // after changing the local files...
* cfg.reload();
* int after = cfg.someProperty();
*
* // before and after may differ now.
* if (before != after) { ... }
* }
* </pre>
*
* <p>The reload method will reload the properties using the same sources used when it was instantiated the first time.
* This can be useful to programmatically reload the configuration after the configuration files were changed.</p>
*
* @author Luigi R. Viggiano
* @since 1.0.4
*/
public interface Reloadable extends Config {
/**
* Reloads the properties using the same logic as when the object was instantiated by {@link
* ConfigFactory#create(Class, java.util.Map[])}.
*
* @since 1.0.4
*/
void reload();
/**
* Add a ReloadListener.
* @param listener the listener to be added
*
* @since 1.0.4
*/
void addReloadListener(ReloadListener listener);
/**
* Remove a ReloadListener.
* @param listener the listener to be removed
*
* @since 1.0.4
*/
void removeReloadListener(ReloadListener listener);
}
| [
"[email protected]"
] | |
5c5155858e8c48f29b9b728c60ff5580f6223ae9 | de3eb812d5d91cbc5b81e852fc32e25e8dcca05f | /branches/crux/4.0.0/Crux/src/ui/gwt/org/cruxframework/crux/gwt/rebind/RichTextAreaFactory.java | c628128d04fb5b50a08f96c12afbe335df3f07a0 | [] | no_license | svn2github/crux-framework | 7dd52a951587d4635112987301c88db23325c427 | 58bcb4821752b405a209cfc21fb83e3bf528727b | refs/heads/master | 2016-09-06T13:33:41.975737 | 2015-01-22T08:03:25 | 2015-01-22T08:03:25 | 13,135,398 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,875 | java | /*
* Copyright 2011 cruxframework.org.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package org.cruxframework.crux.gwt.rebind;
import org.cruxframework.crux.core.client.collection.FastMap;
import org.cruxframework.crux.core.client.utils.EscapeUtils;
import org.cruxframework.crux.core.rebind.CruxGeneratorException;
import org.cruxframework.crux.core.rebind.screen.widget.ViewFactoryCreator;
import org.cruxframework.crux.core.rebind.screen.widget.WidgetCreatorContext;
import org.cruxframework.crux.core.rebind.screen.widget.ViewFactoryCreator.SourcePrinter;
import org.cruxframework.crux.core.rebind.screen.widget.creator.HasHTMLFactory;
import org.cruxframework.crux.core.rebind.screen.widget.creator.HasInitializeHandlersFactory;
import org.cruxframework.crux.core.rebind.screen.widget.creator.children.WidgetChildProcessor;
import org.cruxframework.crux.core.rebind.screen.widget.creator.children.WidgetChildProcessor.HTMLTag;
import org.cruxframework.crux.core.rebind.screen.widget.declarative.DeclarativeFactory;
import org.cruxframework.crux.core.rebind.screen.widget.declarative.TagAttributeDeclaration;
import org.cruxframework.crux.core.rebind.screen.widget.declarative.TagAttributesDeclaration;
import org.cruxframework.crux.core.rebind.screen.widget.declarative.TagChild;
import org.cruxframework.crux.core.rebind.screen.widget.declarative.TagChildren;
import org.cruxframework.crux.core.rebind.screen.widget.declarative.TagConstraints;
import com.google.gwt.user.client.ui.RichTextArea;
import com.google.gwt.user.client.ui.RichTextArea.FontSize;
import com.google.gwt.user.client.ui.RichTextArea.Formatter;
import com.google.gwt.user.client.ui.RichTextArea.Justification;
class RichTextAreaContext extends WidgetCreatorContext
{
protected FastMap<String> declaredProperties;
}
/**
* Represents a rich text area component
* @author Thiago Bustamante
*/
@DeclarativeFactory(id="richTextArea", library="gwt", targetWidget=RichTextArea.class)
@TagAttributesDeclaration({
@TagAttributeDeclaration("backColor"),
@TagAttributeDeclaration("fontName"),
@TagAttributeDeclaration(value="fontSize", type=Integer.class),
@TagAttributeDeclaration("foreColor"),
@TagAttributeDeclaration("justification"),
@TagAttributeDeclaration(value="bold", type=Boolean.class),
@TagAttributeDeclaration(value="italic", type=Boolean.class),
@TagAttributeDeclaration(value="subscript", type=Boolean.class),
@TagAttributeDeclaration(value="superscript", type=Boolean.class),
@TagAttributeDeclaration(value="underline", type=Boolean.class),
@TagAttributeDeclaration(value="strikethrough", type=Boolean.class)
})
@TagChildren({
@TagChild(value=RichTextAreaFactory.ContentProcessor.class, autoProcess=false)
})
public class RichTextAreaFactory extends FocusWidgetFactory<RichTextAreaContext>
implements HasHTMLFactory<RichTextAreaContext>, HasInitializeHandlersFactory<RichTextAreaContext>
{
@Override
public void processAttributes(SourcePrinter out, final RichTextAreaContext context) throws CruxGeneratorException
{
super.processAttributes(out, context);
context.declaredProperties = readDeclaredProperties(context);
}
@Override
public void postProcess(SourcePrinter out, RichTextAreaContext context) throws CruxGeneratorException
{
super.postProcess(out, context);
String widget = context.getWidget();
// We need to give UI thread time to render the textArea before try to focus it
printlnPostProcessing(widget+".setFocus(true);");// Necessary to work around a bug in mozzila
printFormatterOptions(context);
}
/**
* Reads all declared properties in the component span tag. These properties will be used
* to initialise the basic formatter. It will be done by method initBasicFormatterOptions
* @param element
*/
protected FastMap<String> readDeclaredProperties(WidgetCreatorContext context)
{
FastMap<String> declaredProperties = new FastMap<String>();
String backColor = context.readWidgetProperty("backColor");
if (backColor != null && backColor.length() > 0)
{
declaredProperties.put("backColor",backColor);
}
String fontName = context.readWidgetProperty("fontName");
if (fontName != null && fontName.length() > 0)
{
declaredProperties.put("fontName",fontName);
}
String fontSize = context.readWidgetProperty("fontSize");
if (fontSize != null && fontSize.length() > 0)
{
declaredProperties.put("fontSize",fontSize);
}
String foreColor = context.readWidgetProperty("foreColor");
if (foreColor != null && foreColor.length() > 0)
{
declaredProperties.put("foreColor",foreColor);
}
String justification = context.readWidgetProperty("justification");
if (justification != null && justification.length() > 0)
{
declaredProperties.put("justification",justification);
}
String bold = context.readWidgetProperty("bold");
if (bold != null && bold.length() > 0)
{
declaredProperties.put("bold",bold);
}
String italic = context.readWidgetProperty("italic");
if (italic != null && italic.length() > 0)
{
declaredProperties.put("italic",italic);
}
String subscript = context.readWidgetProperty("subscript");
if (subscript != null && subscript.length() > 0)
{
declaredProperties.put("subscript",subscript);
}
String superscript = context.readWidgetProperty("superscript");
if (superscript != null && superscript.length() > 0)
{
declaredProperties.put("superscript",superscript);
}
String underline = context.readWidgetProperty("underline");
if (underline != null && underline.length() > 0)
{
declaredProperties.put("underline",underline);
}
String strikethrough = context.readWidgetProperty("strikethrough");
if (strikethrough != null && strikethrough.length() > 0)
{
declaredProperties.put("strikethrough",strikethrough);
}
return declaredProperties;
}
/**
* Render basic formatter options
*/
protected void printFormatterOptions(RichTextAreaContext context)
{
String formatter = ViewFactoryCreator.createVariableName("formatter");
printlnPostProcessing(Formatter.class.getCanonicalName()+" "+formatter+" = "+context.getWidget()+".getFormatter();");
printlnPostProcessing("if (formatter != null){");
if (context.declaredProperties.containsKey("backColor"))
{
printlnPostProcessing(formatter+".setBackColor("+EscapeUtils.quote(context.declaredProperties.get("backColor"))+");");
}
if (context.declaredProperties.containsKey("fontName"))
{
printlnPostProcessing(formatter+".setFontName("+EscapeUtils.quote(context.declaredProperties.get("fontName"))+");");
}
if (context.declaredProperties.containsKey("fontSize"))
{
switch (Integer.parseInt(context.declaredProperties.get("fontSize")))
{
case 1:
printlnPostProcessing(formatter+".setFontSize("+FontSize.class.getCanonicalName()+".XX_SMALL);");
break;
case 2:
printlnPostProcessing(formatter+".setFontSize("+FontSize.class.getCanonicalName()+".X_SMALL);");
break;
case 3:
printlnPostProcessing(formatter+".setFontSize("+FontSize.class.getCanonicalName()+".SMALL);");
break;
case 4:
printlnPostProcessing(formatter+".setFontSize("+FontSize.class.getCanonicalName()+".MEDIUM);");
break;
case 5:
printlnPostProcessing(formatter+".setFontSize("+FontSize.class.getCanonicalName()+".LARGE);");
break;
case 6:
printlnPostProcessing(formatter+".setFontSize("+FontSize.class.getCanonicalName()+".X_LARGE);");
break;
case 7:
printlnPostProcessing(formatter+".setFontSize("+FontSize.class.getCanonicalName()+".XX_LARGE);");
break;
default:
printlnPostProcessing(formatter+".setFontSize("+FontSize.class.getCanonicalName()+".MEDIUM);");
}
printlnPostProcessing("}");
if (context.declaredProperties.containsKey("foreColor"))
{
printlnPostProcessing(formatter+".setForeColor("+EscapeUtils.quote(context.declaredProperties.get("foreColor"))+");");
}
if (context.declaredProperties.containsKey("justification"))
{
String justification = context.declaredProperties.get("justification");
if (justification.equalsIgnoreCase("center"))
{
printlnPostProcessing(formatter+".setJustification("+Justification.class.getCanonicalName()+".CENTER);");
}
else if (justification.equalsIgnoreCase("left"))
{
printlnPostProcessing(formatter+".setJustification("+Justification.class.getCanonicalName()+".LEFT);");
}
else if (justification.equalsIgnoreCase("right"))
{
printlnPostProcessing(formatter+".setJustification("+Justification.class.getCanonicalName()+".RIGHT);");
}
}
if (context.declaredProperties.containsKey("bold") && Boolean.parseBoolean(context.declaredProperties.get("bold")))
{
printlnPostProcessing(formatter+".toggleBold();");
}
if (context.declaredProperties.containsKey("italic") && Boolean.parseBoolean(context.declaredProperties.get("italic")))
{
printlnPostProcessing(formatter+".toggleItalic();");
}
if (context.declaredProperties.containsKey("subscript") && Boolean.parseBoolean(context.declaredProperties.get("subscript")))
{
printlnPostProcessing(formatter+".toggleSubscript();");
}
if (context.declaredProperties.containsKey("superscript") && Boolean.parseBoolean(context.declaredProperties.get("superscript")))
{
printlnPostProcessing(formatter+".toggleSuperscript();");
}
if (context.declaredProperties.containsKey("underline") && Boolean.parseBoolean(context.declaredProperties.get("underline")))
{
printlnPostProcessing(formatter+".toggleUnderline();");
}
if (context.declaredProperties.containsKey("strikethrough") && Boolean.parseBoolean(context.declaredProperties.get("strikethrough")))
{
printlnPostProcessing(formatter+".toggleStrikethrough();");
}
}
}
@TagConstraints(minOccurs="0", maxOccurs="unbounded", type=HTMLTag.class)
public static class ContentProcessor extends WidgetChildProcessor<RichTextAreaContext> {}
@Override
public RichTextAreaContext instantiateContext()
{
return new RichTextAreaContext();
}
}
| [
"[email protected]@a5d2bbaa-053c-11de-b17c-0f1ef23b492c"
] | [email protected]@a5d2bbaa-053c-11de-b17c-0f1ef23b492c |
5dec47698b21c0ea8835ec9c54310d0b1d245b54 | 088f85c0f187697b084e00c924b1c22c54868c1b | /bos-test-1/src/main/java/com/czxy/bos/itextpdf/ITextTest01.java | 0826dd2450852c8ce199da7a9cd46a165e293fce | [] | no_license | sunpeilun/bos | 9dc1d39d7d1ee370ab9ce24e43f4e6fd7865b501 | fee4d42a417081316f61c1ea1132f80867dcb398 | refs/heads/master | 2020-04-07T11:48:27.251432 | 2018-11-20T07:58:07 | 2018-11-20T07:58:07 | 158,341,728 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 798 | java | package com.czxy.bos.itextpdf;
import com.itextpdf.text.Document;
import com.itextpdf.text.Paragraph;
import com.itextpdf.text.pdf.PdfWriter;
import java.io.File;
import java.io.FileOutputStream;
public class ITextTest01 {
public static void main(String[] args) throws Exception{
//1 创建文档对象
Document document = new Document();
//2 设置输出位置
// 第一个参数:文档数据
// 第二个参数:输出位置
PdfWriter.getInstance(document,new FileOutputStream(new File("d:\\java1.pdf")));
//3 打开文档
document.open();
//4 写入内容
document.add(new Paragraph("czdx,一统江湖,千秋万代,yi tong jiang hu"));
//5 关闭文档
document.close();
}
}
| [
"[email protected]"
] | |
db2369056dd4ddc15f8c663ba6e53fdc4ee56f41 | 7426c52f9419c9fede043d31f10aceba1a8a104b | /src/com/tharindu/moodlloid/MessagesFragment.java | e8af0e769f33f53937cf74f7223ca12c95c8cac1 | [] | no_license | TharinduMunasinge/Moodlloid | 98d14b72ef6686a8e5e08213c88d3d474be515dd | 0496ed29dddc0d84fc49d18834404d1fbe579c83 | refs/heads/master | 2016-09-02T09:14:22.924721 | 2014-09-17T21:11:54 | 2014-09-17T21:11:54 | 30,195,461 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 459 | java | package com.tharindu.moodlloid;
import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
public class MessagesFragment extends Fragment {
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
View rootView = inflater .inflate(R.layout.explanations_fragment, container, false);
return rootView;
}
}
| [
"[email protected]"
] | |
9e9ef4adeaa6746df97489711c5c32ce9f97c38b | 6732796da80d70456091ec1c3cc1ee9748b97cc5 | /TS/jackson-databind/src/test/java/com/fasterxml/jackson/databind/util/ByteBufferUtilsTest.java | bb713b2875c822874f4d072cf8e6e4a646a8d252 | [
"LicenseRef-scancode-generic-cla",
"Apache-2.0"
] | permissive | nharrand/argo | f88c13a1fb759f44fab6dbc6614de3c0c0554549 | c09fccba668e222a1b349b95d34177b5964e78e1 | refs/heads/main | 2023-08-13T10:39:48.526694 | 2021-10-13T09:40:19 | 2021-10-13T09:40:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,024 | java | package com.fasterxml.jackson.databind.util;
import java.nio.ByteBuffer;
import com.fasterxml.jackson.databind.BaseMapTest;
public class ByteBufferUtilsTest extends BaseMapTest
{
public void testByteBufferInput() throws Exception {
byte[] input = new byte[] { 1, 2, 3 };
ByteBufferBackedInputStream wrapped = new ByteBufferBackedInputStream(ByteBuffer.wrap(input));
//ARGO_PLACEBO
assertEquals(3, wrapped.available());
//ARGO_PLACEBO
assertEquals(1, wrapped.read());
byte[] buffer = new byte[10];
//ARGO_PLACEBO
assertEquals(2, wrapped.read(buffer, 0, 5));
wrapped.close();
}
public void testByteBufferOutput() throws Exception {
ByteBuffer b = ByteBuffer.wrap(new byte[10]);
ByteBufferBackedOutputStream wrappedOut = new ByteBufferBackedOutputStream(b);
wrappedOut.write(1);
wrappedOut.write(new byte[] { 2, 3 });
//ARGO_PLACEBO
assertEquals(3, b.position());
//ARGO_PLACEBO
assertEquals(7, b.remaining());
wrappedOut.close();
}
}
| [
"[email protected]"
] | |
3f43be48a00bcccbce7599f85e2e9a208889d003 | 694d574b989e75282326153d51bd85cb8b83fb9f | /google-ads/src/main/java/com/google/ads/googleads/v2/enums/FeedMappingCriterionTypeEnumOrBuilder.java | b423d8eda454ddab81aadc23e109bb70a0c7453f | [
"Apache-2.0"
] | permissive | tikivn/google-ads-java | 99201ef20efd52f884d651755eb5a3634e951e9b | 1456d890e5c6efc5fad6bd276b4a3cd877175418 | refs/heads/master | 2023-08-03T13:02:40.730269 | 2020-07-17T16:33:40 | 2020-07-17T16:33:40 | 280,845,720 | 0 | 0 | Apache-2.0 | 2023-07-23T23:39:26 | 2020-07-19T10:51:35 | null | UTF-8 | Java | false | true | 398 | java | // Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/ads/googleads/v2/enums/feed_mapping_criterion_type.proto
package com.google.ads.googleads.v2.enums;
public interface FeedMappingCriterionTypeEnumOrBuilder extends
// @@protoc_insertion_point(interface_extends:google.ads.googleads.v2.enums.FeedMappingCriterionTypeEnum)
com.google.protobuf.MessageOrBuilder {
}
| [
"[email protected]"
] | |
4a314b30f678fe6eae8f22b5e217cbe3792da3bf | e648967466e2f6f3df17b5ea0139fd19444a9503 | /CNN/src/test/java/testhomepage/TestHomePage.java | 2f40fdb6787f1becf38cfbe36de93b94fb483a4d | [] | no_license | zashuvro/Team-1_WebAutomationFramework | b6c20e273ed5b6279c3c7dba40549c852590c0cb | eb4d30120a393b74afde20c7005f2d300853c947 | refs/heads/master | 2022-07-10T00:08:26.469354 | 2020-02-19T06:56:21 | 2020-02-19T06:56:21 | 238,089,553 | 0 | 0 | null | 2021-04-26T19:56:08 | 2020-02-04T00:18:58 | Java | UTF-8 | Java | false | false | 11,671 | java | package testhomepage;
import common.WebAPI;
import homepage.pageobject.HomePage;
import org.apache.poi.ss.formula.functions.T;
import org.openqa.selenium.support.PageFactory;
import org.testng.annotations.Test;
public class TestHomePage extends HomePage {
public static void initElements (){
PageFactory.initElements(driver, HomePage.class);
}
@Test(priority = 1)
public static void testManuButton() throws InterruptedException {
initElements();
clickManuButton();
Thread.sleep(2000);
}
@Test(priority = 2)
public static void testliveTvButton() throws InterruptedException {
initElements();
clickLiveTvButton();
Thread.sleep(2000);
}
@Test(priority = 3)
public static void testSearchButton() throws InterruptedException {
initElements();
clickSearchButton();
Thread.sleep(2000);
//navigateBack();
}
@Test(priority = 4)
public static void testUSButton() throws InterruptedException {
initElements();
clickUSbutton();
Thread.sleep(2000);
}
@Test(priority = 5)
public static void testWorldButton() throws InterruptedException {
initElements();
clickWorldButton();
Thread.sleep(2000);
}
@Test(priority = 6)
public static void testPoliticesbutton() throws InterruptedException {
initElements();
clickPoliticesButton();
Thread.sleep(2000);
}
@Test(priority = 7)
public static void testBusinessButton() throws InterruptedException {
initElements();
clickBusinessButton();
Thread.sleep(2000);
}
@Test(priority = 8)
public static void testOpinionButton() throws InterruptedException {
initElements();
clickOpinionButton();
Thread.sleep(20000);
}
@Test(priority = 9)
public static void testHealthButton() throws InterruptedException {
initElements();
clickHealthButton();
Thread.sleep(2000);
}
@Test(priority = 10)
public static void testEnterteinmentButton() throws InterruptedException {
initElements();
clickEntertenmentButton();
Thread.sleep(2000);
}
@Test(priority = 11)
public static void testStyleButton() throws InterruptedException {
initElements();
clickStyleButton();
Thread.sleep(2000);
}
@Test(priority = 12)
public static void testTravelButton () throws InterruptedException {
initElements();
clickTravelButton();
Thread.sleep(2000);
}
@Test(priority = 13)
public static void testSportsButton() throws InterruptedException {
initElements();
clickSportsButton();
Thread.sleep(2000);
}
@Test(priority = 14)
public static void testVideoButton() throws InterruptedException {
initElements();
clickVideoButton();
Thread.sleep(2000);
}
@Test(priority = 15)
public static void testEditionTab() throws InterruptedException {
initElements();
clickEditionTab();
Thread.sleep(2000);
}
@Test(priority = 16)
public static void testEditionUS() throws InterruptedException {
initElements();
clickEditionTab();
Thread.sleep(2000);
clickEditionUS();
Thread.sleep(2000);
}
@Test(priority = 17)
public static void testEditionInternational() throws InterruptedException {
initElements();
clickEditionTab();
Thread.sleep(2000);
clickEditionInternational();
Thread.sleep(2000);
}
@Test(priority = 18)
public static void testEditionArabic() throws InterruptedException {
initElements();
clickEditionTab();
Thread.sleep(2000);
clickEditionArabic();
Thread.sleep(2000);
}
@Test(priority = 19)
public static void testEditionEspanol() throws InterruptedException {
initElements();
clickEditionTab();
Thread.sleep(200);
clickeditionEspanol();
Thread.sleep(2000);
}
@Test(priority = 20)
public static void testManuButtonSearchBar() throws InterruptedException {
initElements();
clickManuButton();
Thread.sleep(2000);
clickmanuButtonSearchBar();
}
@Test(priority = 21)
public static void testWorldAfrica() throws InterruptedException {
initElements();
clickWorldButton();
Thread.sleep(2000);
clickWorldAfrica();
Thread.sleep(2000);
}
@Test(priority = 22)
public static void testWorldAmericans() throws InterruptedException {
initElements();
clickWorldButton();
Thread.sleep(2000);
clickWorldAmericas();
Thread.sleep(2000);
}
@Test(priority = 23)
public static void testWorldAsia() throws InterruptedException {
initElements();
clickWorldButton();
Thread.sleep(2000);
clickWorldAsia();
Thread.sleep(2000);
}
@Test(priority = 24)
public static void testWorldAustralia() throws InterruptedException {
initElements();
clickWorldButton();
Thread.sleep(2000);
clickWorldAustralia();
Thread.sleep(2000);
}
@Test(priority = 25)
public static void testWorldChina() throws InterruptedException {
initElements();
clickWorldButton();
Thread.sleep(2000);
clickWorldChina();
Thread.sleep(2000);
}
@Test(priority = 26)
public static void testWorldEurope() throws InterruptedException {
initElements();
clickWorldButton();
Thread.sleep(2000);
clickWorldEurope();
Thread.sleep(2000);
}
@Test(priority = 27)
public static void testWorldIndia() throws InterruptedException {
initElements();
clickWorldButton();
Thread.sleep(2000);
cickWorldIndia();
Thread.sleep(2000);
}
@Test(priority = 28)
public static void testWorldMiddleEast() throws InterruptedException {
initElements();
clickWorldButton();
Thread.sleep(2000);
clickWorldMiddleEast();
Thread.sleep(2000);
}
@Test(priority = 29)
public static void testWorldUnitedKingdome() throws InterruptedException {
initElements();
clickWorldButton();
Thread.sleep(2000);
clickWrldUnitedKingdome();
Thread.sleep(2000);
}
@Test(priority = 30)
public static void testManuButtonSearchBar1() throws InterruptedException {
initElements();
clickManuButton();
Thread.sleep(2000);
clickmanuButtonSearchBar1();
Thread.sleep(2000);
}
@Test(priority = 31)
public static void testManuButtonSearchBar2() throws InterruptedException {
initElements();
clickManuButton();
Thread.sleep(2000);
clickmanuButtonSearchBar2();
Thread.sleep(2000);
}
@Test(priority = 32)
public static void testManuButtonSearchBar3() throws InterruptedException {
initElements();
//scrollUpDown(2800);
clickManuButton();
Thread.sleep(2000);
//scrollUpDown(-2800);
clickmanuButtonSearchBar3();
Thread.sleep(2000);
}
@Test(priority = 33)
public static void testManuBarSearchBar4() throws InterruptedException {
initElements();
clickManuButton();
Thread.sleep(2000);
clickManuButtonsearchBar4();
Thread.sleep(2000);
}
@Test(priority = 34)
public static void testBoxOfFooterStyle() throws InterruptedException {
initElements();
scrollUpDown(4000);
listOfBoxFooterStyle();
Thread.sleep(3000);
System.out.println(getBoxOfFooterStyle().getText());
}
@Test(priority = 35)
public static void testBoxOfHeadderStyle() throws InterruptedException {
initElements();
checkAndListOfBoxHeadderStyle();
Thread.sleep(2000);
System.out.println(getBoxOfHeadderStyle().getText());
}
@Test(priority = 36)
public static void testFooterBoxInUSBox() throws InterruptedException {
initElements();
scrollUpDown(4000);
listOFFooterBoxInUS();
Thread.sleep(2000);
System.out.println(getFooterBoxInUSbox().getText());
}
@Test(priority = 37)
public static void testmanuBarUSCrimeJastic() throws InterruptedException {
initElements();
clickManuButton();
Thread.sleep(2000);
clickmanuBarUSCrimeJastic();
Thread.sleep(200);
}
@Test(priority = 38)
public static void testmanuBUSEnergyEnviroment() throws InterruptedException {
initElements();
clickManuButton();
Thread.sleep(2000);
clickmanuBUSEnergyEnviroment();
Thread.sleep(2000);
}
@Test(priority = 39)
public static void testManubarFood() throws InterruptedException {
initElements();
clickManuButton();
Thread.sleep(2000);
clickManubarFood();
Thread.sleep(2000);
}
@Test(priority = 40)
public static void testManubar45() throws InterruptedException {
initElements();
clickManuButton();
Thread.sleep(2000);
clickmanuBar45();
Thread.sleep(2000);
}
@Test(priority = 41)
public static void tesMnueBarCNNStore() throws InterruptedException {
initElements();
clickManuButton();
Thread.sleep(2000);
clickmanubarCNNStore();
Thread.sleep(2000);
}
@Test(priority = 42)
public static void testmanuBarPhotos() throws InterruptedException {
initElements();
clickManuButton();
Thread.sleep(2000);
clickmanuBarPhotos();
Thread.sleep(2000);
}
@Test(priority = 43)
public static void testlastFooterBox() throws InterruptedException {
initElements();
scrollUpDown(4800);
Thread.sleep(2000);
seelastFooterBox();
System.out.println(getLastFooterBox().getText());
}
@Test(priority = 44)
public static void testcnnLinklist() throws InterruptedException {
initElements();
//scrollUpDown(4800);
//Thread.sleep(2000);
seecnnLinklist();
Thread.sleep(2000);
System.out.println(getCnnLinklist().getText());
}
@Test(priority = 45)
public static void testlinkStyleTearm() throws InterruptedException {
initElements();
//scrollUpDown(4800);
seecnnLinklist();
Thread.sleep(2000);
clicklinkStyleTearm();
Thread.sleep(2000);
}
@Test(priority = 46)
public static void testlinkStylePrivecy(){
initElements();
scrollUpDown(4800);
getLinkStylePrivecy().click();
}
@Test(priority = 47)
public static void testlinkFoNotSellMyPersonalStuff(){
initElements();
scrollUpDown(4800);
getLinkFoNotSellMyPersonalStuff().click();
}
@Test(priority = 48)
public static void testlinkAddChoic() throws InterruptedException {
initElements();
scrollUpDown(4800);
clicklinkAddChoic();
Thread.sleep(2000);
}
@Test(priority = 49)
public static void testlinkAboutUs() throws InterruptedException {
initElements();
scrollUpDown(4800);
clicklinkAboutUs();
Thread.sleep(2000);
}
@Test(priority = 50)
public static void testlinkLicenceFotege() throws InterruptedException {
initElements();
scrollUpDown(4800);
clicklinkLicenceFotege();
Thread.sleep(2000);
}
}
| [
"[email protected]"
] | |
72ce1725f5c681810419da33d84a1e6fce2823a4 | 3ff8a408c819e39ef41caedc2553de148bd66af1 | /SDK MODIFICADAS/ICueSDKCorsair/src/ca/fiercest/cuesdk/enums/LedId.java | e6d6a098c5d73157b4fe5b7583eeef27a7490143 | [] | no_license | claudineiw/RGB-Sync | 4ade3b3cf0aa76e739c95816750d94e3196a646c | a25bd024aa12c9c883454c3cee567834a588410f | refs/heads/master | 2023-05-08T05:05:19.304364 | 2021-05-29T00:17:07 | 2021-05-29T00:17:07 | 351,955,378 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 28,417 | java | package ca.fiercest.cuesdk.enums;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
@Getter
@RequiredArgsConstructor
public enum LedId
{
CLI_Invalid(0),
CLK_Escape(1),
CLK_F1(2),
CLK_F2(3),
CLK_F3(4),
CLK_F4(5),
CLK_F5(6),
CLK_F6(7),
CLK_F7(8),
CLK_F8(9),
CLK_F9(10),
CLK_F10(11),
CLK_F11(12),
CLK_GraveAccentAndTilde(13),
CLK_1(14),
CLK_2(15),
CLK_3(16),
CLK_4(17),
CLK_5(18),
CLK_6(19),
CLK_7(20),
CLK_8(21),
CLK_9(22),
CLK_0(23),
CLK_MinusAndUnderscore(24),
CLK_Tab(25),
CLK_Q(26),
CLK_W(27),
CLK_E(28),
CLK_R(29),
CLK_T(30),
CLK_Y(31),
CLK_U(32),
CLK_I(33),
CLK_O(34),
CLK_P(35),
CLK_BracketLeft(36),
CLK_CapsLock(37),
CLK_A(38),
CLK_S(39),
CLK_D(40),
CLK_F(41),
CLK_G(42),
CLK_H(43),
CLK_J(44),
CLK_K(45),
CLK_L(46),
CLK_SemicolonAndColon(47),
CLK_ApostropheAndDoubleQuote(48),
CLK_LeftShift(49),
CLK_NonUsBackslash(50),
CLK_Z(51),
CLK_X(52),
CLK_C(53),
CLK_V(54),
CLK_B(55),
CLK_N(56),
CLK_M(57),
CLK_CommaAndLessThan(58),
CLK_PeriodAndBiggerThan(59),
CLK_SlashAndQuestionMark(60),
CLK_LeftCtrl(61),
CLK_LeftGui(62),
CLK_LeftAlt(63),
CLK_Lang2(64),
CLK_Space(65),
CLK_Lang1(66),
CLK_International2(67),
CLK_RightAlt(68),
CLK_RightGui(69),
CLK_Application(70),
CLK_LedProgramming(71),
CLK_Brightness(72),
CLK_F12(73),
CLK_PrintScreen(74),
CLK_ScrollLock(75),
CLK_PauseBreak(76),
CLK_Insert(77),
CLK_Home(78),
CLK_PageUp(79),
CLK_BracketRight(80),
CLK_Backslash(81),
CLK_NonUsTilde(82),
CLK_Enter(83),
CLK_International1(84),
CLK_EqualsAndPlus(85),
CLK_International3(86),
CLK_Backspace(87),
CLK_Delete(88),
CLK_End(89),
CLK_PageDown(90),
CLK_RightShift(91),
CLK_RightCtrl(92),
CLK_UpArrow(93),
CLK_LeftArrow(94),
CLK_DownArrow(95),
CLK_RightArrow(96),
CLK_WinLock(97),
CLK_Mute(98),
CLK_Stop(99),
CLK_ScanPreviousTrack(100),
CLK_PlayPause(101),
CLK_ScanNextTrack(102),
CLK_NumLock(103),
CLK_KeypadSlash(104),
CLK_KeypadAsterisk(105),
CLK_KeypadMinus(106),
CLK_KeypadPlus(107),
CLK_KeypadEnter(108),
CLK_Keypad7(109),
CLK_Keypad8(110),
CLK_Keypad9(111),
CLK_KeypadComma(112),
CLK_Keypad4(113),
CLK_Keypad5(114),
CLK_Keypad6(115),
CLK_Keypad1(116),
CLK_Keypad2(117),
CLK_Keypad3(118),
CLK_Keypad0(119),
CLK_KeypadPeriodAndDelete(120),
CLK_G1(121),
CLK_G2(122),
CLK_G3(123),
CLK_G4(124),
CLK_G5(125),
CLK_G6(126),
CLK_G7(127),
CLK_G8(128),
CLK_G9(129),
CLK_G10(130),
CLK_VolumeUp(131),
CLK_VolumeDown(132),
CLK_MR(133),
CLK_M1(134),
CLK_M2(135),
CLK_M3(136),
CLK_G11(137),
CLK_G12(138),
CLK_G13(139),
CLK_G14(140),
CLK_G15(141),
CLK_G16(142),
CLK_G17(143),
CLK_G18(144),
CLK_International5(145),
CLK_International4(146),
CLK_Fn(147),
CLM_1(148),
CLM_2(149),
CLM_3(150),
CLM_4(151),
CLH_LeftLogo(152),
CLH_RightLogo(153),
CLK_Logo(154),
CLMM_Zone1(155),
CLMM_Zone2(156),
CLMM_Zone3(157),
CLMM_Zone4(158),
CLMM_Zone5(159),
CLMM_Zone6(160),
CLMM_Zone7(161),
CLMM_Zone8(162),
CLMM_Zone9(163),
CLMM_Zone10(164),
CLMM_Zone11(165),
CLMM_Zone12(166),
CLMM_Zone13(167),
CLMM_Zone14(168),
CLMM_Zone15(169),
CLKLP_Zone1(170),
CLKLP_Zone2(171),
CLKLP_Zone3(172),
CLKLP_Zone4(173),
CLKLP_Zone5(174),
CLKLP_Zone6(175),
CLKLP_Zone7(176),
CLKLP_Zone8(177),
CLKLP_Zone9(178),
CLKLP_Zone10(179),
CLKLP_Zone11(180),
CLKLP_Zone12(181),
CLKLP_Zone13(182),
CLKLP_Zone14(183),
CLKLP_Zone15(184),
CLKLP_Zone16(185),
CLKLP_Zone17(186),
CLKLP_Zone18(187),
CLKLP_Zone19(188),
CLM_5(189),
CLM_6(190),
CLHSS_Zone1(191),
CLHSS_Zone2(192),
CLHSS_Zone3(193),
CLHSS_Zone4(194),
CLHSS_Zone5(195),
CLHSS_Zone6(196),
CLHSS_Zone7(197),
CLHSS_Zone8(198),
CLHSS_Zone9(199),
CLD_C1_1(200),
CLD_C1_2(201),
CLD_C1_3(202),
CLD_C1_4(203),
CLD_C1_5(204),
CLD_C1_6(205),
CLD_C1_7(206),
CLD_C1_8(207),
CLD_C1_9(208),
CLD_C1_10(209),
CLD_C1_11(210),
CLD_C1_12(211),
CLD_C1_13(212),
CLD_C1_14(213),
CLD_C1_15(214),
CLD_C1_16(215),
CLD_C1_17(216),
CLD_C1_18(217),
CLD_C1_19(218),
CLD_C1_20(219),
CLD_C1_21(220),
CLD_C1_22(221),
CLD_C1_23(222),
CLD_C1_24(223),
CLD_C1_25(224),
CLD_C1_26(225),
CLD_C1_27(226),
CLD_C1_28(227),
CLD_C1_29(228),
CLD_C1_30(229),
CLD_C1_31(230),
CLD_C1_32(231),
CLD_C1_33(232),
CLD_C1_34(233),
CLD_C1_35(234),
CLD_C1_36(235),
CLD_C1_37(236),
CLD_C1_38(237),
CLD_C1_39(238),
CLD_C1_40(239),
CLD_C1_41(240),
CLD_C1_42(241),
CLD_C1_43(242),
CLD_C1_44(243),
CLD_C1_45(244),
CLD_C1_46(245),
CLD_C1_47(246),
CLD_C1_48(247),
CLD_C1_49(248),
CLD_C1_50(249),
CLD_C1_51(250),
CLD_C1_52(251),
CLD_C1_53(252),
CLD_C1_54(253),
CLD_C1_55(254),
CLD_C1_56(255),
CLD_C1_57(256),
CLD_C1_58(257),
CLD_C1_59(258),
CLD_C1_60(259),
CLD_C1_61(260),
CLD_C1_62(261),
CLD_C1_63(262),
CLD_C1_64(263),
CLD_C1_65(264),
CLD_C1_66(265),
CLD_C1_67(266),
CLD_C1_68(267),
CLD_C1_69(268),
CLD_C1_70(269),
CLD_C1_71(270),
CLD_C1_72(271),
CLD_C1_73(272),
CLD_C1_74(273),
CLD_C1_75(274),
CLD_C1_76(275),
CLD_C1_77(276),
CLD_C1_78(277),
CLD_C1_79(278),
CLD_C1_80(279),
CLD_C1_81(280),
CLD_C1_82(281),
CLD_C1_83(282),
CLD_C1_84(283),
CLD_C1_85(284),
CLD_C1_86(285),
CLD_C1_87(286),
CLD_C1_88(287),
CLD_C1_89(288),
CLD_C1_90(289),
CLD_C1_91(290),
CLD_C1_92(291),
CLD_C1_93(292),
CLD_C1_94(293),
CLD_C1_95(294),
CLD_C1_96(295),
CLD_C1_97(296),
CLD_C1_98(297),
CLD_C1_99(298),
CLD_C1_100(299),
CLD_C1_101(300),
CLD_C1_102(301),
CLD_C1_103(302),
CLD_C1_104(303),
CLD_C1_105(304),
CLD_C1_106(305),
CLD_C1_107(306),
CLD_C1_108(307),
CLD_C1_109(308),
CLD_C1_110(309),
CLD_C1_111(310),
CLD_C1_112(311),
CLD_C1_113(312),
CLD_C1_114(313),
CLD_C1_115(314),
CLD_C1_116(315),
CLD_C1_117(316),
CLD_C1_118(317),
CLD_C1_119(318),
CLD_C1_120(319),
CLD_C1_121(320),
CLD_C1_122(321),
CLD_C1_123(322),
CLD_C1_124(323),
CLD_C1_125(324),
CLD_C1_126(325),
CLD_C1_127(326),
CLD_C1_128(327),
CLD_C1_129(328),
CLD_C1_130(329),
CLD_C1_131(330),
CLD_C1_132(331),
CLD_C1_133(332),
CLD_C1_134(333),
CLD_C1_135(334),
CLD_C1_136(335),
CLD_C1_137(336),
CLD_C1_138(337),
CLD_C1_139(338),
CLD_C1_140(339),
CLD_C1_141(340),
CLD_C1_142(341),
CLD_C1_143(342),
CLD_C1_144(343),
CLD_C1_145(344),
CLD_C1_146(345),
CLD_C1_147(346),
CLD_C1_148(347),
CLD_C1_149(348),
CLD_C1_150(349),
CLD_C2_1(350),
CLD_C2_2(351),
CLD_C2_3(352),
CLD_C2_4(353),
CLD_C2_5(354),
CLD_C2_6(355),
CLD_C2_7(356),
CLD_C2_8(357),
CLD_C2_9(358),
CLD_C2_10(359),
CLD_C2_11(360),
CLD_C2_12(361),
CLD_C2_13(362),
CLD_C2_14(363),
CLD_C2_15(364),
CLD_C2_16(365),
CLD_C2_17(366),
CLD_C2_18(367),
CLD_C2_19(368),
CLD_C2_20(369),
CLD_C2_21(370),
CLD_C2_22(371),
CLD_C2_23(372),
CLD_C2_24(373),
CLD_C2_25(374),
CLD_C2_26(375),
CLD_C2_27(376),
CLD_C2_28(377),
CLD_C2_29(378),
CLD_C2_30(379),
CLD_C2_31(380),
CLD_C2_32(381),
CLD_C2_33(382),
CLD_C2_34(383),
CLD_C2_35(384),
CLD_C2_36(385),
CLD_C2_37(386),
CLD_C2_38(387),
CLD_C2_39(388),
CLD_C2_40(389),
CLD_C2_41(390),
CLD_C2_42(391),
CLD_C2_43(392),
CLD_C2_44(393),
CLD_C2_45(394),
CLD_C2_46(395),
CLD_C2_47(396),
CLD_C2_48(397),
CLD_C2_49(398),
CLD_C2_50(399),
CLD_C2_51(400),
CLD_C2_52(401),
CLD_C2_53(402),
CLD_C2_54(403),
CLD_C2_55(404),
CLD_C2_56(405),
CLD_C2_57(406),
CLD_C2_58(407),
CLD_C2_59(408),
CLD_C2_60(409),
CLD_C2_61(410),
CLD_C2_62(411),
CLD_C2_63(412),
CLD_C2_64(413),
CLD_C2_65(414),
CLD_C2_66(415),
CLD_C2_67(416),
CLD_C2_68(417),
CLD_C2_69(418),
CLD_C2_70(419),
CLD_C2_71(420),
CLD_C2_72(421),
CLD_C2_73(422),
CLD_C2_74(423),
CLD_C2_75(424),
CLD_C2_76(425),
CLD_C2_77(426),
CLD_C2_78(427),
CLD_C2_79(428),
CLD_C2_80(429),
CLD_C2_81(430),
CLD_C2_82(431),
CLD_C2_83(432),
CLD_C2_84(433),
CLD_C2_85(434),
CLD_C2_86(435),
CLD_C2_87(436),
CLD_C2_88(437),
CLD_C2_89(438),
CLD_C2_90(439),
CLD_C2_91(440),
CLD_C2_92(441),
CLD_C2_93(442),
CLD_C2_94(443),
CLD_C2_95(444),
CLD_C2_96(445),
CLD_C2_97(446),
CLD_C2_98(447),
CLD_C2_99(448),
CLD_C2_100(449),
CLD_C2_101(450),
CLD_C2_102(451),
CLD_C2_103(452),
CLD_C2_104(453),
CLD_C2_105(454),
CLD_C2_106(455),
CLD_C2_107(456),
CLD_C2_108(457),
CLD_C2_109(458),
CLD_C2_110(459),
CLD_C2_111(460),
CLD_C2_112(461),
CLD_C2_113(462),
CLD_C2_114(463),
CLD_C2_115(464),
CLD_C2_116(465),
CLD_C2_117(466),
CLD_C2_118(467),
CLD_C2_119(468),
CLD_C2_120(469),
CLD_C2_121(470),
CLD_C2_122(471),
CLD_C2_123(472),
CLD_C2_124(473),
CLD_C2_125(474),
CLD_C2_126(475),
CLD_C2_127(476),
CLD_C2_128(477),
CLD_C2_129(478),
CLD_C2_130(479),
CLD_C2_131(480),
CLD_C2_132(481),
CLD_C2_133(482),
CLD_C2_134(483),
CLD_C2_135(484),
CLD_C2_136(485),
CLD_C2_137(486),
CLD_C2_138(487),
CLD_C2_139(488),
CLD_C2_140(489),
CLD_C2_141(490),
CLD_C2_142(491),
CLD_C2_143(492),
CLD_C2_144(493),
CLD_C2_145(494),
CLD_C2_146(495),
CLD_C2_147(496),
CLD_C2_148(497),
CLD_C2_149(498),
CLD_C2_150(499),
CLI_Oem1(500),
CLI_Oem2(501),
CLI_Oem3(502),
CLI_Oem4(503),
CLI_Oem5(504),
CLI_Oem6(505),
CLI_Oem7(506),
CLI_Oem8(507),
CLI_Oem9(508),
CLI_Oem10(509),
CLI_Oem11(510),
CLI_Oem12(511),
CLI_Oem13(512),
CLI_Oem14(513),
CLI_Oem15(514),
CLI_Oem16(515),
CLI_Oem17(516),
CLI_Oem18(517),
CLI_Oem19(518),
CLI_Oem20(519),
CLI_Oem21(520),
CLI_Oem22(521),
CLI_Oem23(522),
CLI_Oem24(523),
CLI_Oem25(524),
CLI_Oem26(525),
CLI_Oem27(526),
CLI_Oem28(527),
CLI_Oem29(528),
CLI_Oem30(529),
CLI_Oem31(530),
CLI_Oem32(531),
CLI_Oem33(532),
CLI_Oem34(533),
CLI_Oem35(534),
CLI_Oem36(535),
CLI_Oem37(536),
CLI_Oem38(537),
CLI_Oem39(538),
CLI_Oem40(539),
CLI_Oem41(540),
CLI_Oem42(541),
CLI_Oem43(542),
CLI_Oem44(543),
CLI_Oem45(544),
CLI_Oem46(545),
CLI_Oem47(546),
CLI_Oem48(547),
CLI_Oem49(548),
CLI_Oem50(549),
CLI_Oem51(550),
CLI_Oem52(551),
CLI_Oem53(552),
CLI_Oem54(553),
CLI_Oem55(554),
CLI_Oem56(555),
CLI_Oem57(556),
CLI_Oem58(557),
CLI_Oem59(558),
CLI_Oem60(559),
CLI_Oem61(560),
CLI_Oem62(561),
CLI_Oem63(562),
CLI_Oem64(563),
CLI_Oem65(564),
CLI_Oem66(565),
CLI_Oem67(566),
CLI_Oem68(567),
CLI_Oem69(568),
CLI_Oem70(569),
CLI_Oem71(570),
CLI_Oem72(571),
CLI_Oem73(572),
CLI_Oem74(573),
CLI_Oem75(574),
CLI_Oem76(575),
CLI_Oem77(576),
CLI_Oem78(577),
CLI_Oem79(578),
CLI_Oem80(579),
CLI_Oem81(580),
CLI_Oem82(581),
CLI_Oem83(582),
CLI_Oem84(583),
CLI_Oem85(584),
CLI_Oem86(585),
CLI_Oem87(586),
CLI_Oem88(587),
CLI_Oem89(588),
CLI_Oem90(589),
CLI_Oem91(590),
CLI_Oem92(591),
CLI_Oem93(592),
CLI_Oem94(593),
CLI_Oem95(594),
CLI_Oem96(595),
CLI_Oem97(596),
CLI_Oem98(597),
CLI_Oem99(598),
CLI_Oem100(599),
CLDRAM_1(600),
CLDRAM_2(601),
CLDRAM_3(602),
CLDRAM_4(603),
CLDRAM_5(604),
CLDRAM_6(605),
CLDRAM_7(606),
CLDRAM_8(607),
CLDRAM_9(608),
CLDRAM_10(609),
CLDRAM_11(610),
CLDRAM_12(611),
CLD_C3_1(612),
CLD_C3_2(613),
CLD_C3_3(614),
CLD_C3_4(615),
CLD_C3_5(616),
CLD_C3_6(617),
CLD_C3_7(618),
CLD_C3_8(619),
CLD_C3_9(620),
CLD_C3_10(621),
CLD_C3_11(622),
CLD_C3_12(623),
CLD_C3_13(624),
CLD_C3_14(625),
CLD_C3_15(626),
CLD_C3_16(627),
CLD_C3_17(628),
CLD_C3_18(629),
CLD_C3_19(630),
CLD_C3_20(631),
CLD_C3_21(632),
CLD_C3_22(633),
CLD_C3_23(634),
CLD_C3_24(635),
CLD_C3_25(636),
CLD_C3_26(637),
CLD_C3_27(638),
CLD_C3_28(639),
CLD_C3_29(640),
CLD_C3_30(641),
CLD_C3_31(642),
CLD_C3_32(643),
CLD_C3_33(644),
CLD_C3_34(645),
CLD_C3_35(646),
CLD_C3_36(647),
CLD_C3_37(648),
CLD_C3_38(649),
CLD_C3_39(650),
CLD_C3_40(651),
CLD_C3_41(652),
CLD_C3_42(653),
CLD_C3_43(654),
CLD_C3_44(655),
CLD_C3_45(656),
CLD_C3_46(657),
CLD_C3_47(658),
CLD_C3_48(659),
CLD_C3_49(660),
CLD_C3_50(661),
CLD_C3_51(662),
CLD_C3_52(663),
CLD_C3_53(664),
CLD_C3_54(665),
CLD_C3_55(666),
CLD_C3_56(667),
CLD_C3_57(668),
CLD_C3_58(669),
CLD_C3_59(670),
CLD_C3_60(671),
CLD_C3_61(672),
CLD_C3_62(673),
CLD_C3_63(674),
CLD_C3_64(675),
CLD_C3_65(676),
CLD_C3_66(677),
CLD_C3_67(678),
CLD_C3_68(679),
CLD_C3_69(680),
CLD_C3_70(681),
CLD_C3_71(682),
CLD_C3_72(683),
CLD_C3_73(684),
CLD_C3_74(685),
CLD_C3_75(686),
CLD_C3_76(687),
CLD_C3_77(688),
CLD_C3_78(689),
CLD_C3_79(690),
CLD_C3_80(691),
CLD_C3_81(692),
CLD_C3_82(693),
CLD_C3_83(694),
CLD_C3_84(695),
CLD_C3_85(696),
CLD_C3_86(697),
CLD_C3_87(698),
CLD_C3_88(699),
CLD_C3_89(700),
CLD_C3_90(701),
CLD_C3_91(702),
CLD_C3_92(703),
CLD_C3_93(704),
CLD_C3_94(705),
CLD_C3_95(706),
CLD_C3_96(707),
CLD_C3_97(708),
CLD_C3_98(709),
CLD_C3_99(710),
CLD_C3_100(711),
CLD_C3_101(712),
CLD_C3_102(713),
CLD_C3_103(714),
CLD_C3_104(715),
CLD_C3_105(716),
CLD_C3_106(717),
CLD_C3_107(718),
CLD_C3_108(719),
CLD_C3_109(720),
CLD_C3_110(721),
CLD_C3_111(722),
CLD_C3_112(723),
CLD_C3_113(724),
CLD_C3_114(725),
CLD_C3_115(726),
CLD_C3_116(727),
CLD_C3_117(728),
CLD_C3_118(729),
CLD_C3_119(730),
CLD_C3_120(731),
CLD_C3_121(732),
CLD_C3_122(733),
CLD_C3_123(734),
CLD_C3_124(735),
CLD_C3_125(736),
CLD_C3_126(737),
CLD_C3_127(738),
CLD_C3_128(739),
CLD_C3_129(740),
CLD_C3_130(741),
CLD_C3_131(742),
CLD_C3_132(743),
CLD_C3_133(744),
CLD_C3_134(745),
CLD_C3_135(746),
CLD_C3_136(747),
CLD_C3_137(748),
CLD_C3_138(749),
CLD_C3_139(750),
CLD_C3_140(751),
CLD_C3_141(752),
CLD_C3_142(753),
CLD_C3_143(754),
CLD_C3_144(755),
CLD_C3_145(756),
CLD_C3_146(757),
CLD_C3_147(758),
CLD_C3_148(759),
CLD_C3_149(760),
CLD_C3_150(761),
CLLC_C1_1(762),
CLLC_C1_2(763),
CLLC_C1_3(764),
CLLC_C1_4(765),
CLLC_C1_5(766),
CLLC_C1_6(767),
CLLC_C1_7(768),
CLLC_C1_8(769),
CLLC_C1_9(770),
CLLC_C1_10(771),
CLLC_C1_11(772),
CLLC_C1_12(773),
CLLC_C1_13(774),
CLLC_C1_14(775),
CLLC_C1_15(776),
CLLC_C1_16(777),
CLLC_C1_17(778),
CLLC_C1_18(779),
CLLC_C1_19(780),
CLLC_C1_20(781),
CLLC_C1_21(782),
CLLC_C1_22(783),
CLLC_C1_23(784),
CLLC_C1_24(785),
CLLC_C1_25(786),
CLLC_C1_26(787),
CLLC_C1_27(788),
CLLC_C1_28(789),
CLLC_C1_29(790),
CLLC_C1_30(791),
CLLC_C1_31(792),
CLLC_C1_32(793),
CLLC_C1_33(794),
CLLC_C1_34(795),
CLLC_C1_35(796),
CLLC_C1_36(797),
CLLC_C1_37(798),
CLLC_C1_38(799),
CLLC_C1_39(800),
CLLC_C1_40(801),
CLLC_C1_41(802),
CLLC_C1_42(803),
CLLC_C1_43(804),
CLLC_C1_44(805),
CLLC_C1_45(806),
CLLC_C1_46(807),
CLLC_C1_47(808),
CLLC_C1_48(809),
CLLC_C1_49(810),
CLLC_C1_50(811),
CLLC_C1_51(812),
CLLC_C1_52(813),
CLLC_C1_53(814),
CLLC_C1_54(815),
CLLC_C1_55(816),
CLLC_C1_56(817),
CLLC_C1_57(818),
CLLC_C1_58(819),
CLLC_C1_59(820),
CLLC_C1_60(821),
CLLC_C1_61(822),
CLLC_C1_62(823),
CLLC_C1_63(824),
CLLC_C1_64(825),
CLLC_C1_65(826),
CLLC_C1_66(827),
CLLC_C1_67(828),
CLLC_C1_68(829),
CLLC_C1_69(830),
CLLC_C1_70(831),
CLLC_C1_71(832),
CLLC_C1_72(833),
CLLC_C1_73(834),
CLLC_C1_74(835),
CLLC_C1_75(836),
CLLC_C1_76(837),
CLLC_C1_77(838),
CLLC_C1_78(839),
CLLC_C1_79(840),
CLLC_C1_80(841),
CLLC_C1_81(842),
CLLC_C1_82(843),
CLLC_C1_83(844),
CLLC_C1_84(845),
CLLC_C1_85(846),
CLLC_C1_86(847),
CLLC_C1_87(848),
CLLC_C1_88(849),
CLLC_C1_89(850),
CLLC_C1_90(851),
CLLC_C1_91(852),
CLLC_C1_92(853),
CLLC_C1_93(854),
CLLC_C1_94(855),
CLLC_C1_95(856),
CLLC_C1_96(857),
CLLC_C1_97(858),
CLLC_C1_98(859),
CLLC_C1_99(860),
CLLC_C1_100(861),
CLLC_C1_101(862),
CLLC_C1_102(863),
CLLC_C1_103(864),
CLLC_C1_104(865),
CLLC_C1_105(866),
CLLC_C1_106(867),
CLLC_C1_107(868),
CLLC_C1_108(869),
CLLC_C1_109(870),
CLLC_C1_110(871),
CLLC_C1_111(872),
CLLC_C1_112(873),
CLLC_C1_113(874),
CLLC_C1_114(875),
CLLC_C1_115(876),
CLLC_C1_116(877),
CLLC_C1_117(878),
CLLC_C1_118(879),
CLLC_C1_119(880),
CLLC_C1_120(881),
CLLC_C1_121(882),
CLLC_C1_122(883),
CLLC_C1_123(884),
CLLC_C1_124(885),
CLLC_C1_125(886),
CLLC_C1_126(887),
CLLC_C1_127(888),
CLLC_C1_128(889),
CLLC_C1_129(890),
CLLC_C1_130(891),
CLLC_C1_131(892),
CLLC_C1_132(893),
CLLC_C1_133(894),
CLLC_C1_134(895),
CLLC_C1_135(896),
CLLC_C1_136(897),
CLLC_C1_137(898),
CLLC_C1_138(899),
CLLC_C1_139(900),
CLLC_C1_140(901),
CLLC_C1_141(902),
CLLC_C1_142(903),
CLLC_C1_143(904),
CLLC_C1_144(905),
CLLC_C1_145(906),
CLLC_C1_146(907),
CLLC_C1_147(908),
CLLC_C1_148(909),
CLLC_C1_149(910),
CLLC_C1_150(911),
CLD_C1_151(912),
CLD_C1_152(913),
CLD_C1_153(914),
CLD_C1_154(915),
CLD_C1_155(916),
CLD_C1_156(917),
CLD_C1_157(918),
CLD_C1_158(919),
CLD_C1_159(920),
CLD_C1_160(921),
CLD_C1_161(922),
CLD_C1_162(923),
CLD_C1_163(924),
CLD_C1_164(925),
CLD_C1_165(926),
CLD_C1_166(927),
CLD_C1_167(928),
CLD_C1_168(929),
CLD_C1_169(930),
CLD_C1_170(931),
CLD_C1_171(932),
CLD_C1_172(933),
CLD_C1_173(934),
CLD_C1_174(935),
CLD_C1_175(936),
CLD_C1_176(937),
CLD_C1_177(938),
CLD_C1_178(939),
CLD_C1_179(940),
CLD_C1_180(941),
CLD_C1_181(942),
CLD_C1_182(943),
CLD_C1_183(944),
CLD_C1_184(945),
CLD_C1_185(946),
CLD_C1_186(947),
CLD_C1_187(948),
CLD_C1_188(949),
CLD_C1_189(950),
CLD_C1_190(951),
CLD_C1_191(952),
CLD_C1_192(953),
CLD_C1_193(954),
CLD_C1_194(955),
CLD_C1_195(956),
CLD_C1_196(957),
CLD_C1_197(958),
CLD_C1_198(959),
CLD_C1_199(960),
CLD_C1_200(961),
CLD_C1_201(962),
CLD_C1_202(963),
CLD_C1_203(964),
CLD_C1_204(965),
CLD_C1_205(966),
CLD_C1_206(967),
CLD_C1_207(968),
CLD_C1_208(969),
CLD_C1_209(970),
CLD_C1_210(971),
CLD_C1_211(972),
CLD_C1_212(973),
CLD_C1_213(974),
CLD_C1_214(975),
CLD_C1_215(976),
CLD_C1_216(977),
CLD_C1_217(978),
CLD_C1_218(979),
CLD_C1_219(980),
CLD_C1_220(981),
CLD_C1_221(982),
CLD_C1_222(983),
CLD_C1_223(984),
CLD_C1_224(985),
CLD_C1_225(986),
CLD_C1_226(987),
CLD_C1_227(988),
CLD_C1_228(989),
CLD_C1_229(990),
CLD_C1_230(991),
CLD_C1_231(992),
CLD_C1_232(993),
CLD_C1_233(994),
CLD_C1_234(995),
CLD_C1_235(996),
CLD_C1_236(997),
CLD_C1_237(998),
CLD_C1_238(999),
CLD_C1_239(1000),
CLD_C1_240(1001),
CLD_C1_241(1002),
CLD_C1_242(1003),
CLD_C1_243(1004),
CLD_C1_244(1005),
CLD_C1_245(1006),
CLD_C1_246(1007),
CLD_C1_247(1008),
CLD_C1_248(1009),
CLD_C1_249(1010),
CLD_C1_250(1011),
CLD_C1_251(1012),
CLD_C1_252(1013),
CLD_C1_253(1014),
CLD_C1_254(1015),
CLD_C1_255(1016),
CLD_C1_256(1017),
CLD_C1_257(1018),
CLD_C1_258(1019),
CLD_C1_259(1020),
CLD_C1_260(1021),
CLD_C1_261(1022),
CLD_C1_262(1023),
CLD_C1_263(1024),
CLD_C1_264(1025),
CLD_C1_265(1026),
CLD_C1_266(1027),
CLD_C1_267(1028),
CLD_C1_268(1029),
CLD_C1_269(1030),
CLD_C1_270(1031),
CLD_C1_271(1032),
CLD_C1_272(1033),
CLD_C1_273(1034),
CLD_C1_274(1035),
CLD_C1_275(1036),
CLD_C1_276(1037),
CLD_C1_277(1038),
CLD_C1_278(1039),
CLD_C1_279(1040),
CLD_C1_280(1041),
CLD_C1_281(1042),
CLD_C1_282(1043),
CLD_C1_283(1044),
CLD_C1_284(1045),
CLD_C1_285(1046),
CLD_C1_286(1047),
CLD_C1_287(1048),
CLD_C1_288(1049),
CLD_C1_289(1050),
CLD_C1_290(1051),
CLD_C1_291(1052),
CLD_C1_292(1053),
CLD_C1_293(1054),
CLD_C1_294(1055),
CLD_C1_295(1056),
CLD_C1_296(1057),
CLD_C1_297(1058),
CLD_C1_298(1059),
CLD_C1_299(1060),
CLD_C1_300(1061),
CLD_C2_151(1062),
CLD_C2_152(1063),
CLD_C2_153(1064),
CLD_C2_154(1065),
CLD_C2_155(1066),
CLD_C2_156(1067),
CLD_C2_157(1068),
CLD_C2_158(1069),
CLD_C2_159(1070),
CLD_C2_160(1071),
CLD_C2_161(1072),
CLD_C2_162(1073),
CLD_C2_163(1074),
CLD_C2_164(1075),
CLD_C2_165(1076),
CLD_C2_166(1077),
CLD_C2_167(1078),
CLD_C2_168(1079),
CLD_C2_169(1080),
CLD_C2_170(1081),
CLD_C2_171(1082),
CLD_C2_172(1083),
CLD_C2_173(1084),
CLD_C2_174(1085),
CLD_C2_175(1086),
CLD_C2_176(1087),
CLD_C2_177(1088),
CLD_C2_178(1089),
CLD_C2_179(1090),
CLD_C2_180(1091),
CLD_C2_181(1092),
CLD_C2_182(1093),
CLD_C2_183(1094),
CLD_C2_184(1095),
CLD_C2_185(1096),
CLD_C2_186(1097),
CLD_C2_187(1098),
CLD_C2_188(1099),
CLD_C2_189(1100),
CLD_C2_190(1101),
CLD_C2_191(1102),
CLD_C2_192(1103),
CLD_C2_193(1104),
CLD_C2_194(1105),
CLD_C2_195(1106),
CLD_C2_196(1107),
CLD_C2_197(1108),
CLD_C2_198(1109),
CLD_C2_199(1110),
CLD_C2_200(1111),
CLD_C2_201(1112),
CLD_C2_202(1113),
CLD_C2_203(1114),
CLD_C2_204(1115),
CLD_C2_205(1116),
CLD_C2_206(1117),
CLD_C2_207(1118),
CLD_C2_208(1119),
CLD_C2_209(1120),
CLD_C2_210(1121),
CLD_C2_211(1122),
CLD_C2_212(1123),
CLD_C2_213(1124),
CLD_C2_214(1125),
CLD_C2_215(1126),
CLD_C2_216(1127),
CLD_C2_217(1128),
CLD_C2_218(1129),
CLD_C2_219(1130),
CLD_C2_220(1131),
CLD_C2_221(1132),
CLD_C2_222(1133),
CLD_C2_223(1134),
CLD_C2_224(1135),
CLD_C2_225(1136),
CLD_C2_226(1137),
CLD_C2_227(1138),
CLD_C2_228(1139),
CLD_C2_229(1140),
CLD_C2_230(1141),
CLD_C2_231(1142),
CLD_C2_232(1143),
CLD_C2_233(1144),
CLD_C2_234(1145),
CLD_C2_235(1146),
CLD_C2_236(1147),
CLD_C2_237(1148),
CLD_C2_238(1149),
CLD_C2_239(1150),
CLD_C2_240(1151),
CLD_C2_241(1152),
CLD_C2_242(1153),
CLD_C2_243(1154),
CLD_C2_244(1155),
CLD_C2_245(1156),
CLD_C2_246(1157),
CLD_C2_247(1158),
CLD_C2_248(1159),
CLD_C2_249(1160),
CLD_C2_250(1161),
CLD_C2_251(1162),
CLD_C2_252(1163),
CLD_C2_253(1164),
CLD_C2_254(1165),
CLD_C2_255(1166),
CLD_C2_256(1167),
CLD_C2_257(1168),
CLD_C2_258(1169),
CLD_C2_259(1170),
CLD_C2_260(1171),
CLD_C2_261(1172),
CLD_C2_262(1173),
CLD_C2_263(1174),
CLD_C2_264(1175),
CLD_C2_265(1176),
CLD_C2_266(1177),
CLD_C2_267(1178),
CLD_C2_268(1179),
CLD_C2_269(1180),
CLD_C2_270(1181),
CLD_C2_271(1182),
CLD_C2_272(1183),
CLD_C2_273(1184),
CLD_C2_274(1185),
CLD_C2_275(1186),
CLD_C2_276(1187),
CLD_C2_277(1188),
CLD_C2_278(1189),
CLD_C2_279(1190),
CLD_C2_280(1191),
CLD_C2_281(1192),
CLD_C2_282(1193),
CLD_C2_283(1194),
CLD_C2_284(1195),
CLD_C2_285(1196),
CLD_C2_286(1197),
CLD_C2_287(1198),
CLD_C2_288(1199),
CLD_C2_289(1200),
CLD_C2_290(1201),
CLD_C2_291(1202),
CLD_C2_292(1203),
CLD_C2_293(1204),
CLD_C2_294(1205),
CLD_C2_295(1206),
CLD_C2_296(1207),
CLD_C2_297(1208),
CLD_C2_298(1209),
CLD_C2_299(1210),
CLD_C2_300(1211),
CLD_C3_151(1212),
CLD_C3_152(1213),
CLD_C3_153(1214),
CLD_C3_154(1215),
CLD_C3_155(1216),
CLD_C3_156(1217),
CLD_C3_157(1218),
CLD_C3_158(1219),
CLD_C3_159(1220),
CLD_C3_160(1221),
CLD_C3_161(1222),
CLD_C3_162(1223),
CLD_C3_163(1224),
CLD_C3_164(1225),
CLD_C3_165(1226),
CLD_C3_166(1227),
CLD_C3_167(1228),
CLD_C3_168(1229),
CLD_C3_169(1230),
CLD_C3_170(1231),
CLD_C3_171(1232),
CLD_C3_172(1233),
CLD_C3_173(1234),
CLD_C3_174(1235),
CLD_C3_175(1236),
CLD_C3_176(1237),
CLD_C3_177(1238),
CLD_C3_178(1239),
CLD_C3_179(1240),
CLD_C3_180(1241),
CLD_C3_181(1242),
CLD_C3_182(1243),
CLD_C3_183(1244),
CLD_C3_184(1245),
CLD_C3_185(1246),
CLD_C3_186(1247),
CLD_C3_187(1248),
CLD_C3_188(1249),
CLD_C3_189(1250),
CLD_C3_190(1251),
CLD_C3_191(1252),
CLD_C3_192(1253),
CLD_C3_193(1254),
CLD_C3_194(1255),
CLD_C3_195(1256),
CLD_C3_196(1257),
CLD_C3_197(1258),
CLD_C3_198(1259),
CLD_C3_199(1260),
CLD_C3_200(1261),
CLD_C3_201(1262),
CLD_C3_202(1263),
CLD_C3_203(1264),
CLD_C3_204(1265),
CLD_C3_205(1266),
CLD_C3_206(1267),
CLD_C3_207(1268),
CLD_C3_208(1269),
CLD_C3_209(1270),
CLD_C3_210(1271),
CLD_C3_211(1272),
CLD_C3_212(1273),
CLD_C3_213(1274),
CLD_C3_214(1275),
CLD_C3_215(1276),
CLD_C3_216(1277),
CLD_C3_217(1278),
CLD_C3_218(1279),
CLD_C3_219(1280),
CLD_C3_220(1281),
CLD_C3_221(1282),
CLD_C3_222(1283),
CLD_C3_223(1284),
CLD_C3_224(1285),
CLD_C3_225(1286),
CLD_C3_226(1287),
CLD_C3_227(1288),
CLD_C3_228(1289),
CLD_C3_229(1290),
CLD_C3_230(1291),
CLD_C3_231(1292),
CLD_C3_232(1293),
CLD_C3_233(1294),
CLD_C3_234(1295),
CLD_C3_235(1296),
CLD_C3_236(1297),
CLD_C3_237(1298),
CLD_C3_238(1299),
CLD_C3_239(1300),
CLD_C3_240(1301),
CLD_C3_241(1302),
CLD_C3_242(1303),
CLD_C3_243(1304),
CLD_C3_244(1305),
CLD_C3_245(1306),
CLD_C3_246(1307),
CLD_C3_247(1308),
CLD_C3_248(1309),
CLD_C3_249(1310),
CLD_C3_250(1311),
CLD_C3_251(1312),
CLD_C3_252(1313),
CLD_C3_253(1314),
CLD_C3_254(1315),
CLD_C3_255(1316),
CLD_C3_256(1317),
CLD_C3_257(1318),
CLD_C3_258(1319),
CLD_C3_259(1320),
CLD_C3_260(1321),
CLD_C3_261(1322),
CLD_C3_262(1323),
CLD_C3_263(1324),
CLD_C3_264(1325),
CLD_C3_265(1326),
CLD_C3_266(1327),
CLD_C3_267(1328),
CLD_C3_268(1329),
CLD_C3_269(1330),
CLD_C3_270(1331),
CLD_C3_271(1332),
CLD_C3_272(1333),
CLD_C3_273(1334),
CLD_C3_274(1335),
CLD_C3_275(1336),
CLD_C3_276(1337),
CLD_C3_277(1338),
CLD_C3_278(1339),
CLD_C3_279(1340),
CLD_C3_280(1341),
CLD_C3_281(1342),
CLD_C3_282(1343),
CLD_C3_283(1344),
CLD_C3_284(1345),
CLD_C3_285(1346),
CLD_C3_286(1347),
CLD_C3_287(1348),
CLD_C3_288(1349),
CLD_C3_289(1350),
CLD_C3_290(1351),
CLD_C3_291(1352),
CLD_C3_292(1353),
CLD_C3_293(1354),
CLD_C3_294(1355),
CLD_C3_295(1356),
CLD_C3_296(1357),
CLD_C3_297(1358),
CLD_C3_298(1359),
CLD_C3_299(1360),
CLD_C3_300(1361),
CLMB_Zone1(1362),
CLMB_Zone2(1363),
CLMB_Zone3(1364),
CLMB_Zone4(1365),
CLMB_Zone5(1366),
CLMB_Zone6(1367),
CLMB_Zone7(1368),
CLMB_Zone8(1369),
CLMB_Zone9(1370),
CLMB_Zone10(1371),
CLMB_Zone11(1372),
CLMB_Zone12(1373),
CLMB_Zone13(1374),
CLMB_Zone14(1375),
CLMB_Zone15(1376),
CLMB_Zone16(1377),
CLMB_Zone17(1378),
CLMB_Zone18(1379),
CLMB_Zone19(1380),
CLMB_Zone20(1381),
CLMB_Zone21(1382),
CLMB_Zone22(1383),
CLMB_Zone23(1384),
CLMB_Zone24(1385),
CLMB_Zone25(1386),
CLMB_Zone26(1387),
CLMB_Zone27(1388),
CLMB_Zone28(1389),
CLMB_Zone29(1390),
CLMB_Zone30(1391),
CLMB_Zone31(1392),
CLMB_Zone32(1393),
CLMB_Zone33(1394),
CLMB_Zone34(1395),
CLMB_Zone35(1396),
CLMB_Zone36(1397),
CLMB_Zone37(1398),
CLMB_Zone38(1399),
CLMB_Zone39(1400),
CLMB_Zone40(1401),
CLMB_Zone41(1402),
CLMB_Zone42(1403),
CLMB_Zone43(1404),
CLMB_Zone44(1405),
CLMB_Zone45(1406),
CLMB_Zone46(1407),
CLMB_Zone47(1408),
CLMB_Zone48(1409),
CLMB_Zone49(1410),
CLMB_Zone50(1411),
CLMB_Zone51(1412),
CLMB_Zone52(1413),
CLMB_Zone53(1414),
CLMB_Zone54(1415),
CLMB_Zone55(1416),
CLMB_Zone56(1417),
CLMB_Zone57(1418),
CLMB_Zone58(1419),
CLMB_Zone59(1420),
CLMB_Zone60(1421),
CLMB_Zone61(1422),
CLMB_Zone62(1423),
CLMB_Zone63(1424),
CLMB_Zone64(1425),
CLMB_Zone65(1426),
CLMB_Zone66(1427),
CLMB_Zone67(1428),
CLMB_Zone68(1429),
CLMB_Zone69(1430),
CLMB_Zone70(1431),
CLMB_Zone71(1432),
CLMB_Zone72(1433),
CLMB_Zone73(1434),
CLMB_Zone74(1435),
CLMB_Zone75(1436),
CLMB_Zone76(1437),
CLMB_Zone77(1438),
CLMB_Zone78(1439),
CLMB_Zone79(1440),
CLMB_Zone80(1441),
CLMB_Zone81(1442),
CLMB_Zone82(1443),
CLMB_Zone83(1444),
CLMB_Zone84(1445),
CLMB_Zone85(1446),
CLMB_Zone86(1447),
CLMB_Zone87(1448),
CLMB_Zone88(1449),
CLMB_Zone89(1450),
CLMB_Zone90(1451),
CLMB_Zone91(1452),
CLMB_Zone92(1453),
CLMB_Zone93(1454),
CLMB_Zone94(1455),
CLMB_Zone95(1456),
CLMB_Zone96(1457),
CLMB_Zone97(1458),
CLMB_Zone98(1459),
CLMB_Zone99(1460),
CLMB_Zone100(1461),
CLGPU_Zone1(1462),
CLGPU_Zone2(1463),
CLGPU_Zone3(1464),
CLGPU_Zone4(1465),
CLGPU_Zone5(1466),
CLGPU_Zone6(1467),
CLGPU_Zone7(1468),
CLGPU_Zone8(1469),
CLGPU_Zone9(1470),
CLGPU_Zone10(1471),
CLGPU_Zone11(1472),
CLGPU_Zone12(1473),
CLGPU_Zone13(1474),
CLGPU_Zone14(1475),
CLGPU_Zone15(1476),
CLGPU_Zone16(1477),
CLGPU_Zone17(1478),
CLGPU_Zone18(1479),
CLGPU_Zone19(1480),
CLGPU_Zone20(1481),
CLGPU_Zone21(1482),
CLGPU_Zone22(1483),
CLGPU_Zone23(1484),
CLGPU_Zone24(1485),
CLGPU_Zone25(1486),
CLGPU_Zone26(1487),
CLGPU_Zone27(1488),
CLGPU_Zone28(1489),
CLGPU_Zone29(1490),
CLGPU_Zone30(1491),
CLGPU_Zone31(1492),
CLGPU_Zone32(1493),
CLGPU_Zone33(1494),
CLGPU_Zone34(1495),
CLGPU_Zone35(1496),
CLGPU_Zone36(1497),
CLGPU_Zone37(1498),
CLGPU_Zone38(1499),
CLGPU_Zone39(1500),
CLGPU_Zone40(1501),
CLGPU_Zone41(1502),
CLGPU_Zone42(1503),
CLGPU_Zone43(1504),
CLGPU_Zone44(1505),
CLGPU_Zone45(1506),
CLGPU_Zone46(1507),
CLGPU_Zone47(1508),
CLGPU_Zone48(1509),
CLGPU_Zone49(1510),
CLGPU_Zone50(1511),
CLKLP_Zone20(1512),
CLKLP_Zone21(1513),
CLKLP_Zone22(1514),
CLKLP_Zone23(1515),
CLKLP_Zone24(1516),
CLKLP_Zone25(1517),
CLKLP_Zone26(1518),
CLKLP_Zone27(1519),
CLKLP_Zone28(1520),
CLKLP_Zone29(1521),
CLKLP_Zone30(1522),
CLKLP_Zone31(1523),
CLKLP_Zone32(1524),
CLKLP_Zone33(1525),
CLKLP_Zone34(1526),
CLKLP_Zone35(1527),
CLKLP_Zone36(1528),
CLKLP_Zone37(1529),
CLKLP_Zone38(1530),
CLKLP_Zone39(1531),
CLKLP_Zone40(1532),
CLKLP_Zone41(1533),
CLKLP_Zone42(1534),
CLKLP_Zone43(1535),
CLKLP_Zone44(1536),
CLKLP_Zone45(1537),
CLKLP_Zone46(1538),
CLKLP_Zone47(1539),
CLKLP_Zone48(1540),
CLKLP_Zone49(1541),
CLKLP_Zone50(1542),
CLK_Profile(1543),
CLI_Last(1543);
private final int id;
public static LedId byOrdinal(int ordinal)
{
return (ordinal >= 0 && values().length > ordinal) ? values()[ordinal] : null;
}
}
| [
"[email protected]"
] | |
a2d67a140df37204a5db6915c24f9e6d1deb6583 | f08e9024b9139a1b5b90e26411ca2ac926d57123 | /src/main/java/codingtest/main/TestApplication.java | 692c5c07b6d0c1612da3de312044e06e91ac7bb2 | [] | no_license | NblYb/CodeTest | c5bc4a6704787abbcf1782193ec5a66374b43ca3 | 68ca85d6be9b54cfe13e2d7bbc3feb0b5e47bccc | refs/heads/main | 2023-07-18T19:51:47.266586 | 2021-09-27T02:27:36 | 2021-09-27T02:27:36 | 409,911,814 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 764 | java | package codingtest.main;
import codingtest.main.methods.IOMethods;
import codingtest.main.methods.MatchingMethod;
import codingtest.main.pojo.Record;
import codingtest.main.pojo.Result;
import java.io.*;
import java.text.ParseException;
import java.util.*;
public class TestApplication {
public static void main(String[] args) throws IOException, ParseException {
IOMethods ioMethods = new IOMethods();
MatchingMethod matchingMethod = new MatchingMethod();
List<Record> records = ioMethods.readFile();
HashMap<String, List<Record>> recordGroup = matchingMethod.divideRecordsIntoHashedGroups(records);
List<Result> results = matchingMethod.calculateResults(recordGroup);
ioMethods.writeFile(results);
}
}
| [
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.