method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
791788f4-b7f8-4ee3-b37f-f3da66f58860
9
@Override public boolean isBuffered() { //if(gcode==null) return false; if (Constants.GCDEF.G0.equals(gcode) || Constants.GCDEF.G1.equals(gcode) || Constants.GCDEF.G2.equals(gcode) || Constants.GCDEF.M106.equals(gcode) || Constants.GCDEF.M107.equals(gcode) ||Constants.GCDEF.G29.equals(gcode) || Constants.GCDEF....
17a9fc56-a65e-4850-8d11-481f5e6525b0
9
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { Player player = null; if (sender instanceof Player) { player = (Player) sender; } if (args.length == 0) { if (player == null) { sender.sendMessage(ChatColor.RED+"This command can o...
40beffd7-82ca-4ee1-9bc6-9011daf697c7
8
public void run(){ try { while(true){ Thread.sleep(1000); //TEST STUB: change to 1000 synchronized(this.doc){ //Decrement all active game times by 1 second: NodeList activeList = this.doc.getElementsByTagName("games_active"); if(((Element)activeList.item(0)).getChildNodes() == null){ c...
a87fb7dc-57b3-4b34-8564-e8ed8838d3cf
4
protected boolean decodeFrame() throws JavaLayerException { try { AudioDevice out = audio; if (out==null) return false; Header h = bitstream.readFrame(); if (h==null) return false; // sample buffer set when decoder constructed SampleBuffer output = (SampleBuffer)decoder.decod...
f7809868-6184-4f47-b56b-33987cc0dd4e
8
public void verify(String expected, Flag... flags) { List<String> lines = component.out.reset(); while (lines.isEmpty()) { lines = component.out.reset(); } if (contains(Flag.LAST, (Object[]) flags)) { lines = Collections.singletonList(lines.isEmpty() ? "" : lines.get(lines.size() - 1)); } String actua...
3b0a6d6b-5a35-486c-bf65-4ebaeecbe4e7
3
private boolean isPrime(int n) { boolean result = true; // assume true and try to prove otherwise int i=2; while ((i<n) && (result == true)) { if ((n%i) == 0) { result = false; } i++; } return result; }
2e2d9701-0b8b-463d-82a9-ffd2660f831d
9
void outerHtmlTail(StringBuilder accum, int depth, Document.OutputSettings out) { if (!(childNodes.isEmpty() && tag.isSelfClosing())) { if (out.prettyPrint() && (!childNodes.isEmpty() && ( tag.formatAsBlock() || (out.outline() && (childNodes.size()>1 || (childNodes.size()==1 && !...
32280eb0-b3d2-4473-bf36-86156504447a
2
public T findOneByField(String campo, String condicao, String valor) { T result = null; try { Query query = manager.createQuery("select x from " + entityClass.getSimpleName() + " x " + "where x." + campo + " " + condicao + ":value"); query.setParameter(campo, valor); result = (T) query.getSingleResult(...
32f4164d-8eb2-49a0-b619-dc900e0aa28b
3
public static void start(){ List<String> mapsToExclude = new ArrayList<String>(); mapsToExclude.add(previousMapName); final Map mA = MapData.getRandomMapExcluding(mapsToExclude); mapsToExclude.add(mA.getName()); final Map mB = MapData.getRandomMapExcluding(mapsToExclude); mapsToExclude.add(mB.getName()); ...
1c5fe542-f73b-43e0-8ce1-945c1fb9df4c
6
private boolean compare(Block testBlock, int row, int column, int rowOffset, int columnOffset) { for(int i = 0; i < BLOCK_SIZE; i++) { for(int j = 0; j < BLOCK_SIZE; j++) { try { if (testBlock.getValue(i, j) == ACTIVE_BLOCK) { if(gameBoard[i + row + rowOffset][j + column + columnOffs...
af5f5d68-3ce6-442f-b4c9-eafe6f5def95
1
public static Facade getFacade(boolean reset) { if (true) { instance = new Facade(); } return instance; }
c1bb87d9-81b2-44d3-a7ac-bbd785cf3566
4
public static void main(String args[]) { try{ ServerSocket server=null; try{ server=new ServerSocket(6888); //创建一个ServerSocket在端口6888监听客户请求 }catch(Exception e) { System.out.println("can not listen to:"+e); //出错,打印出错信息 } ...
59995e30-53ef-44a7-a18e-2c77b31baa40
1
public static String wrapVariableBinding(String command, CycSymbol variable, Object value) { try { // @todo consider setting *ke-purpose* return "(clet ((" + DefaultCycObject.cyclifyWithEscapeChars(variable, true) + " " + getAPIString(value) + ")) " + command + ")"; } catch (Exception e) { ret...
e49a8a15-c529-4b97-b1f0-aae243bc4807
8
private boolean checkBorders() { boolean check = false; int width = gameInst.container.getWidth(); int height = gameInst.container.getHeight(); if (location[0] >= width) { check = true; if (velocity[0] > 0) velocity[0] *= -.5f; } if (location[0] <= 0) { check = true; if (velocity[0] ...
fb8be363-471f-42a0-b0d3-d4e094f50fdd
1
private void printCell(String s) { System.out.print(s); for (int i = s.length(); i <= 16; i++) { System.out.print(" "); } }
9a59dac7-6edb-46ba-a31f-bf7574ea57d1
5
@BeforeClass public static void setUpBeforeClass() { try { new MySQLConnection(); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (SQLException e) { e...
5241b3a6-42ca-4c00-9615-ff30247b2bfd
7
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); int writtenKeyCount = keyCount; if (writtenKeyCount != 0) { keyCount = 0; boolean hasIntValues = in.readBoolean(); boolean hasObject...
096b8848-47d5-425f-b296-f612d5fbc14d
7
public static boolean tryRepairingSomethingIfNeeded(Unit worker) { // If we're out of minerals, don't repair if (!xvr.canAfford(10)) { return false; } // Disallow wounded workers to repair; this way we can save many lives if (worker.getHP() < 45) { return false; } // =============================...
36c67d06-a109-4561-a971-c92a57b70b21
1
public static Balancer getInstance() { if (balancer == null) { balancer = new Balancer(); } return balancer; }
07bd1dc3-1961-4b0a-90fb-bff1f1057d90
0
public Piece[] getSuivantes() { return suivantes; }
95079902-ff93-4bad-a3ec-1a7aed38bc34
1
public List<ExtensionsType> getExtensions() { if (extensions == null) { extensions = new ArrayList<ExtensionsType>(); } return this.extensions; }
0465b557-7abe-4262-9d47-857d6a74e9c8
4
private void initilizeComponents (){ //Create User Options Panel userOptionsPanel = new JPanel(); userOptionsPanel.setLayout(new GridLayout(15,2)); userOptionsPanel.setBorder(BorderFactory.createEtchedBorder()); //Create Bottom Buttons bottomButtons = new JPanel(); bottomButtons.setLayout(new FlowLa...
b3585136-7db9-4101-886d-236686df904b
4
@Override public boolean equals(Object obj) { if (this == obj) { return true; } else if (obj instanceof SentenceSpan) { SentenceSpan a = (SentenceSpan) obj; return getSentence().equals(a.getSentence()) && section.equals(a.section) && Arrays.equals(getWords(), a.getWord...
ad462e13-9939-44ce-b746-bb92c08adb92
1
public JSONArray getJSONArray(String key) throws JSONException { Object object = this.get(key); if (object instanceof JSONArray) { return (JSONArray)object; } throw new JSONException("JSONObject[" + quote(key) + "] is not a JSONArray."); }
9f912028-209e-416a-9a10-c4ce49a4bb66
5
private void normal(Key key) { if (limitReached()) { return; } // If delete comes through don't print it out! if (key.getCharacter() == 127) { return; } TextGrid.DataGridCel cel = grid.getCel(currentRow + rowOffset, currentCol + c...
5a55e66c-d09a-4ee9-90e0-45e1411ace85
1
public URLFileDownloader(String s) throws MalformedURLException { this.url = new URL("http://oberien.bplaced.net/Oberien/" + s); s = s.replace("%20", " "); if (s.contains("natives")) { s = "Game/" + s.substring(s.lastIndexOf("/")); } file = new File(s); }
ddedc27c-8e17-4b8e-a8cd-501a7b1b95cc
0
public GrammarTestAction(GrammarEnvironment environment) { super("Grammar Test", null); this.environment = environment; this.frame = Universe.frameForEnvironment(environment); }
30f4f5df-6c5f-4bf6-bb74-2be8ee7b6c01
9
public void retrieveEvent(String[] arguments) throws RemoteException { final String retrieveUsage = "Usage: retrieve [user] xxxx-xx-xx xx:xx:xx xxxx-xx-xx xx:xx:xx.\n"; if((arguments.length != 5) && (arguments.length != 6)) { System.out.println(retrieveUsage); return; } ArrayList<E...
520513a5-0389-4210-b9d7-a7b81efa2cd1
7
public void loadGraphFromSXGFString(String graphXML) { //System.out.println(graphXML); try { Document document = builder.parse(new InputSource(new StringReader(graphXML))); // Graph NodeList graphroots = document.getElementsByTagName("Graph"); Node graph...
598ad60a-3199-48d6-8de1-73ae2defdb81
3
public void replace(String statement) throws CannotCompileException { thisClass.getClassFile(); // to call checkModify(). ConstPool constPool = getConstPool(); int pos = currentPos; int index = iterator.u16bitAt(pos + 1); Javac jc = new Javac(thisClass); ClassPool cp =...
f8107a94-a5a9-4ea5-8bd1-f69d1073bd57
2
public List<JsonIngredient> getParentIngredients(){ if(parent == null){ return null; } if(parent.getInternal() == null){ return null; } return parent.getInternal().getParent(); }
68cbf032-98ef-4abf-ae29-e4b34934287f
4
private String fetchFormatFromQuery( URI requestedURI, String defaultFormat ) { if( requestedURI.getQuery() == null ) return defaultFormat; String encoding = java.nio.charset.StandardCharsets.UTF_8.name(); // "UTF-8"; String key = "format"; try { ikrs.httpd.datatype.Query query = new ikrs.h...
5350d034-a4b9-4bd3-9a7c-6844a3bce39e
2
public void minimumParentheses(){ Pattern pattern = Pattern.compile("[(][0-9¥+¥-¥*/]+[)]"); Matcher matcher = pattern.matcher(expression); if (matcher.find()) { for(int i = 0; i < matcher.groupCount(); i++) { //add matched expression into list and replace it to %s ...
006e8587-c766-4d37-9a53-0e3bceb72863
3
public boolean isPathSelected(TreePath path, boolean dig) { if (!dig) { return super.isPathSelected(path); } while (path != null && !super.isPathSelected(path)) { path = path.getParentPath(); } return path != null; }
3b1e430a-02d8-435d-ae67-20263e36013c
3
@Override public void ejecutar(Stack<Valor> st, MemoriaDatos md, Cp cp) throws Exception { if (st.size() < 2) throw new Exception("DIV: faltan operandos"); Valor op1 = st.pop(); Valor op2 = st.pop(); if (op1 instanceof Entero && op2 instanceof Entero) { st.push(new Entero(((int) op1.getValor()) / (...
fac678c5-0f51-4276-9e76-16146830a838
0
public Integer getId() { return this.id; }
66311d21-94c8-4478-a1c6-fc7d7648cfe6
4
protected synchronized void ensureOpened(){ if (this.dialogState == DialogState.CLOSED) { throw new IllegalStateException("对话已经关闭"); } else if (this.dialogState == DialogState.OPENNING) { throw new IllegalStateException("对话正在建立"); } else if (this.dialogState == DialogState.CREATED) { throw new IllegalSig...
6c5750b0-e08e-4cf9-9d21-65551d8fb3ff
3
public boolean login(){ String Username = jTextField1.getText(); String Password = String.valueOf(jPasswordField1.getPassword()); String reply = ""; try { Soutput.writeObject("login " + Username + " " + Password); Soutput.flush (); } catch (IOException e) { System.ou...
0f498efc-ea8e-41d0-92ba-a3e57994dcf2
3
static boolean check(int r, int c) { return r >= 0 && r < m && c >= 0 && c < n; }
c279703a-9785-4c50-baa8-5432e8309b5e
7
public void show() { if (mazeFilled) { for (int i = 0; i < height; i++) { for (int j = 0; j < width; j++) { if (maze[j][i].equals(ETile.WALL)) { System.out.print(ETile.WALL.getSymbol()); } else if (maze[j][i].equals(ETil...
5abfa783-40b9-45d1-9ef3-2794bb189d23
0
private void setNameGameWorld(String name) { nameGameWorld = name.substring(name.lastIndexOf(".") + 1, name.indexOf("Loc")); }
367da238-e8a6-4275-9ce1-76aeeadc19ce
5
public void putByte(byte newByte) { byte[] ar = new byte[1]; ar[0] = newByte; msg = new String(ar); if (newByte == '$') { // new Message Start detected // reset Msg String and add Start-delimiter outmsg = msg; startDetected = true; } else if (newByte == '\n' && startDetected == true) { // En...
7e925f6a-7ea8-4146-b2b9-9adb965e7020
2
public void displayTieOrWinMessage() { if(this.isInCheck()&&!this.canGetOutOfCheck()) { this.displayGameOverMessage(); } else { this.displayTieMessage(); } }
0cc8fbcd-b141-4a07-ae65-4495c43031be
5
@Override public void execute(CommandSender sender, String[] arg1) { if (!CommandUtil.hasPermission(sender, PERMISSION_NODES)) { sender.sendMessage(plugin.NO_PERMISSION); return; } if (arg1.length < 1) { sender.sendMessage(ChatColor.RED + "/" + plugin.unban + " (PlayerName)"); return; } St...
5a057198-16aa-4a97-bdce-4164e9a653ba
8
public boolean fletching2(int Status, int Amount1, int Amount2) { if (playerLevel[playerFletching] >= fletching[1]) { addSkillXP((fletching[2] * fletching[3]), playerFletching); deleteItem(useitems[0], useitems[3], Amount1); deleteItem(useitems[1], useitems[2], Amount2); addItem(fletching[4], Amount2); ...
5b249080-235e-4246-9abd-cc53d430d53c
3
public boolean adicionarPromocao(Promocao p, String nomeOUcodigo) throws ExceptionGerenteEstoque { if (getProduto(nomeOUcodigo)== null){ throw new ExceptionGerenteEstoque("Produto n��o exite"); } if (p.getId() == 0){ throw new ExceptionGerenteEstoque(" Promocao n��o exite");...
7f62b039-8406-4e3e-bd8d-c9ee6c8d878e
4
@EventHandler public void onPlayerRespawn(PlayerRespawnEvent event) { final Player player = event.getPlayer(); if (!player.hasPermission("lifemc.lives.lose")) return; int lives = plugin.getDataHandler().getLives(player); if (lives <= 1) { plugin.getDataHandler().setLives(player, 0); //player.getI...
bc892e0b-0c97-458b-873c-bacb406926d6
7
private String convertXXX(int n) { if(n==0) return ""; int first = n % 10; int second = ((n - first) /10)%10; int third = ((n - 10 * second - first) / 100)%10; String result = ""; if (third != 0) { result += getWord1(third); result += " Hundred and "; } if (second != 0) { if (second > 1) { ...
5f539ca1-f9aa-45e1-90a3-d918d8cac4bf
6
public static void main(String[] argv) throws IOException, InterruptedException, LWJGLException { Renderer r = new Renderer(1); Sprite s = new Sprite("mask.dmi"); for(int x = 0; x<20; x++) for(int y=0;y<20;y++) { Atom a = new Atom(); a.direction = Directions.SOUTH; a.frame = 0; a.sprite_state ...
88faeebd-b0a1-4824-81d6-367ef081826d
1
public static Duration minDuration(Duration a, Duration b) { if (a.isShorterThan(b)) { return a; } else { return b; } }
a4089b6e-c1a8-48f0-8f1b-39f435657e52
9
public static <VertexType extends BaseVertex, EdgeType extends BaseEdge<VertexType>> AbstractList<VertexType> doSort(BaseGraph<VertexType, EdgeType> graph) { ArrayList<VertexType> alv = new ArrayList<VertexType>(); ArrayList<VertexType> out = new ArrayList<VertexType>(); LibraryUtils.fa...
2b7600fc-25f2-4fda-acb9-960154887528
3
public static void main(String[] args) { // Build model Model model = new CPModel(); // Declare every letter as a variable IntegerVariable d = Choco.makeIntVar("d", 0, 9, Options.V_ENUM); IntegerVariable o = Choco.makeIntVar("o", 0, 9, Options.V_ENUM); IntegerVariable n = Choco.makeIntVar("n", 0, 9, Options...
41de44ee-5c02-4b33-ae09-f3e86fa5b2a5
2
@EventHandler public void onJoin(PlayerJoinEvent e){ Player p = e.getPlayer(); try{ API api = Plugin.getAPI(); api.setPlayersJob(p, api.getDefaultJob()); if(api.checkForProperty(p) == null){ api.setMoney(p, api.getStartMoney()); }else{ } }catch(Exception exception){ }...
e50f6603-6b18-405c-8ba5-77b4f5e68d05
5
public String toString() { StringBuffer buf = new StringBuffer(); // line 1 buf.append(" "); for (int i=1; i<=s.length(); i++) buf.append(" "+sAt(i)+" "); buf.append("\n"); // line 2 buf.append(" "); for (int i=1; i<=s.length(); i++) buf.append("-...
1136614f-78d5-4544-90a9-347e130b07df
0
public ArrayList<Pet> arrayList(int size) { ArrayList<Pet> result = new ArrayList<Pet>(); Collections.addAll(result, createArray(size)); return result; }
f99bb983-f62a-4278-ba83-738d381b0d1e
4
public void presentMineralMap(World world, Terrain terrain) { final int colourKey[][] = new int[mapSize][mapSize] ; final int typeColours[] = { 0xff000000, 0xffff0000, 0xff0000ff, 0xff00ff00 } ; final int degreeMasks[] = { 0xff000000, 0xff3f3f3f, 0xff7f7f7f, ...
647fab2f-3ac2-48f6-8ced-7f06076de663
8
private final void method2590(byte[] is, int[] is_0_, int i, int i_1_, int i_2_, int i_3_, int i_4_, int i_5_, int i_6_) { int i_7_ = -(i_3_ >> 2); i_3_ = -(i_3_ & 0x3); for (int i_8_ = -i_4_; i_8_ < 0; i_8_++) { for (int i_9_ = i_7_; i_9_ < 0; i_9_++) { if (is[i_1_++] != 0) is_0_[i_2_++] = ...
4391c553-02dd-4d78-9e60-abce54d59fe1
4
public boolean hasChild(Spatial spat) { if (children.contains(spat)) return true; for (Spatial child : children) { if (child instanceof Node && ((Node)child).hasChild(spat)) return true; } return false; }
d98ad612-0540-4c3f-ae39-7c7abfa8606d
3
private boolean checkWin(){ boolean win = false; int deads = 0; for (SimulatorRobot robot : Board.robots) { if (robot.getLives() <= 0) { deads++; if(deads == Board.robots.size() -1 ){ win = true; } ...
e41be2bb-1bc1-41d6-81ff-033e7e723b4e
2
public boolean replaceSubBlock(StructuredBlock oldBlock, StructuredBlock newBlock) { if (thenBlock == oldBlock) thenBlock = newBlock; else if (elseBlock == oldBlock) elseBlock = newBlock; else return false; return true; }
8f493373-39cc-494d-beba-54b32e2f4e05
2
public void update(GameContainer gc, StateBasedGame sbg, int delta)throws SlickException { if(!isGameOver) { if(!isPause) { } else { } } else { } }
3f4f4484-3d99-4c17-982d-f10cfc309d2f
8
private void playEvents() { try { while(running.get()) { // Lock the events and wait until we have unprocessed events eventsLock.lock(); try { while(eventsIsProcessed.get()){ eventsNotProcessed.await(); } // Double buffer the events so that we can play them completely pl...
8394a70d-dd50-4788-9b1f-7128517a5947
5
private void handleValidDate(Field field, Object container, SwingWorkerInterface swingworker) throws IllegalAccessException { ValidDate validDate=field.getAnnotation(ValidDate.class); if(validDate!=null && isCheckSupposedToExecuteBasedOnAction(validDate.value(), swingworker.getAction())){ Ob...
e3b68669-131f-44d4-bed0-807b4c28ce07
0
public ProfessorServlet() { super(); // TODO Auto-generated constructor stub }
1f992434-031e-4899-8fe8-55ceb56386f9
4
private void setTextFieldVerifiers() { //Определяем массив текстовых компонентов final JComponent[] componentArr = new JComponent[]{textFieldName, textFieldMinAmount, textFieldMaxAmount, textFieldDuration, textFieldStartPay, textFieldPercent, textAreaDescription}; //Создаем обьект проверки ...
91e4a100-86ee-4163-a2b1-304363854b0c
9
private boolean areValidObstacles() { boolean answer = true; for(Obstacle o : obstacles) { if(o.getxStart() <= 0 || o.getxStart() >= nbLigneGrille -1) { answer = false; } if(o.getyStart() <= 0 || o.getyStart() >= nbColGrille - 1) { answer = false; } if(o.getxEnd() <= 0 || o.getxEnd() ...
365fe2ab-664e-4ca2-beeb-99f64b9d9d65
7
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { final Item target=getTarget(mob,null,givenTarget,commands,Wearable.FILTER_ANY); if(target==null) return false; if(!(target instanceof Scroll)) { mob.tell(L("You can't clarify that.")); ...
3eb63bcc-aff9-4901-a53a-dcf626abbd5b
4
@Override public String getColumnName(int column){ switch(column){ case 0: return ("szYear"); case 1: return("szMonth"); case 2: return("IntWorkingDay"); case 3: return("szWorkplaceId"); default: return null;...
eb596259-f4be-48b9-9b84-f36eb7d76363
3
public void newwdg(int id, Widget w, Object... args) { if(w instanceof Listbox) { chrlist = (Listbox)w; } else if(w instanceof Button) { if(((Button)w).text.text.equals("I choose you!")) selbtn = (Button)w; } check(); }
cf41051e-43cd-48a6-9462-e1bda2fe036b
8
public List<SearchResult> findPostByWord(String keyWord, Map<String, String> indexMap, File contentFile) { List<SearchResult> results = new ArrayList<SearchResult>(); try { keyWord = keyWord.toLowerCase(); String indexStr = indexMap.get(keyWord); if (indexStr == null || indexStr.trim().length() == 0) ...
912b6d77-bb86-4417-bafe-15f5cd999584
2
@Override public void execute() { final SceneObject cutRoot = SceneEntities.getNearest(Settings.CUT_ROOT_FILTER); if(cutRoot != null) { doAction("Collect", cutRoot); } else { final SceneObject uncutRoot = SceneEntities.getNearest(Constants.STRAIGHT_ROOT_ID); if(uncutRoot != null) { doAction("Chop", ...
0b79bf54-1529-4336-9c7e-b2c10c45debd
3
public boolean testVictoire(Joueur joueur) { for (Case c : joueur.getCases()) { if (c.getBateau() != null && !c.getBateau().testBateauCoule()) { return false; } } return true; } // testVictoire(Joueur joueur)
7ad0bd46-7065-46c4-8712-ace09ac5d9e2
7
public static void makeCompactGrid(Container parent, int rows, int cols, int initialX, int initialY, int xPad, int yPad) { SpringLayout layout; try { layout = (SpringLayout)pa...
d6aaeec9-6fc8-4f23-ba22-edac2cd71627
7
protected int parseTag() throws IOException { if (_peekTag >= 0) { int tag = _peekTag; _peekTag = -1; return tag; } int ch = skipWhitespace(); int endTagDelta = 0; if (ch != '<') throw expectedChar("'<'", ch); ch = read(); if (ch == '/') { endTagDel...
128a0e00-95f8-415d-81e1-92d0f9be87f4
5
public Theater getTheater(int theaterID) throws RemoteException { if(this.lastRequest == -1) this.lastRequest = System.currentTimeMillis(); if(connectionTimout()) return null; for(LinkedList<Theater> theaters : list) for(Theater t : theaters) if(t.getId() == theaterID) return t; retur...
1a7ea015-6020-4998-b2ef-fa1246389887
1
public void commitOnly(final Set methods, final Set fields) { try { final OutputStream outStream = loader.outputStreamFor(this); final DataOutputStream out = new DataOutputStream(outStream); writeHeader(out); writeConstantPool(out); writeAccessFlags(out); writeClassInfo(out); writeFields(out, fi...
47690c43-a255-4708-bc63-aeddfd8d8013
7
private boolean search(Task task) throws IOException, ParseException { searchResult = new ArrayList<TaskData>(); String content = task.getContent(); if (content != null && !content.isEmpty() && (content.startsWith("block") || content .startsWith("blocked"))) { searchResult = blockedList; } else...
ded29651-5b8c-4146-a270-42c267db74dc
5
public int [][] darHuertosIniciales() throws Exception { int ij0=0; int ij1=0; int[][] rta= new int[Interfaz.NUM_COORD][Interfaz.NUM_HUERTOS]; for(int i=0; i <Interfaz.NUM_COORD;i++) { for(int j =0; j<Interfaz.NUM_HUERTOS;j++) { if(j%2==0){ ij0=Integer.parseInt(txtCrops[i][j].getText()); r...
3f6850bf-f8a8-481a-a031-c9d2223b7abf
3
@SuppressWarnings("deprecation") public static boolean isPigChest (Entity entity) { if (entity instanceof Pig) { Pig pigc = (Pig) entity; if (pigc.getPassenger() instanceof StorageMinecart) { ItemStack pigcChest = new ItemStack(Material.LEATHER_CHESTPLATE, 1, (short) ...
591b84a8-362a-41d8-84ee-593b4c0abfb3
1
protected static void importOutlinerDocument(FileProtocol protocol) { DocumentInfo docInfo = new DocumentInfo(); PropertyContainerUtil.setPropertyAsString(docInfo, DocumentInfo.KEY_PROTOCOL_NAME, protocol.getName()); PropertyContainerUtil.setPropertyAsBoolean(docInfo, DocumentInfo.KEY_IMPORTED, true); // Sel...
970e1968-213e-4343-92e1-207c45d13a2a
3
public boolean addBindListener( BindListener l ) throws NullPointerException { if( l == null ) throw new NullPointerException( "Cannot add null listeners." ); for( int i = 0; i < this.bindListeners.size(); i++ ) { if( this.bindListeners.get(i) == l ) return false; } this.bindListeners.add( l ); re...
18d59fbd-2319-4e32-852f-07bb6f14fae2
3
public void createOffspring(Gene gene2, Gene offspring){ int crossoverBit = Math.abs(Environment.random.nextInt()%environment.bitsPerGene); int crossoverByte = crossoverBit/Byte.SIZE; byte[] firstGene, lastGene;//who provides the first bits? if(Environment.random.nextInt()%2 == 0){ firstGene = geneData...
fa8e312a-a46b-4e72-86a5-628e9d470687
9
public AsieLauncherGUI() { launcher = new AsieLauncher(); launcher.setUpdater((IProgressUpdater) this); isRunning = true; setResizable(false); setLocationRelativeTo(null); setDefaultCloseOperation(DISPOSE_ON_CLOSE); addWindowListener(new WindowAdapter() ...
23e86af2-c6f8-445f-87b7-dd76c77ab40f
5
public ConsoleOut(JavaConsole console) { if(mFonts == null) { mFonts = new Font[4]; for(int i = 0; i < 4; i++) { mFonts[i] = new Font("Lucida Console", i, 14); } } mForegroundColor = Color.white; mBackgroundColor = Color.black; mConsoleForegroundColor = Color.white; mConsoleBackgroundC...
6e670139-04d1-4baa-85c3-0a15e75c9f41
4
@Override public String multiply(String a, String b) throws NumberFormatException { if (a.equals(BigDecimal.ZERO) || b.equals(BigDecimal.ZERO)) { return String.valueOf(BigDecimal.ZERO); } else if (a.contains(".") || b.contains(".")) { BigDecimal aa = new BigDecimal(a); BigDecimal bb = new BigDecim...
5defe005-25ec-4311-9f74-9f60a0f9cf3a
2
private static int findLastInstanceOfStackHanoi(Stack[] stacks) { for (int i = stacks.length - 1; i >= 0; --i) { if (stacks[i] instanceof StackHanoi) { return i; } } return -1; }
f6a88bd1-d4f7-4ea4-86cb-4693a4e73154
8
public static String printVars(String className, boolean raw, boolean newLine, MyVar... varList) { String res = className == null ? "" : className + (newLine ? "\n" : " "); for (MyVar v : varList) { res += raw ? "" : "["; if (v.name != null && !raw) { res += v.na...
a4eb867a-eef7-44b4-a5a0-3f168bc16fcc
7
public void method360(int i, int j, int k) { for(int i1 = 0; i1 < anIntArray1451.length; i1++) { int j1 = anIntArray1451[i1] >> 16 & 0xff; j1 += i; if(j1 < 0) j1 = 0; else if(j1 > 255) j1 = 255; int k1 = anIntArray1451[i1] >> 8 & 0xff; k1 += j; if(k1 < 0) k1 = 0; else if(k...
3ca32194-6a89-4fbb-a130-8757bb60d8fa
3
public void simpan(javax.swing.JTextField no_beli, javax.swing.JTable kwitansiTable){ if (!no_beli.getText().equals("")){ kwitansi.setNoPembeli(no_beli.getText()); Object[][] listKwitansi = new Object[kwitansiTable.getRowCount()][3]; for (int i=0; i <kwitansiTable.getRo...
38f9d833-558f-44e4-8016-d8436f8759a8
6
public static void tempBanPlayer( String sender, String player, int minute, int hour, int day, String message ) throws SQLException { BSPlayer p = PlayerManager.getPlayer( sender ); BSPlayer t = PlayerManager.getSimilarPlayer( player ); if ( t != null ) { player = t.getName(); ...
fbf93435-915e-4f25-97c5-f5aa52aa2dbc
9
public Node<T> findLowestCommonAncestor(Node<T> root, T data1, T data2){ if(root ==null){ return null; } if(contains(root.left, data1) && contains(root.left, data2)){ return findLowestCommonAncestor(root.left, data1, data2); } if(contains(root.right,data1...
edb76fa1-4386-42bf-9ab2-052b3d2e6b9f
7
public int open() { final Shell dialog = new Shell(getParent(), SWT.DIALOG_TRIM | SWT.RESIZE | getStyle()); dialog.setText(GraphicsExample.getResourceString("Gradient")); //$NON-NLS-1$ GridLayout gridLayout = new GridLayout(); gridLayout.numColumns = 2; gridLayout.marginHeight = 10; gridLayout...
3ddb332d-7a6b-49cc-b765-4d8db840cd43
7
@Override public List<MOB> getCurrentReaders() { final List<MOB> readers=new LinkedList<MOB>(); if(amDestroyed()) return readers; final MOB lastReader=this.lastReader; if(lastReader!=null) { if(((lastReader==owner())||(lastReader.location()==owner())) &&(CMLib.flags().isInTheGame(lastReader, true))...
9f092c1b-d891-41ec-9b35-057d0c2e6706
2
@Override public void run() { while (!end) { process(); try {Thread.sleep(SLEEP_LONG);} catch (InterruptedException e) {} } process(); }
e3ca6ca7-3922-44ce-9206-de45ed689f7d
2
public double getDouble(int index) throws JSONException { Object object = get(index); try { return object instanceof Number ? ((Number)object).doubleValue() : Double.parseDouble((String)object); } catch (Exception e) { throw new JSONExcepti...
d02e126e-0d40-405e-9619-0b5b98505480
0
public Keyboard getKeyboard() { return keyboard; }
5c5de92a-288d-43b3-a3f7-312aaa5811b6
9
public BufferedImage getImage(){ boolean canMove = this.canMove; this.canMove = true; BufferedImage img = null; if(lastMove == NO_MOVE) img = isLookRight() ? skin.getStandR() : skin.getStandL(); else if(lastMove > MOVE_RIGHT) img = isLookRight() ? skin.getJumpR() : skin.getJumpL(); else img = isLoo...
958589d6-1af0-4fc2-81e8-424ae8083160
7
public static String search4SqVenues(double[] sw, double[] ne, String clientId, String clientSecret) throws Exception { HttpsURLConnection c = null; InputStream is = null; int rc; String url=""; /** This parameter represents the date of the Foursquare API version that we use. * If you want to modify the...
be20345f-eebe-467b-ad73-541c3b9e3380
3
public void showCamera() { if (checkCameraSupport() == false) { // showAlert("Error", "Camera is not supported!", null); return; } if (checkPngEncodingSupport() == false) { // showAlert("Error", "Png encoding is not supported!", null); return; ...
9b04154e-3e39-457b-af25-453f4d05a621
9
private void findCutOff(double[] pos, double[] neg){ int[] pOrder = Utils.sort(pos), nOrder = Utils.sort(neg); /* System.err.println("\n\n???Positive: "); for(int t=0; t<pOrder.length; t++) System.err.print(t+":"+Utils.doubleToString(pos[pOrder[t]],0,2)+" "); System.err.println...