method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
ff2a21ee-fcd8-4fce-b7e2-2945bbeb9cf1
3
public Expression lookup( String name ) { if ( ! environment.containsKey(name) && this.parent == null ) { System.err.println("Error in DeferredSubst.lookup() looking up " + name + " - Unbound identifier!"); System.exit(1); } else if ( ! environment.containsKey(name) ) { ...
0b688a55-eab1-4e73-97ff-7b534666d276
8
public void doWork() { Connection conn = null; ResultSet rs = null; try { conn = getConnection(dbUrl,properties); if(conn == null) throw new Exception("Failed to obtain connection!"); conn.setAutoCommit(true); // Setting isolation level to read uncommitted, since this is a sample applica...
851216c1-786c-407f-97f8-ac42d756ef4a
1
@Override public void execute(CommandExecutor player, String[] args) { LevelHandler handler = player.getServer().getLevelHandler(); StringBuilder finalStr = new StringBuilder(); for(Level l : handler.getLevelList()) { finalStr.append(l.name); finalStr.append(", "); } player.sendMessage(finalStr.to...
d472691b-d7cf-4de0-ba44-2b745f6a7cc6
3
public void savePlayerInventoryConfig() { if (playerInventoryConfig == null || playerInventoryConfigFile == null) { return; } try { getPlayerInventoryConfig().save(playerInventoryConfigFile); } catch (IOException ex) { this.getLogger().log(Level.SEVERE, "C...
facda66f-1076-44a1-9587-e5abcf840205
9
public SensorGnomonEcho(Transform3D transform, double baseWidth, double axisLength, boolean enableLighting) { super() ; int FRONT = 0 ; int BACK = 1 ; int LEFT = 2 ; int RIGHT = 3 ; int TOP = 4 ; int BOTTOM = 5 ; Point3f[] axes = new Point3f[6] ; float length = (float)axisLength ...
ecfe95e7-6633-4b92-b02a-ffef370ee1dc
9
public void mouseClicked(MouseEvent ev) { //récupération de la position de la souris final Point p = ev.getPoint(); /* Affiche la page d'accueil */ if (m.zoneAccueil.contains(p)) { System.out.println("ActionAccueil"); m.f.page.removeAll(); m.f.clearN...
15d863f3-7dac-45ea-bee0-d2a4f81c088d
7
void fill(char[][] board, int x, int y) { if (board[x][y] == 'X') { return; } Queue<int[]> Q = new LinkedList<>(); int[] pair = { x, y }; Q.offer(pair); while (!Q.isEmpty()) { int[] p = Q.poll(); if (board[p[0]][p[1]] == 'O') { board[p[0]][p[1]] = 'D'; if (p[0] - 1 >= 0) { int[] top = ...
ffc308bf-6d6d-458d-830b-cc921dce53f7
2
@Override public void run() { try { while (true) { CalcState state = Main.workQueue.take(); CalcState returnState = work(state); Main.doneQueue.put(returnState); } } catch (InterruptedException ex) { Logger.getLogger...
cc0f64b8-f3ed-4201-a7da-516ac7481c48
2
public void showStorage(){ System.out.println("Total Balance : " + access(Accesscreate())); if(itemList.size() != 0){ System.out.println("List item : "); for(Item item : itemList){ System.out.println("item :" + item.toString()); } }else{ System.out.println("There is no item in list"); }...
ce8a5e7a-4b8f-47ed-8146-90ce7862c5e1
9
public Dimension preferredLayoutSize(final Container parent) { Component c0, c1, c2, c3, c4, c5; synchronized (parent.getTreeLock()) { final Insets insets = parent.getInsets(); int componentIndex = 0; final int rowCount = this.rowHeights.length; for (int...
3fe85f7b-54ac-405c-8a6f-33e4274ee6d6
5
@Override public void process(Map<String, Object> jsonrpc2Params) throws Exception { if (method.equals(Constants.Method.GET_FORUM_CONTENT)) { getForumContent(jsonrpc2Params); } else if (method.equals(Constants.Method.GET_CATEGORY_CONTENT)) { getCategoryContent(jsonrpc2Params)...
10ef1ce6-ba9b-4567-86f3-38032dabbfc8
1
public void buildAccount(int fn) throws IOException { FileReader fr = new FileReader(accDir+fn+".txt"); BufferedReader textReader = new BufferedReader(fr); int numberOfLines = 6; String[] textData = new String[numberOfLines]; for (int i = 0; i < numberOfLines; i++) { textDa...
4c106da0-5f03-4129-8890-2bbc300cf6aa
9
protected void makeMove(int type,int stepX,int stepY){ switch(type){ // Swiping on x with going stepY up or down each time we end on a border case 0: if (x+stepX>(width-1)||x+stepX<0) y = (height+y+stepY)%(height); x = (width+x+stepX)%(width); break; case 1: // Swiping on y if (y+stepY>(heigh...
de28f75f-06b6-4764-af09-6efe27a11045
5
protected void paintScrollContentBorder(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h) { Insets bi = new Insets(0, 0, 0, 0); if (tabPane.getBorder() != null) { bi = tabPane.getBorder().getBorderInsets(tabPane); } if (tabPane.getTabPlacement() == ...
b3fc0687-bd11-4c50-b8b9-8b48c93639fd
4
@Override public Command nextCommand() { if (thereIsAnUnreachedGoal()) { if (cabin.areDoorsOpened()) { return close(); } if (isNextGoalAbove()) { return up(); } else { return down(); } } ...
4639305c-1ac4-491b-9f57-e10f6166d800
8
public static void main(String[] args) throws SlotException, NotUniqueException { // TODO get username password from command line? String username = "komodo"; String password = "komodomq51"; String filename = "komodo.dat"; Galaxy galaxy = null; UniverseGenerator ug = n...
1410a3d7-ab34-4f2d-84d5-feba7f878f7c
4
public void applyTransformation(int frameId) { if (vertexSkin == null) return; if (frameId == -1) return; Animation animationFrame = Animation.forFrameId(frameId); if (animationFrame == null) return; Skins skins = animationFrame.animationSkins; vertexModifierX = 0; vertexModifierY = 0; vertexMo...
021272bb-787e-46ad-8acb-92133f987b9f
4
void installListeners() { styledText.addCaretListener(new CaretListener() { public void caretMoved(CaretEvent event) { updateStatusBar(); updateToolBar(); } }); styledText.addListener(SWT.MouseUp, new Listener() { public void handleEvent(Event event) { handleMouseUp(event); } }); style...
c11eb4f0-1857-4b3f-aa6d-c9243f4b5460
5
public final WTabPanel setOrientation(Orientation orientation) { if (this.orientation != orientation) { this.orientation = orientation; switch (orientation) { case TOP: ((FlowLayout) super.getLayoutManager()).setFlowType(FlowLayout.VERTICAL_FLOW); ...
04929555-c3cd-46a2-bb91-66db9c76253f
3
void paintPalette(PaintEvent event) { GC gc = event.gc; gc.fillRectangle(paletteCanvas.getClientArea()); if (imageData.palette.isDirect) { // For a direct palette, display the masks. int y = py + 10; int xTab = 50; gc.drawString("rMsk", 10, y, true); gc.drawString(toHex4ByteString(imageData.palette...
a675c181-d5c1-4aed-8927-6e6f9cf89108
2
public String getName() { if (longname != null && !longname.equals("")) return longname; return shortname; }
250205d0-cad8-4c30-bf80-727e911c06e0
9
private void setupUpdater() { Updater updater = new Updater(this, 71125, this.getFile(), Updater.UpdateType.DEFAULT, true); Updater.UpdateResult result = updater.getResult(); switch (result) { case SUCCESS: // Success: The updater found an update, and has readied it to be // loaded the next time the ser...
9f1afb4f-3621-4cc5-8ab0-5ab11569e5a8
0
public void setKeyReference(String value) { this.keyReference = value; }
b3503f55-469d-41eb-b7bf-ae644c01e301
8
@Override public int castingQuality(MOB mob, Physical target) { if((mob!=null)&&(target!=null)) { if(CMLib.flags().isSitting(mob)) return Ability.QUALITY_INDIFFERENT; if(!CMLib.flags().isAliveAwakeMobileUnbound(mob,false)) return Ability.QUALITY_INDIFFERENT; if(mob.isInCombat()&&(mob.rangeToTarge...
900c6624-44af-45b0-84a2-f2fc218af712
9
private InanimateEntity parseEntitiy(String[] values) { String name = values[0]; InanimateEntity item = null; if(name.equals(Entities.KEY.name())){ //Its a Key! parse its description and id item = new Key(parseDescription(2, values), Integer.parseInt(values[1])); }else if(name.equals(Entities.BAG.name())...
8ba98dc0-7487-4eb6-99be-49a1e5f0fa79
0
public String getNick() { return _nick; }
a8f1f00b-26c9-4a1b-adca-46715d62fef4
7
public int goodAxe() { for (int j = VALID_AXE.length - 1; j >= 0; j--) { if (c.playerEquipment[c.playerWeapon] == VALID_AXE[j]) { if (c.playerLevel[c.playerWoodcutting] >= AXE_REQS[j]) return VALID_AXE[j]; } } for (int i = 0; i < c.playerItems.length; i++) { for (int j = VALID_AXE.length - 1; ...
076194f2-c13e-4722-8848-bea8d6e3d27e
5
private boolean probabilityLogic(SudokuGrid grid) { boolean isPossible = true; boolean change = false; int i,j; while(isPossible) { isPossible = false; for(i=0;i<9;i++) { for(j=0;j<9;j++) { if(((boxProbability[i][j].xpectedNum).size()==1)&&(boxProbability[i][j].isFinal ==...
77e69116-9ab8-4a19-a205-8323bd4728d5
3
public void insertWriteThread() { System.out.println("Inserting write thread"); WritePropertiesThread writeThread = new WritePropertiesThread(); Future<?> future = ProtoThreadQueue.getInstance().addToQueue(writeThread, "write"+THREAD_NAME_COUNT++); try { System.out.println(fu...
d227d7f5-996c-43be-8bc8-9fe70179f0e0
4
public void leer_bc(String nombre) throws IOException { long ap_actual, ap_final; RandomAccessFile leer_archi = new RandomAccessFile(nombre, "r"); while ((ap_actual = leer_archi.getFilePointer()) != (ap_final = leer_archi.length())) { char etiqueta[] = new char[15], te...
933e8e6f-44fd-49ac-8cfb-9cba8283b45a
4
public void tick() { if (!isLive()) { return; } if (weapon != null) { weapon.tick(); } if (dir == Direction.LEFT) { setX(getX() + (-speed)); } else if (dir == Direction.RIGHT) { setX(getX() + speed); } ...
d5324aba-f078-4f6b-8657-498d67c6137d
1
@SuppressWarnings("deprecation") public void testConstructor_RP_RP_PeriodType3() throws Throwable { YearMonthDay dt1 = null; YearMonthDay dt2 = new YearMonthDay(2005, 7, 17); try { new Period(dt1, dt2, PeriodType.standard()); fail(); } catch (IllegalArgumentEx...
e5d9eeb4-0c5c-4272-bcc2-911731fca78d
3
public void visitPhiCatchStmt(final PhiCatchStmt stmt) { if (stmt.target == from) { stmt.target = (LocalExpr) to; ((LocalExpr) to).setParent(stmt); } else { final ListIterator e = stmt.operands.listIterator(); while (e.hasNext()) { final LocalExpr expr = (LocalExpr) e.next(); if (expr == from)...
38e520fb-2c93-4430-8c84-67be5e8cf6a3
3
public int getAnimationFrames(int paramInt) { switch (paramInt) { case 0: default: return 1; case 1: return 6; case 2: } return 7; }
958f3810-c103-4c8f-9960-848da5a959cb
3
@Override public Tuple getNext() throws IOException { if (!activeNode) return null; while (!ready) { logger.info("GraphChi-Java running: waiting for graphchi-engine to finish: " + this.getStatusString()); PigStatusReporter.getInstance().setStatus(getStatusString()); ...
d751a4fd-53b8-4148-8c16-5c3039a55825
5
static Set<IndexHint> validate(Set<IndexHint> indexHints) { boolean hasUse = false; boolean hasForce = false; for (IndexHint indexHint : indexHints) { hasUse = hasUse || indexHint.getType() == IndexHint.Type.USE; hasForce = hasForce || indexHint.getType() == IndexHint.Type.FORCE; } if (h...
109bd14e-aac8-4e8f-bc82-9e71d2a782a6
0
public Worker () { //initial settings isInputActive = true; isTimeSet1 = false; isTimeSet2 = false; this.keyboard = new BufferedReader(new InputStreamReader(System.in)); System.out.println(MSG_WELCOME); //start this.lifeCycle(); }
ca927357-b641-48c5-8046-6abd0f4b4f8a
8
public PreCombatDialog(FreeColClient freeColClient, GUI gui, FreeColGameObject attacker, FreeColGameObject defender) { super(freeColClient, gui); CombatModel combatModel = attacker.getGame().getCombatModel(); Set<Modifier> offence = sortModi...
fb648c46-25fd-445d-ab66-6c2a867b75c3
3
public boolean isTriangular(int[][] array) { boolean isTriangular = true; for (int i = 1; i < array.length; i++) { for (int j = 0; j < i; j++) { if (array[i][j] != 1) { isTriangular = false; } } } return isTriang...
b95114b3-9ac7-4748-bbbb-919ac7f6dbce
4
private void copyDir(File src, File dest) throws IOException { if (src.isDirectory()) { if (!dest.exists()) { dest.mkdirs(); } String list[] = src.list(); for (int i = 0; i < list.length; i++) { File dest1 = new File(dest, list[i]); ...
2ab1d95b-ddfb-45b9-be97-400114b198af
1
public void test_getDifferenceAsLong_long_long() { assertEquals(0L, iField.getDifferenceAsLong(1L, 0L)); assertEquals(567L, iField.getDifferenceAsLong(567000L, 0L)); assertEquals(567L - 1234L, iField.getDifferenceAsLong(567000L, 1234000L)); assertEquals(567L + 1234L, iField.getDifference...
95f93695-a6a1-4dc6-8b5c-546f9e3c076b
7
public static Node parseNodes(EnumArray[][] ara) { Node curr = new Node(); Node start = curr; Node nextRow = curr; Node nextCol = curr; // RoomFactory factory = RoomFactory.getInstance(); for (int i = 0; i < ara.length; i++) { for (int j = 0; j < ara[i].length; j++) { if (i == 0 && j == 0) ...
64116e19-d54e-4276-a022-6e99b8d4c19f
2
public boolean canPlayMonument(int playerIndex) { //Checks status, players turn, has player already played dev card, and if the player has a monument card if (generalDevCardPreconditions(playerIndex) && serverModel.getPlayers().get(playerIndex).getOldDevCards().getMonument() > 0) { return true; } else { ...
144ab291-2cc0-43cb-8a79-53e9363c1348
0
public void loadConsole() throws DataLoadFailedException { dataHolder.loadConsole(); }
777ce5c4-72e7-4780-8111-e4ea6a88d2b1
1
@Test public void shouldThrowErrorWhenFileCannotBeOpened() throws IOException { //given File tmpFile = folder.newFile(FILENAME); String filePathString = tmpFile.getAbsolutePath(); tmpFile.delete(); //when try { FileParser fileParser = new FileParser(filePa...
e4952a2e-7142-40dc-a6c8-366c1dae647e
6
public static String[] bracketToCapsule(String text, String[] brackets) { ArrayList<String> capsuled = new ArrayList<String>(); for (String bracket : brackets) { String[] bracketSplit = bracket.split(","); if (bracketSplit.length != 3) continue; String startBracket = bracketSplit[0]; String endBrac...
30ccc05e-0eda-497f-8ed3-8f0bb9db8f62
6
public CHRModel() { for(int i=0;i<imagePalette.length;i++){ if(i>0 && (i % 4 != 0)) { imagePalette[i] = (byte)i; } } for(int i=0;i<spritePalette.length;i++){ if(i>0 && (i % 4 != 0)) { spritePalette[i] = (byte)i; } ...
e1fb0e09-3666-4562-a1bc-ba9bb157b447
0
public String getExportFileFormat() { return (String) exportFormatComboBox.getSelectedItem(); }
1eda0940-d61a-4c82-9bb4-c8a782217520
1
final public CycObject predicate(boolean requireEOF) throws ParseException, java.io.IOException, UnsupportedVocabularyException { CycObject t = null; t = representedTerm(false); eof(requireEOF); {if (true) return t;} throw new Error("Missing return statement in function"); }
9b70a230-7e1c-4487-9d6e-27350d7fc9e9
9
public static int edmons_karp(int source, int finish) { int u; mf = 0; s = source; t = finish; while (true) { f = 0; Queue<Integer> q = new LinkedList<Integer>(); ArrayList<Integer> dist = new ArrayList<Integer>(); dist.addAll(Collections.nCopies(V, INF)); dist.set(s, 0); q.offer(s); p.c...
22389135-c058-4e59-9d4c-6dbd9ada422f
5
public void breakDNAStrand(){ String temp = null; for(int i = 0; i < arraySize;i++){ //checks to see if it is iterating through the for the first time. //This increase efficiency since we already know the outcome // if(i == 0){ temp = stringCharN(i); maxPercentageDNA = percentageCG; dnaStri...
5fbbbcb1-7db2-4617-ad08-553772bf7424
5
public double kinship(Individual individual) { if(this==individual) return 1; Expression other= (Expression) individual; double k=0; double mF= this.fitness(); double hF= other.fitness(); k=(64-Math.abs(mF-hF))*(mF+hF/2)/64; k= k/Math.abs(depth()-other.depth()); if(this.isLeaf()^other.isLeaf()) k/= 3; ...
46b33b77-db6d-4499-af4e-e3f85740c104
2
public boolean VerificaColisao(Point ponto) { for (int i = 0; i < pontos.size(); i++) { if (forma.contains(ponto)) { return true; } } return false; // boolean resposta = false; // int cont1 = 0, cont2 = 0; // int[] dx = new int[3]; // ...
f33ea3f6-75fa-456f-a513-6ebf8ac62f2b
6
public void blinkparticle() { if (untouchable > 0) { if (blink > 15 && blink <= 30) { setImage(invin); } else if (blink >= 0 && blink <= 15) { setImage(empty); } } else if (untouchable == 0) { getWorld()...
def0b329-46d0-442b-a630-0f41f7edbcd5
1
@Override public void changedMostRecentDocumentTouched(DocumentRepositoryEvent e) { if (e.getDocument() == null) { setEnabled(false); } else { calculateEnabledState(e.getDocument().getTree()); } }
6c4af261-cb1f-4121-8bdb-ed60d3a37258
5
public void reMoveElements(PetriNet pn, int x, int y) { for (Place p : pn.getListOfPlaces()) { p.setX(p.getX() + Math.abs(x) + 30); p.setY(y - p.getY() + 30); } for (Transition t : pn.getListOfTransitions()) { t.setX(t.getX() + Math.abs(x) + 30); t...
900ef1a0-3b22-40f3-a6a6-dff8abe16e93
2
public static void toggleMoveableInheritanceForSingleNode(Node node, CompoundUndoable undoable) { int oldValue = node.getMoveableState(); int newValue = Node.MOVEABLE_INHERITED; boolean isMoveable = node.isMoveable(); if (oldValue == Node.MOVEABLE_INHERITED) { if (isMoveable) { node.setMoveableState(N...
9c40a27f-4b61-4de7-afbe-39adbbc4c3fc
1
public void disconnect(){ //Shut down client try{ System.out.println("Quitting client"); ftp.disconnect(); } catch(Exception e){ } }
e09401d9-1c68-4a58-9211-86a911c4b47e
1
MAJ_Interface(MonInterface vue1, ArrayList<Message> filemessages, boolean temps_reel) { vue = vue1; this.filemessages = filemessages; dernier_nb_messages = 0; terminer = false; if(temps_reel == true) { go_temps_reel(); } else { go_hors_ligne(); } }
6aa977d6-733c-4fa9-8c4e-5e60b94d81bb
5
@Override public boolean canConvertImplicit(Type v) { if (this == v) return true; if (v instanceof TypeList) { TypeList tl = (TypeList) v; if (types.size() != tl.types.size()) return false; for (int i = 0; i < types.size(); ++i) { if (!types.get(i).canConvertImplicit(tl.types.get(i))) retu...
9a1bce99-0ab5-474f-bec8-4a379784d12e
9
public boolean posNeg(int a, int b, boolean negative){ if((a > 0 && b < 0) && negative == false){ return true; } else if((b > 0 && a < 0 ) && negative == false){ return true; } else if(negative == true){ if(a < 0 && b < 0){ return true; } } return false; }
b863f121-d4db-4f9f-9685-803d14a163e1
6
static final int method1082(int i, boolean bool) { anInt1795++; int i_1_ = ByteBuffer.anInt7207; while_44_: do { do { if ((i_1_ ^ 0xffffffff) != -1) { if (i_1_ != 1) { if ((i_1_ ^ 0xffffffff) == -3) break; break while_44_; } } else { if (bool) return 0; return Cla...
f69aa283-7d68-45c1-b546-ae466657039e
6
private void estableceTipo(String tipo) { if (tipo.equals(ManejadorMatrizXML.TRISD)) { tipocod = 1; } else if (tipo.equals(ManejadorMatrizXML.TRISN)) { tipocod = 2; } else if (tipo.equals(ManejadorMatrizXML.TRIID)) { tipocod = 3; } else if (tipo.equals(ManejadorMatrizX...
e62f6c0d-f351-48d3-9797-c1ca092cad23
2
public List<Contato> buscarContatoPorNome(String nomeBusca){ List<Contato> contatosEncontrados = new ArrayList<Contato>(); List<Contato> contatosBusca = contatoDAO.listarContatos(); for (Contato contato : contatosBusca) { if(contato.getNome().toLowerCase().contains(nomeBusca.toLowerC...
f23134d4-86b6-4973-ae38-47b182ded384
8
public static void heapSiftDown(edu.isi.stella.Stella_Object[] heap, int start, int end, Stella_Object value, java.lang.reflect.Method predicate) { { int parent = start; int child = Stella.NULL_INTEGER; Stella_Object leftchild = null; Stella_Object rightchild = null; heap[start] = value; ...
753209b8-e89e-4cd5-b3ac-48e3f4a4984f
7
private void rmTask(String jid, String tid) { Task[] taskArray = null; synchronized (this.syncTaskList) { taskArray = this.syncTaskList.toArray(new Task[0]); } if (taskArray == null || taskArray.length < 1) { return; } Task objTask = null; for (int i = 0; i < taskArray.length; i++) { ...
f994c59d-f51b-49b4-b96e-45cef3a2fed1
9
private void handleTransmission(boolean blnRes) { this.setSysMsg(EzimLang.WaitingForResponse); this.jbtnYes.setVisible(false); this.jbtnNo.setVisible(false); this.jbtnClose.setVisible(true); EzimFrxList.getInstance().put(this.id, this); // let the user choose where to save the incoming file if (blnRes)...
5c1c4c48-af1f-48eb-ad50-8034d2b1bf32
2
public double standardError_of_ComplexModuli() { boolean hold = Stat.nFactorOptionS; if (nFactorReset) { if (nFactorOptionI) { Stat.nFactorOptionS = true; } else { Stat.nFactorOptionS = false; } } double[] re = this.array_as_modulus_of_Complex(); double standardError = Stat.standardError(re);...
c9337fee-3ff8-42cb-87e3-4bf03ed98519
2
public void insertaFinal(T dato){ Nodo<T> nodoQ = new Nodo<T>(dato); if(this.inicio == null){ this.inicio = nodoQ; }else{ Nodo<T> nodoT = this.inicio; while(nodoT.getLiga() != null){ nodoT = nodoT.getLiga(); } nodoQ.setLiga(null); nodoT.setLiga(nodoQ); } }
6b2a8551-77bd-4967-97e8-3394fad9831c
8
private Nodo factor() { Nodo tem = null; if (aux.getTipo()==Nodo.tipoToken.ParentesisIzquierdo){ aux=(Tokens2)tok.next(); tem = this.expresion(); if (aux.getTipo()==Nodo.tipoToken.ParentesisDerecho) { aux=(Tokens2)tok.next(); } else { ...
5711a8e4-8dee-49e5-8a5b-f12741d135b0
9
public boolean contains(AASystem other) { if (other.atoms.isEmpty()) { return true; } if (other.arches() > this.arches()) { return false; } if (other.as() > this.as()) { return false; } if (thi...
230c3951-a8e2-4f13-91af-13895d43b1ec
3
public static int getLargestPeriod(List<Partition> lop) { int ret = 0; for (Partition p : lop) { for (PeriodicTask pt : p.getWorkload()) { if (pt.getPeriod() > ret) ret = pt.getPeriod(); } } return ret; }
52dbd716-cba1-4062-be94-666a2d17ce01
3
@Override public void decode(final ByteBuffer buf, final int available, final StringBuilder log) throws Exception { if (available <= 0) { data = null; if (log != null) log.append("USINT type, data : - nothing-\n"); return; } ...
4d73437e-27ce-407a-ac61-158b7663efa6
0
public static void main(String[] args) { AdditiveNumber additiveNumber=new AdditiveNumber(); System.out.println(additiveNumber.isAdditiveNumber("12012122436")); System.out.println(Integer.MAX_VALUE); }
e7678a0b-9bf6-4eb6-99f4-ba97504b1b1f
1
public String toString() { if (nome != null) return nome.toString(); return id + ""; }
28d02584-2694-4b92-aca0-bac796ba0156
0
public int y() { return y; }
ba12c496-7ddc-486a-a34c-f48b53a1c342
2
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String str1; // str1=request.getParameter("option"); System.out.println("option is"+str1); Connection conn; Statement stmt; PrintWriter out=response.getWriter(); response.setContentType("...
e6202b9b-310e-47f6-b084-ae69c67f265e
7
protected static Target nextMineFace(ExcavationSite site, Tile under[]) { // // Firstly, we set up some initial reference variables, and sample the // tiles and outcrops that can harvest from. final Presences presences = site.world().presences ; final int SS = World.SECTOR_SIZE ; final Batch <...
8f141e05-ce8e-4fdc-acc9-66b7b280b2e5
1
public static void spawnSkeletonWarriorIron (Location loc, int amount) { int i = 0; while (i < amount) { Skeleton SkeletonWarriorIron = (Skeleton) loc.getWorld() .spawnEntity(loc, EntityType.SKELETON); SkeletonWarriorIron.getEquipment().setChestplate( ...
dd74f4b3-0480-49d8-bb1e-0f15c0694958
8
@SuppressWarnings("unchecked") private boolean loadKotHMatches(){ //Creates an instance of the file location to save the objects File f = new File(this.getDataFolder()+ File.separator + "Matches.dat"); //If the file does not exist, then we cannont read the file, so return false if (!f.exists())return fal...
fec58672-4457-4c05-b6f3-e80aa769fb88
0
public void setIdEncargo(int idEncargo) { this.idEncargo = idEncargo; }
fa4be59c-045b-44ef-bb9b-b12f6cc47b9e
7
FileOnDisk(File file, String string, long l) throws IOException { try { if ((l ^ 0xffffffffffffffffL) == 0L) l = 9223372036854775807L; if (l < file.length()) file.delete(); aRandomAccessFile3036 = new RandomAccessFile(file, string); maximumSize = l; aLong3039 = 0L; aFile3046 = file; ...
9b54a8b3-7726-4486-8e44-a155211c56b9
1
public static void setInstanceSupplier(Function<Class<?>, Object> instanceSupplier) { Injector.instanceSupplier = instanceSupplier; }
73b1997f-e1db-4b1f-85f1-498c73d92bce
2
private void inOrderPositions(Position<Entry<K, V>> p, ArrayList<Entry<K, V>> ps) throws InvalidPositionException, BoundaryViolationException { if (hasLeft(p)) inOrderPositions(left(p), ps); ps.add(p.element()); if (hasRight(p)) inOrderPositions(right(p), ps); }
d38b3440-5b80-4f56-98f7-badae08de5d3
5
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof ConsultantAddress)) { return false; } ConsultantAddress other = (ConsultantAddress) object; if ((this.addId == ...
4a72a1db-54f0-423c-9af0-ece35bffbfa8
0
public ArrayList<String> getGradeTitle() { return gradeTitle; }
44bebbea-b341-4c2a-b986-1f8bebceb553
6
public static void main(final String[] args) { if (args.length != 1) { System.out.println("First argument: GraphJ file"); System.exit(1); } BufferedInputStream fstream = null; try { fstream = new BufferedInputStream(new FileInputStream(args[0])); } catch (final FileNotFoundException e) { ...
ecd53797-6d55-4268-afbf-ba92b1637744
8
public void fetchUrl(String container1, String url1, String dest) { String fileData = ""; BufferedWriter bufferWritter = null; try { String container = container1; String url = url1; String destination = dest; Document doc = org.jsoup.Jsoup.connect(url).timeout(10 * 1000) .userAgent("Mozilla/5....
c825f02a-1390-4c96-9cdb-9b93ead21964
5
public List<Book> getBooksByBookLanguage(int branch_id, int booklangid) { List<Book> list = new ArrayList<>(); Connection con = null; Statement stmt = null; try { DBconnection dbCon = new DBconnection(); Class.forName(dbCon.getJDBC_DRIVER()); con = Dr...
8278a743-a469-48b6-a2b1-79a54bc8f49c
2
private Object arbitrary(Type paramType, int position, Random random, long size) { Gen<?> generator = genCache.get(Pair.make(paramType, position)); if (generator == null) { generator = generator(paramType, position); genCache.put(Pair.make(paramT...
2de98499-466c-48c2-b2c2-9c14e487d94f
0
@Test public void findDuplicateTypeHand_whenOnePairExists_returnsOnePairPlusHighestKicker() { Hand hand = findDuplicateTypeHand(twoEightsPlusQueenTenSevenKicker()); assertEquals(HandRank.OnePair, hand.handRank); assertEquals(Rank.Eight, hand.ranks.get(0)); assertEquals(Rank.Queen, hand.ranks.get(1)); assertE...
34762e27-bb8f-473c-85b2-93057de2ab43
2
public static void main(String[] args){ // String s1 = "nematode_knowledge"; // String s2 = "empty_bottle"; String s1 = "ABCDEFGH"; String s2 = "ABCGIJKDC"; // method 1 int[][] lcs = lengthLCS(s1, s2); System.out.println(lcs[s1.length()][s2.length()]); String cs = extractLCS(s1, s2, lcs); System.out....
349d3803-13d6-4a09-bcae-8364c078a0ee
4
private void bonus(Invasor invasor){ //obtenemos el valor de la dificultad int value = juego.getDificultad().VALUE; //1:fácil, 2:medio, 3:difícil //habrá 1/value+1 posibilidades de que se recuperen de 1 a 3 escudos if (random(0, value+1) == 1){ //probamos suerte ...
cec0d795-506e-4191-a239-2fb80dab5478
1
public List getSongsList(){ List<Song> songs = null; try{ org.hibernate.Transaction tx = session.beginTransaction(); songs = session.createCriteria(Song.class).list(); } catch (Exception e){ e.printStackTrace(); } return songs; }
4a95b4f3-264c-4931-938e-365dfd1c3d4c
3
public String version_string() { switch (h_version) { case MPEG1: return "MPEG-1"; case MPEG2_LSF: return "MPEG-2 LSF"; case MPEG25_LSF: // SZD return "MPEG-2.5 LSF"; } return(null); }
10b19a1a-c7c4-4223-a8c5-b1e4f3a5c862
9
private void clickCell(Board.Move move) { Point TL = getCellLoc(move.X, move.Y); int x = 0, y = 0; switch(move.VAL) { case 1: x = 4; y = 4; break; case 2: x = 15; y = 4; break; case 3: x = 26; y = 4; break; ...
d1d69f35-9a98-47f8-a562-b4977390d12e
5
private final void retrieveGlobal() { PreparedStatement ps = null; ResultSet rs = null; try { final Connection con = DatabaseConnection.getConnection(); ps = con.prepareStatement("SELECT * FROM drop_data_global WHERE chance > 0"); rs = ps.executeQuery(); while (rs.next()) { globaldrops.add( ...
0dcdf7c9-f52c-429f-b32a-7ce533b1e711
9
public void parseParameters(String paramstring) throws MaltChainedException { if (paramstring == null) { return; } final String[] argv; try { argv = paramstring.split("[_\\p{Blank}]"); } catch (PatternSyntaxException e) { throw new LibException("Could not split the parameter string '"+paramstring+"'....
90da6e2c-83be-4ef0-8b54-19c504e43795
2
public boolean isAValidKey(Integer key) throws Exception { for (Integer code : getKeySet()) { if (key.equals(code)) return true; } throw new KeyException("Key is Invalid"); }
6484f80c-7ac3-40fd-b9b5-0a6f281fab3c
9
static String getName(Config.Identifier i, HashSet<String> taken) { String base = ""; for (Config.FontType ft : i.fonts) { String fb = ft.font.replaceAll("[^a-zA-Z]", "").toLowerCase(); if (ft.italic) { fb += "_italic"; } base += fb + "_"; } if (base.isEmpty()) { base = "identifier"; } String all ...