method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
c91d12f8-2107-4c96-95f4-eb746ffa73cc
6
@Override public String log(Iterable<LogItem> items) throws Exception { for (BarItem item : this.items.values()) item.price = item.quantity = 0; for (LogItem item : items) { BarItem currentItem = this.items.get(item.barID); if (currentItem == null) throw new Exception("Item not found (ID=" + item.b...
66ef0057-9433-4d0c-bc19-2ce3a9f1110a
1
public void save() { try { this.yml.save(configFile); } catch (Exception e) { System.out.println("[BurningCS] Could not save config file!"); e.printStackTrace(); } }
65b33f7c-6b32-42ea-8e84-4d23e5e9eb68
4
protected boolean out_grouping_b(char [] s, int min, int max) { if (cursor <= limit_backward) return false; char ch = current.charAt(cursor - 1); if (ch > max || ch < min) { cursor--; return true; } ch -= min; if ((s[ch >> 3] & (0X1 << (ch & 0X7))) == 0) { cursor--; return true; } return...
f648a242-b2d7-41a1-9b55-7dc27573e0d2
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...
7b3b0916-b870-4148-b402-7a6c2b7e805c
5
public JSONObject addCategoryAction(String UserID, String action, String ImageId, String TargetId, String targetValue) { try { Class.forName(JDBC_DRIVER); conn=DriverManager.getConnection(DB_URL,USER,PASS); stmt=conn.createStatement(); json=new JSONObject(); String SQL="inse...
117c7579-5123-40da-a5ae-d5c19f6eb65e
4
public void loadTeleporters() { YamlConfiguration config = YamlConfiguration.loadConfiguration(teleportersFile); for (String teleporterName : config.getKeys(false)) { ConfigurationSection teleporterSection = config.getConfigurationSection(teleporterName); Teleporter teleporter = this.createTeleporter(teleport...
47e65e66-833b-487f-8fb6-dd19d9e806c9
0
public void setTotalPoints(int total){ totalPoints.setText(Integer.toString(total)); }
8c084d8b-bae0-4112-9664-08328916caef
1
public List<String> getValues() { System.out.println("count cells in row: " + cells.size()); List<String> values = new ArrayList<String>(); for (TableCell cell : cells) { String text = cell.getText(); values.add(text); System.out.println(text); } return values; }
a84fbf9b-b770-403e-8e75-8c9418c1083b
3
public static boolean escribir(Map<String,Producto> array){ try{ BufferedWriter escribe=Files.newBufferedWriter(path, java.nio.charset.StandardCharsets.UTF_8, java.nio.file.StandardOpenOption.TRUNCATE_EXISTING); Iterator it=array.entrySet().iterator(); while(it.hasNext()){ Map.Entry...
f87851b1-afa1-4052-96b8-b3796cf96f79
5
public CharacterIcons(String getCharacter) { if (getCharacter.equals("White")) setImage(new GreenfootImage("CharacterIcons//FuShu.png")); else if (getCharacter.equals("Bond")) setImage(new GreenfootImage("CharacterIcons//JamesBond.png")); else if (getCharacter.equals("Ninja")...
014b9aca-fa5b-426f-9898-7f4c87c9b2d7
3
public static void insertSubnet(Subnet sub, SubnetData d){ SubnetData data; if (sub!=null) //call from the Rest Interface data = sub.getSubnet(); else //call from createMultiple data=d; //Recover the subnet object (from the Rest Interface) attributes String name = data.getName(); String n = ...
6ad4d4eb-7b0c-4ad0-badd-38c04b3ca161
2
public void visitInnerClass(final String aname, final String outerName, final String innerName, final int attr_access) { if ((name != null) && name.equals(aname)) { this.access = attr_access; } super.visitInnerClass(aname, outerName, innerName, attr_access); }
7ea3e6e6-2887-4580-99cd-6dbcf2499d24
6
public User convertTxtFileToUserObjSixMonthData(String basePath, String directoryName, String fileName, String extension) throws FileNotFoundException, IOException { String userPostAsString = readTxtFileAsString(basePath, directoryName, fileName, extension); String temp[]; User user = new User()...
2f01a4a5-1322-432d-a779-9015f37c6fe5
2
public byte evaluate() { if(!type.hasLiteral()) { return type.getCode(); } else { assert(data.checkResolved()); if(hasNextWord()) { return type.getCode(); } else { assert(type == ValueType.LITERAL); return (b...
7066ac3b-83ab-41f1-97b7-0a267955711e
5
protected PathTraceMaterial nodeIsHomogeneous( SolidNode sn ) throws DereferenceException { if( sn.getType() == SolidNode.Type.HOMOGENEOUS ) return sn.getHomogeneousMaterial(); if( sn.getType() == SolidNode.Type.DENSITY_FUNCTION_SUBDIVIDED ) return null; // lets ignore this possibility for now Object o = no...
ba8ed78c-153e-4fc0-81a8-8c0cfb081f67
8
private static int decode4to3( byte[] source, int srcOffset, byte[] destination, int destOffset, int options ) { // Lots of error checking and exception throwing if( source == null ){ throw new NullPointerException( "Source array was null." ); } // end if ...
df5b45f0-ed7e-49ff-816a-1232c8ee3321
2
public int observe(int bytes) { if (observer != null && bytes != -1) { totalBytes += bytes; observer.bytesRead(totalBytes, clientId); } log.debug("Total Bytes Read = [" + totalBytes + "]"); return bytes; }
ea997464-823f-4738-851e-39cbfe7f35f1
0
public String toString(){ return "LU: " + ul.toString() + ", " + width + " x " + height; }
33a697a2-1d50-4572-85e1-e59efc3bf1cb
7
@Override public void fuse(Property property) throws PropertyException { if(property != null) { if(property.getClass().equals(getClass())) { MinMaxProperty prop = (MinMaxProperty) property; int newMin; if(min != UNDEFINED) { if(prop.getMin() != UNDEFINED) { newMin = Math.max(min, prop.getM...
528bbbd6-7ebb-43e5-8ae6-29a590d8e27a
4
public void addVersions( BitSet bs ) { this.versions.or( bs ); for ( int i=0;i<cells.size();i++ ) { FragList fl = cells.get(i); for ( int j=0;j<fl.fragments.size();j++ ) { Atom a = fl.fragments.get(j); if ( a instanceof Frag...
8748397a-38c1-420e-9fa0-b365c3c3a43d
9
@Override public void run() { BufferedReader in = null; PrintWriter out = null; try { in = new BufferedReader(new InputStreamReader( this.socket.getInputStream())); out = new PrintWriter(this.socket.getOutputStream(), true); String currentTime = null; String body = null; while (true) { bo...
1125db5f-a596-476d-aa4a-859f004153ca
7
public int getMaxSum() { maxSum = Integer.MIN_VALUE; for (int rowStart = 0; rowStart < width; rowStart++) { for (int colStart = 0; colStart < width; colStart++) { for (int rowEnd = 0; rowEnd < width; rowEnd++) { for (int colEnd = 0; colEnd < width; colEnd++) { int sum = 0; for (int row = r...
94f0e142-aa96-4a73-9b34-80048e0966d8
9
public boolean isMoveable(String str) { for (Artifacts a : artList) { if(a.name.toUpperCase().equals(str)){ if (a.movability == 1) { return true; } return false; } } for (Keys ...
b1e92bcc-0cc2-4965-bb59-465c6fb8b9f6
6
@Override public boolean equals(Object obj) { if (!obj.getClass().equals(Genotype.class)) return false; Genotype other = (Genotype) obj; if (this.generation != other.generation) return false; if (this.hiddenLayersCount != other.hiddenLayersCount) return false; // if (this.genes.equals(other.genes)) ...
278e07ad-6135-405c-b969-a95d25d96951
3
private void RegisterPlayer(Player player) { if (_currentPhase.equals(Phase.Registration)) { if (_registeredPlayers.contains(player)) { player.sendMessage("You have already registered for the games."); } else if (_registeredPlayers.size() < _maxRegistrations) { _registeredPlayers.add(player); player...
ac8fd3ee-aff4-48a1-80e8-a841a3911262
9
public boolean MovingBoxIntoBox(int x, int y){ if(map[y][x] != box){ return false; } //move box south if(y_loc+1 == y){ if(map[y+1][x] == box)System.out.println("box in the way"); return true; } //move box north if(y_loc-1 == y){ if(map[y-1][x] == box)System.out.println("box in the way"); r...
f480d99a-669b-4c5a-be91-72deba70189b
3
public static List<Mixer> getCompatibleMixers(Class<? extends Line> pLineClass) { Line.Info lineInfo = new Line.Info( pLineClass ); Mixer.Info[] mixerInfo = AudioSystem.getMixerInfo(); List<Mixer> ret = new ArrayList<>(); for ( Mixer.Info info : mixerInfo ) { Mixer current = AudioSystem.getMixer( info ); ...
f8087f2d-649b-4e9b-b271-85a373373fde
4
public void drawShakingText(String text, int x, int y, int colour, int elapsed, int tick) { if (text == null) return; /* * Calculate the current amplitude of the * shake based on how long the text has been * shaking for. */ double amplitude = 7D - elapsed / 8D; if (amplitude < 0.0D) ampl...
ff3571f9-6ad7-4826-9134-de79977d1845
9
public void destroyBody(Body body) { assert (m_bodyCount > 0); assert (isLocked() == false); if (isLocked()) { return; } // Delete the attached joints. JointEdge je = body.m_jointList; while (je != null) { JointEdge je0 = je; je = je.next; if (m_destructionListener != null) { m_destruct...
0437646b-1fed-494d-9922-03b0142ec67f
0
DccManager(PircBot bot) { _bot = bot; }
83b6e8b6-fbc9-4def-8cdb-7300c124f380
9
public ListNode addTwoNumbers(ListNode l1, ListNode l2) { if (l1 == null) { return l2; } if (l2 == null) { return l1; } ListNode resultListNode = new ListNode(0); ListNode temp = new ListNode(0); resultListNode = temp; while (l1 != ...
a0f28ae2-3b22-4edd-a0d9-ea07a557d65c
3
private boolean resquestIsLegal(String challenge, String validate, String seccode) { if (objIsEmpty(challenge)) { return false; } if (objIsEmpty(validate)) { return false; } if (objIsEmpty(seccode)) { return false; } return true; }
3c1894ec-a33f-4b7f-ba91-c100c2313465
0
public float getH() { return h; }
4fecf491-4149-4405-baf2-7526314cadc0
0
private void setUpgrade(Upgrade upgrade, BodyPart bodyPart){ bodyPart.addUpgrade(upgrade); upgrade.setUsed(true); }
65ff60db-9171-47d2-8222-2f4536eaaee4
8
public static ArrayList<Tile> getTileNeighbors(Tile t, Tile[][] tiles, int size){ ArrayList<Tile> neighbors = new ArrayList<>(); int xStartIndex = t.getX() - 1 < 0 ? 0 : -1; int xEndIndex = t.getX() + 1 >= size ? 0 : 1; int yStartIndex = t.getY() - 1 < 0 ? 0 : -1; int yEndIndex = t.getY() + 1 >= size? 0 : 1;...
8da63aa4-5df1-4b17-be35-5154986685d3
3
private static int rank_iterative(int[] N, int key) { int lo = 0; int hi = N.length - 1; while (lo <= hi) { int mid = findMidpoint(hi, lo); // find the midpoint if (key < N[mid]) { // the key is in the lower half so lower the upper bound hi = --mid; } else if (key > N[mid]) { // the key is in t...
9a5b065d-6439-4adb-a616-2aa0cb8d78ab
4
boolean deleteDirectory(File dir) { if (dir.exists()) { if (dir.isDirectory()) { for (File file : dir.listFiles()) { if (file.isDirectory()) { deleteDirectory(file); } else { file.delete(); } } } return dir.delete(); } else return false; }
d12abe82-8d07-4b99-87f4-96a3319b3456
9
static public Date toDate(String date, String time) { Date retVal = new Date(); if (date != null) { Date d = parseDate(date); Integer s = null; if (time != null) s = secPastMid(time); if (s == null || s < 0) s = secPastMid(...
3026491c-9cc5-4b72-9c3d-230d56511677
4
public IRouteResult route(GenericNode from, GenericNode to) { // ways est une file qui contiendra tous les chemins possibles tandis que way est une pile qui contiendra un de ces mêmes chemins PriorityQueue ways = new PriorityQueue(); Stack way = new Stack(); // On y met le premier maillon way.push(new Element(...
610ac980-4d2e-481e-944c-f9299ba9de7a
2
private void mergeFiles() throws FileNotFoundException { try (OutputStream outStream = new FileOutputStream( "monthlyDataFile.txt"); SequenceInputStream inputStream = new SequenceInputStream( fileStreams.elements());) { byte[] buffer = new byte[4096]; int numberRead = 0; while ((numberRead = in...
8eb33edc-699d-4997-a99a-eadfe6a08d02
6
public InetAddress discoverHost (int udpPort, int timeoutMillis) { DatagramSocket socket = null; try { socket = new DatagramSocket(); broadcast(udpPort, socket); socket.setSoTimeout(timeoutMillis); DatagramPacket packet = discoveryHandler.onRequestNewDatagramPacket(); try { socket.receive(packet)...
4b8d4f71-1b2e-477f-b968-cd78c6c9ba9d
1
public void writeCBytesA(int len, byte buf[], int off) { // method441 for (int i = (len + off) - 1; i >= len; i--) { payload[offset++] = (byte) (buf[i] + 128); } }
816782ef-ba2b-4498-9ec8-6108b5a09c18
9
private static void showTrainingOptionsAndTrain( ) throws NumberFormatException, IOException { Restaurant restaurant = player.getRestaurant(); System.out.println("\tTrain worker:"); Chef chef = restaurant.getChef(); System.out.println("\t" + "1. Chef: " + chef.getName() + " " + chef.getSurname() + "\t\tEx...
76bb6f28-9f0a-487d-b31f-46ccb31a6ac4
2
public boolean showConfirmationDialog() { String name = answerSideManager.getAnswersName(); if (name != null && !name.equals("")) messageLabel.setText(name + ", правильно?"); else messageLabel.setText("Правильно?"); showDialog(); return isCorrect; ...
d51962ff-fe15-445c-83c3-5953af5e419d
2
private void trimText() { if(textLimit > 0 && text.length() > textLimit) { text = text.substring(0, textLimit); resize(); } }
fca18047-f857-4b8f-bc3c-2a7d7355cb60
9
public static void main(String[] args) throws IOException { InputStream in = System.in; OutputStream out = System.out; ConChMode mode = ConChMode.UNSET; byte[] source = ConCh.Sigma94; byte[] codeabet = ConCh.C94; for (int index = 0; inde...
4f383534-239c-4348-9cc3-9560cb1dd717
9
AudioFormat createAudioFormat(int channels, long sampleRate) { switch(format) { case SoundFileType.FORMAT_PCM_S8: case SoundFileType.FORMAT_PCM_U8: return AudioFormats.pcm().channels(channels).rate(sampleRate).bitDepth(8); case SoundFileType.FORMAT_PCM_16: return AudioFormats.pcm().channels(channels).rate...
8bc73362-904e-416a-86dd-bd778e898865
3
public boolean attachPrevious(Linkable paramLinkable) { boolean b=false; if ((paramLinkable instanceof InstructionList)) { InstructionList localInstructionList = (InstructionList)paramLinkable; if (localInstructionList.getNextInstruction() == null) { localInstructionList.setNext...
7ac2e374-864f-4b30-895a-6464dc45edd7
4
@Override public void onToggle(Key key, boolean pressed) { InputHandler input = InputHandler.getInstance(); if (pressed) { if (key == input.up) selectionUp(); if (key == input.down) selectionDown(); if (key == input.enter) ...
c2c8fd50-2e13-4e76-9044-9ee6567d44c9
9
@Override public final String toString(String f) { StringBuilder buffer = new StringBuilder(); if (field == null || !field.equals(f)) { buffer.append(field); buffer.append(":"); } buffer.append("\""); int lastPos = -1; for (int i = 0 ; i < termArrays.length ; ++i) { Term[] ...
bcb6004d-d1b2-4239-98ec-bf5ada257cf8
3
public void addCommand(Command command){ List<Command> previousCommands = new ArrayList<Command>(); if(command.isSameCommand()){ commands.get(commands.size()-1).copyCommand(command); } for(Command com: commands){ if(command.compareCommandTo(com)==1){ previousCommands.add(com); } } commands.remo...
bd0a5666-4c5e-4557-be74-95052753e038
0
@Override public void setTmp(String value) { this.tmp = convertToHashMap(value); }
beaa2e13-054f-47d5-9ca3-697dfde80f63
3
private void updateCustomComponent() { resetFields(); actionListPanel.removeAll(); actionListPanel.add(actionComponents.get(rtsItem + actionListKeyword).get(0), BorderLayout.NORTH); actionListPanel.revalidate(); actionListPanel.repaint(); customPanel.removeAl...
193dd83c-5aa6-419e-85bd-5ebf2aca3ec6
8
public static void main (String[] args) throws IOException { int customPort = 0; int customWorkersNum = 0; try { if (args.length != 0) { customPort = Integer.parseInt(args[0]); customWorkersNum = Integer.parseInt(args[1]); } } ...
b60a00fa-56d2-477d-80d6-5cbfebf524be
4
private boolean jj_3R_49() { if (jj_scan_token(LEFTB)) return true; if (jj_3R_9()) return true; if (jj_3R_9()) return true; if (jj_scan_token(RIGHTB)) return true; return false; }
136f4c1a-d68a-4cb9-b862-61ab063910c7
6
private void createRoutes(boolean heuristic) { fromNode.setDistTo(0); if (heuristic) { fromNode.setHeuristic(Math.sqrt(Math.pow((toNode.getxCoord() - fromNode.getxCoord()), 2) + Math.pow(toNode.getyCoord() - fromNode.getyCoord(), 2)) / 1000); } else { fromNode.setHeuristic(Math.sqrt(Math.pow((toNode.ge...
0b8fcdde-9470-46d2-8cd4-647e399f5804
3
@Override public void calcMove(int delta) { double currentTime = System.currentTimeMillis(); this.delta = delta; if (currentMove == MoveDir.MOVE_NULL) { if (currentTime - lastMoveChange >= waitTime) { lastMoveChange = currentTime; randomMove(); } } else { edgeCheck(); if (currentTime - last...
9b513d4f-8556-4239-ac2c-bbea7b495cf8
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...
7d5b6302-7956-46ed-88d8-a839206ae38e
5
public String executeDijkstra (String nodo) { StringBuilder buffer = new StringBuilder(); final String origen = nodo; int posicion = 0; int costeTotal = 0; // Se obtiene la posición donde se encuentra el nodo origen for (int i=0; i<...
2db70168-fd80-4582-b0ab-0db9370aab05
7
private int buildZone(int x, int maxLength) { int t = random.nextInt(totalOdds); int type = 0; for (int i = 0; i < odds.length; i++) { if (odds[i] <= t) { type = i; } } switch (type) { case ODDS_...
da17f8a7-8d20-448a-b964-d22743595216
8
@Override public void unInvoke() { if(pathOut!=null) { if(currRoom==null) currRoom=CMLib.map().getRandomRoom(); if(theGroup!=null) for(int g=0;g<theGroup.size();g++) { final MOB M=theGroup.elementAt(g); M.tell(L("You are told that it's safe and released.")); currRoom.bringMobHere(M,fal...
228dbcac-6990-4698-a90e-3ad541e32306
2
public Builder name(String receivedName) { if (receivedName == null || receivedName.equals("")) { log.warn("Wrong Name. receivedName ={}", name); throw new IllegalArgumentException("Name must be not null. Received value =" + receivedName); } this.name ...
1c8500b9-5026-4294-a4d7-28f68524b72c
0
public static void main(String[] args) { ObjectFoo foo1 = new ObjectFoo(); ObjectFoo foo2 = new ObjectFoo(); foo1.setFoo(new Boolean(false)); Boolean b = (Boolean)foo1.getFoo(); foo2.setFoo(new Integer(10)); Integer i = (Integer)foo2.getFoo(); ObjectFoo foo3 = new ObjectFoo(); foo3.setFoo(n...
a33820f8-9bc1-48f0-b6d0-63ee453c1cec
1
private boolean jj_3_67() { if (jj_scan_token(GREATER)) return true; return false; }
0a28d2c7-df94-4b75-90f3-20ddb24b434b
3
private void ordenar(){ int m = 0; int j = 0; for(int i = 0; i < individuos; ++i){ m = i; for(j = i+1; j < individuos; ++j){ if(aptitud[j] < aptitud[m]){ m = j; } } int tempAptitud = aptitud[i]; Cromos...
c0c0dcd0-752b-4f13-b6fe-801980b62809
2
public boolean deleteFile(String sPath) { flag = false; File file = new File(sPath); // 路径为文件且不为空则进行删除 if (file.isFile() && file.exists()) { file.delete(); flag = true; } return flag; }
a73b4f38-53d8-4c3e-a108-e201ca6ef158
5
@Override public boolean move(Player player, int[] position) { // Check if player is the currentPlayer if (player != currentPlayer) { if (currentPlayer == null) { player.message("Game Over!"); } else { ...
022a924d-1a4a-4830-a50e-742e0a9d3de1
5
private void testr(String userTyped) { errLvl = 0f; if (userTyped.equals("Ping")) outputField.setText("Pong"); else errLvl = errLvl + 1f; if (userTyped.equals("ping")) outputField.setText("Pong"); else errLvl = errLvl + 1f; if (userTyped.equals("Pong")) outputField.setText("Ping"); else errLvl = err...
2c74f9d6-516f-4ac8-b16c-aab3e5b87d45
5
public int generateDurability(int blockY) { int durability = baseDurability_; if (variance_ > 0) { // variance_ is a max +- adjustment range to add to the durability durability += Citadel.getRandom().nextInt() % (variance_ * 2 + 1); durability -= variance_; } ...
e0dec305-1e6e-4513-b9b7-d3e64dd95ed9
6
private Integer negaScout(Board board, Color current, Integer depth, Integer alpha, Integer beta) { if ( depth > 0 ) { Integer best = beta; for ( Move m : board.getPossibleMoves(current) ) { board.apply(m); Integer score = - negaScout(board, current.other(), depth - 1, -...
5861d15d-15c0-4b46-8ef9-053d7e071bdb
8
public String execute() { StringBuilder sb = new StringBuilder(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ"); if ("json".equalsIgnoreCase(type)) { /* [{ statusCode: 200, method: 'GET', url: 'http://foo.c...
84c3b03c-8905-4470-9eea-7af089448778
8
@Override public AttributeValue getExampleAttributeValue(Example e) { int playerToken = e.getResult().currentTurn; int height = e.getBoard().height; // 6 int width = e.getBoard().width; // 7 int numTokensCountingFor = 3; // checking for 3 in a row int countOfTokensEncounteredVertically = 0; // counter /...
b639a4e5-dff2-4d5d-b75a-7a353e0ad1fb
9
public int[][] up(int grid[][]) { score = 0; for (int xIndex = 0; xIndex < 4; xIndex++) { for (int yIndex = 3; yIndex > 0; yIndex--) { if (grid[yIndex - 1][xIndex] == 0) { for (int a = yIndex - 1; a < 3; a++) { grid[a][xIndex] = gri...
a6eafc37-8d86-4c6f-b93a-aa8d9b17bc72
7
private void incrementTime() { second++; if (second > 59) { second = 0; minute++; if (minute > 59) { minute = 0; hour++; if ((minute != 0 || second != 0) && hour > 23) { ...
00d3fc93-4677-413a-9959-7706bc4e3d17
4
@Override public void onPluginMessageReceived( String channel, Player player, byte[] message ) { DataInputStream in = new DataInputStream( new ByteArrayInputStream( message ) ); String task = null; try { task = in.readUTF(); } catch ( IOException e ) { e.pri...
cc153c74-a772-4366-bf7c-0404919a343f
1
protected Texture load(String ref) throws IOException { if(ref.endsWith(".tga")) { return TextureLoader.getTexture("TGA", ResourceLoader.getResourceAsStream(System.getProperty("resources") + "/sprites/" + ref + ".tga")); } return TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream(Syste...
c387dfad-44ff-4a94-9be2-7463f07ed953
1
@Override public Converter put(String key, Converter value) { Converter v = super.put(key, value); if (v != null) { throw new IllegalArgumentException("Duplicate Converter for " + key); } return v; }
6e725e60-85cb-49d3-b709-3b20affbe46e
8
public void run(TriplesInputStream stream) throws IOException { while (true) { Triple next = stream.nextTriple(); if (next == null) { if (currentSubject != null) { handleSubject(currentSubject, currentProps, currentLinks); } return; } String s = next.getSubject(); // Try to url-decod...
93772f9c-4cca-42df-b4b7-0bb2bfa05826
0
public String getNombre() { return nombre; }
13db75f7-1b15-4c32-8b85-a23e9edb6098
2
public void enqueue(TypeValue val, int prio) { QueueElement current = head; while (current.getNext() != null && current.getNext().getPrio() < prio) { current = current.getNext(); } QueueElement tmp = new QueueElement(val, prio); tmp.setNext(current.getNext()); ...
25025093-135b-4f53-a4f5-b86d1701f172
1
public void accept(final MethodVisitor mv) { AbstractInsnNode insn = first; while (insn != null) { insn.accept(mv); insn = insn.next; } }
1832c89b-afff-4e0b-a241-7ca174e96810
6
public int offset(int i) { switch (npcs[i].npcType) { case 50: return 2; case 2881: case 2882: return 1; case 2745: case 2743: return 1; case 8133: return 3; } return 0; }
d0a0d02d-308b-47b4-b3fd-a8dbb815d676
6
private void decoderChar(char c1,char c2,char[][] c) { int t11; int t12; int t21; int t22; this.chercheTab(c, c1); t11=this.i1; t12=this.i2; this.chercheTab(c, c2); t21=this.i1; t22=this.i2; if(t11==t21) { if(t12==0) { this.t1=c[t11][4]; } else{ this.t1=c[t11][(t12-1)%5]; } ...
31ecda45-1728-41ad-b450-67d5c4c52e98
1
private void replyFile(String path) throws Exception { path = path.replace('/', File.separatorChar); File file = new File(path); if (!file.exists()) { System.err.println("File \"" + path + "\" not found"); return; } System.err.println("File \"" + path + "\" found and sent"); // FileInputStream...
1bd2a4e5-fe91-40c7-bd9a-2ab458c84627
1
public void checkProduction(Production production) { if (!ProductionChecker.isRightLinear(production)) throw new IllegalArgumentException( "The production is not right linear."); }
5acaa46c-073b-4d82-9c4a-0fa82b572d38
3
public FlowGraph(final MethodEditor method) { this.method = method; subroutines = new HashMap(); catchBlocks = new ArrayList(method.tryCatches().size()); handlers = new HashMap(method.tryCatches().size() * 2 + 1); trace = new LinkedList(); srcBlock = newBlock(); iniBlock = newBlock(); snkBlock = newBl...
3fc0e8a5-cc6f-4af9-8e42-487a7845fa5d
1
public File getFile() { JFileChooser fc = new JFileChooser(); int result = fc.showOpenDialog(new JFrame()); File sendfile; if (result == JFileChooser.APPROVE_OPTION) { sendfile = fc.getSelectedFile(); filename = sendfile.getAbsolutePath(); filesize = (int)sendfile.length(); jLabel1.setText("傳送檔案" + ...
3f55c892-c3ab-446e-aa63-d50f011038af
1
private int[] getArrayForHuffman() { String resultDecompression = huffman.getResultDecompress(); char array[] = resultDecompression.toCharArray(); arrayForHuffman = new int[array.length]; int i = 0; int temp = 0; for (char symbol : array) { temp = (int)symbol ...
d34351cd-ddb4-4651-b371-52862832198b
4
public double standardizedPersonRange(int index){ if(!this.dataPreprocessed)this.preprocessData(); if(index<1 || index>this.nPersons)throw new IllegalArgumentException("The person index, " + index + ", must lie between 1 and the number of persons," + this.nPersons + ", inclusive"); if(!this.vari...
25d408b6-fe62-47e5-9abb-c2be692dceb1
3
public void compare() { // could not find the new generated pdf document if(pdfInfoHolder.getDifferent() == DifferenceType.MISSINGDOCUMENT) { missingDocument(pdfInfoHolder.getPDF1()); return; } PDFFile pdf1 = pdfInfoHolder.getPDF1(); PDFFile pdf2 = pdfInfoHold...
3cd5238c-1fe2-4bfa-ba54-ff45d6676ea1
4
@SuppressWarnings("unused") public boolean outputToFile(String strDirectory, int[] objSave, String strFileName, String[] strStatistics) throws Exception { try { File fObjSave = new File(strDirectory); String strSaved = ""; if(strStatistics != null) { strSaved = "Statistics:\r\n"; strSaved += (strSta...
6e21fa5b-e696-47b1-bb68-38de65136cdf
5
public String readSQL() throws FileNotFoundException{ String resultSql = ""; System.out.println("[INFO]Begin to get SQL from ["+this.sqlFileName+"]"); FileReader fr; try { String sql = ""; fr = new FileReader(new File(sqlFolderPath+sqlFileName)); BufferedReader br = new BufferedReader(fr); while((sq...
70d93b8b-2db9-4fbf-b82d-d4b6b1be857a
1
public static double absVolumeError(double[] obs, double[] sim) { sameArrayLen(obs, sim); double volError = 0; for (int i = 0; i < sim.length; i++) { volError += sim[i] - obs[i]; } return Math.abs(volError); }
d2a5a384-9cfe-4aa3-8682-20f7e6dc206e
6
private double average_efficient(String measure) { int type = get_type(measure); if (type == RATE_BASED) { if (trans_time < 0.0) { trans_time = 0.0; } if (end_time < 0.0) { // Method called at run time return ((double)((Long)data.get(measure)).longValue())/(Sim_system.s...
da962d69-0ded-45bf-98e2-f1d71b16f5cf
8
private int[] alphaBetaPrunning(int depth, Board b, int alpha, int beta,String player, int bestRow, int bestCol, int score) { if(cutoff(b, depth)) { //need to get score and row and column of move score = evaluate(b); return new int[] {score, bestRow, bestCol }; } //children = all valid moves ...
d7d1ece0-7d64-4a34-b6c8-a76347c1a921
9
static long function(long i, long j){ if(mem[(int)i][(int)j]>0)return mem[(int)i][(int)j]; if(i==n&&j==1)return an1; if(i<j){ long max = 0; for (long k = i; k < j; k++) max = Math.max(max, function(i, k) + function(k+1, j)); return mem[(int)i][(int)j] = max; } else{ long num = 0, num1 = 0; ...
c0828724-fe57-4127-8c73-3ba6a82fbf85
0
public String getCiudad() { return ciudad; }
0aea3fa9-920f-4a62-919c-100db232e75f
2
public void InsertaFinal(int ElemInser) { if ( VaciaLista()) { PrimerNodo = new NodosProcesos (ElemInser); PrimerNodo.siguiente = PrimerNodo; } else { NodosProcesos Aux = PrimerNodo; while (Aux.siguiente != PrimerNodo) Aux = Aux.siguiente; NodosProcesos Nuevo=new NodosProces...
3bf290b0-8bd8-4ba3-a983-0d4c3a218b3c
5
public int checkExam(Exam originalExam, Exam answeredExam) { assert (originalExam.getId().equals(answeredExam.getId())); int correctAnswers = 0; if (answeredExam.getQuestions() == null || answeredExam.getQuestions().isEmpty()) { return correctAnswers; } Map<String,...
ff3bb37b-5728-450c-abea-961302c1d8bc
0
@Test public void runTestRegisterGlobal2() throws IOException { InfoflowResults res = analyzeAPKFile("Callbacks_RegisterGlobal2.apk"); Assert.assertNotNull(res); Assert.assertEquals(1, res.size()); }