method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
0bc38360-d4d8-40f3-ae43-1b193d15cb65
9
public void run() { // Used to assign each error an id so an error tree structure can be // constructed. int errorIdCounter = 0; while (true) { try { // Read from dump file to point array String dumpData = dReader.readDumpFile(); if (dumpData != null) { JSExecutionTracer.addPoint(dumpData);...
ec9ff06e-3fbc-4e17-983a-9e0ea5901c2a
9
private void parseSimpleFace(String[] tokens, MeshData md, ScanData sd) { short[] indices = new short[tokens.length-1]; for(int i = 1; i < tokens.length; i++) indices[i-1] = (short) (Short.parseShort(tokens[i])-1); if(computeNormals) { // First we compute the normal float[] normal = {0,0,0}; fl...
907bbbb1-ac7c-49b0-99c2-bef7c7c06caf
5
public void setEditedBlock(JBlock b) { if(b==editing) return ; if(editing!=null) finnishEdit(); editing=(startBlock)b; fields.clear(); fieldsPane.removeAll(); name.setText(editing.name); silent.setSelected(editing.silent); displayName.setSelect...
e8f7b254-f130-45c8-983c-55f4a540614e
2
public void testProviderSecurity() { if (OLD_JDK) { return; } try { Policy.setPolicy(RESTRICT); System.setSecurityManager(new SecurityManager()); DateTimeZone.setProvider(new MockOKProvider()); fail(); } catch (SecurityException...
3442187f-fcbb-4924-a96c-389aad5a8bf2
2
public static String itostrx(int hex) { final int BASE = 16; final int ASCII_DIGITS = 48; final int ASCII_LETTERS = 55; final int CUTOFF = 10; String result = ""; do{ int remainder = (hex % BASE); if(remainder >= CUTOFF){// If it is a letter result = (char) (remainder + ASCII_LETTERS) + result; ...
2b2aa540-2212-4a12-a92e-1c07ce089eba
8
public static void shootProjectile(String projectileName, Screen screen, int ref, TimeManager currentTime, int dist, Point shooterPosition) { if (projectileName.equals(ProjectileNames.CANNISTER_SHOT)) { Projectile canisterShot = new CanisterShot(screen, ref, currentTime); canisterShot.shoot(dist, shoot...
981c658e-9027-4f62-87ba-e1eede229a62
1
public static void install() { if (installed == null) { installed = new RepeatingReleasedEventsFixer(); Toolkit.getDefaultToolkit().addAWTEventListener(installed, AWTEvent.KEY_EVENT_MASK); } }
db4b508f-2a9a-40d7-8606-887a23e3fb2f
7
public static Rule_COMMA parse(ParserContext context) { context.push("COMMA"); boolean parsed = true; int s0 = context.index; ArrayList<Rule> e0 = new ArrayList<Rule>(); Rule rule; parsed = false; if (!parsed) { { ArrayList<Rule> e1 = new ArrayList<Rule>(); int ...
d6860bc3-457a-4f63-8180-fd79e8bca631
5
@Override public void run() { while (true) { if (shutdown) { if (this.id % 10 == 0) // every 10th thread logger.info("Thread #" + this.id + " increased the counter " + this.sum + "-times"); else logger.info("Thread #" + this.id + " summed up to " + this.sum); return; } if (st...
06f2e070-8f83-4532-853a-cbd592536198
7
@Override public Object execute(Scope scope, Statement tokens) { Method method = null; Object[] args = new Object[tokens.size()]; for (int i = 0 ; i < args.length;++i){ try { args[i] = scope.getValue(tokens.get(i)); } catch (PoslException e) { // TODO Auto-generated catch block e.printStackTr...
be4f9e31-5ee6-4b0b-ad57-d3fa2cf70ae9
2
private Float averageMarketChange(float[] changes) { float sum = 0; float valid = 0; for (float f : changes) { if (f == f) { sum += f; valid++; } } // System.out.println("SUMMING GIVES : " + sum); return sum / valid; }
03234d63-98a1-463f-b152-d88fc4a32151
4
public List<BatchResult> doFlushStatements(boolean isRollback) throws SQLException { try { if (isRollback) { return Collections.emptyList(); } else { return executeStatements(); } } finally { for (StatementData stmt : statem...
1621edcf-4d93-4663-a5ef-0e5266b94521
6
@Override public boolean onCommand(final CommandSender sender,final Command command,final String label,final String[] args) { if (args.length <= 1) { return false; } final OfflinePlayer player = this.plugin.getServer().getOfflinePlayer(args[0]); if (player == null) { ...
b808b77d-384d-4099-8579-8ca9e7fa1850
7
private void createFiles(File path, File rel) throws DBException { if (path.isDirectory()) { for (String name : path.list()) createFiles(new File(path, name), new File(rel, name)); } if (null != rel && !path.isDirectory()) { NodeNameDTO node = nameDAO.find(rel, false); if (null == n...
1e7a8e59-6c49-45fb-9448-85e390f6529a
9
public static String modUtente(HttpServletRequest req) { HttpSession s = req.getSession(); UserBean user = (UserBean) s.getAttribute("user"); String username = user.getUsername(); try { Utente u = Model.getUtente(username); switch (u.getPermission()) { ...
84e7275a-44f1-4c13-91b7-ef81e10fb046
1
private void addTable() { tableModel = new DefaultTableModel(new String[] { "nazwa", "punkty", "czas zakończenia" }, 0); table = new JTable(tableModel); table.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 1) { JTable target = (JTable) e....
71cb3169-1b85-4e84-8057-7e025417342f
0
public String getEventName() { return eventName; }
581e44f5-6385-4ce6-b6f1-c04904a88f08
9
static GateType getTypeFromString(String type) { if (type.toUpperCase().trim().equals("AND")) return AND; else if (type.toUpperCase().trim().equals("OR")) return OR; else if (type.toUpperCase().trim().equals("NOT")) return NOT; else if (type.toUpperCase().trim().equals("NAND")) return NAND; else ...
fa081218-7474-4059-928b-f5541b4c00eb
0
public void setProtocol(FileProtocol protocol) { this.protocol = protocol; setText(protocol.getName()); }
a0dc3fd4-7787-4c21-9d09-9779178e8a3a
5
@Override public Class<?> getColumnClass(int columnIndex) { switch(columnIndex){ case 0: return String.class; case 1: return String.class; case 2: return Double.class; case 3: return Component.class; default: return Object.class; } }
47b08615-65fa-4a19-abb2-4714e9aeb726
7
void createTabList(Composite parent) { tabList = new Tree(parent, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); Arrays.sort(tabs, new Comparator() { public int compare(Object tab0, Object tab1) { return ((GraphicsTab)tab0).getText().compareTo(((GraphicsTab)tab1).getText()); } }); HashSet set = new ...
d333b2bf-ad6c-4cc4-9ba1-5f0b3020ffc0
8
public void resetStatus() { if (map.isEmpty()) return; synchronized (map) { for (ModelCanvas mc : map.values()) { if (!mc.isUsed()) continue; final MDContainer c = mc.getMdContainer(); c.getModel().stop(); c.getModel().clearMouseScripts(); c.getModel().clearKeyScripts(); mc.setUse...
d6352d05-bfce-4075-bf86-31eba7e3d189
5
public void step(SimulationComponent mComp) { String tLine = lineList.get(ticks); tick(); Pattern tPat1 = Pattern.compile("\\s*print\\s*\"(.*)\".*"); Matcher tM1 = tPat1.matcher(tLine); if(tM1.matches()) { mComp.addStatusMessage(name + " output : " + tM1.group(1)); } else { mComp.add...
7824156f-ed14-41aa-96f7-6c0bae56ebd3
4
private void btnConsultarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnConsultarActionPerformed // TODO add your handling code here: try { //Para establecer el modelo al JTable DefaultTableModel modelo = new DefaultTableModel(); this.Jtable.setModel(...
357881a0-6c9f-41cc-908a-dcdb906b0af0
5
public double Caldj(int iy, int im, int id) throws palError { int ny; double d = 0.0; TRACE("Caldj"); /* Default century if appropriate */ if ((iy >= 0) && (iy <= 49)) { ny = iy + 2000; } else if ((iy >= 50) && (iy <= 99)) { ny = iy + 1900; ...
47bd1b79-ef6a-4ccc-916e-d85c7d10e87a
8
@Override public boolean okMessage(final Environmental myHost, final CMMsg msg) { if(!super.okMessage(myHost,msg)) return false; if(!(affected instanceof MOB)) return true; if((msg.source()==affected) &&(msg.targetMinor()==CMMsg.TYP_DAMAGE) &&(msg.target() instanceof MOB) &&(msg.source().getWorshi...
d2db69b5-66db-460a-8eac-dad6bd7ba116
5
public double operar(){ double a,b, resultado = 0; String operacion; while(miPila.size()>2){ a = Double.parseDouble(miPila.pop()+""); b = Double.parseDouble(miPila.pop()+""); operacion = miPila.pop()+""; ...
2d90eba1-c7c8-431c-80a3-386e35b8e056
4
@Test(expected = UnsupportedOperationException.class) public void test() throws IOException { pq = new PacketQueue(); cl = new ConnectionListener(Settings.getPortNumber(), "", pq); Thread simserver = new Thread(new Runnable() { @Override public void run() { ...
29148d38-7975-4cf9-a125-a31100c4c2a2
1
public static void main(String[] args) throws SQLException { //RequetesPays pp= new RequetesPays(); pays ok // RequetesPays.ecrirePays("ALLEMAGNE"); // VuePays vtest= new VuePays(); // vtest.setVisible(true); //Pays ll= RequetesPays.paysId(2); /...
95027882-b0a8-4841-b5f0-5598f9c18d0c
8
@Override public void undoableEditHappened(UndoableEditEvent undoableEditEvent) { UndoableEdit edit = undoableEditEvent.getEdit(); // Make sure this event is a document event if (edit instanceof DefaultDocumentEvent) { // Get the event type DefaultDocumentEvent event = (DefaultDocumentEvent) edit; Even...
7e035e1d-44a3-4415-a6b9-e56e6e44a0ee
6
protected Term extractTerm(String fis) { String line = ""; for (char c : fis.toCharArray()) { if (!(c == '[' || c == ']')) { line += c; } } List<String> nameTerm = Op.split(line, ":"); if (nameTerm.size() != 2) { throw new Runt...
2bae812b-dc31-407f-a26d-3dc480aeedd0
8
public IEvaluableToken parse() { try { // 1. Extract all parentheses into TokenLists extractParentheses(); // 2. Convert operator tokens to operators, including their arguments // in the correct order ^ * / + - extractOperator(TokenOperatorFactorial.class); extractOperator(TokenOperatorPower.cl...
aff69455-ee86-4e56-ae8c-b4694f58a374
7
public void merge(int A[], int m, int B[], int n) { if (m<=0&&n<=0){ return; } int index = m+n-1; while(m!=0&&n!=0){ if(A[m-1]>B[n-1]){ A[index]=A[m-1]; m--; } else { A[index]=B[n-1]; ...
3e4e58d2-7971-4e41-bb5f-a7eb01944de1
9
public ArrayList<Auction> searchWinnerByBoth(String keyword, String username, String winner) { try { ArrayList<Auction> auctions = new ArrayList<Auction>(); String[] keywords = keyword.split(" "); String[] usernames = username.split(" "); String[] winners = winner.split(" "); String sql = "select * ...
bd1a1526-01ba-428d-9644-cba1617cc9b9
5
private Operator findO(I I, ArrayList<O> Oids){ for(O O:Oids){ if(O.id.equals(I.id)){ return O; } } Operator curr = I.next; while(curr != null){ if(curr.type == Operator.Type.O && I.id.equals(curr.id)){ ...
50bee4d5-5a57-4585-90c9-b30895ee5ed4
2
/** @param column The source column being dragged. */ protected void setSourceDragColumn(Column column) { if (mSourceDragColumn != null) { repaintColumn(mSourceDragColumn); } mSourceDragColumn = column; if (mSourceDragColumn != null) { repaintColumn(mSourceDragColumn); } }
74acd2af-ce89-4acf-8ec7-3cf5a35409bd
7
public void updateRightClick(int cellPosX, int cellPosY) { if (!(cells[cellPosX][cellPosY].getIsRevealed())) { cells[cellPosX][cellPosY].setCellState(); if (cells[cellPosX][cellPosY].getCellState() == 1) { for (GameEventHandler gameEvent : gameEventList) { gameEvent.buttonUpdate(cellPosX, cellPosY, Bu...
76daa047-3796-4103-866e-85d8581a9f2c
7
private JSONWriter append(String string) throws JSONException { if (string == null) { throw new JSONException("Null pointer"); } if (this.mode == 'o' || this.mode == 'a') { try { if (this.comma && this.mode == 'a') { this.writer.write('...
d8c7b509-24c5-413b-a312-3ba24b810fd5
6
* The plant that the creature is interested in * @param amount * The amount of energy that the creature is interested in * @return true, if the creature is happy to make a partnership, else false */ protected synchronized boolean requestCompanionship(IntelCreature creature,...
cd4d4c6a-89af-4cb7-84e9-d3b6886c563f
9
@Override public Room modifyRoom(MOB mob, Room R, int showFlag) throws IOException { if((showFlag == -1) && (CMProps.getIntVar(CMProps.Int.EDITORTYPE)>0)) showFlag=-999; boolean ok=false; while(!ok) { int showNumber=0; R=genRoomType(mob,R,++showNumber,showFlag); genDisplayText(mob,R,++showNumber,s...
ebd55d0c-75e3-4e9e-be21-7b7b627bf083
0
public void setAcceptByFinalState(boolean t) { turingAcceptByFinalState = t; turingAcceptByFinalStateCheckBox.setSelected(t); }
9b0b50d6-6388-4e3b-82e2-c1230a6471eb
4
public InputStream getInputStream() throws IOException { if( !this.isOpen() ) throw new IOException( "Cannot retrieve resource's input stream. Resouce was not yet opened." ); if( this.readLimitInputStream == null ) { if( this.contentRange.getLastBytePosition() >= this.getCoreResource().getLength() ) t...
3b9614d3-f4a5-4370-aab3-e9b9c005b8d5
3
private void initGenome(StateObservation stateObs) { genome = new int[N_ACTIONS][POPULATION_SIZE][SIMULATION_DEPTH]; // Randomize initial genome for (int i = 0; i < genome.length; i++) { for (int j = 0; j < genome[i].length; j++) { for (int k = 0; k < genome[i][j]....
d3bf1d99-82c0-4317-b8c6-446ee7f8633c
3
public IllegalOrphanException(List<String> messages) { super((messages != null && messages.size() > 0 ? messages.get(0) : null)); if (messages == null) { this.messages = new ArrayList<String>(); } else { this.messages = messages; } }
c92d2daa-7fc0-43ce-9287-28d77801df57
7
protected Size2D arrangeNN(BlockContainer container, Graphics2D g2) { double x = 0.0; double width = 0.0; double maxHeight = 0.0; List blocks = container.getBlocks(); int blockCount = blocks.size(); if (blockCount > 0) { Size2D[] sizes = new Size2D[blocks.size...
dccad8ee-05f5-4780-a80e-28a56460aa93
1
public BEValue toBEValue() throws UnsupportedEncodingException { Map<String, BEValue> peer = new HashMap<String, BEValue>(); if (this.hasPeerId()) { peer.put("peer id", new BEValue(this.getPeerId().array())); } peer.put("ip", new BEValue(this.getIp(), Torrent.BYTE_ENCODING)); peer.put("port", new BEValue(t...
98035ccf-53ad-4e90-9d8e-9715687c731c
8
private boolean arePiecesBetweenSourceAndTarget(int sourceRow, int sourceColumn, int targetRow, int targetColumn, int rowIncrementPerStep, int columnIncrementPerStep) { int currentRow = sourceRow + rowIncrementPerStep; int currentColumn = sourceColumn + columnIncrementPerStep; while...
7be061b3-c242-4f90-9f85-b31dbf50f48b
6
public void find(Course[][] courses) { System.out.print("Enter Department: "); String dept = scan.next(); dept = dept.toUpperCase(); System.out.print("Enter Course Number: "); int courseNum = scan.nextInt(); boolean found = false; for(int x = 0; x < courses.length; x++) { for(int y = 0; y < cours...
841ba9a9-88a1-4579-875f-dd592df88c3b
2
public static void nouvellePartie() { if (fenetreNouvellePartie != null) { fenetreNouvellePartie.dispose(); } fenetreNouvellePartie = new WindowNouvellePartie(); if (fenetrePrincipale != null) { fenetrePrincipale.dispose(); } }
950ab7c6-792a-4dc7-8b65-08d255631343
3
private void btnAbrirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAbrirActionPerformed //Se le asigna lo que hay en la caja de texto a nombre String nombre = String.valueOf(txtNombreArchivo.getText()); //Se crea un objeto General g = new General(); String...
4dccdd43-d38b-417b-a2b1-654db872d277
2
protected void checkCommand(String command) { if (command == null) throw new IllegalArgumentException("ERR00403012b"); if (!drinkPattern.matcher(command).matches()) { Out.infoLn("Processing command: '%1$s' ...", command); Processing.process("Sending mail", 1000); ...
91e1ebf8-e366-4db4-a71e-817e171a7099
7
public void setSpawnEye(World world, Location location){ if (customConfigurationFile == null) { customConfigurationFile = new File(plugin.getDataFolder(), "spawn.yml"); } customConfig = YamlConfiguration.loadConfiguration(customConfigurationFile); String worldName = world.getName(); for (String worldN : plugin...
55d668c6-3228-44eb-b65b-66f501e05667
2
@Override public boolean activate() { return (Players.getLocal().isMoving() && !Constants.BEAR_AREA.contains(Players.getLocal()) && !Constants.ESCAPE_AREA.contains(Players.getLocal())); }
8aa64bd4-9e42-484d-b82e-5ca12b31736f
6
public SetTranslationInfoResult genLoad() { checkPermission(viewerId); HashoutListToJson hashoutListToJson = new HashoutListToJson(); List<EntityJson> jsons = hashoutListToJson.loadEntities(HashoutList.INTL_MESSAGES_CURRENT.getId().getKey()); Map<String, List<EntityJson>> nameToJson = new HashMap<String...
01311ee8-4379-48e0-a121-7ae8230a1bb9
8
private void loadConfig( String filename ) { try{ File file = new File(filename); BufferedReader br = new BufferedReader(new FileReader(file)); String str; while((str = br.readLine()) != null) { if( str != null ) { String item[] = str.split(":"); if( item[0].equals( "port" ) ) ...
fd65f5d7-f3c0-40c6-a314-704abad37f9a
0
public Vision() { _setDistance(0); }
e3517e28-ce36-4da3-a67b-e1caf11dacbb
0
public DWT() { }
7b8a2475-5625-44dd-ac99-4571176e3667
6
public void executeSequence(MoveSequence sequence) { for (MovementAction action : sequence) { switch (action) { case Forward: forward(); break; case TurnLeft90: turnLeft90(); break; case TurnLeft45: ...
4cd0513c-e062-4cb7-bcfc-96fa05f7c0ad
9
private void sendMsg(TsapiRequest req, CSTAPrivate priv) throws IOException { synchronized (this.out) { IntelByteArrayOutputStream acBlock = new IntelByteArrayOutputStream( 18); IntelByteArrayOutputStream encodeStream = new IntelByteArrayOutputStream(); IntelByteArrayOutputStream privateData = new Intel...
fdda6963-276f-4c68-8c0d-6ab2d9977b64
9
@Override public void spremi(Resource r) { Evictor e = new Izbaci(); File file = new File(m.getNazivSpremista() + "\\" + r.getNaziv()); try { if (m.isKb()) { trenutnaVelicina = m.izracunajVelicinu(); if ((trenutnaVelicina + r.getSadrzaj().toString...
38d4161b-b100-4dc0-b462-29017889652a
1
public String[] toArray() { return new String [] {String.valueOf(points), endTime==null?" ":endTime.toString()} ; }
fe82b653-50e3-4b0b-8778-9cbe4efb2e44
4
public static void createImages() { String pokemonType; char a; URL url; for (int i = 0; i < pokedexImg.length; i++) { pokemonType = getSpecies(i+1).toString(); if(pokemonType.equalsIgnoreCase("Mr_Mime")) pokemonType="Mr_Mime"; else if(pokemonType.equalsIgnoreCase("Nidoran_M")...
59f9146a-e185-4c04-81c2-ea4d20daf445
3
public void moveCannonBalls(){ // Move the cannonballs for(int i=0; i<cannons.size(); i++){ CannonBall cannon = cannons.get(i); if(cannon.getDone()){ try { // Makes the "splashed" cannonball appear longer Thread.sleep(10); ...
d07552ae-8a65-43d5-a737-021ed35eb349
4
@RequestMapping(value = {"search", "s"}) @ResponseBody public Map search( @RequestParam int page, @RequestParam(value = "limit") int pageSize, @RequestParam(required = false, defaultValue = "0") int gradeId, @RequestParam(required = false, defaultValue = "0") int ...
b1831263-6e35-4d90-a016-58c56795c19c
9
protected void evalDefinitions(String[] command) { Matcher matcher; boolean isStatic = false; for (String ci : command) { ci = ci.trim(); if (ci.equals("")) continue; if (ci.toLowerCase().startsWith("static")) { ci = ci.substring(6).trim(); isStatic = true; } else { isStatic = false...
3eb22750-8897-42ec-96dd-a3cb791f3d3b
4
@Override public boolean equals(Object o) { if(o == null) { return false; } if(o == this) { return true; } if(!(o instanceof Pixel)) { return false; } Pixel other = (Pixel) o; return (...
772cbad4-7679-4898-ab28-1b6f04f882b3
9
@Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); InterfaceDepartamento aO = new DepartamentoDAO(); De...
82e9cdfb-7088-48c1-b0f0-071a67be1371
1
public TestInstanceInfo getTestInstance(long testInstanceId) throws Exception { TestInstanceInfo testInstance = null; QcRequest qcRequest = new QcRequest(QcConstants.QC_ENDPOINT_URL + "/test-instance/" + testInstanceId); try { XMLConfiguration testInstanceData = restCl...
496c8872-3962-4d1f-b47c-09b84e6e5795
0
@Override public PermissionType getType() { return PermissionType.RCON; }
ae78365e-2204-4467-b7a5-b858536fc91f
2
public void healPokemonNoPrompt() { for (Pokemon aPartyPokemon : partyPokemon) { if (aPartyPokemon != null) { aPartyPokemon.health = aPartyPokemon.healthMax; aPartyPokemon.status = Pokemon.Status.OK; aPartyPokemon.substatus = Pokemon.Substatus.OK; ...
538ed9b5-efa7-447e-bbbd-944a268f7dd2
4
public void run() { try { sourceDataLine.open(audioFormat); sourceDataLine.start(); int cnt; // Keep looping until the input read method // returns -1 for empty stream or the // user clicks the Stop button causing // stopPlayback to switch from false to // true. while ((cnt = aud...
99a28af6-0ada-4471-a8af-bf024c0007d7
9
private byte[] decrypt(final byte[] encryptedResponse) throws IOException { // if (DISPLAY_APDU) { // System.out.println("CIPHERTEXT RESPONSE APDU:"); // System.out.println("yo: " + Integer.toHexString(encryptedResponse[0] & 0xFF)); // for (int i = 0; i < en...
2c1a2ca3-0ed3-44e3-96f7-be46866ee894
6
public Position getNodeAhead(Position position, int angle){ Position _pos = null; if(angle >= 360){ angle -= 360; } if(angle < 0){ angle += 360; } switch(angle){ case 0: _pos = new Position(position.getX(), position.getY() - 1); break; case 90: _pos = new Position(position.getX() + ...
570abd9d-2678-452b-971c-a107a911b296
3
private void createControlPanel(){ controlPanel = new JPanel(); final JButton startButton = new JButton("start"); final JButton stopButton = new JButton("stop"); stopButton.setEnabled(false); final JButton pauseButton = new JButton("pause"); pauseButton.setEnabled(false)...
74b3f71a-91d4-418a-bd4b-6328f543b212
3
public String getParsedFormat() { String formatted = ""; for(String str : format.split(" ")) if(!str.isEmpty() && !str.equalsIgnoreCase("...")) formatted = formatted + " " + str.substring(1, str.length()); else formatted = formatted + " " + str; return formatted; }
dc4f849a-c5b9-4532-9671-22e5f2a27b91
8
public static void main(String[] args) { Scanner scan = new Scanner(System.in); Integer rowNumber = Integer.parseInt(scan.nextLine()); Integer startNumber = scan.nextInt(); scan.nextLine(); boolean hasElement = false; ArrayList<Integer> outputs = new ArrayList<Integer>()...
30fcb8b7-b18c-44b2-bbb5-c5d9f633df6e
2
@Override protected void paintComponent(Graphics g) { super.paintComponent(g); g.setColor(Color.WHITE); for (MoveableObject asteroid : field.getAsteroids()) { asteroid.draw(g); } g.setColor(Color.RED); for (MoveableObject bullet : field.getBullets()) { bullet.draw(g); } g.setColor(Color.GREEN)...
31b87571-4d4a-461f-9404-eda613bb7f0f
7
@Override public String healthText(MOB viewer, MOB mob) { final double pct=(CMath.div(mob.curState().getHitPoints(),mob.maxState().getHitPoints())); if(pct<.10) return L("^r@x1^r is almost squashed!^N",mob.name(viewer)); else if(pct<.25) return L("^y@x1^y is severely gashed and bruised.^N",mob.name(vie...
2be810b6-7ae1-4010-ad30-cb5fbe17ee54
2
public static AccessibilityFeatureEnumeration fromValue(String v) { for (AccessibilityFeatureEnumeration c: AccessibilityFeatureEnumeration.values()) { if (c.value.equals(v)) { return c; } } throw new IllegalArgumentException(v); }
99792c6b-ba63-4ee1-9279-932ccdf7dcaf
2
@Override public void execute() { System.out.println("Production Dialog is off..... Turning on"); Constants.PRODUCTION_WIDGET.interact("Toggle Production Dialog"); final Timer timeout = new Timer(2000); while(timeout.isRunning() && Settings.get(1173)==1879048192) { Task.sleep(50); } }
3de736eb-6776-44b0-8c54-3195f2e4c558
0
public static void main(String[] args) { Flyweight flyweight1, flyweight2, flyweight3; FlyweightFactory ff = new FlyweightFactory(); flyweight1 = ff.factory("aaa"); flyweight2 = ff.factory("bbb"); // 如果存在,则不创建新的对象 flyweight3 = ff.factory("aaa"); flyweight1.func(); flyweight2.func(); flyweight3.func(...
1b901f80-cfc8-40fb-8ab3-77faa50f0cc5
7
public static PlayerConfig getPlayerConfig(String name) throws Exception { PlayerConfig config = new PlayerConfig(name); HashMap<String, String> classifiers = new HashMap<String, String>(); HashMap<String, HashMap<String, Boolean>> attributes = new HashMap<String, HashMap<String, Boolean>>(); SAXBuilder bui...
c3bb81c8-ef4f-4119-a707-a5d44c978162
2
private void isLessThanEqualsToInteger(Integer param, Object value) { if (value instanceof Integer) { if (!(param <= (Integer) value)) { throw new IllegalStateException("Integer is not greater than supplied value."); } } else { throw new IllegalArgumentException(); } }
447e5eb6-60c7-404a-a6d6-e4284f589bb0
3
private void createItems() { ih = new ItemHandler(); MenuItem info = new MenuItem("(c) UploadR v"+Constants.VERSION +" | shortcuts "+(Constants.KEYS_ENABLED ? "enabled" : "disabled")); info.setEnabled(false); this.add(info); for(byte i=0;i<ItemHandler.items.length;++i) { if(ItemHandler.items[i][0].equal...
3e3475c1-77a3-47df-96fd-bc441b67dda7
7
public static void generateCsvFromList(String fileName, List<Object> elems, Integer rowElems) throws IOException { StringBuffer buffer = new StringBuffer(); if (elems.isEmpty()) { createCsvFile(fileName, buffer.toString()); } else { rowElems = rowElems == null ? 1 : rowElems < 1 ? 1 : rowElems; int el...
35235fa1-7da6-4003-86f5-d309f03c680e
7
public static void experimentEcoli3(String[] args) { // insertion of sequence with partly similarity final String ID = args[0]; ExecutorService exec = Executors.newFixedThreadPool(Runtime .getRuntime().availableProcessors()); System.out.println("Start with " + Runtime.getRuntime().availableProcessors() ...
9a2a25f5-7f1a-4da3-81bc-de393c6c7a8d
2
private void jLabel3MouseClicked(java.awt.event.MouseEvent evt) { //Set options of all panels for (Component p : getParent().getComponents()) { if(p instanceof AbleToGetOptions) { ((AbleToGetOptions) p).getOptions(); } } CardLayout cl =...
4ef96d7b-f91e-4531-9b3a-a5b5518d8d79
2
public static void checkGlobalConfigYAML() { File config = new File(path + "config.yml"); if(!config.exists()) { try { config.createNewFile(); FileConfiguration c = YamlConfiguration.loadConfiguration(config); c.set("Features.AutoBroadcast.Enabled", false); c.set("Features.AutoSave.Enabled", true...
b78b6f6a-3b63-4c00-9cb3-100aaeac2440
5
private static double[] getResistPoints(int curvePoints,int lineNumber, double[] highPrices) { double[] rPoints = new double[lineNumber]; for(int i =0;i<lineNumber-1;i++){ double price = 0; for(int j=-curvePoints;j<=0;j++){ if((i+j>=0) && (i+j<lineNumber-1) && hig...
13231c70-ff0a-43c1-ac4b-2d66c04c1afa
2
private void drawVillagers(int screenX0, int screenY0, Graphics2D gI) { ArrayList<Village> villages = getVillages(); for (Village v : villages) { for (Villager villager : v.getPopulation()) { double vAbsX = villager.getRelativeX()+(v.getX()-screenX0+0.5)*Chunk.lengthOfChunk-0.5, vAbsY = villager.getRel...
a5127ea0-86fb-4381-8d47-44e2f96e4d82
7
private void checkStatus(boolean force) { if (isMuted()) { if (status != MicStatus.MUTED || force) { status = MicStatus.MUTED; trayIcon.setImage(mutedIcon); if (guiDisplay) { guiPanel.setBackground(mutedColour); } ...
962b40af-b0c8-4aa3-ab06-db34fd6a98df
0
@Override public Iterator<TElement> iterator() { return this._source.iterator(); }
8a12cb3b-5159-40ac-90ea-a145ded32dfc
2
@Override public void onEnable() { this.log = getLogger(); saveConfig(); this.world = getConfig().getString("world", "world"); this.ccost = getConfig().getInt("chunk-cost", 0); int id = getConfig().getInt("tool.id", 280); String name = getConfig(...
c3740bd0-108c-49e9-b313-27a1c1b386c7
4
@Override public void addComponent(Component component, LayoutParameter... layoutParameters) { Set<LayoutParameter> asSet = new HashSet<LayoutParameter>(Arrays.asList(layoutParameters)); if(asSet.contains(MAXIMIZES_HORIZONTALLY) && asSet.contains(GROWS_HORIZONTALLY)) throw new IllegalArg...
ccab1ffb-b49a-4d67-885f-10103ddbda40
4
public Pair<Pair<Livraison, PlageHoraire>, NoeudItineraire> supprimerLivraison(Noeud noeudSel) { if(this.testItineraireCharger()){ //Suppression autoris�e Livraison liv = null; for(PlageHoraire ph : this.plagesHoraire){ liv = ph.rechercheLivraison(noeudSel); if(liv != null){ //Livraison supprime...
bd5091e1-74b9-4e45-a4f2-f7eb23531fa0
6
public static boolean isGamemode(String gamemode) { if (gamemode.equalsIgnoreCase("survival") || gamemode.equalsIgnoreCase("0") || gamemode.equalsIgnoreCase("creative") || gamemode.equalsIgnoreCase("1") || gamemode.equalsIgnoreCase("adventure") || gamemode.equalsIgnoreCase("2")) { return true; ...
d550e63f-8ffc-4c17-843a-dccf722b51bd
0
public Piste getPelaajanAlkusijainti() { return pelaajanAlkusijainti; }
3f047330-f10f-4372-ae32-73bc0a815e79
3
public void testPlus() { Period base = new Period(1, 2, 3, 4, 5, 6, 7, 8); Period baseDaysOnly = new Period(0, 0, 0, 10, 0, 0, 0, 0, PeriodType.days()); Period test = base.plus((ReadablePeriod) null); assertSame(base, test); test = base.plus(Period.years(10)); ...
341a8289-7394-4bf0-85f2-a9b73ecd042e
4
private Object parseString() throws StreamCorruptedException { int strLen = readLength(); indexPlus(1); // get rid of " Object output; CharBuffer cb = CharBuffer.allocate(strLen); boolean containsZeroChar = false; for (int r = 0; r < strLen; r++) { char ch; try { ch = input.get(); if (ch == '\...
05209008-3a11-4788-9e1e-44a1df640db3
0
private void menuOpenMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_menuOpenMouseClicked // TODO add your handling code here: }//GEN-LAST:event_menuOpenMouseClicked