method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
224a678e-4754-4b4e-9c2f-fd17df2a37f5
2
public static void resume(String s) { if (mute) return; if (clips.get(s).isRunning()) return; clips.get(s).start(); }
15b8931e-58ec-4986-a34f-d0a250130c94
4
public static void main(String[] args) { Graph G = null; try { G = new Graph(new In(args[0])); } catch (Exception e) { System.out.println(e); System.exit(1); } int s = Integer.parseInt(args[1]); ISearch search = new Search(G, s); for (int v = 0; v < G.V(); v++) if (search.marked(v)) ...
e544b49f-3c2b-493e-9c1a-3a72e106f06e
2
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((fst == null) ? 0 : fst.hashCode()); result = prime * result + ((snd == null) ? 0 : snd.hashCode()); return result; }
5d9a0d37-0c4f-4393-9226-36b13a4973aa
7
void doneCommands() { if (commandsRunning.isEmpty()) return; // Commands to delete LinkedList<OsCmdRunner> toDelete = new LinkedList<OsCmdRunner>(); for (OsCmdRunner cmd : commandsRunning) { if (cmd.isDone()) { toDelete.add(cmd); // Any error executing command? if (cmd.getExitValue() > 0) { ...
afede6a6-ebbb-4fba-b0ba-cd89fb39f793
9
public static void main(String[] args) { // TODO code application logic here //7. Фирма имеет три магазина. Известен доход каждого магазина за каждый, //из десяти дней. Определить: //а) какой из магазинов получил максимальный общий доход за 10 дней; //б) какого числа фирма по...
e73a2ad4-4af3-4cfa-868b-9e21ae2da986
8
public static void newCodeExtractor(String fn, String str){ System.out.println("called"); String[] renta_repeater = str.split("renta_repeater"); ArrayList<String> renta_repeater_filtered = new ArrayList(); for (String rr : renta_repeater) { if (rr.contains("renta_publicado"))...
c24c9068-86dd-49e1-9e3e-3833ed91d515
7
@Override public void actionPerformed(ActionEvent arg0) { JCheckBoxMenuItem clickedItem = (JCheckBoxMenuItem) arg0 .getSource(); if (arg0.getActionCommand().equals("paintDoorLabels")) { paintDoorLabels = clickedItem.isSelected(); } else if (arg0.getActionCommand().equals("paintSensorLabels")) { pa...
05363dd4-36de-4100-b9ca-ce744e59fee8
8
public ArrayList<ArrayList<Integer>> subsetsWithDup(int[] num) { ArrayList<ArrayList<Integer>> rst = new ArrayList<ArrayList<Integer>>(); if (num.length == 0) { rst .add(new ArrayList<Integer>()); return rst; } Arrays.sort(num); int[] point = new int[num.length]; int[] cou...
bce11046-c0e3-41bb-852b-6426160c7be4
9
private void transcribeHarmony(Staff staff) { transcriber.printString(new HarmonyPart()); MeasureOfHarmonies measure = new MeasureOfHarmonies(); Iterator<Event> staffIterator = staff.iterator(); while (staffIterator.hasNext()) { Event event = staffIterator.next(); if (event instanceof Harmon...
069492b2-c59d-4975-9141-72cdea70cf68
7
public int compareTo(Version other) { if (other == null) { return 1; } String[] versionParts = version.split("\\."); String[] otherVersionParts = other.version.split("\\."); for (int i = 0; i < Math.min(versionParts.length, otherVersionParts.length); i+...
7f7349c1-ad95-4a19-a468-ab66c52b957c
8
@Test public void testRandomInitializer() { Environment.getInstance().setUseWeightsSharedMemory(true); NeuralNetworkImpl nn = NNFactory.mlp(new int[] { 3, 2 }, true); NNRandomInitializer rand = new NNRandomInitializer(new MersenneTwisterRandomInitializer(-0.1f, 0.1f), 0.5f); rand.initialize(nn); for (Layer l ...
5b0d84a5-e707-4497-9e81-6832f1a0a74a
8
public void connect(TreeLinkNode root) { if (root == null) return; TreeLinkNode p = root; TreeLinkNode q = null; TreeLinkNode nextNode = null; while(p != null) { if (p.left != null) { if (q != null) ...
c6f4b04a-cb45-412a-8445-cf998c0967e4
0
public void setParams(Params params) { this.params = params; }
67dea111-afa4-47d7-a757-d555d5febc55
7
public int[] checkLines() { ArrayList<Integer> temp = new ArrayList<>(); int i, j, k; for (i = tailleX - 1; i >= 0; i--) { k = 0; for (j = 0; j < tailleY; j++) { if (plateau[i][j] != 0) { k++; } } ...
cfbf7434-0419-4cb0-b269-08af9f49ae01
9
@Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String condicao = " WHERE "; condicao += (request.getParameter("nome") != null && !request.getParameter("nome").isEmpty()) ? " NOME LIKE '%" + ...
b8a409eb-d1ee-4e5c-8350-0755432bff1d
4
public void ensureCapacity(int i) throws MidiUnavailableException { if (!initialized) throw new MidiUnavailableException(); int repeat = (int) Math.floor((double)i / 16); for (int j = 0; j < repeat; j++) { Synthesizer s = new SoftSynthesizer(); s.open(); ...
a34ceae1-c99c-49b5-8332-e752e2452288
3
public EnemyLauncher findLauncherById(String launcherId) { EnemyLauncher user_launcher = null; for (EnemyLauncher launcher : getLaunchers()) { if (launcher.getLauncherId().equalsIgnoreCase(launcherId)) { user_launcher = launcher; break; } } if (user_launcher != null) { return user_launcher; }...
5678d8df-705a-437c-89c4-e94280e11332
9
String jvxlUncompressString(String data) { if (data.indexOf("~") < 0) return data; if (logCompression) Logger.info(data.length() + " uncompressing\n" + data); String dataOut = ""; char chLast = '\0'; for (int i = 0; i < data.length(); i++) { char ch = data.charAt(i); if (ch == '~') { int nChar...
2946f645-1cf0-4bd6-9ffe-e796a873646e
1
@JsonIgnore public void validate(boolean useDefaultValidator) throws ValidationException { if (useDefaultValidator) { this.getDefaultSearchParamsValidator().validate(); } else { this.validator.validate(); } }
d404fb4c-a22c-4ee8-8513-b604280bbe8b
0
public void setItemName(String value) { this.itemName = value; }
161854f6-707c-4c08-a1e3-80fdfb6a3635
7
@Override public FiniteAutomaton execute(FiniteAutomatonTransformerMode mode) { FiniteAutomaton fa = getInput(); fa.getStartState(); if (mode == FiniteAutomatonTransformerMode.NONDESTRUCTIVE) { fa = fa.clone(); } State rejectState = null; if (alphabet == null) { alphabet = FiniteAutomaton...
45e4be56-2a67-48e9-8cfe-f73d92539bcb
2
@Test public void delMinReturnsCorrectOrderWithRandomNegativeInput() { Random r = new Random(); int[] expected = new int[100]; for (int i = 0; i < 100; i++) { int randomInteger = r.nextInt(5000) - 10000; h.insert(new Vertex(0, randomInteger)); expected[i] ...
e6c7f05c-76f9-4b64-829a-ff09e6347796
0
@Override public Human next() { return humans[current++]; }
ae3fe72b-3ea0-48fb-93f1-b4513522c202
0
private int getIndex(long time) { return (int) ((time - this.startOfDay) / Appointment.TIME_UNIT); }
ce788904-ffc9-4536-a24f-e147ed4bc55f
0
@Override public void lost() { JOptionPane.showMessageDialog(null, "You Lose!\nYour high score was: " + score + " points", "Lost", JOptionPane.WARNING_MESSAGE); // Reset Possibly Stuck Keys leftKeyPressed = false; jumpKeyPressed = false; rightKeyPressed = false; // Reset Score and Lives score = 0;...
666995a8-9b40-4e18-93ab-774439f53c5b
0
public CheckResultMessage check9(int day) { return checkReport.check9(day); }
8140e5ec-ab83-40c6-bdfd-1eb8452b256a
2
private void registerSuperAliases(ChunkyCommand command) { for (String alias : command.getAliases()) { if (alias.startsWith("/")) superAliases.put(alias.toLowerCase(), command); } }
d5d24fcd-9c1c-4fce-b151-38e106cb7853
2
private AbstractInsnNode[] cleanInsn(AbstractInsnNode[] rawInstructions) { List<AbstractInsnNode> cleanedInstructions = new ArrayList<AbstractInsnNode>(); for (AbstractInsnNode n : rawInstructions) if (n.getOpcode() >= 0) cleanedInstructions.add(n); return cleanedInstructions .toArray(new AbstractInsnN...
e159791e-86c0-4242-aeb9-9f81ef40c18f
8
public static char leftOf(char direction){ //determine the direction to the left of this one switch(direction){ //TODO: figure out a better way to handle directions than these commands case '1': return '2'; case '2': return'3'; case '3': return '6'; case '4': return '1'; case '6': return ...
acb236a6-0a85-429f-a137-46ce199368c2
3
void doDefaultFileAction(File[] files) { // only uses the 1st file (for now) if (files.length == 0) return; final File file = files[0]; if (file.isDirectory()) { notifySelectedDirectory(file); } else { final String fileName = file.getAbsolutePath(); if (! Program.launch(fileName)) { MessageBox ...
9f3fa725-5751-4e9e-a3eb-a7751ec6e16e
4
public boolean Init() throws LoadingOpenTransactionsFailure { final Logger l = Logger.getLogger(Load.class.getName()); if (!isNativeLoaded) { throw new LoadingOpenTransactionsFailure(LoadErrorType.NATIVE_NOT_LOADED, "Native Libs Not Loaded!"); } if (isInitialized) { ...
c123eb35-4f64-4b40-94e7-b52e5354506e
0
public void parse() { LLParsePane panel = new LLParsePane(environment, grammar, targetParseTable); environment.add(panel, "LL(1) Parsing"); environment.setActive(panel); }
2e43bc5f-f308-44b5-b610-4358794c2b43
2
public static void displayTIFFs(PixImage[] images) { JFrame frame = new JFrame(); Box box = Box.createHorizontalBox(); for (int i = 0; i < images.length; i++) { box.add(new JLabel(new ImageIcon(pixImage2buffer(images[i])))); if (i < images.length - 1) { box.add(Box.createHorizontalStrut(10)); } } ...
36d55cbe-700c-46d2-afc6-6a930a1dfa39
8
public String convert(String s, int nRows) { if (s == null || s.isEmpty()) { return s; } if (nRows <= 1) { return s; } int zigsize = 2 * nRows - 2; String result = ""; for (int i = 0; i < nRows; i++) { for (int j = i; j < s.length(); j += zigsize) { result += String.valueOf(s.charAt(j)); ...
575f3df0-ba46-43ff-8f18-ac528ce13d14
4
@Override public void run() { name = Thread.currentThread().getName(); write("Opening up socket."); try { socket = new ServerSocket(2226); } catch (IOException e){ writeErr("Could not open port 2226. \nEither an instance of Chat Server is already \nrunning or ...
aae2bfde-2be1-4764-8124-36a1b604a4cf
4
@SuppressWarnings("unchecked") public LinkedHashMap<K, V> parse(Object... args) throws ClassCastException, IllegalArgumentException { LinkedHashMap<K, V> attrs = new LinkedHashMap<K, V>(); if (args.length % 2 != 0) { throw new IllegalArgumentException("Odd number of elements in varargs map!"); } K key = n...
688eb0cb-f75b-4126-aba1-f0d43e3cb88f
6
public Boolean loadPlayer1() { boolean test = false; if (test || m_test) { System.out.println("Loader :: loadPlayer1() BEGIN"); } if (loadPlayer(getPlayer1File())) { setPlayer1(createPlayerType(m_playerInfo[PLAYER_TYPE_INDEX])); g...
8d15a27d-b8ce-4a13-9e30-97251e03565d
1
@Override protected void onMessageNotDelivered(int messageId, int resendMessageId, String message) { System.out.println("Message not delivered: \"" + message + "\" Resending..."); try { resend(resendMessageId, message); } catch (CouldNotSendPacketException e) { System.out.println("Message could not be rese...
c208190d-e0bd-4a9b-947a-05f76788716b
7
public static void main(String[] args)throws IOException { double finalAnswer=-99999; double finalcurvePoints=0; double finalPeriod=0; double finalPercDif=0; double finalminSRDif=0; double finalTP=0; double[] PortfolioValue=new double[60*260]; ...
ac8de190-da63-4ce4-a3eb-0beabeadbad0
6
public void parseMail(String path, String FileName) { String file = path + "/" + FileName; BufferedReader br = null; try { br = new BufferedReader(new FileReader(file)); } catch (FileNotFoundException e) { e.printStackTrace(); } try { for (String line = br.readLine(); line != null; line = br.rea...
bced6e31-6b91-4080-9f88-761399b2ad95
8
public static double[][] benchmarkJLargeArraysByteSequentual(long[] sizes, int[] nthreads, int iters, String file) { double[][] results = new double[nthreads.length][sizes.length]; long k; System.out.println("Benchmarking JLargeArrays (bytes, sequentual)"); for (int th = 0; th < nthr...
ee5c6869-43ca-4fff-a726-6af5c090d060
9
int determineFileType(String filename) { String ext = filename.substring(filename.lastIndexOf('.') + 1); if (ext.equalsIgnoreCase("bmp")) { return showBMPDialog(); } if (ext.equalsIgnoreCase("gif")) return SWT.IMAGE_GIF; if (ext.equalsIgnoreCase("ico")) return SWT.IMAGE_ICO; if (ext.equalsIgnoreCas...
ede65ae6-8177-4c9b-b937-3cd605369c2b
5
private void IDSResultsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_IDSResultsButtonActionPerformed int count; String Message, Message_MALICIOUS_COMMAND = "", Message_MALICIOUS_TRANSACTION = ""; count = 0; while (jTPFile.getText().toUpperCase().indexOf("MALICIOUS_COMMAND") !...
caabab92-a6b8-48e6-b6e7-9535e9a375df
3
public static void main(String[] args) { ArrayList<persoon2> persoonlijst = new ArrayList<>(); String filenaam = "C:/Users/Sander Blijlevens/git/Sander-Blijlevens/week-3/Personen/personen2/personen2.txt"; try { ObjectInputStream in = new ObjectInputStream(new FileInputStream( filenaam)); persoonlijst ...
fae793a6-6672-456b-ab29-d0e1fe47a159
4
public PointGame getRightNeighbor() { int x0 = x; int y0 = y; while (x0 < MAXX) { // check if x=2 and y=3, we cannot go to the right. if(x0==2 && y0==3) break; x0++; if (Board.validPoints.contains(new PointGame(x0,y0))) { return new PointGame(x0,y0); } } return null; }
cb858e74-1431-40f1-bf29-9c8839193715
4
public List getMaps(GameAction gameCode) { ArrayList list = new ArrayList(); for (int i=0; i<keyActions.length; i++) { if (keyActions[i] == gameCode) { list.add(getKeyName(i)); } } for (int i=0; i<mouseActions.length; i++) { if (mouse...
03609c03-615b-410e-839f-e6ebffcc4e7d
4
public static void createSpell(int castId, int casterY, int casterX, int offsetY, int offsetX, int angle, int speed, int movegfxID,int startHeight, int endHeight, int finishID, int enemyY, int enemyX, int MageAttackIndex) { for (Player p : server.playerHandler.players) { if(p != null) { client person = (client)p; ...
bdf4d7d6-c2ad-4557-aa1e-a7ef07969210
0
public boolean isDefendingNow() { return isDefendingNow; }
228be3a6-481f-4fa4-9e3b-e388d322e0a3
5
@Override public GameState[] allActions(GameState state, Card card, int time) { GameState[] states = new GameState[1]; states[0] = state; if(time == Time.DAY) { Color faction = card.getFaction(); Player p = state.getPlayer(faction); if(p.getHand().isEmpty()) { GameState end = new GameStat...
2e56a1ad-f2ea-4b02-9410-e3da835d6d81
8
public ArrayList<Node> getWaitingPath() { if (_attachPoint != null) { Node node; int[] coord_src; int[] coord_dst; int[] tmp_coord_src; int[] tmp_coord_dst; coord_src = this._map.getVehiculeCoord(); coord_dst = this._attachPoint.clone(); for (ArrayList<Arr...
69fc987d-33ad-40d8-a4a8-774cc073ee3d
4
public Set<ImplementationBuildWrapper> findImplementersBuildWrappers() { ImmutableSet.Builder<ImplementationBuildWrapper> builder = ImmutableSet.builder(); List<AbstractProject> allProjects = Hudson.getInstance().getAllItems(AbstractProject.class); for (AbstractProject project : allProjects) { if(project insta...
67fa00f4-2196-4432-bf40-c43bad5d2e98
5
public QueryExecuter() { File file = new File(System.getProperty("user.dir")+File.separator+"connectionString.txt"); Scanner scan = null; try { scan = new Scanner(file); while (scan.hasNextLine()) { connectionString = scan.nextLine(); break; } connection = DriverManager.getConnection(connectio...
e5b80caf-1840-48a2-998e-3b2415da3076
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Indication other = (Indication) obj; if (kind == null) { if (other.kind !...
3827d721-c1d2-4149-a325-e04b4f3fd187
8
public static void main(String[] args) { List<Rider> riders = new ArrayList<Rider>(); riders.add(new Rider("John", 170)); riders.add(new Rider("Giant", 230)); riders.add(new Rider("Bob", 5)); riders.add(new Rider("Shadhow", -1)); Map<Raceable, Integer> raceables = new ...
fed13229-259c-4378-8428-793f387971fa
3
public void addFile(String person, String path) { try { ArrayList<User> users = DataBase.getInstance().getUsers(); for (Iterator it = users.iterator(); it.hasNext();) { User user = (User) it.next(); if (user.getLogin().equals(person)) { ...
10a90d2d-02ce-4796-9459-906bdb9a8634
6
public <T> Result quickCheckWithResult( Arguments arg, ITesteable<T> testeable ) { ITerminal terminal = null; if(arg.chatty) { terminal = new SystemTerminal(); } else { terminal = new NullTerminal(); } ...
caad7693-0ae7-40e7-8288-5187bdeb9062
2
public boolean shot(Position position) { FieldItem prey = field.get(position); if (!isOccupied(position)) { return false; } if (!validPosition(position)) { return false; } return prey.fired(); }
291b4271-f88a-44bd-b594-d696aae7837e
5
@Override public void draw(Graphics g) { if (acceptingUserInput() && getClosestPt() != null) { g.setColor(Color.LIGHT_GRAY); g.drawLine(getMouseLoc().x, getMouseLoc().y, getClosestProjectionPt().x, getClosestProjectionPt().y); if (captured) { g.setColor(Color.BLUE); int radius = (int)...
d9e36bb3-faa6-4582-a20a-0f75ec5a167b
9
public boolean nextNonLeaf() { assert nextEnt != -1 && nextEnt < entCount: "nextEnt=" + nextEnt + " entCount=" + entCount + " fp=" + fp; nextEnt++; final int code = suffixesReader.readVInt(); if (versionAutoPrefix == false) { suffix = code >>> 1; startBytePos = suffixesReader.getPosition(); ...
0c3766f9-708c-4920-98a7-48cc969e50e8
3
public int trouverIdDernierClient(){ if(this.livraisons != null){ int maxId = -1; for(Livraison liv : this.livraisons){ int id = liv.getIdClient(); if(id > maxId){ maxId = id; } } return maxId; } else{ return -1; } }
3b99a482-d9c4-4aea-997f-e5b506de48f9
2
public void actualiza(long tiempo) { if (isDispara()) { // dispAnim.actualiza(tiempo); num--; if (num == 0) { setDispara(false); } } else { anima.actualiza(tiempo); } }
ae2cb767-5d94-43fc-90bd-aa1f2716eff3
4
@Override public void executar() throws Exception { boolean goBack = false; while ( !goBack ) { mostrarOpcions(); int choice = readint("\nOPCIO: "); switch (choice) { case 1: ...
20c3cf6a-812b-4cdb-9170-0c1d016fed59
3
public static byte[] inetAddresses2Bytes(InetAddress[] val) { if (val == null) { return null; } byte[] buf = new byte[val.length * 4]; for (int i=0; i<val.length; i++) { InetAddress addr = val[i]; if (!(addr instanceof Inet4Address)) { ...
e1b83f20-17f5-4491-9ee8-5eea79c7219e
4
public static void restartService() { Process restarter = null; try { String platform = System.getProperty("os.name").toLowerCase(); if(platform.contains("windows")) { restarter = Runtime.getRuntime().exec("net stop novacomd"); doProcess(restarter)...
ccdf6761-dd8a-43a0-807c-09a26465728d
5
@Override public void run(){ while(this.subAlive){ try { pushSubAtributes(); } catch (IOException ex){ Logger.getLogger(SubmarineServer.class.getName()).log(Level.SEVERE, null, ex); } //scan the area ar...
74aa48d7-d3e7-4d02-ae1d-e5d32a47657d
8
protected static Ptg calcDec2Hex( Ptg[] operands ) { if( operands.length < 1 ) { return new PtgErr( PtgErr.ERROR_NULL ); } debugOperands( operands, "DEC2HEX" ); long dec = PtgCalculator.getLongValue( operands[0] ); int places = 0; if( operands.length > 1 ) { places = operands[1].getIntVal(); } ...
41d035f3-bcf4-4376-8c48-60fbebc73194
5
protected String getMessageForDelete() { String message = ""; int selectedRowsCount = table.getSelectedRows().length; Object tableStatuss = cmbActiveNonActivePersons.getSelectedItem(); if (selectedRowsCount == 0) { message = CHOOSE_MORE_THAN_ONE_STOCK_OWNER; JOptionPane.showMessageDialog(frameDBView, mess...
ce3f1de3-024f-43f9-9a30-1e9f2e5a6e56
3
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed Transferable clipboardContent = getToolkit().getSystemClipboard().getContents(this); if ((clipboardContent != null) && (clipboardContent.isDataFlavorSupported(DataFlavor.strin...
550aec22-82c5-4fd9-abdd-530194ff9099
4
@Override public boolean containsCharacter(String name) { JOSObject<? , ?> raw = this.getObject(name); if(raw == null) return false; if(raw.getName().equalsIgnoreCase(CHARACTER_NAME)) return true; return false; }
9d82b9f7-f95f-4567-b930-10464ddb0d55
8
protected void mergeOneField(MergeState mergeState, FieldInfo fieldInfo) throws IOException { long maxPointCount = 0; int docCount = 0; for (int i=0;i<mergeState.pointsReaders.length;i++) { PointsReader pointsReader = mergeState.pointsReaders[i]; if (pointsReader != null) { FieldInfo rea...
0be20771-b950-440a-a729-2a1673f319bc
9
public int minSubArrayLen(int s, int[] nums) { int left = 0, right = nums.length - 1, sum = 0; for (int i = 0; i != nums.length; i++) { sum += nums[i]; } if (sum < s) { return 0; } while (left < right) { if (nums[left] < nums[right] && ...
290b7d84-a8e5-4449-8c95-ca2a0e225ff4
0
public void init(FilterConfig config) throws ServletException { filterPatten = (String) config.getInitParameter("filterPatten"); }
5559672b-1053-4246-b32f-45d9ed42ce9f
2
private List<String> parsearListaDeObjetivos(List<Regla> listaReglas) { List<String> objetivos = new ArrayList<String>(); for (Regla r : listaReglas) { String producto = r.getProducto(); if (!isCadenaEnLista(producto, objetivos)) { objetivos.add(producto); ...
d894c921-2a3e-4849-b099-e585334e9207
5
public static void moveSubArray(int[] arr, int from, int to, int offset){ int iters=0; if(from>to){ iters=((arr.length-from)+to)+1; } else { iters=(to-from)+1; } if(offset==1){ int previous=circleIncrement(to, arr.length); for(int i=0;i<iters;i++){ swap(arr,to,previous); previous=to; t...
3636644c-33e1-45be-9108-638755608b1f
3
void checkLabel(final Label label, final boolean checkVisited, final String msg) { if (label == null) { throw new IllegalArgumentException("Invalid " + msg + " (must not be null)"); } if (checkVisited && labels.get(label) == null) { throw new IllegalArgumentException("Invalid " + msg + " (must ...
4dbdf302-71b9-49e8-a6ce-5cd3264f0c54
4
private void animateCreation(Graphics g) { if (creating == false) { creating = true; for (int i = 0; i < 100; i++) { particles.add(new Particle((int) (Math.round(Math.random() * FRAME_WIDTH)), (int) (Math.round(Math.random() * FRAME_HEIGHT)))); ...
1b3780e0-0587-4c48-aa7a-265d1739c2e2
9
public static void playerTurn(Adventurer player){ hangOn(500); if(player.getHP()<=0){ System.out.println(player.getName()+" is incapacitated.\n"); player.setHP(0); }else{ System.out.println("\nChoose an action for "+player.getName()+" (Hit rate: "+player.HitRate(opponent)+"%):\n\nA : attack");//displa...
b74651ab-663e-4cdd-a557-1cb950f8f06b
5
public Writer write(Writer writer) throws JSONException { try { boolean b = false; int len = length(); writer.write('['); for (int i = 0; i < len; i += 1) { if (b) { writer.write(','); } Obj...
12c762c5-fc08-48a8-a0d0-010887e172d3
2
public void run() { if (progressBar != null) { progressBar.setMinimum(0); progressBar.setMaximum(countClasses(0, "")); } readPackage(0, new HashMap(), "", 0); TreeModelListener[] ls; synchronized (listeners) { ls = (TreeModelListener[]) listeners .toArray(new TreeModelListener[listeners.size()]...
7acee17f-cefe-4606-bcc4-b16c6d2f246b
7
public boolean actionForage(Actor actor, Flora source) { if (source == null || source.destroyed()) { source = null ; return false ; } float labour = 0, skill = 0 ; if (actor.traits.test(HARD_LABOUR, ROUTINE_DC, 1.0f)) labour++ ; if (actor.traits.test(CULTIVATION, ROUTINE_DC, 1.0f)) ...
c0d2f8b7-edfd-4100-a777-940fe09ecf5c
0
public GlassPane() { super(); rect = new Rectangle(); }
aef5cc3a-6c46-4518-b1a8-94f287586b9b
2
public static Apfloat cdfApfloat(double x, double y, double p[], double q[]) { Apfloat xAp = new Apfloat(x); Apfloat mhalf = new Apfloat(-0.5); // -1/2 /* Evaluate pnorm for sqrt(32) < |z| < 50 */ Apfloat result = new Apfloat(0.0); Apfloat xsq = new Apfloat(1.0 / (x * x)); Apfloat xnum = xsq.multiply(new A...
88e55dfd-3834-4f1a-9fb3-e43ef0fad46d
1
@Override public boolean sendSubmission(Submission submission, String username) throws RemoteException { ContestTime ct = new ContestTime(); if (ct.canSubmit()) { submission.setResult(Submission.RESULT_PENDING); // Set is as // pending submission.setTimeSubmitted(System.currentTimeMillis()...
9c7052fb-3448-4343-95b6-c9f7758a86de
0
public Alloy() { this.fjp = new ForkJoinPool(); this.initialized = false; }
c79c34fb-3063-44dd-a407-4378c62ae0d8
9
public GuideUserAction predict(DependencyStructure gold, ParserConfiguration configuration) throws MaltChainedException { final StackConfig config = (StackConfig)configuration; final Stack<DependencyNode> stack = config.getStack(); if (!swapArrayActive) { createSwapArray(gold); swapArrayActive = true; } ...
54278aa5-8cde-4691-aa56-9c5bcd5f78f5
0
public Set<String> listarProductosDisponibles(){ return stock.keySet(); }
f49fd0c9-12e4-4900-a358-6d37a3c8436b
8
public void annulerDernierCoup() { Deplacement dernierDeplacement; Tour dernierTour = getDernierTour(); if (dernierTour != null) dernierDeplacement = getDernierTour().getDernierDeplacement(); else dernierDeplacement =null; if (dernierDeplacement!=null){ for (DeSixFaces de : dernierTour.getDeSix...
67a3d708-5c17-42f0-bb96-938e897ea7ef
2
public boolean pressedOnce(final int keycode) { boolean isPressed = pressed(keycode); boolean wasCheckedBefore = oncepressedSet.contains(keycode); if (isPressed) oncepressedSet.add(keycode); return isPressed && !wasCheckedBefore; }
c38f06e2-f8e3-46d6-b8f6-7930307aabd0
2
public void openWr(String filename) { try { this.close(); this.filename = filename; outf = true; file = new File(this.filename); fw = new FileWriter(file); //bw = new BufferedWriter(fw); //pw = new PrintWriter(bw); } cat...
8d10e6a9-0b05-4f5c-8b92-60ca6ba6df20
1
public Set getDeclarables() { if (exceptionLocal != null) return Collections.singleton(exceptionLocal); return Collections.EMPTY_SET; }
666d5ee5-ea2f-42c1-a43f-ab566f17a6d6
9
protected Apply(Element apply, FieldMetaInfo.Optype opType, ArrayList<Attribute> fieldDefs, TransformationDictionary transDict) throws Exception { super(opType, fieldDefs); String functionName = apply.getAttribute("function"); if (functionName == null || functionName.length() == 0) { /...
e19cfac7-1cc3-4d5e-ad7c-802d98542552
8
private FormField parseField(XmlPullParser parser) throws Exception { boolean done = false; FormField formField = new FormField(parser.getAttributeValue("", "var")); formField.setLabel(parser.getAttributeValue("", "label")); formField.setType(parser.getAttributeValue("", "type")); ...
62b4c1e8-00b8-4ba1-958d-1b83e3086007
4
public Case getCase(int i, int j){ Case c = null; if (i>=0 && j>=0 && i<taille && j<taille){ c = cases[i][j]; } return c; }
6d5887a6-e386-41fd-8e9a-40f8543badcd
1
public boolean replaceSubBlock(StructuredBlock oldBlock, StructuredBlock newBlock) { if (catchBlock == oldBlock) catchBlock = newBlock; else return false; return true; }
0fb43078-76ac-45fa-8c0e-a9f87024de7a
5
public String explainScore(StringWrapper s, StringWrapper t) { BagOfTokens sBag = (BagOfTokens) s; BagOfTokens tBag = (BagOfTokens) t; StringBuilder buf = new StringBuilder(""); PrintfFormat fmt = new PrintfFormat("%.3f"); buf.append("Common tokens: "); for (Iterator<Toke...
b639c729-a39f-48c4-a01e-19441c391bb7
8
protected String convertFuzziedRewards(){ if(reward==0){ return "is killed"; } else if(reward>0&&reward<=0.4){ return "is hitten by enemy"; } else if(reward>0.4&&reward<0.6){ return "n.a."; } else if(reward>=0.6&&reward...
f37d953f-d6e5-46fc-a721-4b0e9cbabd80
9
@Test public void testSourceRequirements() { // check data access class try { Class<?> clazz = Class.forName("suncertify.db.Data"); Assert.assertTrue("DBMain is not assignable from " + clazz, DBMain.class.isAssignableFrom(clazz)); } cat...
10a22dd6-2c34-4f95-ba9a-6cd438ef9473
7
@Override public boolean equals(Object obj) { boolean areEqual = false; if (obj != null && CatCage.class.isAssignableFrom(obj.getClass())) { CatCage catCageOther = (CatCage) obj; areEqual = (catCageOther.getIdentifier().equals(getIdentifier())) && areCellContentsEqual(getBottomCell(), catCageOther.getBott...
06410b55-0a9e-4a52-87fa-1cf1619238cd
0
public void setDataType(String dataType) { this.dataType = dataType; }
df9f9463-4840-4853-92bb-6d990e0799bc
5
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final PropertyTree other = (PropertyTree) obj; if (this.getValue() != other.getValue() && (this.getValue() == n...