method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
fb8a9a7c-3cfa-404e-af1f-04af3d601f1c
0
public void setName(String name) { this.name = name; }
c9dd07bd-68f2-4185-9de4-3223b5677071
5
public void loadProperties(String xmlDataFile, String xmlSchemaFile) throws InvalidXMLFileFormatException { String dataPath = getProperty(DATA_PATH_PROPERTY); // ADD THE DATA PATH xmlDataFile = dataPath + xmlDataFile; xmlSchemaFile = dataPath + xmlSchemaFile; ...
bd1b65c8-84d7-45a8-a356-c172b8454eb2
9
void sort(int[] a) throws Exception { for (int i = a.length; --i>=0; ) for (int j = 0; j<i; j++) { if (stopRequested) { return; } if (a[j] > a[j+1]) { int T = a[j]; a[j] = a[j+1]; a[j+1] = T; } pause(i,j); } }
636f3560-1031-4228-a346-2566e11aaa30
0
public int getSelectionMode() { return this.selectionMode; }
181bee6c-3e63-4121-a1c7-c4ddd0636a3f
8
public boolean hasEntryPoint(Cell cell, int entryPointId){ String result = ""; char c = get(cell); if(entryPointId == 1) { return StringUtils.isOneOf(c, entryPoints1); } else if(entryPointId == 2) { return StringUtils.isOneOf(c, entryPoints2); } else if(entryPointId == 3) { return StringUtils.isO...
f6423195-0664-4c0d-8826-c77a979802bb
0
public static void main(String[] args) { List v = (List)factory(new Vector()); System.out.println(v.getClass().getName()); v.add("new"); System.out.println("----------------------------"); v.add("old"); System.out.println(v); v.remove(0); System.out.println(v); }
44092816-8bfb-4544-b2bd-dac85903e2d7
8
public ArrayList<Patch> getNeighbors(){ ArrayList<Patch> neighbors = new ArrayList(); if (!topEdge()){ neighbors.add(getN()); if (!leftEdge()){ neighbors.add(getNW()); } if (!rightEdge()){ neighbors.add(getNE()); } } if (!bottomEdge()){ neighbors.add(getS()); if (!leftEdge()){...
9f51a1c1-0a04-4c80-8964-d40c788a38d0
9
private boolean checkNorthEdge(EdgeLocation normEdgeLocation, ArrayList<Road> roads, int playerIndex) { HexLocation thisHexLoc = normEdgeLocation.getHexLoc(); HexLocation NEHexLoc = normEdgeLocation.getHexLoc().getNeighborLoc(EdgeDirection.NorthEast); HexLocation NWHexLoc = normEdgeLocation.getHexLoc().getNeighbo...
e32064a7-e88a-45a2-8907-5613e91ba5ee
9
public int uniquePathsWithObstacles(int[][] obstacleGrid) { if (obstacleGrid==null){ return 0; } int m = obstacleGrid.length; int n = obstacleGrid[0].length; int [][]result = new int[m][n]; result [0][0] = (obstacleGrid[0][0]==0?1:0); for (int i = 1; i...
aa54a54b-90ef-40c4-b5dc-20717eab4f17
7
public Object getValue(String aggregate) { if ("min".equals(aggregate)) { return getMin(); } if ("max".equals(aggregate)) { return getMax(); } if ("avg".equals(aggregate)) { return getAverage(); } if ("count".equals(aggregate)) { return getCount(); } if ("sum".equals(aggregate)) { retur...
835984ad-b8e0-43a7-b64b-86da818a2c27
2
public static QuizResult getQuizResult(int QuizId, int UserId) { try { QuizResult qr = new QuizResult(); String statement = String.format("select qq.questionid ,coalesce(qr.ANSWERID, 0) AnswerID, q.questiontext, coalesce(qr.answertext, 'NONE') ANSWERTEXT, coalesce(qr.iscorre...
d9f83fea-784c-48c9-aa7d-d76310759000
1
static public String convertResponseToString(Object response, Object command) { if (!(response instanceof String)) { throw new RuntimeException("Expected String but received (" + response.getClass() + ") " + response + "\n in response to command " + command); } return (String) response; }
f9675c54-98e6-4a41-b500-42c56f2c79e4
2
public static void checkException(ExceptionGenerator exceptionGenerator, Class expectedException) { try { exceptionGenerator.generateException(); //no exception was caught System.out.println("no exception; expected " + expectedException.getSimpleName()); } catch (Exce...
c4cf6c75-0aa8-455a-8a18-17b14e553352
4
public void init(int mode, byte[] key, byte[] iv) throws Exception{ String pad="NoPadding"; //if(padding) pad="PKCS5Padding"; byte[] tmp; if(iv.length>ivsize){ tmp=new byte[ivsize]; System.arraycopy(iv, 0, tmp, 0, tmp.length); iv=tmp; } if(key.length>bsize){ tmp=new...
34d7da3a-ece8-4e1e-b44a-f5621d4c7bc6
5
@Override public void run() { while(true) { synchronized (timers) { for(Timer timer : timers){ if((timer.isWorking())&&(timer.update())){ timer.stop(); } } } try { sleep(1000); } catch (InterruptedException e) {} } }
fe1715af-223c-40e7-b551-e0df50c7fea9
5
public void insertElement(IndexPair pair) throws IOException { // If there is no block yet, allocate one and insert the element. if (firstBlock == null) { firstBlock = createNewBlock(); firstBlock.insertElement(pair); } else { SignatureStoringBlock block = getBlockFor(pair.getBitSignature(...
28f71050-f735-4e3b-8706-b61d7a0fcad1
6
public static void main(String[] args) throws InterruptedException { EasyPost.apiKey = "cueqNZUb3ldeWTNX7MU3Mel8UXtaAMUi"; try { Map<String, Object> fromAddressMap = new HashMap<String, Object>(); fromAddressMap.put("name", "Simpler Postage Inc"); fromAddressMap.put(...
49081b66-187f-4b53-9c60-79432ea49417
8
public synchronized void setSkin(String skinName) { //LogUtil.logInfo("setSkin(" + skinName + ")"); if (skinName == null || skinName.length() == 0) { // Blank values of "skinName" reset skin to default. resetSkin(); return; } if (isInteger(modelName)) ...
42a13531-4aa5-4d0e-a8dc-21c5887c626b
3
private void paintPlaceable(Placeable obj, Graphics2D g2) { if (obj == null) { System.out.println("obj in paintPlaceable is null"); } else { int yPos = obj.getPosition().getY(); int xPos = obj.getPosition().getX(); int ySide = obj.getDimension().height; ...
79f88227-094d-4429-93dc-a74bc8062c0e
9
private static void handleMoveType3(PGNMove move, String strippedMove, byte color, byte[][] board) throws PGNParseException { byte piece = WHITE_PAWN; int fromhPos = getChessATOI(strippedMove.charAt(1)); int tohPos = getChessATOI(strippedMove.charAt(2)); int tovPos = strippedMove.charAt(3) - '...
73986a0b-85c5-4780-803d-3e7e82ae03d0
4
public Composite(final Delegate<?> ... delegates) { super( new InvocationHandler() { @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { for (Delegate<?> delegate : delegates) { try { Method handler = delegate.getClassTarget().getMethod(method.getName...
7940a625-983d-4764-b574-dd8e37a9cdf9
5
public static int main(Iterator<String> argi) { RepoConfig repoConfig = new RepoConfig(); while( argi.hasNext() ) { String arg = argi.next(); if( repoConfig.parseCommandLineArg(arg, argi) ) { } else { System.err.println("Unrecognized argument: "+arg); return 1; } } repoConfig.fix(); ...
d37ff3d4-1470-4305-8754-e508b263cbdd
6
private void renderIntersections(Graphics2D g2) { Iterator<Intersection> it = model.intersectionsIterator(); while (it.hasNext()) { Intersection intersection = it.next(); // ONLY RENDER IT THIS WAY IF IT'S NOT THE START OR DESTINATION // AND IT IS IN THE ...
b6706f2b-e606-4803-a218-c887f4429a21
6
public static void refreshDefaultTrayToolTip() { if( !SystemTray.isSupported() ) return; AsyncFunction task = new AsyncFunction() { @Override public Object doInBackground() { try { IConfig servlet = (IConfig) ConfigManager.getConfigManager().getActiveContainer(); IConfig database = (IConfig)...
4770dfae-b591-4656-a878-2f1e4a650a8b
1
public void geefLijntje(boolean goed) { if (gekozenAntwoord.isGoed()) imagePanel.setBorder(new EtchedBorder(EtchedBorder.RAISED, Color.GREEN, Color.GREEN)); else imagePanel.setBorder(new EtchedBorder(EtchedBorder.RAISED, Color.RED, Color.RED)); }
023bae98-6b47-4d5a-a2f1-e8348921272e
7
public double[][] rankedAttributes () throws Exception { int i, j; if (m_attributeList == null || m_attributeMerit == null) { throw new Exception("Search must be performed before a ranked " + "attribute list can be obtained"); } int[] ranked = Utils.sort(m_attribu...
c56c5ae9-1b0a-4e37-804f-064e7eb87e50
9
public double getPesoLlaveEntera(int capa, int neurona, int llave){ double peso = 0; switch (llave) { case 0: peso = this.getPeso(capa, neurona, THRESHOLD); break; case 1: peso = this.getPeso(capa, neurona, EMBARAZOS); break; case 2: peso = this.getPeso(capa, neurona, CONCENTRACION_G...
7d449e30-f499-4283-9b69-d90f6c7c601c
5
@Override public void performEvent(ActionEvent e) { if ("Normal".equals(e.getActionCommand())) { Save.DIFFICULTY = 1; } if ("Hard".equals(e.getActionCommand())) { Save.DIFFICULTY = 2; } if ("Easy".equals(e.getActionCommand())) { Save.DIFFICULTY = 0; } if ("On".equals(e.getActionCommand...
8fde2dfa-ecb9-4302-83fb-65e80b951daf
1
private void addDice(String sides) { List<String> letters = new ArrayList<String>(sides.length()); for ( int i = 0; i < sides.length(); i++){ letters.add(String.valueOf(sides.charAt(i))); } dice.add(new Dice<String>(letters)); }
328e7658-03a0-42ab-948a-e6cebdd3caf4
8
protected Command getCommand() { CompoundCommand command = new CompoundCommand(); command.setDebugLabel("Drag Object Tracker");//$NON-NLS-1$ Iterator iter = getOperationSet().iterator(); Request request = getTargetRequest(); if (isCloneActive()) request.setType(REQ_CLONE); else if (isMove()) reques...
3fd794da-1268-4e98-aeec-2e0044f64445
0
public ISocketServerConnection getSocketServerConnection() { return socketServerConnection; }
724e4dba-2644-4da2-938d-76133814b18f
9
@Override public void valueChanged(ListSelectionEvent e) { if (e.getSource() == lstStock) { if (lstStock.getSelectedValue() != null && lstStock.getSelectedValue() instanceof Stock) btnCreate .setEnabled(true); } else if (e.getSource() == lstProduct) { Object sel = lstProduct.getSelectedVa...
3358d694-d84e-4dbc-87a6-9c6304dab602
0
public CheckResultMessage checkDayofMonth() { return checkReport1.checkDayofMonth(); }
2b4b9031-9359-49b1-9942-788c58b0ad3c
0
public int GetNextStopBusStop() { //set a random bus stop to get off at SetStopBusStop((GetSelectedBusStop()+1)+rndStop.nextInt(busStop.length-GetSelectedBusStop())); //SetStopBusStop(rndStop.nextInt(busStop.length+1)+GetSelectedBusStop()); //System.out.println("Stop: "+(GetStopBusSt...
9b236ed6-3ec0-4450-b42a-2ba84354790e
0
@Override public void windowClosing(WindowEvent e) { System.exit(0); }
1562032f-6928-451d-a8d4-4df145097d27
7
public void calculateScaleRange() { if( !automaticScale && userScaleRange != 0.0 ) { scaleRange = userScaleRange; } else { RootedTree tree = treePane.getTree(); if (tree != null) { final double treeHeight = tree.getHeight(tree.getRootNode()); ...
13339a61-d07b-4b51-9f48-697b6542b52a
9
private final void method2454(int i, int i_39_, int i_40_, int i_41_, AnimatableToolkit class64, int i_42_, Class101 class101, AbstractToolkit var_ha, int i_43_) { do { try { if (i != 6253) ((Player) this).aString10544 = null; anInt10563++; int i_44_ = i_43_ * i_43_ + i_39_ * i_39_; if (...
36ae5c02-060a-4112-8d96-1e68d92fbeaa
4
public static void run() { System.out.println("\n\n--|Cards|----------------------------------------------------------------------"); System.out.println(); String value[] = { "Ace", "2", "3", "4", "5", "6", "7", "8", "9", "10", "Jack", "Queen", "King" }; String suit[] = { "diamonds", "clubs", "hearts"...
4c49e451-c6da-4e05-b58e-d0aa80ce7a00
4
@Override public String toString() { String wasQueuedTxt = ""; if (wasQueued() == true) { int queueOverstay; if (getParkingTime() == 0) { queueOverstay = getDepartureTime() - getArrivalTime() - Constants.MAXIMUM_QUEUE_TIME; wasQueuedTxt = "\nExit from Queue: " + getDepartureTime() + "\nQ...
5e1a3daf-0030-4591-a3c3-c0d60fc92544
9
@Override public void executeMsg(Environmental affecting, CMMsg msg) { super.executeMsg(affecting,msg); if((affecting instanceof MOB)&&(!CMLib.flags().isAliveAwakeMobileUnbound((MOB)affecting,true))) return; if(disabled) return; if(((!(affecting instanceof MOB))||(!msg.amISource((MOB)affecting))) &&(...
431a6f39-00f4-4bf5-a96c-11c1d7e05026
0
@AfterClass public static void tearDownClass() { }
eeb77169-e1b5-49d7-b07f-4aa34e29cecb
5
public CheckResultMessage checkDayofMonth5() { int r1 = get(2, 5); int c1 = get(3, 5); date(); if (checkVersion(file).equals("2003")) { try { in = new FileInputStream(file); hWorkbook = new HSSFWorkbook(in); if (!(getValueString(r1 + maxDay, c1 - 1, 4).equals(maxDay + "日"))) { return e...
4e43a884-35a6-41d1-b9f5-7ff3c54d9aa0
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...
103d9aae-60ac-458d-bcba-8e038d75a479
6
private RenderableObject generateShape(Scanner inFile) { Point loc = null; RenderableShape rs = new RenderableShape(loc); String current = inFile.next(); while (inFile.hasNext() && !(isCloseTag(current) && parseTag(current) == LegalTag.Object)) { if (isOpenTag(current)) { switch (parseTag(current)) {...
4cf840cf-d8ba-4a57-9c06-903ccb3d2c40
1
public void setPlacePool(ParkingPlacePool placePool) throws ParkingException { if (placePool == null) { throw new ParkingException("Parking place pool is null"); } this.placePool = placePool; }
30c2ad35-7a17-4eb2-b4c2-2e9b958bf1a9
7
@Override public Query rewrite(IndexReader reader) throws IOException { int numDisjunctions = disjuncts.size(); if (numDisjunctions == 1) { Query singleton = disjuncts.get(0); Query result = singleton.rewrite(reader); if (getBoost() != 1.0f) { if (result == singleton) result = (Query...
2e125d36-ccd3-4367-8980-bd7f6a090d72
0
private void refreshFootprint(int slot) { footprints[slot] = (byte) (random.nextInt(1 << (bitsPerSlot) - 1) + 1); }
c508878c-36a3-4877-91a4-aab050a5062f
2
public void enable() throws IOException { // This has to be synchronized or it can collide with the check in the task. synchronized (optOutLock) { // Check if the server owner has already set opt-out, if not, set it. if (isOptOut()) { configuration.set("opt-out", ...
337e68c4-6710-466a-b264-0dd292961d8d
8
public double[][] fast_idct(double[][] input) { double output[][] = new double[8][8]; double temp[][] = new double[8][8]; double temp1; int i, j, k; for (i = 0; i < 8; i++) { for (j = 0; j < 8; j++) { temp[i][j] = 0.0; for (k = 0; k < 8; k...
a6613141-6fe2-4a23-9743-2ad04af5caa4
3
@EventHandler public void onPlayerMove(PlayerMoveEvent event) { if (event.isCancelled()) return; Player player = event.getPlayer(); if (this.parentarena.getArenaState() != ArenaState.STAT_READY) return; if (!this.parentarena.getplayers().contains(player)) return; event.setCancelled(true); }
e74bb105-de86-47e9-a06d-fe5d6ce3d455
6
private LinkedList<SmallPacket> processData(Byte destination, Byte hops, byte[] data, boolean ack, boolean routing, boolean keepalive) { // data = eh.getPacket(data, destination); LinkedList<SmallPacket> result = new LinkedList<SmallPacket>(); lock.lock(); SmallPacket dp; boolean moar = false; int ma...
7b86129c-05c3-4a2f-8c39-6dd40f4485b5
9
private VariableType simple_expression() { TokenType[] op = new TokenType[]{ TokenType.SPLUS, TokenType.SMINUS, TokenType.SOR}; VariableType ltype, rtype = VariableType.VOID; if(whenToken(new TokenType[]{TokenType.SPLUS, TokenType.SMINUS}) ){ int linum = getLineNumber(); ltype = term(); if(ltype !...
9ad65947-c2b2-4236-a1d0-82faa35006a9
2
public PanelGrille(int largeur, int hauteur) { this.setBackground(Color.black); cellules = new JCellule[largeur][hauteur]; this.setLayout(new GridLayout(largeur, hauteur)); for (int i = 0; i < largeur; i++) { for (int j = 0; j < hauteur; j++) { cellules[i][...
14aa6d57-0c3e-4489-8147-481c5d478599
5
@Override public int pulse() { if (npc != null) { if (npc.isInteracting() && players.getLocalPlayer().isInteracting()) { if (widgets.canContinue()) { widgets.clickContinue(); sleep(1700, 2000); } } else { ...
bd55ffdf-5dab-4c9a-824d-14a347ca52f1
2
public EditorController getNewLevel(int columns, int rows) { EditorController controller = new EditorController(); Board currentLevel = new Board(columns, rows); controller.setModel(currentLevel); LevelEditorView editorView = new LevelEditorView(columns, rows); controller.setView(editorView); // initiali...
b9539fcc-20c0-446f-9844-e78cd804cab4
0
@Override public void removeExtension(String ext) { extensions.remove(ext); }
02e826c0-46c2-415d-8319-b0a7e03f257c
3
private File getFile(String source){ if(source.indexOf(getOsFileSeparator()) == -1){ System.out.println("디렉토리 구분자가 잘못되었습니다."); //리소스 경로 잠못된것인지 체크 } File file = new File(source); if(file.isDirectory() && !file.exists()){ System.out.println("지정한 경로가 존재하지 않습니다."); //리소스 경로에 리소스가 있는지 체크 } return fi...
6cd39d2a-a059-41b1-827e-21b34e57ccd3
7
public String longestPrefixOf(String s) { if (s == null || s.length() == 0) return null; int length = 0; Node<Value> x = root; int i = 0; while (x != null && i < s.length()) { char c = s.charAt(i); if (c < x.c) x = x.left; else if (c > x.c...
ba98b162-15f2-4cc4-9158-95026684b24a
5
private boolean shoudCheckNewVersion() { Logger.getLogger(MainInterface.class.getName()).entering(MainInterface.class.getName(), "shoudCheckNewVersion"); Logger.getLogger(MainInterface.class.getName()).log(Level.INFO, "Checking if the software should check for a new version"); String autoCheckUp...
743b4490-43f0-4ab0-890a-2b8b38871427
1
public Output draw() { if (_drawOutput != null) { return _drawOutput; } return drawRandom(); }
f0c33ff0-66b7-4cae-adef-f60e71251d40
7
@SuppressWarnings({ "unchecked", "rawtypes" }) public void dispatchTask(final String supportedService, final Task t) { List<ProductLine<?>> lines = getProductLinesBySupportedService(supportedService); if (lines == null) { lines = new ArrayList<ProductLine<?>>(); for (ProductLineFactory factory : factoryList)...
d25fa38c-4257-4525-9bc6-b50c116dc986
5
public void flattenSelection() { if (selection.width == 0 || selection.height == 0) return; for (int x = selection.x; x < selection.width + selection.x; x++) { for (int y = selection.y; y < selection.height + selection.y; y++) { try ...
e2d7fe9e-4be2-446f-b72c-4204250a71ed
1
public void tick() { for(int i = 0; i < buttons.length; i++) { oldButtons[i] = buttons[i]; } }
3c12c32f-0fdd-4a5c-b278-240baa5782e8
3
public void removeRow(int position) { // Si la matière est renseignée, on la supprime de la liste des matières de l'enseignant. if(!table.getModel().getValueAt(position, 0).equals("")) { selectedTeacher.removeFieldAt(position); } // Puis on supprime la ligne dans le tableau int indic...
9bfa864a-7817-4445-9330-befc3b129868
7
public void compFinalResult() { do { iStage++; compAllocation(); if (compDistribution()) { /* deadline can not be satisfied */ if (!bDeadline) { System.out.println("THE DEADLINE CAN NOT BE SATISFIED!"); return; } else { System.out.println("\nNEW ROUND WITHOUT CHECKING:"); dEv...
e7873d70-37c5-4169-8ed1-1b90a932fcf3
2
public static boolean hasNull(Object... objs) { boolean result = false; for (Object obj : objs) { if (obj == null) { result = true; break; } } return result; }
90e6b2fb-1568-4402-aaf7-bf8969e8450c
9
public SolarSystem( int numberOfPlanets, int height, int width, Force gravity, boolean centrifugal_flag, double averageEnergy, boolean sun_flag, double sun_size){ int i,j; Color colour; total_mass = 0; centre_of_mass_x = 0; centre_of_mass_y = 0; originalEnergy = 0; potentialEnerg...
ca6d4169-19f5-4b7b-8011-36ff56ca4780
6
public void loadBookmark() throws Exception { ArrayList<Float> myList = new ArrayList<Float>(); FileReader fileReader = new FileReader(new File("BookMark.txt")); BufferedReader reader = new BufferedReader(fileReader); String s; /* float lowVal,highVal,lowValInDataSet,highValInDataSet; int num...
512027e7-a213-4e54-81a1-0279cd5fea0d
4
public static Class<?> formulaClass(Class<?extends Deduction> rule) { try { return (Class<?>) rule.getMethod("formulaClass", null).invoke(null,null); } catch (Exception e) { e.printStackTrace(); return null; } }
9f6e74c3-3f8a-41b1-b6bb-f97cd4f88584
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; final CommandFailure other = (CommandFailure) obj; if (feedbackPropertyReference == n...
bd9dd60e-e97d-4edc-985e-ab82856de5fe
3
public static String encrypt(final String text) { String encryptedText = null; TripleDesCipher cipher = new TripleDesCipher(); cipher.setKey("GWT_DES_KEY_16_BYTES".getBytes()); try { encryptedText = cipher.encrypt(String.valueOf(text)); } catch (DataLengthException e1) { e1.printStackTrace(); /...
ac8f1c33-d28d-4167-b80a-cf23fd59815f
8
private void processLabors(int year, List<Man> mankind, List<Woman> womankind) { List<Man> fathers = calculateFathers(mankind); List<Human> children = new ArrayList<Human>(); for (Iterator<Woman> it = womankind.iterator(); it.hasNext(); ) { Woman woman = it.next(); if (wo...
9a44fa17-832c-4719-bda7-0d47a7439f93
4
public void sortArray() { this.arrayAccess = 0; this.comparisions = 0; int arrLength = this.array.length; /** * This denotes the index of the minimum element. It is assumed that the * first element during the iteration is the minimum and then the array * is s...
f3bc4c5c-32a0-444e-9b8b-4e2bf98a866e
7
protected Double coerceToDouble(Object value) { if (value == null || "".equals(value)) { return Double.valueOf(0); } if (value instanceof Double) { return (Double)value; } if (value instanceof Number) { return Double.valueOf(((Number)value).doubleValue()); } if (value instanceof String) { try ...
9ff1e98c-e912-432d-b15b-014f01733398
0
public XmlRuleSpider(final String filePath){ this.cobweb = new MemoryBasedCobweb(); parseXml(filePath); }
cc377460-2fb8-4cc9-8162-a555f4776a6f
1
public void changePlayerMarker(String username, int markerID){ try { cs = con.prepareCall("{call changePlayerMarker(?,?)}"); cs.setString(1, username); cs.setInt(2, markerID); cs.executeUpdate(); } catch (SQLException e) { e.printStackTrace(); } }
b90dc2a3-fb85-4b66-9b04-2c8303a2d403
8
public void procBtnRech() { int compsSize = getCompsSize(); if (optEmploi.isSelected()) { if (compsSize > 0) { if (!jckbprox.isSelected()) { activerRechercher(true); setErrorMsg(" "); } else { final String text = txtSale...
a03b24f8-29c7-4dfd-93d1-4f6d4950c478
7
public static void addClass(Course course, int type){ //adding class information - name, index, intake size for each course class created String classType = type==1?"lecture":type==2?"tutorial":"laboratory"; System.out.println("How many classes for " + course.getName() + " - " + classType + " ?"); int classAmt;//...
01c81910-c983-4a21-99fb-b63de5fa46a9
1
@Override public List<Integer> update(Criteria beans, Criteria criteria, GenericUpdateQuery updateGeneric, Connection conn) throws DaoQueryException { List paramList1 = new ArrayList<>(); List paramList2 = new ArrayList<>(); StringBuilder sb = new StringBuilder(UPDATE_QUERY); String ...
40fca9c8-1ebe-4e0c-8cdf-ae4cd17d5e55
8
@Override public String getColorRepresentation(char roomChar, int line) { switch (line) { case 0: if (links.containsKey(Integer.valueOf(Directions.NORTH))) return " ^ "; return " "; case 1: { if (links.containsKey(Integer.valueOf(Directions.EAST))) { if (links.containsKey(Integer.valu...
dd5f06c7-e5d1-4a52-927b-a4275622e72f
4
private void lisaaButtonActionPerformed(ActionEvent evt) { if (!kurssiField.getText().isEmpty()) { if (kurssiField.getText().length() > 50) { JOptionPane.showMessageDialog(this, "Kurssin nimi voi olla enintään 50 merkkiä pitkä.", "Virhe", JOptionPane.ERROR_MESSAGE); } else { ...
db07fffe-3865-42c4-a4b3-9fa0f1607efa
1
@Test public void testPermutate1() { int[] testExpansionTabel = new int[]{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 1, 2, 3, 4, ...
629c8a8e-178a-456b-a530-4de21cf01ec6
8
public synchronized void join(RMIClientInterface n) throws RemoteException { threadList.add(n); for (Iterator i = threadList.iterator(); i.hasNext();) { RMIClientInterface client = (RMIClientInterface) i.next(); client.joinMessage(n.getName()); } if (topic != null) { System.out.println(topic); n.to...
71b65680-b5ea-45eb-9aa4-a1b22c373e52
4
public static RecipeBook matcherNOBT(RecipeBook k, Recipe lijst) { RecipeBook a = new RecipeBook(); LNode boek = k.first(); while (boek != null) { boolean res = true; RNode pijl = boek.getElement().first(); while (pijl != null && res==true) { res = lijst.bevatGeq(pijl.getElement()); pijl = pijl...
97535b40-1ec6-4106-826f-19051ee8574f
6
public int lookup(String key) { int index = 0; int base = 1; // base at index 0 should be 1 int keyLength = key.length(); for(int i = 0; i < keyLength; i++) { int previous = index; index = index + base + key.charAt(i); if(index > baseBuffer.limit()) { // Too long return -1; } base = baseBu...
dfdb0a07-dc39-40a7-9897-ff4c30a6138a
1
private static ObjectType parseArray(String sig, Cursor c) throws BadBytecode { int dim = 1; while (sig.charAt(++c.position) == '[') dim++; return new ArrayType(dim, parseType(sig, c)); }
07daf3b2-0139-44c1-82cb-286ad8fbe7ee
4
public BiNode addChild(BiNode child){ if(this.value_type.compareTo(child.value_type) < 0){ child.father = this.father; return child.addChild(this); }else{ if(children[0] == null){ children[0] = child; child.father = this; }e...
de2cf313-b1f8-43e2-8925-35cf0edefda0
1
public static String get(String s) throws IOException { URL url = new URL("http://oberien.net/download/Oberien/" + s); InputStream is = url.openStream(); int i; StringBuffer sb = new StringBuffer(); while ((i = is.read()) != -1) { char c = (char) i; sb.append(c); } is.close(); return sb.toString()...
1e57805d-0544-4e82-b9d4-d9559cf53234
0
public void setFovX(float fovX) { Radar.fovX = fovX; }
c1e5d48c-ee20-4b7d-96f4-56d21a26bd04
5
public void updateAsScheduled(int numUpdates) { if (destroyed()) { I.say(this+" IS DESTROYED! SHOULD NOT BE ON SCHEDULE!") ; this.setAsDestroyed() ; } structure.updateStructure(numUpdates) ; if (! structure.needsSalvage()) { if (base != null && numUpdates % 10 == 0) updatePaving(true) ...
1c8f08b8-5bbf-4144-a842-34e4442e929e
5
public ContentObject getObject(ContentType type, String id) { if (type instanceof RegionType) return getRegion(id); else if (type instanceof LowLevelTextType) { //Text lines, word, glyph for (int i=0; i<regions.size(); i++) { Region reg = regions.getAt(i); if (reg instanceof LowLevelTextContainer) { ...
4812f1d9-3cee-4a87-a000-7b875899c648
3
@Override public void mouseDragged(MouseEvent evt) { int mouseX = evt.getX(); int mouseY = evt.getY(); int row = FindTileRow(mouseY); int col = FindTileCol(mouseX); Point p = new Point(row, col); if (p != lastTilePressed) { if (row != -1 && col != -1) { lastTilePressed = p; ...
fe4aaf0a-a7a1-4f1c-a349-682cd5624604
1
public static void populateEmployeeInfo(ManageEmployeePage emp,String username){ Employee employee=new Employee(); employee.setUsername(username); employee=(Employee)DatabaseProcess.getRow(employee); Gui.setCurrentEmployee(employee); emp.getDobText().setText(employee.getDob().toString()); emp.getAddressText...
eb75ee99-0d06-49f3-878c-e1701372b86b
8
public static int integerParseInt(String data) throws Exception{ int result =0; //返回值 int initType = 1; //用来标示正和负 int i=0; //遍历字符的首 if(null==data) throw new Exception("字符串转化异常"); if('-'==data.charAt(0)){ initType=-1; i++; }else if(0<=data.charAt(...
a864ca09-8110-41a7-bf05-1e0bf2a2c0b7
4
public void start() { if (graphics == null) { throw new SystemMissingException("The game's graphics system has not yet been initialized"); } if (scenemanager == null) { throw new SystemMissingException("The game's scene management system has not yet been initialized"); ...
38811446-4b79-4ca9-bf93-d4ed42a8739c
2
Module addSubModule(Module module) { if (null == module) { return this; } if (null == this.subModules) { this.subModules = new HashSet<>(); } this.subModules.add(module); return this; }
70d31589-6b48-489b-b50e-c4799ae4f8a3
7
public boolean saveChunks(boolean par1, IProgressUpdate par2IProgressUpdate) { int i = 0; for (Iterator iterator = field_73245_g.iterator(); iterator.hasNext();) { Chunk chunk = (Chunk)iterator.next(); if (par1) { func_73243_a(chunk); ...
6e921743-c3ec-4cb5-aa14-617ea7e8f7a4
9
public int newLocal(final Type type) { Object t; switch (type.getSort()) { case Type.BOOLEAN: case Type.CHAR: case Type.BYTE: case Type.SHORT: case Type.INT: t = Opcodes.INTEGER; break; case Type.FLOAT: t = Opcodes.FLOAT; break; case Type.LONG: t = Opcodes.LONG; break; case Type.DO...
5f313b8b-dd7b-4d68-84b5-4f2b89c7b17a
6
public int[] get_circles_years() { if(circles.isEmpty()) return null; int years[]=new int[circles.size()]; int next_year_index=0; boolean is_exist=false; for(int i=0; i<circles.size(); i++) ...
e0e51855-4c28-4026-ab48-1c220bb97637
6
@Override public void executeTask() { try { fs = new ServerSocket(ClientGUITask.port); } catch (Exception e) { System.out.println("problem with initial file sender setup"); } try { do { while (!ClientGUITask.clientSend) ; try { if (ClientGUITask.port != fs.getLocalPort()) { fs....