method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
9b08bd07-1add-48d6-9eea-c1eb3ee37f20
1
public void setImgPath_ShutdownSym(Path img) { this.imgShutdownSym = handleImage(img, UIResNumbers.SHUTDOWNSYMBOL.getNum()); if (this.imgShutdownSym == null) { this.imgShutdownSym = UIDefaultImagePaths.SHUTDOWNSYMBOL.getPath(); deleteImage(UIResNumbers.SHUTDOWNSYMBOL.getNum()); ...
0638d9c5-bdaa-46da-9a20-fcdf984818f0
7
private void assignHuffmanCodeSymbols() { final int[][] huffmanMergedCodeSymbols = this.huffmanMergedCodeSymbols; final int[][] huffmanCodeLengths = this.huffmanCodeLengths; final int mtfAlphabetSize = this.mtfAlphabetSize; final int totalTables = huffmanCodeLengths.length; for (int i = 0; i < totalTables;...
6baf19d6-f76f-4805-9c4a-af37d3f1c0ef
8
public void addDao(BaseDaoImpl<?, ?> dao) { // if the array is full we double its size if (daoArrayC == daoArray.length) { BaseDaoImpl<?, ?>[] newDaoArray = new BaseDaoImpl<?, ?>[daoArray.length * 2]; // NOTE: Arrays.copyof is only for Java 1.6 for (int i = 0; i < daoArray.length; i++) { newDaoAr...
5f2d99bd-9985-4346-86ac-3cf68ac5bc25
9
public void DBUpdateClanMembership(String name, String clan, int role) { final MOB M=CMLib.players().getPlayer(name); if(M!=null) { M.setClan(clan, role); } DBConnection D=null; try { D=DB.DBFetch(); if(role<0) { DB.update("DELETE FROM CMCHCL WHERE CMUSERID='"+name+"' AND CMCLAN='"+clan+"...
18400337-0a7b-4808-81c5-5a4138734f5f
6
public static void load(DictType next) { // Create new pointer Dictionary._WordInfo = new WordInfo(); try { InputStream is = null; switch (next) { case TWL: is = Dictionary.class.getResourceAsStream...
7e5abf58-7a6c-4d53-b4a9-d5ee07cc2c80
1
public boolean replaceSubBlock(StructuredBlock oldBlock, StructuredBlock newBlock) { if (subBlock == oldBlock) subBlock = newBlock; else return false; return true; }
ce522960-29c4-404b-8976-6c3cd5688604
4
private ArrayList<Piece> getWhiteTeamPieces() { ArrayList<Piece> whiteTeam = new ArrayList<>(); // adds all pieces, except kings, to their appropriate teams in an ArrayList for(int y = 0; y < maxHeight; y++) { for(int x = 0; x < maxWidth; x++) { Piece currentPiece = board.getChessBoardSquare(x, y)...
bac22278-7245-4f11-ba3f-2ba622646556
0
public void setTurnOnCommand(Command turnOnCommand) { this.turnOnCommand = turnOnCommand; }
c4352948-a25f-4445-9d0a-f64460786940
2
public void play(){ if(muted)return; try{ new Thread(){ public void run(){ clip.play(); stopped = false; } }.start(); }catch(Throwable e){ e.printStackTrace(); } }
da902303-8fca-4abf-9392-af9660ac9f45
5
@Override public SnpEffectPredictor create() { // Read gene intervals from a file if (fileName == null) fileName = config.getBaseFileNameGenes() + ".txt"; System.out.println("Reading gene intervals file : '" + fileName + "'"); readRefSeqFile(); // Read gene info beforeExonSequences(); // Some clean-up befo...
3bfbc308-8fbb-4705-a5ed-33e0f56720ed
0
int popInt() { return ((Integer) pop()).intValue(); }
0a937bc5-9fde-4a99-9897-8d6a304b6ecd
9
@Override public void received( Connection connection, Object object ) { if (object instanceof ControlMessage) { ControlMessage msg = (ControlMessage)object; switch (msg.type) { // --- CONTROL MESSAGES --- case Network.CONTROL_CONNECT: System.out.println( connection + " REPO...
daacbc8f-c63d-4fef-8faf-40c198eb3445
1
public TcpListener() { clients = new Socket[10]; streams = new ObjectOutputStream[10]; Thread t = new Thread(this, "tcp listener"); try{ servSock = new ServerSocket(1337); } catch (Exception e){ e.printStackTrace(); } t.start(); }
62d1968a-aa91-4dc1-9fac-2ca0640a6e08
3
public void sub(int i){ try { queue1.put(1); System.out.println("线程" + Thread.currentThread().getName() + "正在阻塞"); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); ...
d5cf803e-5393-478f-bba0-7f295b8130e2
0
@Override public int getColumnCount() { return 4; }
5b79f129-1987-4257-8097-d8037d778a21
8
private void removeUnitProduction(Grammar cfg) { //Initialize lists to keep track of the total unit productions removed, as well as the unit productions removed //for each state. ArrayList<String> totalRemovedUnitProductions = new ArrayList<String>(); ArrayList<String> removedUnitProductionsPerState; ArrayLis...
556a3338-1267-4ea0-982b-36a65345972a
2
public void consultation(Colleague colleague) { String name = colleague.getName(); System.out.println("Called ..." + LoggerUtils.getSig() + "; from..." + name ); Iterator<String> it = colleagues.keySet().iterator(); while (it.hasNext()) { Colleague colleagueTmp = (Colleague) colleagues.get(it.next())...
8fcc4bf3-6d41-493b-9fd4-c624b8a60e30
1
public List<Param> getParam() { List<Param> parameter = new ArrayList<Param>(); for (Params paras : getParams()) { parameter.addAll(paras.getParam()); } return parameter; }
f99f5201-0d99-41f0-9da9-c48ddadefece
7
@Override public void parsePayload(final String str) throws ParseException { try { switch(getType()) { case BYTE: payload = (T) Byte.valueOf(str); break; case SHORT: payload = (T) Short.valueOf(str); break; case INT: payload = (T) Int...
e3eb0ea9-05ad-4518-a971-8521ca38de74
7
public String processTag(int i, XMLNode xmlnode) throws ProcessorException { if(xmlnode == null) return ""; Class class1 = null; if(processorRegistry != null) class1 = (Class)processorRegistry.get(xmlnode.XMLData); else throw new DeveloperE...
e3baad18-ea7b-4c32-86dc-b80220446015
2
@Override public void valueChanged(ListSelectionEvent e) { if (e.getSource() == orderingList) { System.out.println(orderingList.getSelectedIndex()); // check if order list is empty if (orderingList.getSelectedIndex() > -1) { // separate the text in the selected list item String[] values = orderingLi...
4be3ad7b-80a9-46c1-879e-c70ca5a6438e
1
public void deleteMax() { if (isEmpty()) throw new RuntimeException("Symbol table underflow error"); delete(max()); }
f6f38283-37b5-4ce5-97a3-bdb9d6e5fa06
2
public void addEnd(Location l) { if (locationEnd != null) { Location[] newEnd = new Location[locationEnd.length + 1]; newEnd[locationEnd.length] = l; for (int x = 0; x < locationEnd.length; x++) { newEnd[x] = locationEnd[x]; ...
ee831aec-81d2-49f0-b2e1-bb0bb039dfbb
0
@BeforeMethod public void setUpMethod() throws Exception { }
29124dfe-c60e-4bb0-b3bc-03b957019f5a
8
LwsFog(StreamTokenizer st, int debugVals) throws ParsingErrorException { debugPrinter.setValidOutput(debugVals); debugOutput(TRACE, "LwsFog()"); color = new Color3f(0f, 0f, 0f); while (!isCurrentToken(st, "DitherIntensity")) { debugOutputLn(LINE_TRACE, "currentToken = " + st.sval); if (isCurrentToken(st...
41e0351f-ad59-4fbc-8b02-52f7b5351e0b
8
private void insertDNA(int index, String str) { if (strands == null || strands[DNA_STRAND_BASE] == null || strands[DNA_STRAND_COMPL] == null) return; if (str == null || str.length() < 1) return; if (index < 0) index = 0; if (index > getLength()) index = getLength(); for (int i = 0; i < str.length(...
5acaf184-44d4-41bc-889c-1b1bedb01c5d
2
private void echoFile(String fileName){ File file = new File(fileName); try(FileReader freader = new FileReader(file)){ //try-with-resources char [] data = new char[100]; int size = freader.read(data); System.out.print(size + " "); for(char c: data){ System.out.print(c); } }catch(IOException i...
7f57f00c-58e1-4dda-914a-5fa6c3052869
1
public void setLocal(final int i, final Value value) throws IndexOutOfBoundsException { if (i >= locals) { throw new IndexOutOfBoundsException( "Trying to access an inexistant local variable " + i); } values[i] = value; }
f30eb0a0-194e-4ab3-9113-ba715403deae
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 HabitatDataset)) { return false; } HabitatDataset other = (HabitatDataset) object; if ((this.datasetKey == null...
fd28abdf-60fe-4e94-bb02-70707889a984
9
private byte[] unwrapResponseAPDU(byte[] rapdu, int len) throws GeneralSecurityException, IOException { long oldssc = ssc; try { if (rapdu == null || rapdu.length < 2 || len < 2) { throw new IllegalArgumentException("Invalid response APDU"); } cipher.init(Cipher.DECRYPT_MODE, ksEnc, ZERO_IV_PARAM_SP...
aed53482-09b5-4322-9875-1bab858a4f10
2
@Override public int hashCode() { int result = messageText != null ? messageText.hashCode() : 0; result = 31 * result + (isError ? 1 : 0); return result; }
dfae91f3-0cf2-4d32-b211-b9280a4ba401
7
public BasicTreeNode<T> insert(T newValue) { if (this.root == null) { this.root = createNode(newValue); ++this.size; return this.root; } // Our data structure doesn't hold nulls if (newValue == null) { return null; } ...
5695ce21-5b6e-4749-9e0f-2d275690da1d
9
public ArrayList<Dutyelement> regelmaessigeDutyelement( Dienstplan dienstplan, Fahrplan fahrplan) { ArrayList<Dutyelement> dutyelementList = new ArrayList<Dutyelement>(); for (int j2 = 0; j2 < dienstplan.getDutyelement().size(); j2++) { if (dienstplan.getDutyelement().get(j2).getElementType() == 1) { fo...
09db7d89-ee75-414e-843c-48c274683481
2
public void layoutContainer(Container container) { while (mDirty) { mDirty = false; Enumeration e = mComponents.keys(); container.getInsets(); while (e.hasMoreElements()) { Component c = (Component) e.nextElement(); Point p = (Point) mComponents.get(c); c.setBounds(p.x, p.y, c.getPref...
5c826326-7410-4c1b-aec7-84e0daf9f1e5
4
ArrayList<TreeNode> DFS(int s, int e) { ArrayList<TreeNode> subTrees = new ArrayList<TreeNode>(); if (s > e) { subTrees.add(null); return subTrees; } for (int i = s; i <= e; ++i) { ArrayList<TreeNode> tmpTreesL = DFS(s, i - 1); ArrayList<TreeNode> tmpTreesR = DFS(i + 1, e); for (TreeNode treeL ...
48861636-d123-42d7-a26a-a779598d6c24
7
@Override protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws IOException { DatabaseManager manager=DatabaseManager.getManager(); try { User user = manager.getUserDao().queryForId( Integer.parseInt(request.getParameter(ID))); if(user==null){ ServletR...
711b7163-8141-44b2-9d9c-a5dba1e60a81
5
@Override public boolean seqChangeEffect(Variant seqChange, ChangeEffects changeEffects) { // Has the whole UTR been deleted? if (seqChange.includes(this) && (seqChange.getChangeType() == VariantType.DEL)) { changeEffects.add(this, EffectType.UTR_5_DELETED, ""); // A UTR was removed enti...
083c2913-4ebf-4251-8636-0fef3cfa263b
2
public final TLParser.elseStat_return elseStat() throws RecognitionException { TLParser.elseStat_return retval = new TLParser.elseStat_return(); retval.start = input.LT(1); Object root_0 = null; Token Else72=null; Token Do73=null; TLParser.block_return block74 = null; ...
9c478552-3d50-4a0a-a18b-171e6cd8ee16
4
public static void loadResources() { try { Image img = new Image("images/guysprite.gif", false, Image.FILTER_NEAREST); SpriteSheet sprite = new SpriteSheet(img, 23, 32); PlayerEntity.STAND_ANIMATIONS = new Animation[4]; for(int i = 0; i < 4; i++) { PlayerEntity.STAND_ANIMATIONS[i] = new Animation(spri...
02dd25ee-9073-4c8f-935c-e305a046c4ea
9
public Point computeSize(int wHint, int hHint, boolean changed) { checkWidget(); int width = 0, height = 0; wrapItems((style & SWT.VERTICAL) != 0 ? hHint : wHint); boolean flat = (style & SWT.FLAT) != 0; for (int row = 0; row < items.length; row++) { int rowWidth = 0, rowHeight = 0; for (int i = 0; i < ...
7bf5afec-49b5-4373-ab0b-0133dd4238ff
9
private boolean r_mark_suffix_with_optional_s_consonant() { int v_1; int v_2; int v_3; int v_4; int v_5; int v_6; int v_7; // (, line 143 // or, line 145 lab0: do { ...
f0703d48-ba34-44e8-b888-f3b4b4ff8eaf
0
@Override public String getWorkingDay() { return super.getWorkingDay(); }
28089cb1-09dd-4b84-8198-416d0d59bf9a
1
@Override public String displayQuestion(int position) { String questionStr = (String) question; StringBuilder sb = new StringBuilder(); sb.append("<span class=\"dominant_text\">" + position + ".</span>\n"); sb.append("<span class=\"quiz_title\">\n"); sb.append("<span class=\"dominant_text\">Multi-Answer Ques...
e2645f7e-0d95-4c73-8073-98728c7e387b
2
@Override public void storeState(Hashtable<Object, Object> state) { List<Row> rows = getRows(); state.put(UNDO_KEY_ROWS, new ArrayList<>(rows)); state.put(UNDO_KEY_SELECTION, new Selection(getSelection())); String sortConfig = getSortConfig(); if (sortConfig != null) { state.put(UNDO_KEY_SORT_CONFIG, sort...
302ba055-513c-4fd6-99aa-1a7adf73c1cc
6
public String keyCount(File inputFile) throws IOException { //Throw error if file does not exist if (!inputFile.exists()) throw new IOException("Input file not found"); StringBuffer result = new StringBuffer(); //store the final result Map<String, Integer> intMap = new HashM...
e571e601-bdc7-4f0f-b0f7-693aa7e6dc6e
2
public EncryptedDeck encryptEncDeck(EncryptedDeck encDeck) throws InvalidKeyException, IllegalBlockSizeException, BadPaddingException { if (e == null) { System.err .println("Cannot encrypt when using decrypting constructor RSAService(gp, gq, gd)"); return null; } for (int i = 0; i < Deck.NUM_C...
0a106906-64db-4554-aed2-acd76a3532d0
5
boolean allChromChiasmata(HaploStruct[] slots) { if (slots.length==4) { //bivalent: only check one chrom, if this has recomb then the other has too return slots[0].getFounder().size()>1 || slots[1].getFounder().size()>1; } else { boolean re...
d1d6ec4c-2f43-4087-931d-f50deb912a67
5
public void tryMoveRight(final Block[][] tank) { //TODO: consider case where piece isn't lined up to left of layout // Don't escape the tank if (coord.getX() >= (Model.TANK_WIDTH - width)) { return; } // Make sure there is space to move into for (int x = 0; x...
a0dc5bd3-e6f2-4d9f-95af-0aa2659ece1c
2
public static KeyUsageType fromValue(String v) { for (KeyUsageType c: KeyUsageType.values()) { if (c.value.equals(v)) { return c; } } throw new IllegalArgumentException(v); }
6576fad8-0c98-4b04-9365-f4a9d5b76fcc
1
public static void main(String[] args) { persoon2 p1 = new persoon2("Sander", "SchijfStraat 26B", "Teteringen"); persoon2 p2 = new persoon2("Jeroen", "SchijfStraat 26B", "Teteringen"); persoon2 p3 = new persoon2("Femke", "SchijfStraat 26B", "Teteringen"); ArrayList<persoon2> lijst = new ArrayList<>(); lijst...
9b3de757-f778-4f96-abab-6bf50564f2d0
9
public void loadHistory(){ BufferedReader br = null; InputStream is = null; InputStreamReader isr = null; try { if(historyFile.exists()){ // Read History log from generated file System.out.println("generated file re...
f64d6f17-310d-40c9-973e-1ee1ed6935c1
3
@Override public List<Paciente> listAll() { Connection con = null; PreparedStatement pstm = null; ResultSet rs = null; List<Paciente> pacientes = new ArrayList<>(); try { con = ConnectionFactory.getConnection(); pstm = con.prepareStatement(LIST); ...
c09d4ba4-5c43-47c0-8526-c1f83a3419b4
8
public SoundBuffer read() { if( myAudioInputStream == null ) return null; // Get the format for the audio data: AudioFormat audioFormat = myAudioInputStream.getFormat(); // Check to make sure there is an audio format: if( audioFormat == null ) { ...
b8134f95-d016-41a0-8662-ea8ae4421cf6
1
@AfterTest public void cleanUp() { File f = new File("test1.h2.db"); if (f.exists()) f.deleteOnExit(); }
af069603-2072-4f00-a859-e238faef5428
5
private boolean activateCommand(CommandSender sender, String[] args) { if (!xPermissions.has(sender, "xauth.admin.activate")) { plugin.getMsgHndlr().sendMessage("admin.permission", sender); return true; } else if (args.length < 2) { plugin.getMsgHndlr().sendMessage("admin.activate.usage", sender); retur...
a35dea79-7769-42f7-88d2-3cc652a65519
7
private void addIgnore(long l) { try { if(l == 0L) return; if(ignoreCount >= 100) { pushMessage("Your ignore list is full. Max of 100 hit", 0, ""); return; } String s = TextClass.fixName(TextClass.nameForLong(l)); for(int j = 0; j < ignoreCount; j++) if(ignoreListAsLongs[j] == l) ...
feafc256-869c-46ec-9d4f-fd1ec5fc8c61
8
public static void main(String[] args) { // N-by-N percolation system (read from command-line, default = 10) int N = 10; if (args.length == 1) N = Integer.parseInt(args[0]); // repeatedly open site specified my mouse click and draw resulting system StdOut.println(N); ...
0b6e6b5b-f6b6-4673-a8fa-359fd80b027b
9
@Override public void parseFlatString(final String flat) { final String[] parts=flat.split(","); if(parts.length < 12 ) throw new IllegalArgumentException("Wrong number of commas in argument: "+flat); targetMajorMask = CMath.s_int(parts[0]); sourceMajorMask = CMath.s_int(parts[1]); othersMajorMask = CMat...
c8720a01-3570-467d-87d2-46b32474d395
3
public void crypt(InputStream in, OutputStream out, Cipher cipher) throws GeneralSecurityException, IOException { int blocksize = cipher.getBlockSize(); int outsize = cipher.getOutputSize(blocksize); byte[] inBytes = new byte[blocksize]; byte[] outBytes = new byte[outsize]; int inLen = 0;...
9a4559c7-106c-4aab-b58b-7b2388ed0b7e
9
public void replaceServices(int serviceToRemove, int serviceToSub){ ListIterator<Service> i = services.listIterator(); while(i.hasNext()) { Service nextService = i.next(); switch(serviceToRemove) { case ENGINE_OIL: if(nextService instanceof EngineOil) { ...
2f88db81-abd9-40bc-af10-a8b161c58603
8
public static void initHelper(Player p) { Scanner sc = null; File fileName = null; if (p == Player.BLACK) fileName = new File(bFileName); else fileName = new File(wFileName); try { sc = new Scanner(fileName); } catch (FileNotFoundException e) { System.out.println("Failed to read file. Please de...
fe3c8fba-2321-4570-8490-fdb153d8dbbe
7
public static Location extractTarget(AIUnit aiUnit, PathNode path) { final Location loc = (path == null) ? null : path.getLastNode().getLocation(); Tile t; Unit u; return (loc == null || aiUnit == null || aiUnit.getUnit() == null) ? null : (invalidRea...
34ed0a53-0761-49a8-a403-b53f8a076958
4
public void connection(Player player) { // si on est pas déjà connecté if (!isConnected) { // si le pseudo est bien inscrit --> on affiche logged boolean ret = false; try { ret = asker.playerExist(player); } catch (SQLRecoverableException e...
0dd34d94-fcb1-4af5-907d-01a57fd6322d
0
public AncestorIterable(T child, Selector<T, T> selector) { this._child = child; this._selector = selector; }
0aac8a21-7903-437b-8c20-8f15593ef508
3
public void run() { /* Run our little CLI */ ConsoleReader reader; try { reader = new ConsoleReader(in, out); } catch (IOException e) { out.println("Unable to initialize console."); e.printStackTrace(out); return; ...
33f1a92d-eefc-466d-8171-f7e857865605
5
@Override public void actionPerformed(ActionEvent e) { if (this.containsDigit(e.getActionCommand())) { for (JInternalFrame ji : this.desktop.getAllFrames()) { if ((ji.getTitle()).equals(e.getActionCommand())) { ji.moveToFront(); break; } } } else if ("new".equals(e.getActionCommand())) { /...
d64f58ae-f448-4ac3-8ca4-d9ccc956db4c
0
public IrcClient getClient() { return Client; }
df8bdb42-fc4f-41ad-9cb8-a92e4508120c
8
public static char[] multiplyInterface(char[] number1, char[] number2) { number1 = (number1.length==0)?new char[] {'0'}:number1; number2 = (number2.length==0)?new char[] {'0'}:number2; boolean minus = false; if(number1[0]=='-' && number2[0]!='-') { number1 = Arrays.copyOfRange(number1, 1, number1.length);...
5419037b-58e9-4b03-b78d-e850eda153bc
5
public static ArrayList<Media> getAllMedia() { try { if(conn == null || conn.isClosed()){ conn = DatabaseConnection.getConnection(); } } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } ArrayList<Media> mediaList = new ArrayList<Medi...
cf592dec-9132-4f1b-9d40-5ce0c2e5b838
1
public float getYAxisDeadZone() { if (yaxis == -1) { return 0; } return getDeadZone(yaxis); }
84ec2a76-919d-4a79-b5de-6d680a012334
0
public static synchronized Singleton_2 getInstance() { // 这个方法比上面有所改进 if (instance == null) { // 实例化 instance = new Singleton_2(); } return instance; }
ab2895a1-b43c-40d1-93b7-61adcd4cb2b3
7
public void newMessage(List<Object> data) { for (Object socket_message : data) { WebSocketRailsEvent event = new WebSocketRailsEvent(socket_message); if (event.isResult()) { if (queue.get(event.getId()) != null) { queue.get(eve...
e1ebb5fd-d0c5-4559-b850-4699755e4041
2
public static void main(String[] args) throws Exception { populateSets(args); System.out.println("Start reconciling"); long start_time, end_time; start_time = System.currentTimeMillis(); int nmessages = 0; Vector<long[]> deltas = new Vector<l...
6ee6c972-3559-444a-9145-c982a5068321
3
public void getPath() { // Find our path AStarContainer container = PathFinding.findPathDebug(startX, startY, endX, endY, tiles, HEURISTIC_WANTED, TIE_BREAKING_TYPE, EXPANSION_TYPE); closedTiles = new HashMap<Location, SearchNode>(); openTiles = new HashMap<Location, SearchNode>(); allTiles = new H...
d1fc2f11-6d0b-4ab9-bc96-24f405e275e0
4
public static void setEdgeType(String selectedType){ edgeTypeShortName = selectedType; if(selectedType.compareTo("Edge") == 0) { // the default edge from the framework edgeType = "sinalgo.nodes.edges.Edge"; } else if(selectedType.compareTo("BidirectionalEdge") == 0) { // the bidirectional edge from the fram...
173288c5-1aa7-4a18-8618-f154115914d4
2
@Override public void keyPressed(KeyBindingEvent keyBindingEvent) { SpoutPlayer player = keyBindingEvent.getPlayer(); if (player.getOpenInventory().getType().equals(InventoryType.WORKBENCH)) { player.closeInventory(); return; } if (!keyBindingEvent.getScreenType().equals(ScreenType.GAME_SCREEN)) { r...
011b7fd5-89db-4837-b4f8-5f405f7e3cf4
6
public void setElement(int userId, double rating){ int beginIndex = 0, halfIndex = 0, endIndex = userIds.length; if(userIds.length > 0){ while(true){ halfIndex = (endIndex - beginIndex) / 2 + beginIndex; if(userId < userIds[halfIndex]){ if(endIndex - beginIndex <= 1){ break; } endInd...
6f6012be-557e-4d11-8d6e-1de722b5e575
7
public Pair<String, File> parse() throws IOException { // opção de entrada Option input = OptionBuilder.withLongOpt("input"). hasArgs().withArgName("lista de arquivos"). withDescription("arquivos de entrada"). create("i"); // opçã...
d4fa0889-5927-49b0-a245-02c0d5f3c8a7
3
public void findSumWithoutRoot(TreeNode root,int sum,ArrayList<Integer> buffer,int level){ if(root == null) return ; buffer.add(level, root.data); int tmp = 0; for(int i = level;i>0;i--){ tmp += buffer.get(level); if(tmp == sum){ print(buffer); } } ArrayList<Integer> left = (ArrayList<Intege...
0ffe50f3-954c-43b2-b9a0-8088530e46b2
8
@Override public void onPovUpdate(int controllerID, float hatSwitchPosition, Component component) { if(Float.compare(hatSwitchPosition, Component.POV.UP) == 0) { player.incrementSelectedHotbar(-0.075f*2f); } else if(Float.compare(hatSwitchPosition, Component.POV.DOWN)...
0ab6d5eb-b4df-4c83-95e1-f594b79d4bbc
4
private Object objectFrom(final XSSFWorkbook workbook, final Cell cell) { Object cellValue = null; if (cell.getCellType() == Cell.CELL_TYPE_STRING) { cellValue = cell.getRichStringCellValue().getString(); } else if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) { ce...
eef5a291-aaf2-4a0a-a532-aa968d7dbbaa
0
public String getRecordCode() { return this.recordCode; }
070b4ee4-e079-4901-abc1-88a4d49b6e19
2
public static URL getCorporationLogoURL(int corporationID, short size) throws ApiException { if(Arrays.binarySearch(corporationLogoSizes, size) < 0) throw new ApiException("Invallid image size: "+Short.toString(size)+". Allowed sizes are: "+Arrays.toString(characterPortraitSizes)); try { return new URL(IMAGE_...
a76b20aa-9c52-4af9-81e1-04d4b1560548
0
public String getMessage() { return message; }
a9959994-eeee-4142-92de-c974a599c8c1
0
public static int getStepToVictim() { return stepToVictim; }
8c770e53-f4dc-4ee4-a9e6-850f91f04a98
5
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final FormasPagamento other = (FormasPagamento) obj; if (this.id != other.id) { return false; ...
49b95c92-695f-4332-98b1-e018c21ea794
0
public CheckResultMessage checkL5(int day) { return checkReport.checkL5(day); }
6196a4d3-a5b0-4626-aecf-9542a7dca600
3
public boolean search(T item){ LinkedListNode<T> current; boolean found; current = first; found = false; //search the list while (current != null && !found){ if (current.info.equals(item)) //item is found found = true; else ...
2ce7ed17-05f6-4647-9e2c-37d07e403d7d
6
static protected void UpdateLineColumn(char c) { column++; if (prevCharIsLF) { prevCharIsLF = false; line += (column = 1); } else if (prevCharIsCR) { prevCharIsCR = false; if (c == '\n') { prevCharIsLF = true; } else line += (column = ...
5b4bd953-769f-4b12-98ab-0b72f2c65de8
2
public static ItemStack buildItemStack(Material material, int amount, short materialData, String name, String... lore) { ItemStack i = new ItemStack(material, amount, materialData); ItemMeta meta = i.getItemMeta(); meta.setDisplayName(name); if (lore != null && lore.length > 0) { ...
374510f7-53b5-4179-bbf3-e3b28eb0569e
0
public void mousePressed(MouseEvent e) { maybeShowPopup(e); }
b492ee0b-f172-4782-b7ec-32e8d08fae67
5
private void readChunkUnzip(Inflater inflater, byte[] buffer, int offset, int length) throws IOException { assert(buffer != this.buffer); try { do { int read = inflater.inflate(buffer, offset, length); if(read <= 0) { if(inflater.finished()...
cf82bf41-675c-402a-9933-4f23b5805278
8
@Override public Orientation getStepOrientation(int lineIndex) { switch(lineIndex) { case 0: case 4: return Orientation.LEFT; case 1: case 5: return Orientation.DOWN; case 2: case 6: return Orientation.UP; case 3: case 7: return Orientation.RIGHT; default: return Orientation.NONE; ...
77065819-9822-44c1-a551-f556518961ab
1
public String getLabel() { if (label == null) label = "switch_" + (serialno++) + "_"; return label; }
6dea654d-c5e4-4f25-a15e-5a383cb442b8
3
private boolean hasIPAddress(ARPPacket packet, byte[] ipAddress){ byte[] thatIp = packet.sender_protoaddr; if (ipAddress.length != thatIp.length) return false; for (int i = 0; i < thatIp.length; i++){ if (ipAddress[i] != thatIp[i]) return false; } return true; }
f93eb003-9fc4-411d-84a0-13c49ad38e98
7
@Override public boolean execute(final CommandSender sender, final String[] split) { if (sender instanceof Player) { if (MonsterIRC.getHandleManager().getPermissionsHandler() != null) { if (!MonsterIRC.getHandleManager().getPermissionsHandler() .hasCommand...
1d924967-2c86-4ce9-8ba0-35140e76d691
9
public int largestRectangleArea(int[] height) { if (height == null || height.length == 0) return 0; Stack<Integer> S = new Stack<>(); int max = 0; int j = 0; for (int i = 0; i <= height.length; i++) { int h = i < height.length ? height[i] : 0; if (S.isEmpty() || h >= height[S.peek()]) { S.push(i)...
ba0b785f-9a43-4d23-9437-3d756a7f6cd8
8
@Override protected boolean remove(String constrain) { String measurementsCnst = (constrain != null && constrain.length() > 0) ? constrain : "1=1"; String readingInMeasurementCnst = " IN (SELECT readingId FROM readinginmeasurement WHERE (" + measurementsCnst + ")) "; String sql_m = " DELETE FROM " + Hom...
556ed68f-5c94-4e0b-b0f6-2b2b82857e39
4
public void setWorldState(CellState[][] states){ Grid<Actor> grid = world.getGrid(); for(int r = 0; r < states.length; r++){ for(int c = 0; c < states[0].length; c++){ Console.info(String.format("LOADING: Row %s Column %s State=%s", r, c, states[r][c])); Location l = new Location(r, c); Actor a = ...
25c362fe-ce58-424a-92ae-9ca4e4810974
5
public static File getPreferencesFile() { if( prefsFile == null ) { String userHome = System.getProperty("user.home"); if(userHome == null) { throw new IllegalStateException("user.home==null"); } File home = new File(userHome); prefsFile = new File(home, prefsFileName); if(!prefsFile.ex...