method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
6254aecf-291b-4868-85d1-c7cc72677d5d
9
public static boolean validate(int index, String listAdd, char addChar) { int isParenthesis = 0; if(listAdd.length() > 0) isParenthesis = listAdd.charAt(0) == '(' ? 1 : 0; if(isOperator(addChar) && listAdd.length() > 0 + isParenthesis) if(addChar != '/') return false; if(!listAdd.contains("_") && addC...
d8f82bcf-8ca3-4df9-afff-a0c960bd9cf4
6
public void buildFromBEDFile(File bedFile) throws IOException { intervals = new HashMap<String, List<Interval>>(); BufferedReader reader = new BufferedReader(new FileReader(bedFile)); String line = reader.readLine(); while(line != null && line.startsWith("#")) { line = reader.readLine(); } while(li...
7a5f8c14-3f04-4bd0-968a-3fb9dd58dda6
9
private void scrapeFootball() { QBsPlaying = new ArrayList<BasketballPlayer>(); WRsPlaying = new ArrayList<BasketballPlayer>(); RBsPlaying = new ArrayList<BasketballPlayer>(); TEsPlaying = new ArrayList<BasketballPlayer>(); DSTPlaying = new ArrayList<BasketballPlayer>(); KickersPlaying = new ArrayList<Baske...
10963e4d-fe1c-4baf-a9ba-6e023b1ab57d
8
@Override public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { if(cmd.getName().equalsIgnoreCase("Suffix")) { if(sender instanceof Player) { Player p = (Player) sender; PlayerUtil pu = new PlayerUtil(p); if(pu.hasPermission("Nostalgia.Command.suffix", Permissio...
3e0a6f91-54fb-41b3-8702-90c22294829d
6
public void run() { try { enc.SetEndMarkerMode(true); if (LzmaOutputStream.LZMA_HEADER) { enc.WriteCoderProperties(out); // 5d 00 00 10 00 final long fileSize = -1; for (int i = 0; i < 8; i++) ...
32f8e586-413b-421c-ba93-d9460295a008
7
private Class<?>[] findMeasureClasses() { AutoExpandVector<Class<?>> finalClasses = new AutoExpandVector<Class<?>>(); Class<?>[] classesFound = AutoClassDiscovery.findClassesOfType("moa.evaluation", MeasureCollection.class); for (Class<?> foundClass : classesFound) { ...
295fe07f-2a92-49ed-be10-e56551f97e80
4
public synchronized void gameFinished(Player winnerPlayer, List<Player> players) { if (firstPhaseElectionTask != null) { firstPhaseElectionTask.cancel(); firstPhaseElectionTask = null; } if (secondPhaseElectionTask != null) { secondPhaseElectionTask.cancel(); secondPhaseElectionTask = null; } if ...
e877491c-1460-4280-8acf-369c00aa2b98
1
private boolean hasPermission(Player player, String node) { if ( this.permissionHandler != null ) { return this.permissionHandler.has(player, node); } else { return player.hasPermission(node); } }
9b328ef2-26d2-4f78-8eb6-3cdd3e97caa4
3
public void loadConfig() { config = new YamlConfiguration(); createConfig(); File file = new File(getDataFolder(), "config.yml"); try { config.load(file); } catch (FileNotFoundException e) { e.printStackTrace(); Logger.warning("Could not load config, using default settings!"); } catch (IOEx...
8559a32f-9a57-42bd-8480-f0795f30e1d0
1
@Override public void paintComponents(Graphics g) { Graphics2D graphics = (Graphics2D) g; graphics.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); graphics.setRenderingHint(Render...
6e09e6fa-ed22-441b-bd6b-6d09fbfc6c9a
4
public static Sens getSens(String s){ switch(s){ case "A": return Sens.AVANCER; case "R": return Sens.RECULER; case "G": return Sens.GAUCHE; case "D": return Sens.DROITE; default: ...
571f07de-afef-4261-824a-ffd7e3e9e690
7
public boolean registerEventListener(final EventListener listener) { logger.debug("EventBus", "Registering "+listener.getClass().getName(), 0); try { for(Method method : listener.getClass().getMethods()) { EventMethod ema = method.getAnnotation(EventMethod.class); if(ema == null) continue; Class<?>[...
8e61798e-2be2-4a2f-8b42-33846e12799d
2
private String attack(Pawn enemy) { String message=this.letter + " attacks!\n"; if (this.board.isBonusSquare(x, y)) message+=enemy.suffer(2); else message+=enemy.suffer(1); if (enemy.isDead()) gold++; return message; }
e055208f-99b0-4b9c-a25d-2887a4ed3244
8
public static void validate(Review review) throws ValidationMovieCatalogException { LinkedList<String> errorList = new LinkedList<>(); if (review == null) { errorList.add("Null pointer review"); } else { if(review.getUser() == null){ errorList.add("Null...
796a1297-7990-4605-ba62-72b9a239109c
3
private static JSONObject toJSONObject(String paramName, Object o, boolean required) throws BadConfig { if (o == null) { if (required) throw new BadConfig("Parameter \"" + paramName + "\" is required"); return null; } if (!(o instanceof JSONObject)) throw new BadConfig("In parameter \"" + paramName +...
5c08f649-f55f-47fd-a575-2d22665aa0b5
5
private boolean isNeedsEscape(String character) { if (character.matches("\\(")) { return true; } else if (character.matches("\\)")) { return true; } else if (character.matches("\\$")) { return true; } else if (character.matches("\\^")) { return true; } else if (character.matches("\\!")) { retur...
09fb208c-ec78-4872-be2c-c68fd124812f
5
private String peekToken() { if (token == null) try { while (st == null || !st.hasMoreTokens()) { line = r.readLine(); if (line == null) return null; st = new StringTokenizer(line); } token = st.nextToken(); } catch (IOException e) { } return token; }
4c01002f-cd28-4809-8de9-b0fec60c04fd
3
public static String permillage(double p1, double p2) { String str; double p3 = p1 / p2; if (p1 == 0.0) { return "0.00"; } if (p2 == 0.0 && p1 != 0.0) { return "-"; } DecimalFormat df1 = new DecimalFormat("0.00"); str = df1.format(p...
5900f16a-66ff-471e-9e4e-65fab123080d
6
public static String[][] read_data_file(String file_name) { String[][] matrix = null; try { BufferedReader br = new BufferedReader(new FileReader(file_name)); String line, cell = ""; String[] tokens; boolean first_line = true; int row = 0, col ...
c4bfabc1-270f-4201-af38-0e838d32046a
9
public String getTopTexture(BlockType type){ // TODO: Make these use official Minecraft texture file names switch (type){ case STONE: return "stone.png"; case GRASS_BLOCK: // TODO: Make grass properly use different colors return "grass_top.png"; case DIRT: return "dirt.png"; case COBBLESTONE: ...
0a577120-0aee-45a9-9cc8-3d53bed5c308
0
public int getEast(){ return this.east; }
3717b5d8-8824-4bc9-8613-21fabfdfc368
9
private static Color setGridChargeColor(float q, float qmin, float qmax) { if (Math.round(q) == 0) return Color.black; // pos. blue, neg. green, neu. black float scale = 1.0f; int ncolor; int isign = Math.round(qmax * qmin); if (isign > 0) { scale = 255.0f / (qmax - qmin); // all pos. or neg. ncolo...
83a32ecf-8762-4e36-867e-7749257e7314
2
public HighscorePanel(Map<String, String> levelNameMap, Map<String, Integer> levelScoreMap) { this.levelNameMap = levelNameMap; this.levelScoreMap = levelScoreMap; header = new String[]{"Level Name", "Score"}; data = new String[this.levelNameMap.size()][2]; int count = 0; ValueComparator comparator = ...
330ef0fb-e4e7-43f5-870a-8e05ffe43252
1
public boolean isEmpty() { return messageBuffer.isEmpty() && writePointer == 0; }
a2e3af98-b941-4db9-9616-cf4a1e462288
9
public boolean editRecord(String badgeId, String lastName, String recordID, String newStatus) { // check if the user is allowed to create this operation if (!isOfficerAuthorized(badgeId)) { log.error(badgeId + " is not a authorized user to perform editRecord"); System.out.println(badgeId + " is n...
1864d165-aa4e-4484-9767-c559204ee773
6
private Chromasome genChild(Chromasome parent1, Chromasome parent2) { int[] par1 = parent1.returnChrom(); int[] par2 = parent2.returnChrom(); Chromasome child = new Chromasome(par1.length); if (Constants.secondCrossover) { int index = 0; while (index < par1.length / 2) { child.chromasome[index] = par1...
1e2348e7-f7b0-4356-baf3-c0c01aae83ec
0
private static void swap(int[] array, int index1, int index2) { int tmp = array[index2]; array[index2] = array[index1]; array[index1] = tmp; qSwaps++; }
03bf34bd-1595-4657-b981-9cfcbe68ab80
2
public void stop() { synchronized (MP3Player.this) { isPaused = false; isStopped = true; MP3Player.this.notifyAll(); } if (playingThread != null) { try { playingThread.join(); } catch (InterruptedException e) { LOGGER.log(Level.SEVERE, "join() failed", e); } } }
badc900a-a803-488d-b2de-e08bf2e509bf
4
public static void main(String[] args) { System.out.println(new Object().equals(new Object())); int m = 3, n = 4; Object[][] a1 = new Object[m][n], a2 = new Object[m][n]; for(int i = 0; i < m; ++i) { for(int j = 0; j < n; ++j) { a1[i][j] = n...
1a92ddde-5d27-4d44-9615-b88fa7cb1e8b
6
protected int contest(int b, int g, int r) { /* finds closest neuron (min dist) and updates freq */ /* finds best neuron (min dist-bias) and returns position */ /* for frequently chosen neurons, freq[i] is high and bias[i] is negative */ /* bias[i] = gamma*((1/netsize)-freq[i]) */ int i, dist, a, biasdist, ...
87843c5d-82fa-41d8-a960-92ccbe66cb05
1
public static boolean downloadFile(String libName, File libPath, String libURL) { try { URL url = new URL(libURL); URLConnection connection = url.openConnection(); connection.setConnectTimeout(5000); connection.setReadTimeout(5000); InputSupplier<Input...
e5fd5fe2-688c-49e7-9d1f-957132eb8820
6
public static void main(String args[]) { Scanner in = new Scanner(System.in); Map<String, String> types = new HashMap<String, String>(); int N = in.nextInt(); // Number of elements which make up the association table. in.nextLine(); int Q = in.nextInt(); // Number Q of file name...
e4509e4b-9808-46f2-a6f0-e6f7ab16cb35
4
public static boolean hasCut(Pokemon[] pokemon) { for (Pokemon aPokemon : pokemon) { if (aPokemon != null) { for (int j = 0; j < 4; j++) { if (aPokemon.move[j] == Pokemon.Move.CUT) return true; } } } ...
9e6a95c9-5e91-455a-bbec-874ef8a8b5cd
5
public @Override void setDNA(String dna) throws IllegalArgumentException { if (dna == null || dna.length() == 0) throw new IllegalArgumentException("argument null or empty"); if (dna.contains("TGC")) throw new IllegalArgumentException("argument contains TGC"); for (int i=...
4d864048-8952-468e-84c8-172f593adefd
5
public void loadIdent(String id) { Ident ident = Yaka.tabident.chercheIdent(id); if (ident != null) {// l'ident existe var_param_const if (ident.isVar()) {// ident est une variable int offset =((IdVar) ident).getOffset(); int index=-1*offset/2 - 1;// index de la variable dans la pile des variables if...
58be5e65-192c-4a6f-b092-cd0f12a5d6c1
6
@Override public void putAll(final Map<? extends K, ? extends V> m) { for (final java.util.Map.Entry<? extends K, ? extends V> entry : m .entrySet()) { final K key = entry.getKey(); final Entry newEntry = new Entry(key, entry.getValue()); final Entry old = this.lookUpMap.put(key, newEntry); if (old =...
39e8cb0a-4656-4c0f-8e31-86f5ef4ce34c
7
public static void ConvertToLibSVM(String directory, String outputDirectory) throws FileNotFoundException,IOException{ FileReader fr = new FileReader (directory); BufferedReader br = new BufferedReader(fr); FileWriter stream = new FileWriter(outputDirectory,false); BufferedWriter bo = new BufferedWri...
3f8bf096-2ddb-44c9-aaff-1b02af482f2d
0
public Message(User u, String m) { this.user = u; this.content = m; }
47a090fd-3955-4439-82c1-a73c4d5017d7
7
public List<Instance> readData() { ArrayList<Instance> instances = new ArrayList<Instance>(); while (this._scanner.hasNextLine()) { String line = this._scanner.nextLine(); if (line.trim().length() == 0) continue; FeatureVector feature_vector = new FeatureVector(); // Divide the line int...
65df4923-9a8d-4d0d-8e0f-c8b2a4df4071
2
public void deleteAll(Collection<T> entities) { if (entities != null) for (T entity : entities) { session().delete(entity); } }
5415fa6b-0feb-4a68-a0b0-0beebf2264c2
7
private void sortDACSpartitions(OneMutation mutArray[], int initDepth, int majorSplitPos[], int numPartitions[], PrunedRotamers<Boolean> prunedRotAtRes, Index3 indexMap[][], int numMutable, int strandMut[][], double pruningE, double initEw, RotamerSearch rsP) { RotamerSearch rs = rsP; //no changes should be...
19e70983-4473-41ad-8ab2-6e02d40867e5
9
public List<TestResultData> process() { List<TestResultData> testResults = new ArrayList<TestResultData>(); try { BufferedReader bufferReader = new BufferedReader(new FileReader( resultFile)); String line = null; while((line = bufferReader.readLine()) != null)...
9004de5e-c8b4-409b-8164-552aac4c78e1
8
public List<Regional> getRegionals(URL url) { Document doc; Tidy tidy = new Tidy(); List<Regional> retVal = new ArrayList<Regional>(); Regional temp; String link = ""; String name = ""; int teamCounter = 0; try { doc = tidy.parseDOM(url.openStream(), null); XPath xpath = XPathFactory.newIn...
04c1b10d-9cb7-4330-98d4-5356ec40fbc9
3
@SuppressWarnings(value="unchecked") public void put(int field$, java.lang.Object value$) { switch (field$) { case 0: to = (java.lang.CharSequence)value$; break; case 1: from = (java.lang.CharSequence)value$; break; case 2: body = (java.lang.CharSequence)value$; break; default: throw new org.apach...
dbdb806a-e436-48fc-a4a0-0f2df2503297
0
public int GetBus() { return bus; }
bd9597dc-5f37-43bd-aea1-7821aafaf5dd
9
public Solmu lisaa(Punamustapuu puu, int avain) { Solmu uusi = puu.binaariLisays(puu, avain); uusi.setVari("puna"); Solmu apu; while (uusi.getParent() != null && uusi.getParent().getVari().equals("puna")) { if (uusi.getParent() == uusi.getParent().getParent().getVasen()) { ...
e7ad50f6-eaa2-44cb-83fd-c86ff4842b08
9
public static List nMRSeperate(String arg){ List fileList = new ArrayList(); List fileList1 = new ArrayList(); List pdbList=new ArrayList(); List NMRresult=new ArrayList(); String line= ""; String nextline=""; int modelCount=0, linecount=0; String currDir...
4e31039c-8dd0-4a21-8285-adbc297ecd60
0
public void saveStatus(){ myKeeper.saveStatus(); }
c4c9c22c-0e38-4805-a3ac-bfb27bbc1dab
9
public static void initCommandLineParameters(String[] args, LinkedList<Option> specified_options, String[] manditory_args) { Options options = new Options(); if (specified_options != null) for (Option option : specified_options) options.addOption(option); Option option = null; OptionBuilder.with...
6a488508-d9b7-4942-bbf7-c8d793489db5
4
public boolean isActive() { if (context == 0) { context = -1; try { if (getAppletContext() != null) { context = 1; } } catch (final Exception localException) { ...
63701bfe-b1d6-4d42-b862-8a10cba49c5d
0
@Override public String toString() { return "[com.cube.geojson.LngLatAlt lng: " + longitude + " lat: " + latitude + " alt: " + altitude + "]"; }
670e50cc-a86e-4fe8-a81f-6c74fb0cc5fc
4
public String getOtherWolve(int current) { String result = ""; boolean first = true; for (int i = 0; i < wolves.size(); i++) { if (wolves.get(i) == current) { continue; } if (!first) { if (i == wolves.size() - 2) { result += " and "; } else { result += ", "; } } first = fa...
ee7e65ab-b6b5-46d4-a3c1-d1452a6d7b63
7
public void create(ConfigDecripcionLogin configDecripcionLogin) { if (configDecripcionLogin.getCmProfesionalesList() == null) { configDecripcionLogin.setCmProfesionalesList(new ArrayList<CmProfesionales>()); } EntityManager em = null; try { em = getEntityManager()...
464daf55-f36c-4f07-9333-2570bb0bab7e
2
private JFreeChart getChart(){ /*Create data for building all graphs */ XYSeriesCollection data = new XYSeriesCollection(); /*Mark line*/ int index = 0; for(Coordinates[] kit: listCoordinates ){ /*Add data to kit of one line*/ XYSeries series = new XYSe...
0fec2220-6c04-4db5-8120-315abb50d4f7
9
public static List<String> buscaSiglas(String texto) { List<String> siglas = new ArrayList<String>(); List<String> siglasFim = new ArrayList<String>(); int countUppers = 0; String[] palavras = texto.split(" "); for (String palavra : palavras) { if (isAllUpper(palavra) && palavra.length() > 2) { count...
03193591-7a9c-429d-85a1-b45e91d85fcf
4
public final void startTile(final Attributes attributes) { tmpTile = new TileType(); if (attributes.getValue("name") != null) { tmpTile.setName(attributes.getValue("name")); } else { tmpTile.setName(""); } tmpTile.setCount(Integer.parseInt(attributes.get...
9510e00d-8ee0-4a1e-9997-c80162c19c33
7
public void buildClassifier(Instances data) throws Exception { super.buildClassifier(data); // can classifier handle the data? getCapabilities().testWithFail(data); // remove instances with missing class Instances newData = new Instances(data); newData.deleteWithMissingClass(); double su...
edb2d542-f72e-4c09-bc29-3c5357ee4054
8
public void service( HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException { PrintWriter out = response.getWriter(); moduli.setRequestResponse(request, response); //passaggio di request e response a moduli per il corretto funzionamento modu...
5e28fb30-d55b-4eed-9d41-7562e42d18f4
5
public void subgridPressed(final String face) { int[] nulled = {-1, -1}; boolean correct = false; if(face.equals("L") || face.equals("R")) { dir = "Hor"; sub_grids.setColor(face, color_correct); repaint(); } else if(face.equals("U") || face.equals("D")) { dir = "Ver"; sub_grids.setCo...
433e8034-1483-4d76-819f-41bc0b35d3ce
4
public void run(){ if (time!=0){time=time-1;} GosLink2.dw.append("HeartBeat Started."); while (true){ try { OLH.put(1,0); OLH.put(2,0); OLH.put(3,0); CTH.put(1,0); CTH.put(2,0); CTH.put(3,0); Thread.sleep(60000); for (int v:GosLink2.TNH.keySet()){ checkserver(v); } ...
8a040ce4-cf7c-4b54-bf55-7fd510dad94e
7
public static String getProperty(String key) { //return rb.getString(key); //TODO make a normal config file! switch(key) { case "path.page.index": return "/index.jsp"; case "path.page.login": return "/jsp/login.jsp"; case "path.page.admin": return "/jsp/admin.jsp"; case "path.page.main": return "/jsp/main.jsp"; ...
fe782a4f-27d9-42d1-9c10-f7e89e7de25e
6
public static float taxesDue(Actor actor) { final int bracket = actor.vocation().standing ; if (bracket == Background.SLAVE_CLASS) return 0 ; if (bracket == Background.RULER_CLASS) return 0 ; final BaseProfiles BP = actor.base().profiles ; int taxLevel = 0 ; if (bracket == Background.LOWER_...
9d0cc141-5a5e-4703-97ac-829d6c97403f
6
public boolean equals( Object other ) { if ( _set.equals( other ) ) { return true; // comparing two trove sets } else if ( other instanceof Set ) { Set that = ( Set ) other; if ( that.size() != _set.size() ) { return false; // different sizes, no need ...
4081f34e-a211-449f-999c-40476a4530a0
3
public static String readData(String filename){ File file = new File(filename); FileReader fr; BufferedReader br; String line; int index = -1; int indexstart = 38; String lineresult; StringBuffer sb = new StringBuffer(); try { fr = new FileReader(file); br = new BufferedReader(fr); while(br.r...
f7d370e3-a1aa-42ae-a722-684a09f79a30
0
public void itemSent(Auction auction, String time, String trackingId){ auction.itemSent(time, trackingId); }
75187519-d01c-4b7d-9861-477aeee16d7c
0
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { }
b99947b4-c368-4e81-a1c5-0574c2602b60
4
public void recursivePrint(LeftistTreeNode root, int parentPosition, Node innerNode, Node p) { Node innerParent; int position; if (root != null) { int height = tree.heightRootToNode(root); int nextTop = getRectNextTop(height); if (innerNode != null) ...
fccb7bd0-f850-4af7-a666-2a36ea926269
7
public void setBombs(){ boolean duplicateBomb=true; // checks for bombs with the same x,y coordinates Random numGenerator = new Random(); int xcoord,ycoord; for(int numBombs=0;numBombs<10;numBombs++){ xcoord = numGenerator.nextInt(10); ycoord = numGenerator.nextInt(10); duplicateBomb=true; while(du...
c797759a-7ae9-40b8-b297-bacf6428abfe
7
public GenericObject load(final String filename) { final long startTime = System.nanoTime(); if (!openInStream(filename)) return null; //notify about loading if (settings.isPrintTimingInfo()) System.out.println("Loading " + filename + "."); ...
61cda267-31d1-45b4-b2cc-63f2b8f33d2c
8
private double pareseMulOrDiv() throws Exception { char op; //运算符 double result; //结果 double partialResult; //子表达式结果 //用指数运算计算当前子表达式的值 result = this.parseExponent(); //如果当前标记的第一个字母是乘、除或者取模运算,则继续进行乘除法运算 while ((op = this.token.charAt(0)) == '*' || op == '/' || op =...
faf28cc1-9670-4a18-b488-53f0e6635c62
8
public static final Define makeMethod(String proxyPackage, final Class clazz, final String methodName, Class... parameters) { parameters = parameters == null ? new Class[0] : parameters; final Method method = Utilities.getMethod(clazz, methodName, parameters); if (method == null) { t...
1ce1cf30-211c-470a-9878-4c3732e8b72b
1
public final void visitEnd() { addEnd("class"); if (!singleDocument) { addDocumentEnd(); } }
ff43af8b-7c4a-4d60-9048-1f88d3ca337d
0
public void setLineEnding(String lineEnding) { this.lineEnding = lineEnding; }
febd66c8-3f8f-4f42-a6d9-1cee876b6dfa
4
public void run() { Message message; MessageObject messageObject; Socket socket; try { while (true) { socket = socketServeur.accept(); System.out.println("Connection de " + socket); synchronized (outputStreams) { outputStreams.put(socket, new DataOutputStream(socket.getOutputStream())...
6e781f38-324b-45be-bb3b-905ecb6b928c
8
public static IMod loadMod(File jar) { try { URLClassLoader classLoader = URLClassLoader.newInstance(new URL[] {jar.toURI().toURL()}); @SuppressWarnings("resource") JarFile jarFile = new JarFile(jar); Enumeration<JarEntry> entries = jarFile.entries(); IMod mainClass = null; while (entries.hasMoreEle...
991bb2da-198f-4708-87d5-da0eadda5b1a
1
public boolean _setLevel(int level) { if(level > 0) { this.level = level; return true; } else { return false; // Invalid level given. } }
1e314eb1-4c91-4ad4-8c55-504e1dff7beb
1
static void test(Runnable r) throws InterruptedException { Future<?> f = exec.submit(r); TimeUnit.MILLISECONDS.sleep(100); System.out.println("Interrupting " + r.getClass().getName()); f.cancel(true); // Interrupts if running System.out.println("Interrupt sent to " + r.getClass().getName()); }
f5df3d6c-aef6-442d-ab1e-c8a80a32b8e3
6
@EventHandler(priority=EventPriority.HIGH ) public void onBlockRedstone(BlockRedstoneEvent event) { Block block = event.getBlock(); int iBlockID = block.getTypeId(); if (iBlockID==69 || iBlockID==77 || iBlockID==143) { return; } if(event.getOldCurrent() >=1 && event.getNewCurrent() == 0 ) { return; } if(...
2222d7a2-d092-41a0-9b51-31f349bf8540
1
final public void Integral_type() throws ParseException { /*@bgen(jjtree) Integral_type */ SimpleNode jjtn000 = new SimpleNode(JJTINTEGRAL_TYPE); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { jj_consume_token(INTEGER); } f...
7dcf4b38-aa5c-4016-b420-fbc0529c3d1e
0
public WebServices() { // TODO Auto-generated constructor stub }
c6ccc90d-cb66-4d44-b525-581a6c1580b0
3
public static boolean writeEdges(int numNodes, int idTopology) { try { PrintStream ps = new PrintStream("./Topology/Edges/"+idTopology+"_edge_"+numNodes+".txt"); ps.println("Number of nodes: " + numNodes); Configuration.printConfiguration(ps); ps.println(separator); Iterator<Node> it = Tools...
b7e297ed-8734-4301-bee7-520a95682a25
0
@Override public IautosSellerInfo getIncompletedSeller(String seqID) { EntityManager em = this.getEntityManager(); return em.find(IautosSellerInfo.class, seqID); }
7c39f247-cfdd-4d19-8a3c-320d0fccdcbd
7
public void map(LongWritable key, Text inputValue, Context context) throws IOException, InterruptedException { String htmlLine = inputValue.toString(); String toLowerCaseHtml = htmlLine.toLowerCase(Locale.US); // Get the source URL for this page if (null == _contributingPageUrl && true == toLowerCaseHtm...
d3fa968e-9d0f-4199-9122-bd7b38768a61
5
private int executeViewer(int posX, int posY, boolean stop) { if (stop) return 1; if (posY < 0 || posY == matrix[0].length) return 1; if (posX < 0 || posX == matrix.length) return 1; stop = matrix[posX][posY].showValue(); executeViewer(posX, (posY + 1), stop); executeVi...
a06c00a2-79a4-4337-b16a-abb15199280e
7
private boolean validarDatos(){ boolean error= false; if(txtNombre.getText().isEmpty()){ txtNombre.setBorder(javax.swing.BorderFactory.createEtchedBorder(Color.lightGray, Color.red)); txtNombre.setToolTipText("Por favor digite el nombre del producto."); error= true; ...
57972fc7-355f-406a-a016-d6865b9333d3
2
public static void main(String[] args){ Scanner in = new Scanner(System.in); int n = in.nextInt(); int k = in.nextInt(); int count=0; for(int i=0;i<n;i++){ int temp = in.nextInt(); if(5-temp >= k) count++; } System.out.println(count/3); }
a49a34d2-41c4-40eb-b2d0-71e72a48b407
9
public void write(int address, int data) { int sets = Cache.MAX_SIZE / this.assoc / this.blockSize; int blockNo = address / this.blockSize; int pos = blockNo % sets; byte tag = (byte) (address / sets); //MRU Way Prediction if (this.mru[pos] >= 0 && tag == this.tags[pos+this.mru[pos]]) { this.hit++; th...
2ef41048-214d-40fd-b4df-32c73c8989dc
2
public User findByID(String userID) { User foundUser = null; try { // Erforderlicher SQL-Befehl String sqlStatement = "SELECT * FROM bookworm_database.users WHERE id LIKE " + userID + ";"; // SQL-Befehl wird ausgeführt myResultSet = mySQLDatabase.executeSQLQuery(sqlStatement); // da das Sele...
68ff808e-4a90-40c4-9909-4670e9d52af6
4
public static Command parseCommand(Game game, String desc) throws NoFactoryFoundException{ ArrayList<String> commandDesc = new ArrayList<String>(); String allDescArray[] = desc.split(" "); for (int i = 0; i < allDescArray.length; i++) { commandDesc.add(allDescArray[i]); } String commandName = commandD...
0aca8b81-b7e2-4e56-b1bb-78abd459564e
4
private void addVM() { final SlaveVM slave = new SlaveVM(openNebula); slave.createVM(); slave.setState(VMState.INIT); allVms.put(slave.getId(), slave); Thread creator = new Thread() { public void run() { while (!slave.getVm().lcmStateStr().equals("RUNNING")) { slave.getVm().info(); } Syst...
30a15455-6a11-425d-9632-c34e59109816
0
public double getDiag(){ return lengh_diag = this.getHig()*Math.sqrt(3); }
b6fb55d9-6132-4ee1-898e-c3028393e22a
4
public void worldInput(int mouseX, int mouseY){ int button = -1; if (Mouse.isButtonDown(0)){ button = 0; } if (mouseX < 800){ int newX = -1; int newY = -1; int cx = Boot.getPlayer().getX(); int cy = Boot.getPlayer().getY(); newX = cx + (mouseX / Standards.TILE_SIZE) - 12; newY = cy +...
2c2f7955-805b-48c9-bd0f-6cc1d39ba3c6
7
public void insert(T newVal) { if (newVal == null) { throw new IllegalArgumentException(); } if (root == null) { root = new Node<>(newVal); return; } Node<T> tmp = root; int compRes = -1; while (tmp != null) { com...
332e980c-b99b-4fd5-98ca-dc0fa182eceb
6
private ArrayList<String> parseRow(String row) { ArrayList<String> data = new ArrayList<>(); String s = ""; char expect = STRING_CONTAINER; for (int i = 0; i < row.length(); i++) { char c = row.charAt(i); switch (expect) { case STRING_CONTAINER: if (c != STRING_CONTAINER) { System.out.println...
18fb6b2c-d47f-4937-a5b4-8c109b90942c
1
public AnnotationVisitor visitAnnotation(final String desc, final boolean visible) { AnnotationVisitor av = super.visitAnnotation(desc, visible); if (fv != null) { ((TraceAnnotationVisitor) av).av = fv .visitAnnotation(desc, visible); } return av; }
773190de-d4d3-445f-996d-e72831e77d3e
5
public int[] getBoundaryPositions(ByteBuffer b, byte[] boundary) { int matchcount = 0; int matchbyte = -1; List<Integer> matchbytes = new ArrayList<Integer>(); for (int i=0; i<b.limit(); i++) { if (b.get(i) == boundary[matchcount]) { if...
558c4280-09b0-48ee-852f-c2d76781da86
3
static boolean isOnBoard(int x, int y){ return(x >= 0 && x <= 7 && y >= 0 && y <= 7); }
8c074ed2-0559-4428-bd7d-21cfc281488d
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.decodeFrame(h, bits...
d2b27615-0a89-4253-9301-ba856d8ef8fc
8
public boolean stateRight() throws Exception { int[] temp = new int[numbers.length + 1]; int spaces=0; for (int i = 0; i < temp.length; ++i) temp[i] = 0; for (int i = 0; i < numbers.length; ++i) { int x = 0; if (!numbers[i].toString().equals(" ")) { x = new Integer(numbers[i].toString()); ...
af8d5011-b728-4a2a-adf5-679d04950067
4
public AStarGraphics(List<CellDescription> cd, List<Cell> ol, List<Cell> cl, List<CellDescription> rp ) { returnPath = rp; knownCells = cd; openList = ol; closedList = cl; int floorXdimension = 1; floorYdimension = 1; for ( int i ...