method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
2a01416f-2a39-413b-bb65-673b108a1b1d
3
public int getLength() { int i; for(i = 0; i < items.length; i++) { try { if(items[i].length() == 0) { break; } } catch(NullPointerException e) { break; } } return i; }
09057827-2e0c-4f68-ba48-0b6d2ca57960
4
public boolean equals(Object obj) { if (!(obj instanceof DrawTextObject) || !super.equals(obj)) return false; DrawTextObject that = (DrawTextObject) obj; return this.topLeft.equals(that.topLeft) && this.text.equals(that.text) && this.font .equals(that.font); }
ccec6b77-16bc-44ac-bdf1-ca6cd28312b9
5
public String toStringAround(K key) { StringBuilder sb = new StringBuilder(); int position = Collections.binarySearch(keys, key); if (position < 0) position = -position - 1; int from = Math.max(0, position - 10); int to = Math.min(keys.size(), position + 10); sb.append("["); if (from > ...
8d8bb9d8-ed46-4f5a-814f-85369ed15069
4
public static void main(String[] args) throws IOException, InterruptedException { bb = new BananaBank("accounts.txt"); allAccounts = bb.getAllAccounts(); int portNumber = 2000; ServerSocket serverSocket= new ServerSocket(portNumber); serverSocket.setSoTimeout(100); ...
91c54546-4ca5-4327-bead-22e82daf33d1
8
final public void SynchronizedStatement() throws ParseException { /*@bgen(jjtree) Block */ BSHBlock jjtn000 = new BSHBlock(JJTBLOCK); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtreeOpenNodeScope(jjtn000); try { jj_consume_token(SYNCHRONIZED); jj_consume_token(LPAREN); Expres...
3a25491d-1d8c-4bf5-b4d1-29219f86095c
9
private static void rdf_ParseTypeResourcePropertyElement(XMPMetaImpl xmp, XMPNode xmpParent, Node xmlNode, boolean isTopLevel) throws XMPException { XMPNode newStruct = addChildNode (xmp, xmpParent, xmlNode, "", isTopLevel); newStruct.getOptions().setStruct(true); for (int i = 0; i < xmlNode.getAttributes...
b01b1e0d-4270-4874-9015-4ed84c871d0e
1
protected double latticePar(double T, double par_0, double TEC, double Tch) { if (T == 0) { return par_0; } else { return par_0 * (1 + TEC * Tch * Utils.debye(Tch / T)); } }
bc13fdcd-5e27-4d60-8ea3-64f463e7ec53
3
@Override public List<T> sort(List<T> list) { // Initially, no elements are sorted. int sortedIndex = 0; // Keep sorting an element each iteration until the entire list is sorted. while (sortedIndex < list.size()) { // The left-most (or lowest) unsorted element is at the boundary of the sorted ...
32eff68d-9e28-468c-8032-bb1646b7dfbd
1
private void isSaveMax(int size) { if (size > EarningsTest.singleton.programSettings.maxSize) EarningsTest.singleton.programSettings.maxSize = size; }
8304cf20-c35f-459e-abaf-6851e771526d
3
@Override public void update(boolean pasued) { // See if we have any work to do if(spawned == true && respawnBases == false) return; // Add more to taste while(game.Game.getActors().getBanditBaseCount() < baseMax){ Vector3f pos = Vector3f.newRandom(FI...
fccaa23f-b13f-4038-878e-89eea043c2c6
5
public boolean reroll(List<Integer> indices, List<Die> dice) throws FlippedSkullException { if (rerollCount > 1 || indices == null || indices.isEmpty())// rerollCount // will be 0 // 1st // time and 1 2nd return false; if (rerollContainsSkulls(indices, dice)) throw new...
d23c98b4-8ed1-4bcc-9352-a2e40fb5c437
0
public void stop_logging() { synchronized (logging_enabled) { logging_enabled = false; } }
4fe7895f-52ae-44cf-90c3-e555a2c72f5d
4
private int getRangeSum(int x,int y){ if(x<0 || y<0 || x>=height || y>=width) return 0; return matrix[x][y]; }
905e4dcd-efd3-44ee-843e-9e9e8180d5a6
2
@Override public void start() throws Exception { String[] args= this.par.getArgs(); int inputNumberValues= args.length - 1; //-1 for command word if(inputNumberValues != 1) throw new Exception("The input for -all command is not correct"); //because for song there are both low and high extraction f...
a99ea3ee-94b7-4697-afc0-f3d5b58af1e2
6
public static double log1p(final double x) { double xpa = 1.0 + x; double xpb = -(xpa - 1.0 - x); if (x == -1) { return x/0.0; // -Infinity } if (x > 0 && 1/x == 0) { // x = Infinity return x; } if (x>1e-6 || x<-1e-6) { dou...
a60a2ee1-4d8a-4652-9962-1be0cda82437
1
@SuppressWarnings("unchecked") @EventHandler public void onPlayerChat(PlayerChatEvent e){ if(!this.privatePlayers.contains(e.getPlayer())){ JSONObject json = new JSONObject(); json.put("message", e.getMessage()); json.put("time", new Date().toString()); json.put("player", e.getPlayer().getName()); js...
19f0a10b-f19e-4d7d-89bf-6c380f3463e8
7
public Object nextContent() throws JSONException { char c; StringBuffer sb; do { c = next(); } while (Character.isWhitespace(c)); if (c == 0) { return null; } if (c == '<') { return XML.LT; } sb = new Str...
931aff61-98fe-4cbb-960e-6d5ebfd2e3c0
7
@Override public void run() { debate = new Debate(); Debate debateCurrent = debate.getSpecificDebate(debateSelected.getId()); if ((!debateCurrent.getCurentTurnTeam().equals(debateCurrent.getAcceptPositionTeam())) && debateCurrent.getCurentTurnTeam().equals(teamType) && (debateSelected.getTeamRe...
779bf3b2-bd13-40e6-a766-8088614a5760
4
@Override public boolean equals(Object o) { if ( o instanceof Word ) { Word w = (Word)o; return ( this.str.equals(w.getString()) && this.x == w.getX() && this.y == w.getY() && this.orient == w.getOrient() ); } else { return false; } }
83c73e04-7901-4762-9a78-72752c17061f
6
private void checkForLongestRoad(ServerModel game, int currentPlayerIndex){ int longest = 4; Player currentPlayer = game.getPlayers().get(currentPlayerIndex); int playerWith=game.getTurnTracker().getLongestRoad(); if(playerWith == -1 && 15-currentPlayer.getRoads() > longest) { // no one has it yet ...
c67c6020-5058-47d9-9bf2-93effe6e79d6
5
public void onEnable() { instance = this; new SpectaclesListener(this); getCommand("spectacles").setExecutor(new SpectaclesCommandExecutor()); getCommand("tour").setExecutor(new SpectaclesCommandExecutor()); config = getConfig(); config.options().copyDefaults(true); ...
4da5de8e-ad3f-419d-9a7d-b3e993387ec2
3
public void removeConnection(Connection connection) { connections.remove(connection); if (connections.isEmpty()) { try { exit(); } catch (IOException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } } }
d4293a46-dbb1-42b2-aa7b-3caaf68e0909
5
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Point point = (Point) o; if (Math.abs(point.x - x) > 0.1) return false; if (Math.abs(point.y - y) > 0.1) return false; return true; ...
67b29d77-eacb-478c-9d1b-fda7c3dc3a4d
5
public static double computeCosine(HashMap<String, Double> vector1, HashMap<String, Double> vector2) { // vector 1 is the user query and vector 2 the representation of the // institution double numerator = 0; double v1denominator = 0; double v2denominator = 0; double cosine = 0; for (String key : vec...
aee2a19e-fc26-4543-95a1-1825e179a8ec
0
public boolean isSatisfied() { return Satisfied; }
2d80fc79-4d02-40b1-a2ef-fd6b57e8786a
5
private void cargarImagenPGM(BufferedReader br) throws IOException { setMatrizGris(new short[getN()][getM()]); int fila = 0; int columna = 0; String data; while((data = br.readLine()) != null) { //almacena todo el conetido de la matriz String splitdata[] =...
01d11ffd-c1f5-44e0-bdf1-fc4478da2121
9
@Override public void start(IClockService arg0, final IEnvironmentSpace space) { // TODO Auto-generated method stub // Initialize the field. Space2D grid = (Space2D) space; int sizex = grid.getAreaSize().getXAsInteger(); int sizey = grid.getAreaSize().getYAsInteger(); ...
759ee291-a273-4b99-8337-465eeeb128a1
9
private static LoopTree parseLoop(SourceInputStream in) throws IOException, ParseException { LoopTree loop = new LoopTree(in.position()); List<Tree> children = loop.getChildren(); in.read(); // skip [ int ch = in.read(); while (ch != ']') { in.backup(); switch (ch) { case '+': case '-': ...
05742047-37a7-4e33-853a-ec31332737d1
2
public boolean deleteItem(int index){ // unacceptable index if(index < 0 || index >= getItemCount()) return false; childItems.remove(index); return true; // success }
83899352-f96c-4b36-b715-d5c164f55d5a
9
public static void main(String[] args) throws IOException { Params params = new Params(); JCommander jc = new JCommander(params); jc.parse(args); Log.setGlobalLogLevel(params.logLevel); if (args.length == 0 || params.help) { usage(jc); System.exit(1); } if (params.reference == null) { System.o...
4294f60f-6a25-4b8c-a11b-45c9684793d6
7
public void checkXCollision() { boundingBox = new Rectangle((int) x + H_OFFSET, (int) y + V_OFFSET, BOX_WIDTH, BOX_HEIGHT); int xcol = (int) (boundingBox.getCenterX() / tileMap.getTileSize()); int yrow = (int) (boundingBox.getCenterY() / tileMap.getTileSize()); int row = 0, col = 0; for (int r = yrow - 1; ...
afc7ab94-1fda-4818-af2e-2bfb7b39049c
4
private void baseFileButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_baseFileButtonActionPerformed if (evt.getSource() == baseFileButton) { final JFileChooser fc = new JFileChooser(); int returnVal = fc.showOpenDialog(this); if (returnVal...
ef157b19-6463-43f9-a1da-86ea4be25369
9
public boolean matches(PersonalData data) { for (String email : data.getAllValues("email")) { if (emails.contains(email)) return true; } for (String twitter : data.getAllValues("twitter")) { if (twitters.contains(twitter)) return true; } for (String phone : data.getAllValues("phone")) { if (p...
863a6862-183f-425f-91ae-b1a40430a5e9
7
@Override public double timeToReach(Node startNode, Node endNode, Message msg) { // TODO Auto-generated method stub double dist = startNode.getPosition().distanceTo(endNode.getPosition()); /* Link rate | time arrive mSec | dist * ---------------------------------------------------- * 11 | 2542 | 399 ...
9ee3fa19-c1a2-4999-8e87-49671653e6ba
5
public boolean ConnectToCard() throws NoReaderFoundException, CardException, CardNotPresentException { List terminalList = null; boolean terminalFound = false; try { terminalList = GetReaderList(); terminalFound = true; } catch (NoReaderFoundException e) { ...
7dada361-32c8-4382-88fe-b47dd8a7ea2a
5
public void close(){ if(!saved) { int choice = JOptionPane.showConfirmDialog(this, "Modifications have been done. Do you want to save ?", "Last Warning", JOptionPane.INFORMATION_MESSAGE, JOptionPane.YES_NO_CANCEL_OPTION); if (choice == 0) { //YES JFileChooser FCdialog = new JFileChoos...
1f32d877-b9ac-4bd2-9115-df05cfe236b7
4
private void setPanelStage(int stage) { if(stage == 1) { /*add main buttons to the top of the panel*/ frame.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); viewRecipies = viewRecipiesPanel.setViewRecipiesPanelDimensions(); newRecipeButton(); closeB...
9833287a-87a4-43b3-b4ba-3e7bf4f8a8cd
1
public static JScrollPane getPastPane(Configuration configuration) { JScrollPane sp = new JScrollPane(new PastPane(configuration), JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); sp.validate(); if (sp.getSize().height > MAXHEIGHT) { sp.setSize(sp.getSize().width, MAXHEIG...
e38db0e9-d722-407b-a939-7e04c0ba05a3
7
public U1A6_MathView(SingleFrameApplication app) { super(app); initComponents(); // status bar initialization - message timeout, idle icon and busy animation, etc ResourceMap resourceMap = getResourceMap(); int messageTimeout = resourceMap.getInteger("StatusBar.messageTimeout")...
103fe70c-4c43-42f3-a81e-c75b523dbd32
9
public int getPlay() { // check from highest Play to lowest (least complicated) if (isRoyalFlush()) return Consts.RoyalFlush; else if (isStraightFlush()) return Consts.StraightFlush; else if (isFours()) return Consts.Fours; ...
f7e9c57d-fb41-48ae-bca1-65c573eeb788
8
private void verifyReservedWords(){ if( this.string.equals( "if" ) ) this.type = TokenType.Element.IF; else if( this.string.equals( "then" ) ) this.type = TokenType.Element.THEN; else if( this.string.equals( "else" ) ) this.type = TokenType.Element.ELSE; else if( this.string.equals( "end" ...
bb1197ed-2ff3-4049-a385-ffa180fc1de7
2
public void setBytes(byte[] b){ if(bList.isEmpty()) for(byte by : b) { bList.add(by); } }
2c1f2c48-88a8-4909-8aba-b689aa3e02b8
1
@Override public String getUserFacingMessage() { if (isUserError()) return getMessage(); else return super.getUserFacingMessage(); }
72b302a3-b635-4fd6-9c44-f530260f1742
2
@Override protected void createCells(int[][] squares) { cells = new ReproductionCell[NCELLS][NCELLS]; for (int row = 0; row < NCELLS; row++) { for (int col = 0; col < NCELLS; col++) { cells[row][col] = new ReproductionCell(); add(cells[row][col]); } } }
07fe67ba-c281-4267-9902-6b6d53c64a93
0
public add() { this.requireLogin = true; this.info = "add an appointmemt"; this.addParamConstraint("name"); this.addParamConstraint("venueId", ParamCons.INTEGER); this.addParamConstraint("startTime", ParamCons.INTEGER); this.addParamConstraint("endTime", ParamCons.INTEGER); this.addParamConstraint("info")...
e3ad99a1-b045-4fe8-ac16-d264ee4ac2d5
7
public static double acos(double x) { if (x != x) { return Double.NaN; } if (x > 1.0 || x < -1.0) { return Double.NaN; } if (x == -1.0) { return Math.PI; } if (x == 1.0) { return 0.0; } if (x == 0) { return Math....
f737fe00-8fc0-4058-8c35-7b3bbd5e80e2
6
public String produceCFGCode() { String[] lines = inputIrCode.split("\n"); //Build the control flow graph cfg = new ControlFlowGraph(); List<String> lineList = new ArrayList<String>(); //Put lines into a list for(int i = 0; i < lines.length; i++) { lineList.add(lines[i]); } cfg.createGraph(l...
d67de0f8-5b1e-4dbb-b914-3c8df6833b2d
7
public String getPermutation(int n, int k) { if(k<1) return ""; ArrayList<Integer> res = new ArrayList<Integer>(); String rt = ""; for(int i=1;i<=n;i++) res.add(i); while(!res.isEmpty() && k!=0) { int j = find(k,res); rt+= String.valueOf(res.get(j-1)); k = k - (j-1)* jiecheng(res.size()-1); r...
2e105de8-9478-43bd-8583-16915e2bcc15
8
@Override protected byte[] load_from_current_position(String frameId, int dataLength, RandomAccessFile openFile) throws IOException { byte[] frameData=super.load_from_current_position(frameId, dataLength, openFile); if(frameData==null) return null; originalEncodingType=frameData[...
5b13a75b-86c1-4c59-bf78-c0abda0e9e46
6
public static int convertLetterToPieceInt(String letter) { if (letter.equals("P")) { return 1; } else if (letter.equals("N")) { return 2; } else if (letter.equals("B")) { return 3; } else if (letter.equals("R")) { return 4; } else if (letter.equals("Q")) { return 5; } else if (letter.equals("...
0d08ed5b-0c42-40c2-aea7-1b2eca47b41d
2
@Override public String execute(SessionRequestContent request) throws ServletLogicException { String page = ConfigurationManager.getProperty("path.page.userorder"); String prevPage = (String) request.getSessionAttribute(JSP_PAGE); resaveParamsShowOrder(request); formUserOrderList(req...
3dd2f738-b32a-48ac-b0dd-31fe7de8f8f1
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (getClass() != obj.getClass()) return false; ConnectorPipe other = (ConnectorPipe) obj; if (inputs == null) { if (other.inputs != null) return false; } else if (!inputs.equal...
7f1793e5-67e6-47da-8dbf-91071594a267
6
public static String unescape(String string) { int length = string.length(); StringBuffer sb = new StringBuffer(); for (int i = 0; i < length; ++i) { char c = string.charAt(i); if (c == '+') { c = ' '; } else if (c == '%' && i + 2 < length) { ...
5d46f448-9057-46b4-8bd2-82259e5133ab
4
public void delete(String table, String nameColumn, int valueColumn) { try { con = DriverManager.getConnection(url, user, password); String stm = null; stm = "DELETE FROM " + table + " WHERE " + nameColumn + " = " + valueColumn; pst = con.prepareStatement(stm); // execute statement me pst.execut...
40936923-29a7-4e75-a1f5-c0b29a1f9319
8
public static void loadBook (VaultHook econ, Player player, String name, boolean firstJoin) { ItemStack is = BMPlugin.getPlugin().bookHandler.getBook(name); if(is == null){ player.sendMessage(ChatColor.RED + "There is no book saved by the name of \"" + name + "\""); return; ...
3406e0c4-12b8-44d9-91c3-39dedbb5743a
6
public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://down...
b8789f98-3bf4-4f40-a85a-dd4da5552c15
0
@Test public void testBuilder() { Car car = new CarBuilder() .setBrakes(1) .setElectricBrakes(true) .setSportKit(true) .build(); assertEquals(car.getBrakes(), 1); assertEquals(car.isElectricBrakes(), true); assertEquals(...
790861e8-e473-46b5-a0a1-29107d4cfbef
1
private void siirryKorkeammalleSuoritustasolle(int prioriteetti) { while (suoritustasot.size() < prioriteetti) { Suoritusjono uusitaso = new Suoritusjono(); nykyinenJono().lisaaSeuraavaArvollinen(uusitaso); suoritustasot.add(uusitaso); } }
a6e89d11-43e8-45be-9dc3-40ecf44639aa
3
@Test public void testReturnPayment() { Gateway beanstream = new Gateway("v1", 300200578, "4BaD82D9197b4cc4b70a221911eE9f70"); CardPaymentRequest paymentRequest = new CardPaymentRequest(); paymentRequest.setAmount(70.00); paymentRequest.setOrderNumber(getRandomOrder...
591b57d8-7387-4813-aa37-fa2ecd3f44b2
6
@Override public void serialize(Buffer buf) { buf.writeShort(subAreaId); buf.writeInt(mapId); buf.writeByte(subareaAlignmentSide); buf.writeUShort(houses.length); for (HouseInformations entry : houses) { buf.writeShort(entry.getTypeId()); entry.seriali...
66ce59a6-02e7-4a0f-b233-989a17815a8e
0
public String toString() { return super.toString(); }
712f7d23-c607-4b12-9ce7-cd03c38e460a
7
@Test @SuppressWarnings("CallToPrintStackTrace") /** * @todo Tests the MatchingEngine trade() function. Two cases are tested: * Firstly, if the trade function will record a trade when an offer and a * bid are explicitly made to match, and secondly if the trade function will * record no trade...
e013c5ce-f5cb-4985-8f10-2129bb1aa4ce
8
protected static boolean isSquareMatch(int x, int y, SquareColour squareColour, SquaresMatrix squaresMatrix) { if(x < 0 || y < 0) return false; if(!(squareColour instanceof SquareColour)) ...
cc630d42-6950-40da-af08-793e5fa831a0
3
protected ConfigurationSerializable deserializeViaMethod(Method method, Map<String, Object> args) { try { ConfigurationSerializable result = (ConfigurationSerializable) method.invoke(null, args); if (result == null) { Logger.getLogger(ConfigurationSerialization.class.get...
45217218-5c50-42e9-bd97-55ce8f93adb9
8
final private boolean jj_3R_141() { if (jj_scan_token(FOR)) return true; if (jj_scan_token(LPAREN)) return true; if (jj_3R_32()) return true; if (jj_scan_token(IDENTIFIER)) return true; if (jj_scan_token(COLON)) return true; if (jj_3R_40()) return true; if (jj_scan_token(RPAREN)) return true...
c53d7714-3253-449e-b159-a050e91de44c
3
public int compareTo(City c) { if (CENTER.x/25==c.CENTER.x/25) return CENTER.y-c.CENTER.y!=0?CENTER.y-c.CENTER.y:CENTER.x-c.CENTER.x; else return CENTER.x-c.CENTER.x!=0?CENTER.x-c.CENTER.x:CENTER.y-c.CENTER.y; }
21eb3939-e9d9-47ff-98a4-c6df237e9be6
8
public static int uniquePaths2(int m, int n) { int[][] pathMatrix = new int[m][n]; for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { if (i == 0 && j == 0) { pathMatrix[0][0] = 1; } else if (i == 0 && j != 0) { pathMatrix[i][j] = pathMatrix[i][j - 1]; } else if (j == 0 && i != 0) {...
40d07860-672c-4206-907f-de55b5a9e97d
6
public static void htmlWrite3PartHrefInDetail(org.powerloom.PrintableStringWriter stream, String target, String action, String objectType, String contextName, String objectName, String objectTitlePrefix, String objectTitle, String objectTitleSuffix, boolean rawtitleP) { stream.print("<A "); if (target != null) ...
dc45b529-1582-4131-9eab-256727db1ab2
8
private Map<String, String> convertRefund(RefundRequest request) { Map<String, String> params = new HashMap<String, String>(); params.put("Action", "Refund"); if (request.isSetTransactionId()) { params.put("TransactionId", request.getTransactionId()); } if (r...
2d30236e-9a92-470d-b3b2-6e85c5db9a4c
2
private Grammar readGrammar(Document document) { Grammar g = new UnboundGrammar(); NodeList list = document.getDocumentElement().getElementsByTagName( RULE_NAME); for (int i = 0; i < list.getLength(); i++) { Production[] p = createRules(list.item(i)); for (int j = 0; j < p.length; j++) g.addProducti...
351bf463-21a5-4b30-b9ec-75e86fcc4153
5
public final T execute() throws InvalidProcessStateException, ProcessExecutionException { if (state != ProcessState.READY && state != ProcessState.ROLLBACK_SUCCEEDED && state != ProcessState.PAUSED) { throw new InvalidProcessStateException(this, state); } logger.debug("Executing '{}'.", this); setState(P...
f3fd187d-d557-467f-8aab-c56fb1663852
6
public int checkInBetweenVertical(int originLetter, int originNum, int newLetter, int newNum, Board b) { valid = 0; this.board = b; if(originNum > newNum) { int upValid = 0; int verticalUpNum = originNum; for(int counter = 0; counter < ((originNum-newNum)-1); counter++) { verticalUpNum = vertic...
d0721a1f-3f1d-4630-8723-c100bf10d4f8
3
private void calculateFitnesses(){ fitnessSum = 0; minCost = -1; for(int i = 0;i<POPULATION_SIZE;i++){ initRouteFromGene(genes[i]); double cost = travelingSalesman.calculateCosts(route); if(minCost < 0 || cost < minCost){ minCost = cost; fittestGeneIndex = i; } fitnesses[i]...
df48b33f-e124-46f8-9030-a493f4b998f7
5
@Override public void run() { if (ctx.game.clientState() == Constants.GAME_MAP_LOADED) { ctx.sleep(2000); if (valid()) { options.status = "House does not have a gilded altar"; if (options.useOtherHouse.get()) { script.houseHandler.currentHouseFailed(); if (!options.detectHouses.get() && scri...
d8483e39-7bc4-4e61-835a-0b3273d11933
8
public Winner getWinner() { if (human.hasBlackjackHand() && dealer.hasBlackjackHand()) { return Winner.PUSH; } if (human.hasBlackjackHand()) { return Winner.HUMAN; } if (dealer.hasBlackjackHand()) { return Winner.DEALER; } in...
e55a33a4-7dc2-4cb2-b7f2-0c2268d6df3f
1
public static void toggleCommentAndClearForSingleNode(Node node, CompoundUndoable undoable) { toggleCommentForSingleNode(node, undoable); for (int i = 0, limit = node.numOfChildren(); i < limit; i++) { clearCommentForSingleNode(node.getChild(i), undoable); } }
fe847773-8949-4ad4-afeb-ba98e3ad869a
0
public BatchOS(){ batchOs = new OSConsole("BatchOS"); batchOs.setCommandListener(this); }
f7c4e298-abc4-4ef0-980a-6309720bf34c
6
public void disappear() { for (int i = 0; i < Yard.YARD_ROW; i++) { boolean flag = true; for (int j = 0; j < Yard.YARD_COL; j++) { if( blocks[i][j] == false) { flag = false; continue; } } if (flag == true) { score++; for (int i2 = i; i2 > 0; i2--) { for (int j2 = 0; j2 <...
fb70b86c-177a-4360-a465-695550ef3300
7
private static void binarySearchLast(int[] a, int i) { // TODO Auto-generated method stub int start = 0; int mid = 0 ; int end = a.length; while(start<end){ mid = ((start + end)/2); System.out.println(mid); if (a[mid] == i){ start = mid; } else if(a[mid] < i){ start = mid + 1...
e9a29b5e-a916-4a66-96b8-16b89eb868d4
1
public void JDBCConn() throws SQLException{ String user = "postgres";//Логин пользователя String password = "zaUgD5Lt";//Пароль пользователя String url = "jdbc:postgresql://192.168.137.142:5432/CDS";//URL адрес String driver = "org.postgresql.Driver";//Имя драйвера try { Class.forName...
13682e42-c6fe-408a-920f-8bd0a7bf550a
8
@Override public void actionPerformed(ActionEvent arg0) { if (colorGain) colorN += 3; else colorN -= 5; if (colorN >= 200) colorGain = false; else if (colorN <= 30) colorGain = true; if (!seen) { tutorial = true; hero.setPaused(true); if (tutorialX > 0) { tutorialX -= 15; t...
8512f39e-f67b-41c0-b0e5-07bbc2d3c6c2
7
public boolean equals(Value value){ if(value.getType() == this.type){ if(this.type == Attribute.Type.CHAR){ if(value.getChar().equals(this.getChar())){ return true; } }else if(this.type == Attribute.Type.INT){ if(value.getInt() == this.getInt()){ return true; } }else if(this.type =...
eff1d96a-b5bc-427a-87a9-5ccc88fed69d
7
public boolean[][] createLandMap() { //get values from mapGeneratorOptions width = mapGeneratorOptions.getInteger("model.option.mapWidth"); height = mapGeneratorOptions.getInteger("model.option.mapHeight"); preferredDistanceToEdge = mapGeneratorOptions.getInteger("model.option.preferredD...
26864a3f-8705-49f9-88c6-c83f95a6063e
4
public static byte[] readFromInputStream(InputStream in) throws IOException { if (in == null) { return null; } ReadableByteChannel rbc = Channels.newChannel(in); ByteBuffer buffer = ByteBuffer.allocate(BUFFER_SIZE); byte[] data = new byte[BUFFER_SIZE]; ByteArrayOutputStream baos = new ByteArrayOutputStre...
9127e88e-6edd-492d-a8e6-d5fa84a05ef7
6
CalRGB(Library l, Hashtable h) { super(l, h); Vector m = (Vector) h.get("WhitePoint"); if (m != null) { for (int i = 0; i < 3; i++) { whitepoint[i] = ((Number) m.elementAt(i)).floatValue(); } } m = (Vector) h.get("Gamma"); if (m != ...
ba7b7498-db26-40d5-ba58-deee950799a0
2
public void load(String dirName, String geneIdsFile) { this.dirName = dirName; if (verbose) Timer.showStdErr("Loading Reactome data from directory '" + dirName + "'"); loadDatabaseObjects(); // Load a map of all object names and types loadComplex2HasComponent(); // Load Complex_2_hasComponent loadPhysicalEnt...
e66d3345-0151-49cf-9c9f-3ece4c67c4ef
4
private boolean validateUrl(){ String text = tfUrl.getText(); if(text == null || text.trim().length() == 0 ){ JOptionPane.showMessageDialog(this, "Informe a URL/Endereço !"); return false; } if(!text.contains("http:") || !text.contains("www.") ){...
ffe5c5a6-2496-4a71-9703-714f2e4edd7e
5
public static void main(String[] args) { try { init(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } try { runTests(); } catch (Exception e) { e.printStackTrace(); } finally { try { if (WRITE_MODE) { os.close(); } e...
9d6f3446-dea9-4d20-9a14-9be9beec0c60
3
@Override protected Interactable.Result unhandledKeyboardEvent(Key key) { if(getSelectedIndex() == -1) return Interactable.Result.EVENT_NOT_HANDLED; if(key.getKind() == Key.Kind.Enter || key.getCharacter() == ' ') { checkedIndex = getSelectedIndex(); retu...
f6d4bcc5-0f4c-47b4-8477-339879b929d8
1
public void updateSubTypes() { subExpressions[0].setType(type != Type.tVoid ? type : Type.tInt); }
cb7f4059-10d0-4dd7-bebf-b358befa7f58
0
public String getServiceDate() { return serviceDate; }
07714e4a-000f-4325-b2de-1ba45c15e9be
5
private void writeFile() { int id = getNextId(); File f = getFile(id); try { fileSync.lock(); try { FileOutputStream fos = new FileOutputStream(f); try { GZIPOutputStream gos = new GZIPOutputStream(fos); DataOutputStream dos = new DataOutputStream(gos); dos.writeInt(writeQue...
d383f490-a445-4cda-b09d-c318dab91e59
9
public void hanoiIteratif(int n, Tour depart, Tour arrivee, Tour intermediaire){ int [] pairTab = { 3 , 2 , 1}; int [] impairTab = { 2 ,3 , 1}; //int stop = (int)Math.pow(2, n)-1; int index = 0; int hauteur = t1.getHauteur(); while(t3.getHauteur() == hauteur) { boolea...
2a1398d3-2333-412f-b3e0-5026b5b66315
8
public static void main(String[] arg) { try { //////////////////////////////////////////////////////////////// // // usage: java com.twmacinta.util.MD5InputStream [--use-default-md5] [--no-native-lib] filename // ///////// // determine the filename to use and the MD5 impelemen...
0d5ee9ae-a43d-4214-b44d-1fac713000cc
6
public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://down...
321dcee3-b4a5-4bec-ab50-26ed6bdda09c
7
public static String runCommand(ArrayList l) throws ClassNotFoundException, SQLException, NoSuchAlgorithmException{ String message = " failed"; if(l.get(0).equals("login")){ //action login boolean isExist = false; isExist = Login.isUserExist(l.get(1).toString(), l.get...
b8e4bd5f-7c6d-4f23-a0ab-062462e12364
1
public void test_DateTime_setHourForward_NewYork_Spring() { DateTime dt = new DateTime(2007, 3, 11, 0, 0, 0, 0, ZONE_NEW_YORK); assertEquals("2007-03-11T00:00:00.000-05:00", dt.toString()); try { dt.hourOfDay().setCopy(2); fail(); } catch (IllegalFieldVal...
0eef8dce-a946-4de3-ac58-235535e8a22f
1
public String map2QcTestInstanceName(ITestResult res) { String qcTestInstanceName = null; if (res.getTestName() != null) { //DD test that is in [test name]-[data id] format. String testInstanceName = res.getTestName(); qcTestInstanceName = testInstanceName.substring(testInstanceName.ind...
3547fd45-32dd-44ac-9471-1de2eab7c11e
5
@Override public String requestPro(HttpServletRequest request, HttpServletResponse response) throws Throwable { request.setCharacterEncoding("euc-kr"); int idx = Integer.parseInt(request.getParameter("idx")); Board article = BoardDao.getInstance().getArticle(idx); String filename = article.getFilename(...
0ee598dd-28aa-4761-a366-9652a82e7eff
4
public boolean inside(Bullet b){ if(b.getX()>x && b.getX()<x+WIDTH && b.getY()>y && b.getY()<y+HEIGHT ){ return true; } return false; }