method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
cb31f105-ffc9-4a93-b927-88e59c248f6c
1
private void markPlaying() { if (playingMP3 != null) { playingMP3.setPlaying(false); } mp3list.getSong().setPlaying(true); revalidate(); repaint(); playingMP3 = mp3list.getSong(); }
09c960e5-8f99-45b4-8584-d0f1b40e58c6
5
public VerifyInfo initInfo() { VerifyInfo info = new VerifyInfo(); int pos = 1; int slot = 0; if (!mi.isStatic()) { String clazzName = ci.getName().replace('.', '/'); if (mi.getName().equals("<init>")) info.locals[slot++] = Type.tType("N" + clazzName + ";", null); else info.locals[slot++] = Typ...
70807205-1fcf-44e7-9a37-203a435e40ad
2
void setPosition(double position) { if (position > this.getCurrentRoad().getLength() || position < 0) throw new IllegalArgumentException("Position " + position + " exceeds the road length " + this.getCurrentRoad().getLength()); //remove the car from the road its in, update the position then add it back to ...
bd9db359-e86e-4c2f-ae8e-850aa1ef638f
0
public void send() { jLabel1.setText("傳送檔案" + filename ); jLabel2.setText("大小: "+filesize+" bytes"); jLabel3.setText("傳送中..."); }
59fa6355-2e8a-4f1f-b0a6-339474ab9faa
7
String checkSecurity(int iLevel, javax.servlet.http.HttpSession session, javax.servlet.http.HttpServletResponse response, javax.servlet.http.HttpServletRequest request){ try { Object o1 = session.getAttribute("UserID"); Object o2 = session.getAttribute("UserRights"); boolean bRedirect = false; ...
40eac38f-40e9-41b0-937c-c423ae4d2138
2
public void serverInsert(Connection connection, String local_path, java.sql.Timestamp time_stamp) { try { Statement stmt = connection.createStatement(); if (!inServerDB(connection, local_path))// already exists so should // update { PreparedStatement ps = connection .prepareStatem...
ddbbd741-2e13-4c7f-93ce-717d4931ea71
1
public void addErrorMessage(String message) { Document docs = textArea.getDocument(); SimpleAttributeSet attrSet = new SimpleAttributeSet(); StyleConstants.setForeground(attrSet, Color.RED); try { docs.insertString(docs.getLength(), "\r\n" + lineNumber++ + ":【错误" + StatData.errorNumber + "】" + message...
a99a02d7-31db-4c24-93df-422acd036d81
4
protected Instruction next(MethodNode m, Instruction insn) { MethodEditor editor = m.editor(); @SuppressWarnings("rawtypes") List code = editor.code(); int index = code.indexOf(insn); int offset = 1; Object e = null; while((code.size() > (index + offset)) && !((e = code.get(index + offset++)) instance...
3a240e1f-50e8-4469-9936-0b2175d2f618
7
private void jButtonGuardarNovaEntradaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonGuardarNovaEntradaActionPerformed // BOTAO GUARDAR -> JANELA ENTRADAS //FAZER AS VALIDAÇÕES, SE OS CAMPOS ESTAO TODOS PREENCHIDOS String nomeFornecedorEntrada = jComboBoxFornecedorEnt...
b2ee1e60-add5-4784-b70b-50c51edc30a3
5
public static ArrayList<Member> searchMemberByFirstName(String firstName){ try { if(conn == null || conn.isClosed()){ conn = DatabaseConnection.getConnection(); } } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } ArrayList<Member> m...
603e0efd-e5b1-4d41-b151-df6dfa9198cf
7
protected final short get_action(int state, int sym) { short tag; int first, last, probe; short[] row = action_tab[state]; /* linear search if we are < 10 entries */ if (row.length < 20) for (probe = 0; probe < row.length; probe++) { /* is this entry labeled with our S...
158a5870-6796-48ff-b548-05d385e64eb6
0
@Test public void test() throws ParseException { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); Date start = sdf.parse("2013-01-12"); Date end = sdf.parse("2013-02-01"); RandomDateGenerator randomDateGenerator = new RandomDateGenerator("table1", "column1", start, end); ...
c6dd459f-5086-474d-b66c-bf8548d8fba5
4
public void removeListener(String event, Callback listener) { List<EventHandler> handlers = listeners(event); if (handlers == null) return; for (int i = 0, n = handlers.size(); i < n; ++i) { if (handlers.get(i).callback == listener) { handlers.remove(i); emit("removeListener", event, listener); ...
3ae0164c-0f3e-41b0-be5c-facf65e0c020
7
@Override public void actionPerformed(ActionEvent e) { switch (((JButton) e.getSource()).getText()) { case "Brush": DrawBrush brush = new DrawBrush(canvas); canvas.addDrawListener(brush); break; case "Bucket Fill": DrawBucketFill bucketFill = new DrawBucketFill(canvas); canvas.addDr...
21f48962-7fc7-4ac4-99bb-6592cc7725c8
3
private void findOtherSprites(GameDescription game){ ArrayList<SpriteData> allSprites = game.getAllSpriteData(); ArrayList<String> combinedLists = new ArrayList<String>(); combinedLists.addAll(avatarSprites); combinedLists.addAll(harmfulSprites); combinedLists.addAll(solidSprites); combinedLists.addAll(coll...
a2dccb2b-de01-4f60-a51c-cbaacabfa396
5
public String replaceVariables(String src,Map<String,String> variables,EntityMapping entity,ResultSet records){ Pattern pattern = Pattern.compile("\\$([^\\?,\\]\\}\\s}]+)"); Matcher matcher=pattern.matcher(src); while(matcher.find()){ String key = matcher.group(1); if(var...
1ec2085e-3dbd-48bb-a23f-4e8c5aaaa861
7
private double scheduleARideWithOtherPassengers(Cab scheduledCab, DialARideModel model, int source, int destination, Queue<Event> eventQueue, double timeStart, int dropCount, boolean isLast, RideRequest rideRequest) { List<Node> nodes = model.getNodes(); Stack<Integer> revPath = new Stack<Int...
b17f4d6b-9eab-4eff-ba3d-6e8314c7c2b4
4
void combineInto(LocalInfo l) { if (shadow != null) { getReal().combineInto(l); return; } l = l.getReal(); if (this == l) return; shadow = l; if (shadow.name == null) { shadow.name = name; shadow.type = type; } Enumeration enum_ = usingInstrs.elements(); while (enum_.hasMo...
8ea6d451-2068-4819-9703-caed6f202a45
3
private static void showMenu(BufferedReader br, ServiceInterface obj, Scanner cs) throws IOException{ // TODO Auto-generated method stub System.out.println("1 Register"); System.out.println("2 Login"); System.out.println("0 Exit"); int val = cs.nextInt(); if(val ==0) System.exit(0); else i...
7ffcace3-6369-40c7-b84d-d3e9130aea62
1
@Test public void testDisconnectDueToMax() throws Exception { final Properties config = new Properties(); final int min_uptime = 20; final int max_uptime = 2000; config.setProperty("min_uptime", "" + min_uptime); config.setProperty("max_uptime", "" + max_uptime); f...
6f63d68c-025a-41da-b66b-6ef76ea8c2d8
7
public void shortestPath(Integer sourceVertex, Integer destinationVertex) { final Map<Integer, Integer> cost = new HashMap<>(); Map<Integer, Integer> parent = new HashMap<>(); PriorityQueue<Integer> heap = new PriorityQueue<>(getAllVertex().size(), new Comparator<Integer>() { @Overr...
721797f5-1055-4142-8c83-0a29cd3b71e3
9
public static void BFS(boolean[][] m, Integer b) { HashMap<Integer, String> hm = new HashMap<Integer, String>(); LinkedList<Integer> p = new LinkedList<Integer>(); HashSet<Integer> hs = new HashSet<Integer>(); hs.add(b); for (int i = 0; i < E; i++) { if (m[b][i]) { ...
626996dd-0468-4286-a52a-6971a2bc0cc5
8
public void buscar() { Busca_cancion num=new Busca_cancion(); int n=num.lineas("Lista_canciones"); Listas cancion=new Listas(20); String dato=campotexto1.getText(); String list[]=new String[8]; if (dato.length()>0) { int resultado; File miDir = new File ("."); try { d...
537c3641-69fd-4566-9513-f59708aef14f
1
private String getPlayerSkills(Characters player) { SkillSet skillSet = player.getSkillSet(); String skills = "\n---------------------------Skills---------------------------\n\n"; skills = skills + "Skill 1: Attack (0 mana)\n"; for (int i = 0; i < skillSet.getNumOfSkills(); i++) { skills = skills...
bd34bdb7-e7e3-476b-8187-1e0a926a982d
0
public void setIsDeleted(Boolean isDeleted) { this.isDeleted = isDeleted; }
3b2bd6fd-52f9-427d-aea0-d659f7fe9973
8
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { if (qName.equalsIgnoreCase("reuters")) { //create new reuters document. document = new ReutersDocument(); //If split attribute is not-used, just whack into training set. if (attrib...
c3a3a494-f49e-4958-9ff5-5cc6e020e208
5
@Override public boolean isDone(Game game) { boolean ended = super.isFinished(game); if(ended) return true; int countAcum = 0; if(itype1 != -1) countAcum += game.getNumSprites(itype1) - game.getNumDisabledSprites(itype1); if(itype2 != -1) countAcum += game.g...
b949038e-d167-41fe-a59f-b28b6e949617
5
public static void next(Grid grid) { for (int i = 0; i < (grid.getColumns() * grid.getRows()); i++) { getNeighbors(grid, i); if(grid.getEntity(i).getState().equals(EntityStates.ALIVE)) { if(grid.getEntity(i).getLiveNeighbor() < 2 || grid.getEntity(i).getLiveNeighbor() > ...
912c48fa-58f6-46e9-9162-d203aebf297b
3
public boolean makeMove(MovementAction action, Creature c){ if (!this.creatureList.contains(c)){ return false; } Point canMakeMove = canMove(action, c); if (canMakeMove == null){ c.updateCreature(c.getX(), c.getY(), new ActionHistory(action, false)); return false; } c.updateCreature(canMakeMove....
738b0987-92d5-4f64-ba8b-875ea6125760
5
private void heapify(int i){ int l = left(i); int r = right(i); if(r<=this.heapsize){ int min; if(this.heap[l].getKey()<this.heap[r].getKey()){ min=l; }else{ min=r; } if(this.heap[i].getKey()>this.heap[mi...
f90d8d47-ece3-48ce-b75c-bee3dd4c895f
7
public static void main(String[] args) { Parser p = null; // the parser and builder of the circuit Formatter f = null; // the parser and builder of the IO BufferedReader br = null; // Reads from stdio int[] dumm = new int[2]; // Load logging configuration file PropertyConfigurator.configu...
3e20433b-9176-4f8f-b9da-8d6e6dd02db5
3
public timeInfo(int route, int stop) { database.openBusDatabase(); Calendar cal = Calendar.getInstance(); route_id = route; bus_stop = stop; timing_point += cal.get(Calendar.HOUR_OF_DAY) * 60; timing_point += cal.get(Calendar.MINUTE); startDate = (Calendar)cal.clone(); if(startDate.get...
0b00687f-0704-4dce-86d2-fe799be465fe
1
* * @throws UnknownHostException if cyc server host not found on the network * @throws IOException if a data communication error occurs * @throws CycApiException if the api request results in a cyc server error */ public CycConstant find(String constantName) throws UnknownHostException, IOExcept...
6349cac0-a890-4a46-835a-d5fd5c6802b0
5
public boolean isEnoughRawMaterials(Pallet pallet) { String sql = "SELECT count(rawmaterials.quantity >= Ingredients.quantity) = sum(rawmaterials.quantity >= Ingredients.quantity) " + "FROM Pallets, Ingredients, RawMaterials " + "WHERE Pallets.recipeName = Ingredients.recipeName AND Ingredients.rawMateri...
871587f4-f320-43af-b5d8-350942818c59
8
@EventHandler(priority = EventPriority.NORMAL) public void onChat(final AsyncPlayerChatEvent event) { if (Bukkit.getServer().getPluginManager().getPlugin("mcMMO") != null) { if (!Users.getProfile(event.getPlayer().getName()) .getAdminChatMode()) { if (event.is...
29070153-8bd1-4276-8c53-8418793328b6
4
public void keyPressed(KeyEvent e) { if ((e.getModifiers() & KeyEvent.ALT_MASK) != 0) { if (e.getKeyCode() == KeyEvent.VK_UP) { // scene.adjustCameraZ(.5f); } else if (e.getKeyCode() == KeyEvent.VK_DOWN) { // scene.adjustCameraZ(-.5f); } } else { if (e.getKeyCode() == KeyEvent.VK_SHIFT) { sh...
e29f55b1-b4b7-446c-ba98-9673b74cee39
9
protected void FillBuff() throws java.io.IOException { if (maxNextCharInd == available) { if (available == bufsize) { if (tokenBegin > 2048) { bufpos = maxNextCharInd = 0; available = tokenBegin; } else if (tokenBegin < 0) bufpos = maxN...
57b9ed63-7aa0-4d1e-9503-29ebb189a17e
7
public ListNode reverseKGroup(ListNode head, int k) { if(head == null || head.next == null) return head; if(k < 2) return head; ListNode dummy = new ListNode(0); dummy.next = head; for(ListNode prev = dummy, end = head; end != null; end = prev.next ){ for(int i = 1; i < k && end != null; ++i){ en...
1ec9c60f-15fd-408c-8d39-217f9e62d4e9
2
public ShipBody(Ship parent){ this.parent = parent; xorigin = parent.getX(); yorigin = parent.getY(); body = new ArrayList<Point2D.Double>(); int widthPoints = (int) (parent.speed/4 + parent.power + parent.hitpoints/100); int heightPoints = (int) (parent.speed/2 + parent.power/4 + parent.hitpoints...
724026ff-44a1-4708-bd1c-a495c4ad0e9e
8
private void replaceCorner(Pipe p, int dir, int ID1, int ID2, int i, Point point) throws PointAllreadyContainsCellException { List<Pipe> path = actualLongestPath.getPath(); Pipe cross = Pipe.getPipe(PipesID.CROSS.getID()); cross.setLocation(new Point(p.getLocation())); ((Cross) cross).setVisitedTwice(true);...
ffde45c7-bc5e-4890-a33f-8c6fdf1803d0
0
public void setTime(IntDataType value) { this.time = value; }
460be81e-60c2-477a-a8bc-7f3cd950db68
6
public ArrayList<Category> getChildCategories(int idNumber) { ArrayList<Category> ret = new ArrayList<Category>(); Connection conn = null; Statement st = null; ResultSet rs = null; try { conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/librarysystem?user=admin&password=123456"); st=conn.cre...
6ab2113c-c9ea-421b-b234-4bc4bd68dd8c
9
public Object getProperty(String name, Object opNode) { validate(name, opNode); if(opNode instanceof RenderedOp && name.equalsIgnoreCase("roi")) { RenderedOp op = (RenderedOp)opNode; ParameterBlock pb = op.getParameterBlock(); ...
60bf9438-7421-4109-b913-a65f330514ce
4
public void draw(Graphics2D g){ super.draw(g); if(Alpha.selected != this||Alpha.selection!=5) { g.setColor(Color.lightGray); }else { if(forceon) g.setColor(new Color(0, 255, 255, 15)); else g.setColor(new Color(200, 200, 200, 1...
8e5d3a62-5379-4290-add3-024a90f906ff
3
private boolean compararFechasConDate(String fecha1, String fechaActual) { boolean resultado= false; try { /**Obtenemos las fechas enviadas en el formato a comparar*/ SimpleDateFormat formateador = new SimpleDateFormat("dd/MM/yyyy"); Date fechaDate1 = formateador.parse(fecha1); Date f...
4f374351-d3af-433f-b5ed-05d33eecbc1c
3
@Override public List<Convenio> listAll() { Connection con = null; PreparedStatement pstm = null; ResultSet rs = null; List<Convenio> convenio = new ArrayList<>(); try{ con = ConnectionFactory.getConnection(); pstm = con.prepareStatem...
691c7309-0a2e-4944-ada4-c83d7c99c7e1
4
public synchronized ArrayList<String> devicesToBeDeleted() { ArrayList<String> devicesToBeDeleted = new ArrayList<String>(); ResultSet result = null; String sqlUpdateTable; double curtime = System.currentTimeMillis()/1000; try { connection = (Connection) DriverManager...
fb816619-9e80-434a-9662-f38233e77c46
5
private static boolean issquaredigitsquare(long l) { // TODO Auto-generated method stub long m = 0; while (l > 0) { m = l % 10; l = l / 10; if (m == 0 || m == 1 || m == 4 || m == 9) { } else { return false; } } return true; }
797b326f-8fe5-4ee9-9694-882d7f1b3621
1
NotebookTxtDb(final String fileName) throws IOException { file = new File(fileName); if (!file.exists()) { file.createNewFile(); System.out.println("New file " + fileName + " has been created in the current directory"); } }
644612a6-078b-4a58-a6b1-65e5cce59ffa
5
public void processLeave(final Player player) { this.spamBot.deVoice(this.spamBot.getChannel("##cah"), this.spamBot.getUser(player.getName())); this.players.remove(player); if (player.isCzar()) { Collections.shuffle(this.players); player.setCzar(false); this.c...
19e50e91-03c9-4eeb-afe4-fa7f93b5b658
2
public static double selectVelocity() { double velocity; while (true) { try { final String velocityString = getStringFromUser("Initial velocity"); velocity = Double.parseDouble(velocityString); break; } catch (final Exception e) { System.err.println("The velocity was not a number! Try again.")...
e6a0ec12-4cd2-4335-b506-9306ae18fac9
7
private static void writeFile(List<Office> offices, String stateName, String dest) { for (Office office : offices) { String key = office.getPinCode() + office.getName(); if(offMap.containsKey(key)) { System.out.println("Duplicate::::"+office.getName() + ":::::" + office.getPinCode() + ":::::" + office.getLo...
d2845567-3f53-4986-b648-ea9bceb05375
3
public static int[] playersAlive() { int[] res = {0, -1}; for (int i = 0; i < Players.size() ; i++) { if(Players.get(i).getBank() > 0) { res[0]++; res[1] = i; } } if(res[0] != 1) res[1] = -1; //returns alive player count and...
cb85dfdd-ba02-497f-9c6c-d8168a830933
4
public static double[] erlangBresources(double blockingProbability, double totalTraffic) { double[] ret = new double[8]; long counter = 1; double lastProb = Double.NaN; double prob = Double.NaN; boolean test = true; while (test) { prob = Stat.erlangBprobability(totalTraffic, counter); if (prob <= blo...
f4722a90-bafb-4cce-ac2e-f8e65b3334f2
3
@Override public String toString() { String isOp = (this.isOpPost()) ? "[OP]" : ""; if (this.attachData == null) { return String.format("%s (%s) %s", getShortHash(), postDateToString(), isOp); } else { if (this.attachData.getLocalFile() != null) { ...
7467bdac-db88-4d67-bcda-81844cce67f6
6
public void setImgPath_SliderArrowDown(Path img, Imagetype type) { switch (type) { case DEFAULT: this.imgSliderArrowDown_Def = handleImage(img, UIResNumbers.SLIDER_DOWN_DEF.getNum()); if (this.imgSliderArrowDown_Def == null) { this.imgSliderArrowDo...
86402ab0-50ca-41e5-9c09-bbc0645f8c15
9
public static Stella_Object accessKeyValueMapSlotValue(KeyValueMap self, Symbol slotname, Stella_Object value, boolean setvalueP) { if (slotname == Stella.SYM_STELLA_THE_MAP) { if (setvalueP) { self.theMap = value; } else { value = self.theMap; } } else if (slotname =...
fdebb35c-1f1c-4d41-a8c8-b60f150ebd44
8
@EventHandler public void itemCraft(CraftItemEvent event) { Material res = event.getRecipe().getResult().getType(); if(res == Material.STONE_SWORD) craftedSword = true; if(res == Material.STONE_PICKAXE) craftedPickaxe = true; if(res == Material.STONE_SPADE) craftedShovel = true; ...
804d9f33-129b-49ab-849e-ec0dcbea4b9f
0
@Test(expected=IllegalArgumentException.class) public void testReadField_dne() { ReflectUtils.readField(new Bean(), "doesnotexist"); }
3a0f7119-27b8-4f8f-a13a-ac6cba149ea7
9
private void setMinMaxScale() { for (int k = 0; k < DIMENSIONS; k++) { max[k] = (double) Double.MIN_VALUE; min[k] = (double) Double.MAX_VALUE; } for (int i = 0; i < numberOfTerms; i++) { //only 2 or 3 DIMENSIONS Term term = terms.get(identifiers[i]); coords = term.getPosition(); for (int k = 0; k...
bbc4a345-c054-49ff-aa32-a969dd2dee64
5
public int getValueByStatus(Bord bord, Pos setPos, Stone color, int cnt) { int retValue = 0; // 仮想ボードを作成する Bord vrBord = bord.clone(); vrBord.DoSet(setPos, color, true); if (cnt < 0) { // 自分と相手の数から状態を取得する int myHand = vrBord.GetCount(getMyColor()); int enHand = vrBord.GetCount(Stone.reverseStone(get...
2d8a9145-62b9-4532-bcfc-f62af4ee5139
2
public void playFirework(Location loc, FireworkEffect fe) throws Exception { World world = loc.getWorld(); // Bukkity load (CraftFirework) Firework fw = (Firework) world.spawn(loc, Firework.class); // the net.minecraft.server.World Object nms_world = null; Object nms_firewor...
b367cd97-42c9-4085-81be-8c99e4b86e77
3
public void mouseClicked(MouseEvent event) { if (getDrawer().getAutomaton().getEnvironmentFrame() !=null) ((AutomatonEnvironment)getDrawer().getAutomaton().getEnvironmentFrame().getEnvironment()).saveStatus(); State state = getDrawer().stateAtPoint(event.getPoint()); if (state != null) { getAutomaton().r...
cfbaadbf-de95-4fe9-ae05-aa56c1d34bb3
5
final int[] method3042(int i, int i_3_) { anInt9110++; if (i_3_ != 255) anInt9107 = -121; int[] is = ((Class348_Sub40) this).aClass191_7032.method1433(i_3_ + -255, i); if (((Class191) ((Class348_Sub40) this).aClass191_7032).aBoolean2570) { int[] is_4_ = this.method3048(i, 633706337, 0); ...
a604e7d2-df4e-4b85-aa64-0185438fb9a7
0
@XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "SignatureProperties") public JAXBElement<SignaturePropertiesType> createSignatureProperties(SignaturePropertiesType value) { return new JAXBElement<SignaturePropertiesType>(_SignatureProperties_QNAME, SignaturePropertiesType.class, nu...
34e0c2e2-04f1-4914-af1a-7b47cecdb6f6
3
public void run() { while (true) { try { Message inMessage = (Message)clientRefrence.getInFromClient().readObject(); System.out.println( inMessage.getSender() + " : " + inMessage.getMessage()); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ClassNo...
2d14a35d-ac77-4a5c-886b-935a733d4015
4
private void mkBus (String busname, int busnum) throws IOException, SecurityException { USB bus; bus = new USB (dir, busname, busnum, listeners, self); if (trace) System.err.println ("mkBus " + bus); busses.put (busname, bus); for (int i = 0; i < listeners.size (); i++) { USBListener li...
ce6782d3-485e-4c47-b5fd-ead26634180a
2
public static final String bytes2Str(byte[] bytes, String separator){ StringBuilder stringBuilder = new StringBuilder(); for (int index = 0; index < bytes.length; index++){ stringBuilder.append(index==0?"":separator).append(((int)bytes[index]) & 0xFF); } return stringBuilder...
9e864bb4-d6bd-4e1a-aa41-e4f1a009adaa
3
public static String selectListPageParam(Map<String, Object> paramMap) throws SQLException{ @SuppressWarnings("unchecked") java.util.Map<String,Object> sqlWhereMap = (Map<String, Object>) (paramMap.get("sqlWhereMap")==null ? "": paramMap.get("sqlWhereMap")); BEGIN(); SELECT(Role.COLUMNS); FROM(R...
d43aef5e-f63a-46e2-b711-21a5f7ef65f4
5
private int decodeLength() throws Asn1Exception { int length = 0; // // There must be at least one byte available // if (residualLength < 1) throw new Asn1Exception("Attempt to read past end of stream"); // // The high-order bit is set in the first b...
7e7a0f2a-91f5-4a4e-a7fa-7fdfc298dc44
4
public void updateMarkers(ArrayList<TATM> t) { for(TATM i : t){ //Checks to see if it is in markers boolean c = markers.contains(i); if(c == true){ //do nothing }else{ markers.add(i); } } //T...
f09eb7e2-4e1e-414f-bc5b-9039f9defc75
2
@Override protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException { String[] line = value.toString().split(inDelimiter); //a,b,c, -> 3개. String outputLine = ""; for (int i = 0; i < line.length; i++) { if (Integer.parseInt(target) == i) continue; outputLi...
9163f130-2bfe-4909-9c5a-0525ac374849
5
public boolean login(){ boolean loginSuccessful = false; boolean loginBlocked = false; //While login has not been successful and IP is not blocked yet while(!loginSuccessful && !loginBlocked){ System.out.println(outputFromServer()); System.out.println(outputFromServer()); System.out.println(outputFromS...
72e4c053-fee2-4ed1-8d69-74c0c86084f4
3
private boolean parseAfterThousand(){ // If no more tokens, it's still valid if (peek() == null){ return true; } //note, this consumes, so peek isn't exactly the same int[] parsed = parsePrefix(); if (parsed == null){ // Error parsing ...
71061c01-a955-42e7-bdd5-fde170dc3959
7
public static void main(String[] args) throws IOException { in = new Scanner(System.in); StringBuilder out = new StringBuilder(); int students = in.nextInt(); int[] his = new int[students], aux = readInts(students), stud = new int[students]; for (int i = 0; i < his.length; i++) his[aux[i] - 1] = i + 1; w...
08d8853d-f900-409b-bba4-210216ced89f
3
public ResourceVO(Path path, ResourceType type, int resourceNumber) { if (!FileUtil.control(path) || (type == null) || (resourceNumber <= 0)) { IllegalArgumentException iae = new IllegalArgumentException( "Non of the parameters should be null, also the resourcenumber have to be b...
41db1d90-c13e-48f4-b95d-e71a2d58a39b
9
private void processRefQueueTx() throws InterruptedException { // need WeakHandle.geRef to return when ref is enqueued - deadlock otherwise! WeakHandle.returnEnqueued.set(Boolean.TRUE); WeakHandle ref = (WeakHandle)refQueue.remove(phantomQueuePollInterval); while (ref != null) { final HGPersiste...
2cf3f5f3-82a9-4568-808c-79d8d0ac738f
4
@Override public void applyEffect(Joueur jou){ ArrayList<ProprieteAConstruire> props = new ArrayList<ProprieteAConstruire>(); props= jou.getProprietesAConstruire(); for(ProprieteAConstruire p : props){ if(p.getRanking()==5){ if(jou.getCash()-getMont...
31cf0f19-9f97-47f6-998a-993c6181fbca
5
@Override public RoleSchool addRole(String json, Integer id) throws NotFoundException { Person p = gson.fromJson(getPerson(id), Person.class); HashMap<String, String> map = new Gson().fromJson(json, new TypeToken<HashMap<String, String>>() { }.getType()); String roleName = map.get("...
c8d390af-4af5-428b-8a9b-5c82f02b129e
9
public Handle evalExpression(Handle node) throws TypeException, RecoverableException { Check.notNull(node, "node"); //#if defined( DEBUG) && DEBUG > 2 // std::cerr << "SimpleEvaluator::evalExpression: "; // printList( node, std::cerr); // std::cerr << std::endl; //#endif // // The car cell of the fi...
52416151-b865-48cf-a877-80ef00ae50b2
0
public boolean validate(double balance){ return balance >= this.money ; }
487506b8-033b-4994-915c-8c0cc56df081
0
public void increment() { count++; }
9af5071b-be43-4b94-92a4-959b44ce050b
3
public int hammingDistance(BitVector v) { int res = 0; int i = 0; for(; i<Math.min(v.data.length, v.length); i++) { res += Long.bitCount(data[i] ^ v.data[i]); } for(int j = i; j < data.length; j++) { res += Long.bitCount(data[j]); } for(int...
92ab62ee-63ab-4f27-a15f-e22a98e03369
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; VariablePrecisionTime other = (VariablePrecisionTime) obj; if (day != other.day) return false; if (hour != other.hour) return false; if...
5cd9674c-6b82-4316-945a-541c861a14a5
8
public int characterAt(int at) throws JSONException { int c = get(at); if ((c & 0x80) == 0) { return c; } int character; int c1 = get(at + 1); if ((c1 & 0x80) == 0) { character = ((c & 0x7F) << 7) | c1; if (character > 0x7F) { ...
f3ab7dfd-1fe7-4d39-ad6f-cf78b4c13189
6
private final int jjStopStringLiteralDfa_0(int pos, long active0) { switch (pos) { case 0: if ((active0 & 0x80L) != 0L) { jjmatchedKind = 23; return 18; } return -1; case 1: if ((active0 & 0x80L) != 0L) { jjmatch...
6134e8bf-f6bb-47d1-ab85-92909b292f74
2
public void printRQ() { for(int i = 0; i < rQueue.size(); ++i) { PCB tempPCB = rQueue.get(i); Job tempJob = tempPCB.getJob(); System.out.println("ID: " + tempJob.getID()); System.out.println("Priority: " + tempJob.getPri()); System.out.println("Number of Instructions: " + tempJob.getJobs()); for(...
f2564400-3a90-4496-bc9a-4e1a6a434778
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://down...
9c842c87-0695-4de3-b8c5-e78e3b9d86e5
2
public boolean markFinal() { LocalInfo li = getLocalInfo(); Enumeration enum_ = li.operators.elements(); int writes = 0; while (enum_.hasMoreElements()) { if (((LocalVarOperator) enum_.nextElement()).isWrite()) writes++; } /* FIXME: Check if declaring final is okay */ li.isFinal = true; return tr...
884af1df-dd57-4b8e-854b-d60832f674da
1
public boolean removeByKey(String tableName, String key) throws DBUnavailabilityException, DataBaseRequestException, DataBaseTableException { if (key == null) { throw new DataBaseRequestException("key shouldn't be null"); } String firstCharAtName = key.substring(0, 1); ...
21e84a13-6a44-4c7f-b6bd-7b12e4703008
4
private double[] smooth_bowl(int[] bowl) { double[] ret = new double[bowl.length]; int count_of_zero = 0; for (int i = 0 ; i < bowl.length; i++ ) { if ( 0 == bowl[i]) { count_of_zero++; } ret[i] = (double)(bowl[i]); } double smo...
6d2c2f98-7c32-430c-a2f0-fedfb34ddafd
0
public int getMATK() { return mAtk; }
78f84c41-0c09-4fad-aac1-ef71dd981263
3
void processContent() { int pos = 0; while ((pos = rawContent.indexOf("$", pos)) != -1) { pos++; if (rawContent.charAt(pos) == 'C') { try { gColor = new Color(Integer.parseInt(rawContent.substring(pos + 1, pos + 7), 16)); } catc...
6880cdcc-3a00-46d3-a255-e401811db273
0
public String[] toStringArray() { String[] tmp = new String[13]; tmp[0] = String.valueOf(this.BlueprintID); tmp[1] = this.BlueprintName; tmp[2] = String.valueOf(this.ProductID); tmp[3] = this.ProductName; tmp[4] = String.valueOf(this.ProductionTime); tmp[5] = Stri...
18f9398e-f1b8-4fe1-91be-f96da440f842
1
/* */ public Sprite(String path) /* */ { /* */ try /* */ { /* 13 */ this.sprite = ImageIO.read(getClass().getResource(path)); /* */ } /* */ catch (IOException e) /* */ { /* 15 */ e.printStackTrace(); /* */ } /* */ }
625a4523-175a-487a-ad09-076979054160
8
void loadModFiles(){ mods.clear(); final File folder = new File(System.getProperty("user.dir")+"/mods"); if(!folder.exists()) folder.mkdirs(); for (final File fileEntry : folder.listFiles()) { if (fileEntry.getName().toLowerCase().endsWith(".strifemod")) { mods.add(fileTools.loadModFile(fileEntry, th...
e6b23503-a73f-4feb-830f-33b2c02b1196
9
protected void update(int x, int y, Tile tile) { if( tile.nextAutoUpdateTime > stepNumber ) return; if( tile.vm == null ) return; final int srcIdx = cellIdx(x,y); tile = tiles[srcIdx] = tile.thaw(); short moveFlags = tile.vm.fetch(ForthVM.MOVEMENT_REG); int moveX = x, moveY = y; if( (moveFlags & 0x0...
9e8cb7f8-0ce7-48f6-b880-07a51658b5b8
1
public static void clearTree(Tree tree) { TreeItem[] items = tree.getItems(); for (TreeItem ti : items) { ti.dispose(); } }
67278af1-9551-450a-9e27-6a98b6248b69
8
public static void findBestOverfittingByHL(String filename, int reps, int epochsPerRep, int printFrequency, ANN ann, int[] hlsizes, double[][] inputs, double[][] outputs) throws IOException { int numDataPoints = epochsPerRep/printFrequency; File file = new File(filename); FileWriter f = new FileWriter(file.get...
ebd8abd1-2eeb-44e4-b4a3-e59b9acd42f4
3
public boolean validateJoined() { boolean result = false; if(this.name != null && this.password != null && this.game != -1) { result = true; } return result; }