method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
6246dd68-0828-4f38-b5b2-60245a533b8f
5
public void avancar() { if((combustivel>0)&&(posicao!=mapa.length-1)){ posicao++; combustivel--; } else if(posicao==(TAMANHO-1)){ System.out.println("GANHOU!"); System.exit(0); } else if((combustivel==0)&&(posicao!=0)){ System.out.println("\nPERDEU!"); combustivel=0; System.exit(0); } ...
cb3ba1ce-cbed-4623-97bc-f57b6e28613f
9
private void computeRectDouble(PlanarImage src, RasterAccessor dst) { RandomIter iter = RandomIterFactory.create(src, src.getBounds()); int minX = src.getMinX(); int maxX = src.getMaxX(); int minY = src.getMinY(); int maxY = src.getMaxY(); int dstWidth = dst.getWidth();...
d4294ae8-dfac-4102-be68-b64f550149b9
5
public double pow(double x, int n) { if ( n == 0 ) return 1; if (Math.abs(x) <zero) return 0; double rst = 1; double current = x; if (n < 0) current = 1/x; int k = n; while (k !=0 ) { if (k % 2 != 0) rst *= current; k = k / 2; current *= current; } ...
fbac739c-8cb2-4613-8e28-618c70e56d16
8
public static List<Transaction> getTransaction(User baseUser) { if(baseUser == null) return null; if(conn == null) getConnection(); List<Transaction> transactionList = new ArrayList<Transaction>(); PreparedStatement stmt = null; ResultSet rs = null; try { stmt = conn.prepar...
77508ac6-6819-49c3-84ab-79c21d78be21
6
public String createCustomerWithParameters(String firstname, String lastname, String number, String street, String city, String zipcode, Date date){ // Check the name if(firstname.equals("") & lastname.equals("") ) { return "the customer name is empty"; } if(firstname.equals("")){ return "the customer ...
24a3b811-fd3c-4966-b73a-4ace713476b4
5
private static String[] filterJar(String pattern) { CodeSource cs = Bukkit.class.getProtectionDomain().getCodeSource(); if(cs == null) { return new String[0]; } ArrayList<String> list = new ArrayList<String>(); try { JarInputStream jis ...
9c70904c-79dc-4592-b9ba-6c2d2a03a93f
5
public static Object readObj(final IBStream stream) { Object result; char ch = stream.peekChar(); if (BConst.EOT == ch) { result = null; } else if (isDigit(ch)) { result = readByteArray(stream); } else if (BConst.INT_START == ch) { result = rea...
c1118a75-8f58-4033-bb1e-d148d39a418c
8
public int[][] GetLine(){ int line[][] = new int [4][2]; int i; switch(this.direction){ case Chessline.LEFT: for(i=this.chess_num-1;i>=0;i--){ line[i][0] = this.start_x-i; line[i][1] = this.start_y; } break; case Chessline.DOWN: for(i=this.chess_num-1;i>=0;i--) { line[i][0] = th...
cbe55301-3214-4b97-a05a-2bb870653f1b
8
public String[] getItemTexts() { String[] itemText = new String[weapons.size() + armours.size() + foods.size() + misc.size()]; int itemCount = 0; if (weapons.size() > 0) { Iterator<Entry<Character, Weapon>> iter = weapons.entrySet().iterator(); while(iter.hasNext()) { Map.Entry<Character, Weapon> entry ...
aff734d1-278d-4f13-90bd-69fc5a920d5f
7
public void render(int xPos, int yPos, Tile tile, boolean flip) { xPos -= xOffset; yPos -= yOffset; for (int y = 0; y < tile.sprite.SIZE; y++) { int yp = yPos + y; for (int x = 0; x < tile.sprite.SIZE; x++) { int xp = xPos + x; if (xp < 0 || xp >= width || yp < 0 || yp >= height) { continue; } ...
8695a7dc-f1c7-45d4-a949-f173bd1a9a3d
4
private void up() { if (currentRow > 0) { currentRow--; } else { // Unnecessary check rowOffset > 0 : done in scrollUp. scrollUp(); } if (grid.getLineLength(currentRow + rowOffset) <= currentCol + colOffset) { if (colOffset > grid.getLine...
4d82497f-2019-4f3a-9cbf-387d59a95c81
3
public BorelTanner(int k, double mu) throws ParameterException { if (k < 1 || mu < 0 || mu > 1) { throw new ParameterException("BorelTanner parameters k in N, 0 <= mu <= 1."); } else { this.k = k; this.mu = mu; borel = new Borel(mu); } }
c22a84cd-77bd-4cfd-aaa2-b53e80d8d94c
1
static public String getSubLForBoolean(boolean val) { return (val == false) ? "nil" : "T"; }
caef2bf4-243c-45e4-9a8b-2228a62cb903
3
private Vocab(String line) { String[] split = line.split(":"); gender = split.length == 3 ? Gender.getGender(split[0]) : Gender.NEUTRAL; french = split[split.length == 3 ? 1 : 0].trim(); english = split[split.length == 3 ? 2 : 1].trim(); id = lastId++; }
efaf2d04-c9b0-427f-aeaa-46cbf15a5f63
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://...
4f31b3b3-5c7d-49eb-96ba-25e8d0369784
1
public int getFollowingGlieder() { return nextGlied != null ? nextGlied.getFollowingGlieder() + 1 : 1; }
04ece6d5-2a1d-44bd-846f-9dbb04b7d2a6
6
public void playHand(int numberOfHand) throws Exception { this.numberOfHand = numberOfHand; deck = new Deck(); anounceNewHand(); dealHoleCards(); playRound(); if (state.getPlayersNotFolded() > 1) { anounceNewRound(); state.addSharedCards(deck.drawCards(3)); // Flop playRound(); } if (state.getP...
a5026930-fb16-421d-8bf0-6676d5f81e28
1
public FieldVisitor visitField(int access, String name, String desc, String signature, Object value) { FieldVisitor fv = super.visitField(access, remapper.mapFieldName(className, name, desc), remapper.mapDesc(desc), remapper.mapSignature(signature, true), remapper.mapValue(value)); return fv == null ...
a210c54d-650c-4a78-b85e-5b9d8183c298
0
public static String yyyymmdd_hh() { SimpleDateFormat D = new SimpleDateFormat("yyyyMMdd_HH"); return D.format(new Date()); }
c71723f6-4f2e-40ec-b5e2-fedcd8910265
7
@Override public void unInvoke() { // undo the affects of this spell if(!(affected instanceof MOB)) return; final MOB mob=(MOB)affected; if((mob.isMonster())&&(mob.amDead())&&(!canBeUninvoked())) super.canBeUninvoked=true; super.unInvoke(); if(canBeUninvoked()) { if((mob.location()!=null)&&(...
2fbe1abf-80fd-4b30-b4ab-7eb38d63c1ae
1
public Class<? extends APacket> getPacketClassByID(int id) { return PList.get(id); }
3df95d07-de43-44d5-b9f5-2d0c20bc0e27
5
@Override protected TerminalSize calculatePreferredSize() { if (lockPreferredSize) { return requestedSize; } TerminalSize ts = getDataSize(); if (ts.getColumns() < minimumCols) { ts.setColumns(minimumCols); } if (ts.getRows() < minimumRows) { ...
84f5826b-8515-4868-b89c-d59a5becf82a
2
public boolean ignoreField(final MemberRef field) { if (ignoreMethods.contains(field)) { return (true); } else if (ignoreClass(field.declaringClass())) { addIgnoreField(field); return (true); } return (false); }
49444d25-28ac-4cce-9aeb-6e7ad753b7cd
3
private static int calculateMarkTier(int finalPoints){ if(finalPoints>=LBARRIER[LBARRIER.length-1]) return LBARRIER.length-1; for(int i=-1; i<LBARRIER.length; i++) { if(finalPoints<LBARRIER[i+1]) return i; } throw new UnsupportedOperationException("Reached unreachable sta...
2de06cf3-ca38-49b8-a6dd-d395a9602512
1
@SuppressWarnings("unchecked") public HashMap arbitrary(Random random, long size) { int length = (int) Arbitrary.random(random, 0, Math.min(Integer.MAX_VALUE, size)); HashMap map = new HashMap(); for (int i = 0; i < length; ++i) { Object...
dcd9b165-61b0-4c78-9fc8-0aee7ea47ad1
4
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { if (isSelected) { renderButton.setForeground(table.getSelectionForeground()); renderButton.setBackground(table.getSelectionBackground()); ...
cd41b97c-85e3-45e0-b4d6-229e451c6738
5
public static boolean shouldBuild() { if (!UnitCounter.weHaveBuildingFinished(UnitTypes.Terran_Engineering_Bay) || Constructing.weAreBuilding(type)) { return ShouldBuildCache.cacheShouldBuildInfo(type, false); } int bunkers = TerranBunker.getNumberOfUnitsCompleted(); int turrets = getNumberOfUnits(); ...
fb2d57e5-aac7-446a-9145-cd568ecb4cc9
9
public <T extends Arguments> ICommand<?, ?> getCommandHandler(String tcCommand, Class toInterface, T toArgs) { List<ICommand<T, ?>> loCommandObjects = (List<ICommand<T, ?>>)Application.getInstance().getObjectCache().getObject(m_oInterface, tcCommand); if (loCommandObjects != null && loCommandObjects...
57b9c5dc-66c5-4b4f-9bf7-6d4f5a049656
9
private void step19(Beat beat) { System.out.println("19: Is in beat interval 3,4 or 7?"); Set<Integer> midiNums = beat.getToneMap().keySet(); for(int midiNum: midiNums) { int[] interval = {3,4,7}; boolean isInInterval = false; int intNum = -1; int tone = -1; for (int i = 0; i < interval.length;...
5a23d708-6cf0-4fb6-8dda-7e3876088d18
9
public List<DefaultMutableTreeNode> populirajTabele(DefaultMutableTreeNode tab, DefaultMutableTreeNode vie, DefaultMutableTreeNode sys, DefaultMutableTreeNode syn, String baza) { List<DefaultMutableTreeNode> listaCvorova = new ArrayList<DefaultMutableTreeNode>(); try { String[] tipoviObjekataTab = {"TAB...
92bf157f-148d-4439-8ffe-609f8de03b09
0
public String getSex() { return sex; }
ffda5752-4975-4143-b03e-2dec4878bef3
4
public void save(String filePath){ try { if(!filePath.toLowerCase().endsWith(".uno")) { filePath = filePath + ".uno"; } filePath = filePath.replace("Selda.jar", ""); File file = new File(filePath); System.out.println(filePath); if (!file.exists()) { if (!file.createNewFile()) ...
6857a1d9-6449-4303-9cdd-f24efbc061d5
6
private static void visitRegisterPointer(MemoryStateCreator mem, RegisterPointerContext tree) { switch (tree.getText()) { case "[A]": mem.addRegisterA_pointer(); break; case "[B]": mem.addRegisterB_pointer(); break; case "[C]": mem.addRegisterC_pointer(); break; case "[X]": mem.ad...
cb12d31d-3b02-4c86-8833-a014140bce6f
1
public void updateGraphics() { try { Thread.sleep(50); } catch (Exception e) { LOGGER.log(Level.WARNING, "Just to shutup SonarA", e); } cSJP.paintComponent(floorBI.createGraphics()); floorFrame.repaint(); }
8cd236c7-888a-4534-86fe-426f5a22adb2
0
public CheckResultMessage checkF(int day) { return checkReport.checkF(day); }
9d758805-516e-4075-89c7-b942f471c161
0
public List<String> getVoiceChannels(){ return VoiceChannels; }
f526421f-26bd-402c-91bc-d5d7ee0c26fa
6
public static void writeRdfProperty( Appendable w, String propName, RDFNode value, String padding, Map<String,String> standardNsAbbreviations, Map<String,String> usedNsAbbreviations ) throws IOException { String propNodeName = XML.longToShort(propName, CCouchNamespace.standardNsAbbreviations, usedNsAbbreviations);...
6b895fe8-aa62-471d-8b67-f0f330b4cc72
7
@Override public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (!(obj instanceof OFQueueConfigReply)) return false; OFQueueConfigReply other = (OFQueueConfigReply) obj; if (port != other...
d9adcb6d-a83f-482e-8d4c-a5732499a05f
8
public void update() { mouseReleased = false; upKeys.clear(); for (int i = 0; i < NUM_KEYCODES; i++) if (!getKey(i) && currentKeys.contains(i)) upKeys.add(i); downKeys.clear(); for (int i = 0; i < NUM_KEYCODES; i++) if (getKey(i) && !currentKeys.contains(i)) downKeys.add(i); currentKeys....
beec8887-6b17-4ff1-abac-932279e55029
2
public static void freezeUndoEdit(Node currentNode) { UndoableEdit undoable = currentNode.getTree().getDocument().getUndoQueue().getIfEdit(); if ((undoable != null) && (undoable.getNode() == currentNode)) { undoable.setFrozen(true); } }
0d11b31c-56b0-4edf-9568-ad7e2a8ea666
0
public KeyStroke getKey() { return KeyStroke.getKeyStroke('a'); }
699cf922-f393-4fc3-8784-db8db5f28300
2
private int countAttributes(File dataFile) { m_numberOfAttributes = 0; m_delimiter=","; try { m_fileScan = new Scanner(dataFile); } catch (FileNotFoundException e) { } m_lineScanner = new Scanner(m_fileScan.nextLine()); m_lineScanner....
4dd950c8-c2d4-4612-b814-89ef59c1b548
3
@Override public void onEnable() { log.info(logPrefix + "WebAuction is initializing."); initConfig(); String dbHost = getConfig().getString("MySQL.Host"); String dbUser = getConfig().getString("MySQL.Username"); String dbPass = getConfig().getString("MySQL.Password"); String dbPort = getConfig().getStrin...
0d6594e1-db40-4c6a-8d6b-b32f65a4699a
4
public static void main(String[] args) { Random rand = new Random(); Scanner scanner = new Scanner(System.in); while(true) { boolean headsOrTails = rand.nextBoolean(); if(headsOrTails == HEADS) { System.out.println("Heads!"); } else if(headsOrT...
c63137af-9d4e-4476-b213-ab952a381981
6
public List<String> completeCities() { try { Class.forName("com.mysql.jdbc.Driver"); } catch (ClassNotFoundException e) { System.out.println("Where is your MySQL JDBC Driver?"); e.printStackTrace(); } PreparedStatement ps = null; Connection co...
e4f1786d-273d-4da4-9c0b-1d41687f0f1c
9
private static void parseByStreamReader(XMLInputFactory xis, InputStream inputStream) { XMLStreamReader reader = null; try { String preflag = null; reader = xis.createXMLStreamReader(inputStream); while (reader.hasNext()) { int type = reader.next(); switch (type) { case XMLStreamConstants.ST...
eb87b1f6-6cec-4f56-a3e9-36f6359f0eb6
1
@SuppressWarnings("deprecation") @Test public void powerSymmMatrix_test() { try{ double [][]mat1= {{1.0,2.0}, {3.0,1.0}}; double power=2; double result[][] = FastICA.powerSymmMatrix(mat1,power); double exp[][]={{9.999999999999998,5.999999999999998}, {5.999999999999998,9.999999999999998}}; Assert.assert...
7dfa3fd5-e8e2-4ebd-babe-2632c87c968a
4
public TextField(String label, String text, int maxSize, int constraints) { super(label); if (text == null) { text = ""; } if (maxSize <= 0) { throw new RuntimeException("The maxSize on the TextField should be more than 0 actual value: " + maxSize); } if (constraints < 0) { constraints= TextField.A...
20239cb6-5e41-4488-a7f6-c65a2b9abe71
8
private List<Tuple<Peer, Integer>> makeScoreBoard() { Map<Peer, Integer> scoreTable = new java.util.HashMap<Peer, Integer>(); for(Match match : matches) { if(scoreTable.get(match.participant1) == null) scoreTable.put(match.participant1, 0); if(scoreTable.get(match...
43678291-ec9f-45a7-9de8-7432616fcccd
0
public void changeImage(int icon) { remove(imageLabel); imageLabel = imageLabelsBuffer.get(icon); add(imageLabel); revalidate(); repaint(); }
fe4e958e-c3b1-44ce-8df5-cecdb62a5fb6
1
@Override @Command public MessageResponse writeQuorum() throws IOException { if(initRMI()) return proxyRMI.writeQuorum(); else return new MessageResponse("Cannot connect to Proxy via RMI"); }
71e8f76d-284c-43ed-9456-3d9c398c80af
7
public static void submitJobAndWaitForCompletion(Job job) { ClusterConfig clusterConfig = new ClusterConfig(job.getConfigFile()); //Ask Job Tracker for a new job Id. //Check output specification for the job. Error if output dir already exists. //Compute input splits for the job. //Copy the resources nee...
574db912-ba06-4ee4-ba2a-4a0a6b3bd252
0
@Override public void startSetup(Attributes atts) { super.startSetup(atts); addActionListener(this); }
90cc5105-6119-48e9-b989-d5d538ab2192
8
public Block getBlock(SerializedBlockImpl serializedBlock, TypeMetadata meta) { BlockPtr ptr = serializedBlock.getPtr(); ChannelBuffer buffer = serializedBlock.getData(); BlockHeader header = BlockHeaderSerializer.getInstance().getHeader(buffer); BlockPtr nextPtr = (BlockPtr) Serializer.getInstance().get...
c4531fb4-992c-4f70-b373-0df1bb1d7e1d
6
public void mouseReleased(MouseEvent event) { if (!controller.isDragged() && !controller.isSelection()) { // if (controller.isObject(event.getPoint()) && // !event.isControlDown()) { // controller.getCurrentGraph().deactivateAll(); // controller.repaint(); // } if (event.isControlDown() && isDeactiv...
328822e8-e8e2-4192-9dfa-559c9c7cdf1f
8
private void GameLoop() { long visualizingTime = 0, lastVisualizingTime = System.nanoTime(); long beginTime, timeTaken, timeLeft; while(true) { beginTime = System.nanoTime(); switch (gameState) { case R...
655c596f-6b58-4d67-8308-21570f0ed94a
6
public int transform(CtClass clazz, int pos, CodeIterator iterator, ConstPool cp) { int c = iterator.byteAt(pos); if (c == GETFIELD || c == GETSTATIC || c == PUTFIELD || c == PUTSTATIC) { int index = iterator.u16bitAt(pos + 1); ...
9fe2492d-445b-4a9c-ba51-ff61dcf3e99e
3
public String execute() { String ret = ERROR; Connection conn = null; try { String URL = "jdbc:mysql://localhost/bookdatabase3"; Class.forName("com.mysql.jdbc.Driver"); System.out.println(bkID); conn = DriverManager.getConnection(URL, "root", "123456789"); String sql = "delete from Book where ISB...
4f87c311-ecd4-4c6d-8e1b-d23628b241e7
1
private String createMappers() { sb.append( TAB + "<mappers>\n" ); for ( String name : classNames ) { sb.append( TAB + TAB + "<mapper resource=\"" + getMapperPath() + "/dao/" + name + "Dao" + fileType + "\" />\n" ); } sb.append( TAB + "</mappers>\n\n" );...
c8d1d7b2-09ed-4f59-a640-9169def3b5a3
3
public static void drawString(String string, Screen screen, int x, int y, ClickListener clickHandler) { int localy = 0; int localx = 0; for (int i = 0; i < string.length(); i++) { int ch = chars.indexOf(string.charAt(i)); if (string.charAt(i) == '\n') { localy += 7; localx = 0; } ...
017a3ef5-e4fc-4541-a6ec-831f82799c82
6
public boolean hasRole(String role) { if (role != null && roles != null) { for (Role r : roles) { if (r != null && r.name != null && r.name.toLowerCase().equalsIgnoreCase(role.toLowerCase())) { return true; } } } return ...
b3d9b4be-620a-49bd-9d2a-8cd0ee7ccddb
6
public static void main(String args[]) { System.out.println("AQUI HABIA CODIGO PERO YA BORRE"); try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UI...
93ff3145-9d3b-456f-b862-45081b866e11
3
public Object get(String key) { int hash = Hash(key) % BUCKETS; LinkedList chain = (LinkedList)v.get(hash); if(chain == null ) { return null; } for(int i = 0; i < chain.getSize(); i++) { HashNode n = (HashNode)chain.get(i); if(n.key == key) { return n.o; } } return null; }
a4d41e99-f2b5-443a-91d3-a0edffdf4910
7
private static long getMillisecondCount(int unit, int count) { switch (unit) { case (YEAR): return (365L * 24L * 60L * 60L * 1000L) * count; case (MONTH): return (31L * 24L * 60L * 60L * 1000L) * count; case (DAY): return (24L ...
4bafc9ad-d473-452a-a805-e877653f25d8
2
@Override public void paintComponent(Graphics g) { super.paintComponent(g); // hoogte van de blok int height; // breedte van de blok int width; if (!stats.isEmpty()) { width = this.width / stats.size(); } else { width = 4; } // blok counter int blok = 0; // teken de blok ...
ecdb54ad-4396-4856-a0ff-fd19613b58c0
4
* @return */ int translateFontIndex( int fid, HashMap localFonts ) { if( (transferFonts != null) && ((fid - 1) < transferFonts.size()) ) { // must translate fid to corrent font index for current fonts // translate font style and see if already present Font thisFont = (Font) transferFonts.get( fid - 1 )...
edd1c8c7-4c1d-448e-b9f3-41c03a9bf3ba
1
public static Term scanTerm (Scanner s) { String coef_patt = "\\-?\\d+(\\.\\d+)?"; if (s.hasNext (coef_patt)) { String coef = s.next(coef_patt); int exp = s.nextInt(); return new Term (Double.parseDouble(coef), exp); } else { return null; ...
b8ac14d6-bb40-43e7-88b3-1dc615ba727a
9
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { final Area target=mob.location().getArea(); if(target==null) return false; if(target.fetchEffect(ID())!=null) { target.fetchEffect(ID()).unInvoke(); return false; } if(!super.invoke...
48c66f5e-fa1e-4548-a0b2-9fe85d05becc
2
public int IDTracker(int trackingNumber){ int loop; for (loop = 0; loop < enemiesPresent.size(); loop++){ if (enemiesPresent.get(loop).getID() == trackingNumber){ return loop; } } return 0; }
62611c7a-a9a9-4dfc-8333-e540d1d0b667
8
@Override public String getDefinitionString() { StringBuilder sb = new StringBuilder(); // Add the return type if applicable (C macros like NULL have no type). String type = getType(); if (type!=null) { sb.append(type).append(' '); } // Add the item being described's name. sb.append(getName()); ...
7350c34f-3833-47d2-a401-355f62152ab4
4
@Test public void testPrijsAanpassen() throws Exception, FileNotFoundException { File f = new File("C:/Users/Jacky/Dropbox/Themaopdracht 4/CSVTestdata/PrijsAanpassenTest.csv"); if (f.exists() && f.isFile()) { String literprijs; String manurenprijs; String dagprijs; String weekprijs; String maandprij...
4b3425d4-41b1-447d-9e70-f8ef3e87d895
0
public void setInputFormat(String inputFormat) { this.inputFormat = inputFormat; }
cfe9bdde-4326-40de-896c-c915222b327e
5
public JSONObject increment(String key) throws JSONException { Object value = this.opt(key); if (value == null) { this.put(key, 1); } else if (value instanceof Integer) { this.put(key, (Integer) value + 1); } else if (value instanceof Long) { this.put(...
aecf6664-b0bd-496c-9c36-a98f95b82574
7
private float AssignBW(float bwmin, float bwmax, BWAssginType type) { if (bwmax < 0 || bwmin < 0 || bwmax < bwmin) throw new RuntimeException("bwmax bwmin must be greater than 1"); Random BWRandom = new Random(System.currentTimeMillis()); float bw; if (type == BWAssginType.CONSTANT) { bw ...
60fa2a1c-74e8-4138-8663-9841c59b4faf
4
@Override public void undo() { if (prevSpeed == CeilingFan.HIGH) { ceilingFan.high(); } if (prevSpeed == CeilingFan.MEDIUM) { ceilingFan.medium(); } if (prevSpeed == CeilingFan.LOW) { ceilingFan.low(); } if (prevSpeed == Cei...
6b4fe310-41a7-4646-a037-6922008f6c6b
5
public static void main(String[] args) { Scanner in = new Scanner(System.in); while (in.hasNextDouble()) { double a = in.nextDouble(); double b = in.nextDouble(); double r1 = in.nextDouble(); double r2 = in.nextDouble(); double mm = a > b ? b : a; if ( (r1*2 > mm) || (r2*2 > mm) ) { System...
7992009f-99b0-4214-9eba-4fbc986333b3
8
protected static double calculateRPN(List<Token> rpnSequence) throws CalculationException { Stack<Token> calcStack = new Stack<>(); for (Token node : rpnSequence) { if (node instanceof TokenValue) { calcStack.push(node); } else if (node instanceof TokenComputable) { TokenComputable function = (TokenCo...
928287b2-5c7d-46c8-b215-fdb34cec1921
9
public SessionListenerCollection(HttpSession session) throws GuacamoleException { // Pull cached listeners from session listeners = (Collection) session.getAttribute(SESSION_ATTRIBUTE); // If no listeners stored, listeners must be loaded first if (listeners == null) { // L...
3ca2cbbc-7c83-4731-bfbc-4e9606b3626f
1
@Override public void run() { String output = processFileExternal(); if (output != null) { mp_handler.xhtmlSuccess(output); } }
4bebe913-2911-4868-b1c7-36c7844eb984
5
public static void main(String Arg[]) { int theMost = 0; for (int p = 120; p < 1000; p++) { int counter = 0; for (int a = 1; a < p; a++) /** b has to be less than a */ for (int b = 1; b < a; b++) { /** c doesn't have to be calculated using a loop, use p to check if c fits the triangle */ in...
04c2e567-de5d-4935-b27f-d649ccfe9728
7
@Override public void executeMsg(final Environmental myHost, final CMMsg msg) { if((msg.sourceMinor()==CMMsg.TYP_DEATH) &&(msg.tool()!=null) &&(msg.tool()==affected)) { final Race R=msg.source().charStats().getMyRace(); if(!R.ID().equalsIgnoreCase("StdRace")) { String[] set=theList.get(R.name());...
cd5ce29c-f624-40c7-a5ec-9a1d0bbb6d23
7
public static void main(String[] args) throws IOException{ if(args.length > 0){ if(args[0].equals("Part1Test")){ new Tester(); return; } } String line = null; Building b; String fileName; String[] params; int floors, elevators, capacity, riders; int rider, from, to; File logfile =...
3b9188b7-ed07-4d9f-a9d6-28e2da4146a1
4
private static java.util.Vector parseConfigFile(String fileName, PrintStream out, PrintStream err) throws FileNotFoundException, IOException, UnknownHostException { java.util.Vector result = new java.util.Vector(); FileInputStream in = new FileInputStream(fileName); java.util.Propert...
143c3fa6-149c-4b19-98c5-2af870664a1b
6
public void mouseReleased(MouseEvent evt) { if (mousein == 1 && evt.getSource()==newgame){ Empous.newGame(); } if (mousein == 2 && evt.getSource()==loadgame){ Empous.loadGame(); } if (mousein == 3 && evt.getSource()==quitgame){ System.out.println("Exiting..."); System.exit(0); } }
42bd9d0a-73be-4973-a6e7-e880d3830c85
1
@Override public void display(String[] playersName, GameStatus status) { JButton confirmButton = createButton(250, 400, "Confirm"); panel.add(confirmButton); addListeners(confirmButton); createVoteList(180, 30); panel.add(voteList); this.status = status; int...
6243164c-841c-4c8a-b28d-dc278d891915
0
public void setSuit(int suit) { this.suit = suit; }
270a08ac-0ddc-45fb-990c-26f64e687550
3
private void configureAdditionalPropertiesForObjectSchema(JsonNode additionalProperties, ObjectSchema schema, URL schemaLocation) { if (additionalProperties == null) { return; } if (additionalProperties.isBoolean()) { JsonSchema additionalPropertiesSchema = additionalProp...
e9921c16-31a1-4076-8513-04668c7f61ab
4
private int getOffsetY(int rowStartOffset, FontMetrics fontMetrics) throws BadLocationException { // Get the bounding rectangle of the row Rectangle r = component.modelToView( rowStartOffset ); int lineHeight = fontMetrics.getHeight(); int y = r.y + r.height; int de...
a048d66a-f69a-47d7-bd6d-a60b70cc562f
0
@BeforeClass public static void setUpClass() { }
930e131a-e437-41c3-b876-5238b501f96d
3
public void setExpLogica(PExpLogica node) { if(this._expLogica_ != null) { this._expLogica_.parent(null); } if(node != null) { if(node.parent() != null) { node.parent().removeChild(node); } node.par...
df4c40c6-e809-488f-b9b4-ef6617694e2e
0
public int getLignes() { return Integer.parseInt(vTxtLignes.getText()); }
6bfdc8a4-99d3-4b90-92aa-87f34ee72d65
1
private boolean checkCameraSupport() { String propValue = System.getProperty("supports.video.capture"); return (propValue != null) && propValue.equals("true"); }
e650fee8-5928-4c7d-a926-d2a96d578895
4
public ArrayList<Patch> getNeighbors4(){ ArrayList<Patch> neighbors = new ArrayList(); if (!topEdge()){ neighbors.add(getN()); } if (!bottomEdge()){ neighbors.add(getS()); } if (!leftEdge()){ neighbors.add(getW()); } if (!rightEdge()){ ...
c85a3e4a-7696-46e8-a168-9595296a23f5
2
public void dispatch() throws HttpException, ServerException, IOException { //handle this.handleDomain(); this.handleRequestType(); this.locateResource(); //request and handler Request request = new Request(this.requestHeader, this.domain, this.resource); Handler handler = this.mapping.createHandler(t...
e464bfd1-8adf-43d4-803e-01899ff09cec
1
private void preencheTabela(List<Cliente> lista){ this.modelo = new DefaultTableModel(); modelo.addColumn("Id"); modelo.addColumn("Nome"); modelo.addColumn("Cpf"); modelo.addColumn("Rg"); modelo.addColumn("Data de Nascimento"); /*modelo.addColumn("Endereç...
7024461b-3cbe-476a-b548-f662dd122085
2
@Override protected void finalize() { for (int i = 0; i < id.length; i++) { glDeleteTextures(id[i]); } if (frameBuffer != 0) { glDeleteFramebuffers(frameBuffer); } }
9f35b49b-0c2b-44c3-b32c-898c17c23754
8
public boolean isBetween(Coordinate A, Coordinate B) { if (A.row == B.row && A.row == this.row) { // coordinates on same row if (Math.min(A.col, B.col) <= this.col && this.col <= Math.max(A.col, B.col)) return true; } if (A.col == B.col && A.col == this.col) { // coordinates on same col if (Math.min(A....
5487484b-dff5-4109-9fb0-de7592bb777a
3
public ChiPointer getVertexValuePtr(int vertexId, int blockId) { assert(vertexId >= vertexSt && vertexId <= vertexEn); if (!sparse) { return new ChiPointer(blockId, (vertexId - vertexSt) * converter.sizeOf()); } else { int idx = Arrays.binarySearch(index, vertexId); ...
1452ae22-e178-46cb-ac46-bdae0899e85f
1
public Boolean agregarStock(String producto, Integer cantidad){ if(!this.stock.containsKey(producto)){ return false; } Integer nuevaCantidad = this.stock.get(producto) + cantidad; this.stock.put(producto, nuevaCantidad); return true; }
e2dbc70c-5dbb-4577-ad05-a056fb714acc
8
public static String formatearNombreCalle(String c){ String[] l = c.toLowerCase().split(" "); String ret = ""; for (String s : l){ if (!s.isEmpty() && !s.equals("de") && !s.equals("del") && !s.equals("la") && !s.equals("las") && !s.equals("el") && !s.equals("los")){ char mayus = Character.toUpperCase(s.c...