method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
f9da89a3-c0b7-4c92-a40f-0b8f42371729 | 2 | @SuppressWarnings({ "rawtypes", "unchecked" })
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException{
resp.setContentType("text/html");
resp.setCharacterEncoding("utf-8");
Cache cache = null;
try {
CacheFactory cacheFactory = CacheManager.getInstance()
.getCacheFactory(... |
a58b1e1a-aafe-41c2-ac60-5f6af9ee4952 | 9 | public void countDiffPixels() {
if (image1 == null || image2 == null) {
return;
}
int w1 = image1.getWidth();
int h1 = image1.getHeight();
int w2 = image2.getWidth();
int h2 = image2.getHeight();
int wmax = ... |
bb805836-2e7f-4ad8-ab02-a430b36782c4 | 8 | public static void jams_wrap(List<String> jars, String srcPath, List<String> className) throws Exception {
if (jars == null || jars.size() == 0) {
throw new RuntimeException("No jar files!");
}
if (srcPath == null) {
throw new RuntimeException("No src path!");
}
... |
726e94ef-d110-41fc-bc83-4149a469ffc5 | 8 | final void method3874(Class229 class229, int i, Class229 class229_129_) {
do {
try {
anInt7959++;
boolean bool = false;
if (class229_129_ != (((NativeToolkit) this).aClass229Array8086
[((NativeToolkit) this).anInt8175])) {
((NativeToolkit) this).aClass229Array8086[(((NativeToolkit) this)
... |
9ae01d30-216a-4c41-9b90-18ac483821d7 | 4 | public PathQuad findContainer(float targetX, float targetY) {
PathQuad temp = this;
// Avoid infinite looping of uncontained coordinates
if(!temp.box.contains(targetX, targetY))
return null;
while(!temp.noChildren()) {
for(int a = 0; a<temp.children.length; a++) {
if(temp.children[a].box.contains(t... |
3113da98-c8b4-46a3-a249-44f10641c927 | 0 | @Override
public void setCity(String city) {
super.setCity(city);
} |
6c06c306-7478-41a3-a767-cfbb46691801 | 2 | public String getParameters() {
return middle +
((middle.length() != 0 && trailing.length() != 0) ? " " : "") +
trailing;
} |
d00e406d-09ab-4b24-9354-27030378a6bb | 3 | public void close() {
EIError.debugMsg("Closing");
if (clientReceiveThread != null) {
clientReceiveThread.setRunning(false);
}
if (socket != null) {
try {
sendData("goodbye");
socket.close();
} catch (IOException e) {
... |
f9174c84-36fe-454d-83e5-0b454a506598 | 3 | public void close() {
logger.debug("DBDao:: close -----------begin ");
try {
if (conn != null && !conn.isClosed()) {
conn.close();
}
} catch (Exception e) {
logger.error(e, e);
}
logger.debug("DBDao:: close -----------end ");
} |
78839700-76be-49db-a4c1-939e8c3283ff | 5 | public CheckResultMessage checkG09(int day) {
int r1 = get(23, 5);
int c1 = get(24, 5);
int r2 = get(30, 5);
int c2 = get(31, 5);
if (checkVersion(file).equals("2003")) {
try {
in = new FileInputStream(file);
hWorkbook = new HSSFWorkbook(in);
if (0 != (getValue(r1 + 7, c1 + day, 5).add(
g... |
35f2af5a-177e-4752-b769-c5395abdbdb0 | 5 | public void transferToOtherCustomerAccount(double amount, BasicAccount source, BasicAccount destination){
if(amount > 0){
if(source.getAccountOwner() == this){
if(source instanceof CustomerTransferSource){
if(source.getCurrentAccountBalance() - amount > 0){
if(destination.getAccountOwner() != this){... |
b4773bca-f67f-471f-af46-49ace8a7af36 | 0 | public String toString(){
return "devide by ";
} |
2901cb65-9673-47ec-b62a-314a80c9580d | 9 | private void visitStandardCall(Node node, Node child)
{
if (node.getType() != Token.CALL) throw Codegen.badTree();
Node firstArgChild = child.getNext();
int childType = child.getType();
String methodName;
String signature;
if (firstArgChild == null) {
i... |
9a98e892-e005-4f7c-9bf6-35c022c6402c | 2 | @RequestMapping(value = {"/SucursalBancaria/id/{idSucursalBancaria}"}, method = RequestMethod.GET)
public void read(HttpServletRequest httpRequest, HttpServletResponse httpServletResponse, @PathVariable("idSucursalBancaria") int idSucursalBancaria) {
ObjectMapper jackson = new ObjectMapper();
String... |
e0b2c49f-b362-469e-9c99-223a26570ac1 | 6 | public void update(GameContainer container, StateBasedGame game, int delta)
throws SlickException {
Input input = container.getInput();
// redemarrer le jeu
if (input.isKeyPressed(Input.KEY_R)) {
init(container, game);
return;
}
//mettre le jeu en pause
if (input.isKeyPressed(Input.KEY_P))
... |
1f151efa-6e87-4c49-8fd7-a95387ca7aa4 | 5 | void readFromCpp() throws FileNotFoundException {
Scanner in = new Scanner(file);
String line, section = "";
while (in.hasNext()) {
line = in.nextLine();
if (line.trim().contains("/*")) {
section = "Settings";
}
if (line.trim().cont... |
6f869196-8e4b-4735-876a-82bae10f132a | 7 | public ProfilePanel(final String emailName, final String emailUser, final FacelookAppGUI a) {
super();
container = a;
this.setBackground(Color.decode("#3b5998"));
this.setPreferredSize(new Dimension(770,539));
setLayout(null);
JLabel lblFacelook = new JLabel("Facelook");
lblFacelook.setFont(new Font("L... |
7c244d47-daff-40af-a8d7-0484c4d67156 | 6 | public void update(InputHandler inHandler){
setX_Point(getX_Point()+(getxVel()*getDir()));
if(getDamage()>0){
setDamage(getDamage()-getDamageLoss());
}else if(getDamage()<0){
setDamage(0);
}
if(timer==null){
timer= new Timer(200);
}
if(timer.isReady()){
if(timeVar==0){
timeV... |
384d7acf-d069-4146-9c34-81b03add7b58 | 4 | public boolean isInBox(int clickX, int clickY, int boxLeftTopX, int boxLeftTopY, int boxRightBottomX, int boxRightBottomY){
if(clickX >= boxLeftTopX + cornerX && clickX <= boxRightBottomX + cornerX
&& clickY >= boxLeftTopY + cornerY && clickY <= boxRightBottomY + cornerY){
return t... |
93ce4632-7f00-47d3-b876-9f5394d80bb3 | 7 | @EventHandler
public void WitherFastDigging(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getZombieConfig().getDouble("Wither.Fas... |
478c621d-013a-451a-81e4-344c4c1fa1db | 7 | static public RealLabelledData dataFromTextFile(String filename, int forcelabel, String split)
{
String line = "";
RealLabelledData ret = new RealLabelledData();
BufferedReader reader = null;
if (split == null)
split = " +"; // if we don't get split information, we assu... |
d224825f-dd2b-4d4d-8ee3-a3ae455527da | 5 | public void createPanel() {
setTitle("Global Preferences");
setSize(500, 600);
setLocationRelativeTo(getParent());
setIconImage(Images.G_PREFS_ICON);
contentPanel.setLayout(null);
FileNameExtensionFilter ff = new FileNameExtensionFilter("Image files *(.jpg, .jpeg, .gif, .png)", "jpg", "jpeg", "gif", "png... |
65603ffe-b8cc-41ab-adf3-b270485ec8fc | 3 | public GameConfiguration load() {
try {
if (istream == null) {
istream = new FileInputStream(f);
}
JAXBContext context = JAXBContext
.newInstance(GameConfiguration.class);
Unmarshaller umarsh = context.createUnmarshaller();
GameConfiguration ret = (GameConfiguration) umarsh
.unmarshal(ist... |
befe7e53-0f78-45f4-bc2c-2610d658ac55 | 7 | BenevolentRobot() {
// On construction, load an english dictionary and word frequency list.
// Dictionary source: SCOWL (wordlist.sourceforge.net)
// Frequency count: BNC Frequency list (http://www.kilgarriff.co.uk/bnc-readme.html)
// Read in (frequency, word) pairs, hash them by word.
freqMap = new HashMap<... |
a57cd499-535a-42d5-9219-11e1d15eefaf | 1 | public ClassInfo getSuperclass() {
if ((status & HIERARCHY) == 0)
loadInfo(HIERARCHY);
return superclass;
} |
1fbe7eaa-8177-46e1-a62c-07e23a07f7b3 | 3 | public static boolean Validate(String xmlFile, String xsdFile, StringBuilder message){
Source schemaFile = new StreamSource(new File(xsdFile));
Source xmlSrc = new StreamSource(new File(xmlFile));
SchemaFactory schemaFactory = SchemaFactory
.newInstance(XMLConstants.W3C_XML_SCHEM... |
7f521a10-a8c6-4cad-a7c8-dade1a64452a | 9 | public static int[] FH(String[] h) {
int[] r = new int[2];
r[0] = -1;
Map<Character, Integer> m = new HashMap<Character, Integer>();
Integer i;
for (String s : h) {
i = m.get(s.charAt(0));
if (i == null) {
i = 0;
}
i++;
m.put(s.charAt(0), i);
}
if (m.keySet().size() == 2) {
List<I... |
f7a31a92-5496-414f-863b-c08c02c9c909 | 9 | private void init(Properties config) {
// keepAliveInterval
String interval = config.getProperty("keepAliveInterval");
try {
keeper = new AliveKeeper(Integer.parseInt(interval));
} catch (Exception e) {
keeper = new AliveKeeper();
}
keeper.start();... |
4aa14e34-cade-4633-ae0f-c85e66bf5a10 | 5 | HashSet<String> findWord(char[][] matrix, HashSet<String> dict) {
TreeNode root = new TreeNode((char) 0);
for (String s : dict)
root.addWord(s.trim());
HashSet<String> res = new HashSet<String>();
boolean[][] flag = new boolean[matrix.length][matrix[0].length];
for (int i = 0; i < matrix.length; i++) {
... |
b0361b5a-a171-4ba0-a33d-1ecf13d4e897 | 4 | public String getTIN(){
String s = (String)personnelCBox.getSelectedItem();
int i;
if(s == null || s.length() == 0){
return null;
}
for(i = 0;i < s.length(); i++){
if(s.charAt(i) == '~'){
break;
}
}
return s.substring(i + 2, s.length());
} |
0e1c6e17-f88a-461b-8b63-83e8383d3798 | 4 | public static void UpperTitle(){
try {
if(conn == null || conn.isClosed()){
conn = DatabaseConnection.getConnection();
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try{
conn.setAutoCommit(false);
PreparedStatement stmnt... |
b87c3784-3302-40a2-96a6-0ed9f56e9719 | 9 | public void setQueue3(FloatQueue t) throws MismatchException {
if (t == null)
throw new NullPointerException("the arg cannot be null");
if (q1 != null) {
if (t.getLength() != q1.getLength())
throw new MismatchException("queue 1 and 3 have different lengths!");
if (t.getPointer() != q1.getPointer())
... |
858bc64f-b73a-4365-8940-ce5ee6455123 | 1 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result
+ ((banckAccount == null) ? 0 : banckAccount.hashCode());
return result;
} |
61be6013-ae8e-42f2-b113-cc5dc6a5ac72 | 4 | @Override
public boolean isAchieved()
{
Belief clientStateGoal = new Belief("Drinking");
for(Table table : tables)
{
if( !table.isFree() )
{
for( Client client : table.getClients() )
{
if( !table.getClientState(client).getName().equalsIgnoreCase( clientStateGoal.getName() ))
return ... |
dd848542-bd6e-4b44-b67f-80f8c094193d | 6 | public int checkSidwaysDown(int originLetter, int originNum, int newLetter, int newNum, Board b)
{
valid = 0;
int diagnalDownLetter = originLetter;
int diagnalDownNumber = originNum;
if(newLetter > originLetter)
{
int downRightValid = 0;
for(int counter = 0; counter < ((newNum-originNum)-1); counter++)... |
9f155437-9b91-44b1-8b49-04726c5de046 | 6 | public void run() {
try {
BufferedReader in = new BufferedReader(new InputStreamReader(client.getInputStream()));
PrintWriter out = new PrintWriter(client.getOutputStream(), true);
out.write(">ACCEPTED");
out.flush();
//DataInputStream is = new DataIn... |
7f5a32da-92d8-49ae-afa0-9f7154027b89 | 1 | public void draw(Graphics g,Location origin, double scale, Color color, int xdiff, int ydiff){
g.setColor(this.color);
for(int i = 0; i < locationPoints.size()-1; i++){
Location loc1 = locationPoints.get(i);
Location loc2 = locationPoints.get(i+1);
Point p1 = loc1.getPoint(origin, scale);
Point p2 = ... |
048301d4-b329-48cc-ab62-e2499aaa14af | 0 | public float getB() {
return b;
} |
50b19abf-b27f-4fd1-9b8d-c20d782c20b3 | 7 | private void addExp(ArrayList<String> players, String job, String level, CommandSender sender) {
job = job.toLowerCase();
double experience = 1.0D;
if(StringToNumber.isPositiveNumber(level))
experience = Double.parseDouble(level);
if (PlayerJobs.getJobsList().get(job) == nul... |
e00d7ab3-f54e-44f0-be57-2085c55866ce | 1 | int repeatSub (int num){
while(num>=10){
num=num-10;
}
return num;
} |
71757c56-f9d1-4533-a2f2-5f396671b73f | 2 | public void visitArithExpr(final ArithExpr expr) {
if (isLeaf(expr.left()) && isLeaf(expr.right())) {
firstOrder = true;
}
} |
8b852439-9e43-47d8-b7a2-8a7c11c631c4 | 0 | public String getPassword(){
return password;
} |
a77e33d3-fb1f-444d-b27b-12da26088d89 | 2 | protected List<Author> getAuthors() {
io.println("Give authors(\"Firstname, Lastname\") separated by newline. Empty line stops.");
Author element = io.getAuthor(": ");
List<Author> list = new LinkedList<Author>();
while (element != null) {
list.add(element);
eleme... |
63a154df-6941-452d-90f0-6054894f5f91 | 5 | @Override
public void handle(HttpExchange exchange) throws IOException {
System.out.println("In join game handler");
String responseMessage = "";
if(exchange.getRequestMethod().toLowerCase().equals("post")) {
try { // check user login cookie and if valid get params
exchange.getResponseHeaders().set... |
6a29822b-57a9-4cc2-b70e-533cd295b58d | 9 | public String stateToString()
{
String stateString = "";
boolean ticker = false;
if ((STATE_TRACKING_GAZE & state) != 0)
{
stateString += "STATE_TRACKING_GAZE";
ticker = true;
}
if ((STATE_TRACKING_GAZE & state) != 0)
{
st... |
cae0f0c6-ae86-4c77-b9eb-b7982f32ef97 | 3 | private static void showIndividualSummaries() {
StringBuilder out = new StringBuilder();
out.append("\n===========================================\n");
out.append("===== Total System Time per/thread =====\n");
out.append("===========================================\n");
Object... |
11bfffe9-833c-43d3-9e06-2dd4fdb1fdea | 9 | public void teleportHome(CommandSender cs, Command cmd, String string,
final String[] args) {
if (args.length == 0) {
final Player player = (Player) cs;
if (player.hasPermission("warpsandports.homes.tp.default") || player.isOp()) {
if(MainClass.players
.contains(player.getUniqueId()
+ ... |
3fd4aec9-843f-4af2-a355-77af6ef9acba | 3 | private static VendorInventory getVendorInventory(int invId) {
QueryExecutor qe = new QueryExecutor();
qe.SendQuery("SELECT * FROM RPG372DB_Inventory WHERE invId='" + invId
+ "'");
if (qe.resultSize() == 0)
return null;
VendorInventory venInv = new VendorInventory(null);
int tempId;
for (int i = ... |
16224b8b-aa93-498e-aa6f-5d8b035ba2b6 | 0 | public String editblogDetails() {
String outcome = null;
Blog blog = this.blogDelegate.getBlogDetail(this.blogId);
this.setBlogId(blog.getBlogId());
this.setBlogContent(blog.getBlogContent());
this.setBlogLabel(blog.getBlogContentLable());
this.setBlogCreatedDate(blog.g... |
c71cf4cb-ef62-44d7-b7c2-fcd2d21ca4ca | 2 | public Chessboard()
{
fields = new Field[NUMBER_OF_ROWS][NUMBER_OF_COLUMNS];
char row = 0;
byte column = 0;
for(int r = 0; r < NUMBER_OF_ROWS; r++)
{
row = (char) (FIRST_ROW + r);
column = FIRST_COLUMN;
for(int c = 0; c < NUMBER_OF_COLUMNS; c++)
{
fields[r][c] = new Field(row, column);
}... |
dfa23b94-237d-4ac4-8b06-bc3726e4a192 | 3 | @Override
public void start()
{
worker = new Thread()
{
@Override
public void run()
{
while (!this.isInterrupted() && currentScene != null)
{
renderScene(currentScene);
... |
ddb756ff-d75d-41be-9145-2dd38ff31d1d | 0 | public CheckResultMessage check30(int day) {
return checkReport.check30(day);
} |
898a0b47-d586-44b0-a732-e85b62ed2736 | 6 | protected boolean isFinished() {
final long timeDiff = System.currentTimeMillis() - startTime;
//TODO make sure things get finished (time to be on target)
return (((state != ClawPivotSubsystem.PICKUP && clawPID.onTarget() && timeDiff > 1500) || timeDiff > 4000) && (driveFinishedChecker == null ... |
ce434d9c-0608-48ba-ae8c-d54fc81f916c | 0 | @Override
public Object clone() {
return new Buchi((HashSet<Character>) alphabet.clone(), (HashSet<Integer>) states.clone(), initialState, (HashSet<Integer>) acceptanceCondition.clone(), (HashSet<Transition>) transitionRelation.clone());
} |
eda29b7d-57e0-43f1-8f19-81af2c8f3e8f | 2 | public static String getMessage(String message, Locale locale){
ResourceBundle resourceBundle = null;
if(locale!=null)
resourceBundle = ResourceBundle.getBundle(BUNDLE_NAME, locale);
else
resourceBundle = ResourceBundle.getBundle(BUNDLE_NAME);
if(resourceBundle!=null){
message = resourceBundle.getStr... |
01e5e4cb-4a08-4867-bcc2-ab7e43b136a6 | 4 | @Override
public FileVisitResult visitFile(Path file,
BasicFileAttributes attr) {
if (attr.isRegularFile()) {
String name = "" + file;
if (name.endsWith(".txt")) {
for (JSONArray comments : extractor.extractFromCrawler(file, related)) {
this.d... |
e7424e81-689b-450b-9ba2-7ddce7c7d82c | 9 | public List performSynchronousInference()
throws IOException, TimeOutException, CycApiException {
if (getStatus() == SubLWorkerStatus.NOT_STARTED_STATUS) {
start();
}
if (getStatus() == SubLWorkerStatus.WORKING_STATUS) {
try {
synchronized (lock) {
lock.wait(getTimeoutMsecs()... |
8146936b-b6df-459c-ae26-9f2a351ef009 | 2 | public AjoutMotClefDialog(ArrayList<CategorieMotClef> categories) {
setResizable(false);
setModalityType(ModalityType.APPLICATION_MODAL);
setTitle("Ajout d'un mot clef pour une catégorie");
setBounds(100, 100, 486, 168);
getContentPane().setLayout(new BorderLayout());
contentPanel.setBorder(new EmptyBorder(... |
dff8d58d-e2ba-49dd-a20b-785a6e1ce842 | 8 | public Node FindLoopBeginning(Node head) {
Node fastrunner = head;
Node slowrunner = head;
while (fastrunner != null && slowrunner != null)
{
fastrunner = fastrunner.next.next;
slowrunner = slowrunner.next;
if (slowrunner == fastrunner)
break;
}
if (fastrunner == null)
return null;
f... |
557074de-cdd5-4765-8d43-8b13a831d43e | 3 | @Override
public ExecutionContext run(ExecutionContext context) throws InterpretationException {
int x = DrawingZone.turtle.getPosX();
int y = DrawingZone.turtle.getPosY();
DrawingZone dw = UserInterface.dw;
Value value = ((AbsValueNode) this.getChildAt(0)).evaluate(context);
... |
7491f259-3e7b-47fb-9221-7135c9b96ed1 | 8 | private void updatePlayers(GameContainer c, int delta, Input in){
for(int i = 0; i < players.length; i++){
if(players[i].isAlive()){
Vector2f direction = new Vector2f(0, 0);
if (in.isKeyDown(playerControls.get("P"+(i+1)+"N"))) {
direction.add(new Vector2f(0, -1));
}
else if (in.isKeyDown(playe... |
2c4969f0-7b3e-4ebb-9c83-fd2045554659 | 2 | public void paintComponent(Graphics g)
{
g.setColor(java.awt.Color.WHITE);
g.fillRect(0, 0, getWidth(), getHeight());
g.setColor(java.awt.Color.BLACK);
if (background != null)
{
g.drawImage(background, 0, 0, null);
} ... |
a79f7d26-ff86-4b6b-add9-26fe98db719f | 5 | public String add(Properties serviceProperties)
{String GETCommand="", ret="";
if(serviceProperties!=null && !serviceProperties.equals(""))
{
GETCommand="";
Enumeration e = serviceProperties.propertyNames();
while (e.hasMoreElements())
{
String key = (String) e.nextElement... |
4621f60e-3ad3-40b8-9fd1-9f5bb76524f3 | 4 | public void saveToDB() {
try {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
NewsInfo newsInfo = new NewsInfo();
newsInfo.title = TitleUtils.half2Fullchange(dataInfo.title);
newsInfo.url = dataInfo.source;
newsInfo.newspaper = dataInfo.... |
4b924eb9-ac61-4e4d-9c7f-230366d190a0 | 7 | private void jButton6ChangDispalyMode(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ChangDispalyMode
// TODO add your handling code here:
if (this.testState != this.playback) {
return;
}
if (this.tstErrors) {
System.out.println("================");
System.out.println("E... |
8c1fe416-c8bf-48eb-9157-22d6a40ce5e2 | 9 | private void AppendPolygon(TEdge e1, TEdge e2) {
// get the start and ends of both output polygons ...
OutRec outRec1 = m_PolyOuts.get(e1.outIdx);
OutRec outRec2 = m_PolyOuts.get(e2.outIdx);
OutRec holeStateRec;
if(Param1RightOfParam2(outRec1, outRec2))
holeStateRec = outRec2;
else if(Param1RightOfParam... |
9a2f6cbf-cd1d-4ebb-ba35-bb0796378f8f | 0 | Template(String name, Vector points)
{
this.Name = name;
this.Points = Utils.Resample(points, Recognizer.NumPoints);
this.Points = Utils.RotateToZero(this.Points);
this.Points = Utils.ScaleToSquare(this.Points, Recognizer.SquareSize);
this.Points = Utils.TranslateToOrigin(this.Points);
} |
59eb8f65-5469-45f8-9bca-0dace9b928bd | 4 | public static Collection<String> getLinks(String article) {
Document doc = null;
try {
doc = Jsoup.connect(article).get();
} catch (IOException e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
Element b... |
d13e07f5-870c-425a-b505-67c5f60440b9 | 7 | public Volume(Element ul) {
Element header = ul;
while(!header.tagName().equals("body")) {
Element candidate = findHeader(header);
if(candidate == null) {
header = header.parent();
} else {
header = candidate;
break;
}
}
if(!header.tagName().equals("body")) {
title = header.select(... |
083fe3e4-0107-4b6b-b6e0-b0aca41d2e21 | 5 | public static void main(String[] args) {
int r,proceso;
int valorx = Integer.parseInt(JOptionPane.showInputDialog("Ingrese el valor del entero X"));
int valory=Integer.parseInt(JOptionPane.showInputDialog("Ingrese el valor del entero Y"));
if (valorx<=0 || valorx>255)
{
... |
01d4ff51-b810-4388-819b-13e1780fcfe2 | 2 | public boolean Move(Tile tile)
{
// Concise method of checking if both tile.Enter(this)
// and this.Enter(tile) succeed.
boolean success = (tile.Enter(this) && this.Enter(tile));
// If the movement succeeded, update stuff and notify everyone.
if(success)
{
this.setLoc(tile);
tile.Entered(this);
... |
aecab698-8110-4583-9029-f63dc52a4e5d | 4 | public boolean save(WorldDescriptor descr) {
boolean ostreamCreatedHere = false;
try {
if (ostream == null) {
ostream = new FileOutputStream(f);
ostreamCreatedHere = true;
}
JAXBContext context = JAXBContext
.newInstance(WorldDescriptor.class);
Marshaller marsh = context.createMarshaller();... |
702220d6-08a9-47a9-a5e1-281b01379365 | 2 | @EventHandler
public void onDamage(EntityDamageEvent e) {
if(!RushPlugin.isGameRunning() || RushPlugin.isGameFinished()) {
e.setCancelled(true);
return;
}
} |
59790bf1-e91e-44be-9399-4978f087eff3 | 6 | @Override
public void deserialize(Buffer buf) {
super.deserialize(buf);
honor = buf.readUShort();
if (honor < 0 || honor > 20000)
throw new RuntimeException("Forbidden value on honor = " + honor + ", it doesn't respect the following condition : honor < 0 || honor > 20000");
... |
5e1418dc-4a02-4f11-8a7d-42bd0346e4d1 | 2 | public static void main(String[] args){
int i=0;
int sum = 0;
for (i=1;i<Integer.MAX_VALUE;i++){
sum+=i;
int divs = dividers(sum);
if (divs > 500) break;
}
System.out.println(sum);
} |
6f3f6f93-94a0-4a1d-b8bb-05530006ffe9 | 4 | public static void main(String[] args)
{
int number1;
int number2;
String operator;
Scanner input = new Scanner(System.in);
System.out.print("Enter the first number: ");
number1 = input.nextInt();
System.out.print("Enter the second number: ");
num... |
53437ae7-ee34-4896-958b-c6565bb8ce1a | 3 | public static void toggleCommentForSingleNode(Node node, CompoundUndoable undoable) {
int oldValue = node.getCommentState();
int newValue = Node.COMMENT_INHERITED;
boolean isComment = node.isComment();
if (oldValue == Node.COMMENT_FALSE) {
node.setCommentState(Node.COMMENT_TRUE);
newValue = Node.COMMEN... |
8c35ccc7-ae3c-4cc9-970d-af41c71198b2 | 4 | public double rollOut(StateObservationMulti state)
{
int thisDepth = this.m_depth;
while (!finishRollout(state,thisDepth)) {
//random move for all players
Types.ACTIONS[] acts = new Types.ACTIONS[no_players];
for (int i = 0; i < no_players; i++) {
... |
ae1a4a55-3d06-4951-9592-b5ae87270ef1 | 5 | @Override
public void update(double delta, World w)
{
super.update(delta, w);
if(follow!= null)
{
this.setDx(((follow.getX()+follow.getxLen()/2)-(this.getX()+this.cameraWidth/2))/20);
this.setDy(((follow.getY()+follow.getyLen()/2)-(this.getY()+this.cameraHeight/2))/20);
}else{
this.setDx(this.getDx()... |
f21e2fa3-fd48-4553-bb0e-7e28ad7627c8 | 8 | public boolean compress(int maxX, int maxY)
{
boolean needRepaint = false;
for( ; ; )
{ Rectangle r = cardBounds();
if(r.width > maxWidth() || r.x + r.width >= maxX && dX > 5)
{ --dX;
needRepaint = true;
}
else if(r.height >... |
74738b6e-1806-4493-bbd5-a08a21fffce3 | 6 | @Override
public boolean dispatchKeyEvent(KeyEvent e) {
if (e.getID() == KeyEvent.KEY_RELEASED) {
char key = e.getKeyChar();
if (key >= 'a' && key <= 'z') key=(char) (key-32);
if ((key >= '1' && key <= 'Z')){
KEYBORD.jButtonActionPe... |
02c25a09-c84d-41f3-b570-add143436067 | 6 | public List<Class<?>> getClasses(String packageName) throws ClassValidationException {
try {
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
String path = packageName.replace('.', '/');
Enumeration<URL> resources = classLoader.getResources(path);
... |
dd17c2b5-bbdc-418d-b1ba-0640c81754bc | 4 | private boolean checkValidUser_basicAuthentication( URI requestURI,
HTTPHeaders headers,
HypertextAccessFile htaccess,
String authMethod,
File authUserFile,
Map<String,BasicType> additionalSettings,
Map<String,BasicType> optionalReturnSettings
)
throws IOException,
... |
1b54e1a9-32a1-437b-a6f2-037478466505 | 8 | protected void stepToSquare(){
if (this.nextSquare==this.currentSquare+1){ //if the next square is to the right
this.parent.setX(this.parent.getX()+this.parent.speed);
} else if (this.nextSquare==this.currentSquare-1) { //if the next square is to the left
this.parent.setX(this.pa... |
a685bee5-1774-466a-a380-1464d7511d54 | 2 | *
* @return a list of the backchaining implication rules which might apply to the given predicate
*
* @throws UnknownHostException if cyc server host not found on the network
* @throws IOException if a data communication error occurs
* @throws CycApiException if the api request results in a cyc server er... |
98305bad-f8f1-4708-aa18-4273f2231363 | 8 | public void update(Update query) throws IOException, Error, ClassNotFoundException{
Condition cond = query.getCondition();
ArrayList< ArrayList<Value> > tupleList;
ArrayList<AttrAssign> attrAssignList = query.getAttrAssignList();
Hashtable<String, Table> tables = null;
Table table;
File tableFile = new Fil... |
7e89f36c-05b5-406c-b704-dfd643d444cd | 1 | public Set adjacent(Object vertex) {
if (!verticesToNeighbors.containsKey(vertex))
verticesToNeighbors.put(vertex, new HashSet());
return (Set) verticesToNeighbors.get(vertex);
} |
79fbc40a-1e96-415f-8059-59873f652a79 | 5 | public void move() {
if (userKick) {
userKick = false;
cleverBall = ball.getCopy();
while (cleverBall.getY() >= this.getTop()) {
cleverBall.move();
}
futureOfX = cleverBall.getX();
moveToBall = true;
}
if (m... |
f3f7e642-03a3-4978-8ce0-e8640dfd6185 | 8 | private static void executeFunctionalTestCase(File file) {
ArrayList<Command> commands = new ArrayList<Command>();
System.out.println("Executing test case " + file.getName());
// Start up a server
ServerThread server = new ServerThread();
server.start();
// Hashmap to keep track of the clients that h... |
a7c6dfeb-957c-4c2a-bd96-f7f211c89a37 | 4 | public static LinkedList<String> benchmarkIcebergs(Path path, double frequency){
Hashtable<String, Integer> tab = new Hashtable<String, Integer>();
int comp = 0;
for (String s : new WordReader(path)){
if (!tab.containsKey(s))
tab.put(s, 1);
else{
int d = tab.remove(s);
... |
0ebb549d-6109-49e1-a83a-e7406de8b0e6 | 2 | public ArrayList<UserModelBean> getAllUser() {
// return value
ArrayList<UserModelBean> userList = new ArrayList<UserModelBean>();
try {
// create connection
connection = java.sql.DriverManager.getConnection("jdbc:mysql://"
+ dB_HOST + ":" + dB_PORT + "/" + dB_NAME, dB_USER, dB_PWD);
// Cr�ation d... |
a6f61636-db73-4e74-9ff8-b0d8bb08e91a | 4 | public Grid getGridObj() {
boolean test = false;
if (test || m_test) {
System.out.println("FileManager :: getGridObj() BEGIN");
}
if (test || m_test) {
System.out.println("FileManager :: getGridObj() END");
}
return m_gridObj;
} |
b574e77e-9ce3-4e15-ab55-699e3667b21e | 8 | public int moverDeA(int deFila, int deColumna, int aFila,int aColumna){
if(esObjetoUno(aFila, aColumna)){
int valorACorrer=matriz[deFila][deColumna];
actualizarCasilla(deFila,deColumna, ID_VACIA);
actualizarCasilla(aFila,aColumna, valorACorrer);
robot.setCarga... |
ef37e5e3-e41a-4ba3-9f46-887ff0bb994c | 0 | public String getCountry() {
return country;
} |
01b584f8-b279-4ce5-b64e-8da4e3f490fe | 7 | private BoundType getBoundTypeForTerminalIntegerLiteral(Class<?> type, boolean array)
throws SynException
{
if (int.class.equals(type)) {
return IntBoundType.INSTANCE;
} else if (type.isAssignableFrom(Integer.class)) {
return IntegerBoundType.INSTANCE;
} e... |
660c3ce5-31b0-4b96-8215-d8052c1b0264 | 6 | @SuppressWarnings("static-access")
public boolean approveSelection(){
boolean seccheck = false;
File f = listener.getJfchooser().getSelectedFile();
if(f.exists() && listener.getJfchooser().getDialogType() == listener.getJfchooser().SAVE_DIALOG){
int result = JOptionPane.showConfirmDial... |
42392000-eaea-42cc-8689-429b73faf28f | 9 | public static String generatePossibleMoves()
{
String list="";
for (int i=0; i<64; i++)
{
switch (chessBoard[i/8][i%8])
{
case "P": list+=Pawn.possiblePawnMoves(i);
break;
case "R": list+=Rook.possibleRookMoves(i);
... |
995bb16d-f449-4662-9880-53c0804db2fc | 0 | public HashMap<Character, Vehicle> getVehicles() {
return vehicles;
} |
1d7aa490-7cb4-4336-99a9-29c3dd27472d | 1 | public void testMinus_Seconds() {
Seconds test2 = Seconds.seconds(2);
Seconds test3 = Seconds.seconds(3);
Seconds result = test2.minus(test3);
assertEquals(2, test2.getSeconds());
assertEquals(3, test3.getSeconds());
assertEquals(-1, result.getSeconds());
... |
7439d4f5-3e81-4906-b8cf-72b7678c9095 | 6 | public void update(int delta) {
int index = 0;
Object projectileArray[] = projectiles.toArray();
while(index < projectileArray.length) {
if(projectileArray[index] instanceof Projectile) {
Projectile projectile = (Projectile) projectileArray[index];
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.