method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
db542117-8b5e-45ba-9b41-78906228b2a1
5
@Override public void keyPressed(KeyEvent e) { // TODO Auto-generated method stub if (e.getKeyCode() == KeyEvent.VK_RIGHT) { right = true; } if (e.getKeyCode() == KeyEvent.VK_LEFT) { left = true; } if (e.getKeyCode() == KeyEvent.VK_UP) { ...
bacb4727-bd47-44bd-aa48-e55038641f06
2
public ClassEditor editClass(final ClassInfo info) { // Check the cache ClassEditor ce = (ClassEditor) classEditors.get(info); if (ce == null) { ce = new ClassEditor(this, info); classEditors.put(info, ce); classRC.put(info, new Integer(1)); if (!classInfos.containsValue(info)) { final String cl...
b5284767-2ba0-4927-a3fb-a89e5c78aeb9
6
private void btninsertActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btninsertActionPerformed if(txtname.getText() == "" && txtlname.getText() =="" && txtemail.getText() =="" && txtdepartment.getText() =="" && txttitle.getText() =="") { firstName=txtname.getText(...
e479dae3-29c7-4a39-bd15-a1ac85742e7d
6
public String getDescription() { if(fullDescription == null) { if(description == null || isExtensionListInDescription()) { fullDescription = description==null ? "(" : description + " ("; // build the description from the extension list Enumeration<String> extensions = filters.keys(); if(extensions != nul...
b1574778-6768-48f9-85f5-44d418545c7e
5
private static void sink(Comparable[] a, int k, int N) { while (2 * k <= N) { int j = 2 * k; if (j < N && less(a, j, j + 1)) j++; if (j == a.length || !less(a, k, j)) break; exch(a, k, j); k = j; } }
ceadb6c4-33d0-4aac-89f9-a438fe42b3da
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 fe...
4bfd8ed9-5d0b-49ad-b1da-414b0c9276de
8
@Override public boolean _equals(TwitterEntry other) { return (id == other.id) && _eq(text, other.text) && (from_user_id == other.from_user_id) && (to_user_id == other.to_user_id) && _eq(from_user, other.from_user) && _eq(to_use...
e2acbea7-aea9-43cc-b020-ad63a7bf781b
7
public void run(){ // If there is not word to recognized or the word is empty then do not recognize if(word == null || word.trim().isEmpty()){ return; } DefaultHighlighter.DefaultHighlightPainter highLighter = FileUtils.getInstance().getHighlighter(); word = word.tr...
1b64ab15-2bc4-4606-89fd-90ccb5b1a60c
2
public static boolean checkString(String val, String pattern) { if (val == null) return false; if (val.length() == 0) return false; return val.matches(pattern); }
d0c387f2-4393-4743-9a7a-d9bf6a590ddd
9
public String nextToken() throws JSONException { char c; char q; StringBuilder sb = new StringBuilder(); do { c = next(); } while (Character.isWhitespace(c)); if (c == '"' || c == '\'') { q = c; for (;;) { c = next(); ...
4282e91a-aefa-46d6-bee7-9855fc902809
3
@Override public List<Device> build(InputStream instream) throws BuilderException { SAXParserFactory factory = SAXParserFactory.newInstance(); factory.setValidating(true); factory.setNamespaceAware(true); XMLReader reader; try { SAXParser parser = factory.newSAXParser(); SAXDeviceHandler handler ...
dedb03bc-60ee-4fda-8846-65b3849ddbdb
8
private Component cycle(Component currentComponent, int delta) { int index = -1; loop : for (int i = 0; i < m_Components.length; i++) { Component component = m_Components[i]; for (Component c = currentComponent; c != null; c = c.getParent()) { if (component == c) { index = i; break loop; } ...
7cb245fb-ab68-41fd-899d-73d9157f8b41
4
public void removeArbitersForBody(Body body) { arbitersToRemove.clear(); for (Arbiter arb : arbiters.values()) { if (arb.body1.uniqueGameObjectID == body.uniqueGameObjectID || arb.body2.uniqueGameObjectID == body.uniqueGameObjectID) { arbitersToRemove.ad...
2eb24612-6e20-4608-b9c3-429f9c2e374f
4
@Override public Object _load(Class<?> c, Object obj) { if(obj == null){ return null; } Connection connection = createConnectionObject(); // Check if PK exists Field pkField = getPrimaryKey(obj); Object pkObj = getPrimaryKeyObj(pkField,obj); if(pkObj != null){ Map<String, Object> whereClause = new ...
1a7b12c9-f80b-40bd-a3e4-9fa8df5cde26
5
public static Search_Result search(Database database, Search_Param params) { Logger.getLogger(API.class.getName()).log(Level.FINE, "Entering API.getFields()"); Search_Result result; try { ValidateUser_Result vResult = validateUser(database, new ValidateUser_Param(params.user...
79f5b955-7f81-44b7-a522-ba5c8143fa74
1
@Override public void addServerStartListener(ServerStartListener listener) { if (serverStartListenerList != null) serverStartListenerList.add(ServerStartListener.class, listener); }
a70d6505-01d5-442c-a837-d4dcb6a5eb34
7
public void setDNA(DNA dna) { if (!wasFirstPainting) { needSetDNA = dna; return; } if (model == null) { model = new DNAScrollerModel(dna); model.addPropertyChangeListener(this); } else { model.clearMutationListeners(); model.setDNA(dna); } createRectangles(); setGeometry(); if (dna !...
76c5e657-6d61-47ff-a3e8-c1cf1dfedf81
7
public boolean equals(Object other) { if ( (this == other ) ) return true; if ( (other == null ) ) return false; if ( !(other instanceof RelEventoHermanoId) ) return false; RelEventoHermanoId castOther = ( RelEventoHermanoId ) other; return (this.getIdevento()==castOther.getIdevento()) ...
da17d333-969e-4f2c-85a6-09431ef3ed84
1
public int getActiveAsInt(){ if(this.active){ return 1; }else{ return 0; } }
7bce172a-d029-47f9-8dac-ba1e450e3db8
5
public static void main(String[] args) throws Exception { final int port = 3344; ServerSocket server = null; Socket client = null; final int RSAKeySize = 1024; PublicKey pubKey = null; PrivateKey priKey = null; Key clientPubKey = null; String serverText = "password"; byte[] plainText = serverText.ge...
c06a3a30-a992-4d37-8191-20979cc5c578
9
public static Ranker getRankerByArguments(CgiArguments arguments, Options options, Indexer indexer) { switch (arguments._rankerType) { case FULLSCAN: return new RankerFullScan(options, arguments, indexer); case CONJUNCTIVE: return new RankerConjunctive(options, arguments, indexer); case FAVORITE...
612f22f7-27f4-4eab-a39d-1c18a544964f
3
private void constructTables(List<Specie> species) { for (Reaction reaction : reactions) { int indexOfExpression = insertExpressionValueInTable(species, reaction); // Add the expression value for the left hand side species List<Specie> lhsSpecies = reaction.getPattern().getLhs(); for (Specie specie :...
b6f83f6c-8a92-4a1a-8ce3-5eafd704e959
2
public static String getName(EntityType type) { switch (type) { case OBJ_TREE: return "Tree"; case OBJ_DOOR_WOOD: return "Wooden Door"; } return "No Name Found"; }
907f0b02-a9e9-4a0a-a3da-92f281def75f
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...
8a836cc9-dae0-4eae-8f8a-f3f11d0290cd
5
public void operation() { lugeja++; if (lugeja == 1) { ajutnumber = number; strnumber = ""; number = 0; } else { if (syndmus == "+") ajutnumber += number; else if (syndmus == "-") ajutnumber -= number; else if (syndmus == "*") ajutnumber = ajutnumber * number; else if (syndmus == ...
9c01bd48-e169-485b-ace7-57766fb56bdb
0
public Server(int port) { this.port = port; }
e593d50d-23b7-494f-88f4-3bc5da48ea1a
7
public static byte[] getInputStreamAsByteArray(InputStream stream, int length) throws IOException { byte[] contents; if (length == -1) { contents = new byte[0]; int contentsLength = 0; int amountRead = -1; do { int amountRequested = Math.max(stream.available(), DEFAULT_READING_SIZE); // read at l...
7b9e8aba-b2bc-4ab9-99f5-16a86d60d9d8
6
public int majorityElement(int[] nums) { int count = 1; int majorityIndex = 0; //Find a majority candidate for (int i=0; i<nums.length; i++) { if (nums[majorityIndex] == nums[i]) count = count + 1; else count = count - 1; ...
39366948-7256-4ad5-a75d-e317eabf5c21
7
public PrivateProperty fetchAPropertyRecord() { final Room R=CMLib.map().getRoom(landPropertyID()); if(R!=null) { final PrivateProperty A=CMLib.law().getPropertyRecord(R); if(A!=null) return A; } final Area area=CMLib.map().getArea(landPropertyID()); if(area!=null) { final PrivateProperty A=...
e7ce7959-c0e4-4eb3-9958-f976762e5c99
0
public void setTrainNumber(String value) { this._trainNumber = value; }
ef28e263-06ce-4428-8cf6-da2ad44e86d3
8
private boolean readFeed() { try { // Set header values intial to the empty string String title = ""; String link = ""; // First create a new XMLInputFactory XMLInputFactory inputFactory = XMLInputFactory.newInstance(); // Setup...
89cab120-45bc-4b03-846b-763b0e0bab27
0
public void setTreeDrawer(TreeDrawer drawer) { treeDrawer = drawer; repaint(); }
48d54c93-f11d-4ac3-9493-51c1c77aa539
8
public static Stella_Object access_tuples_Slot_Value(tuples self, Symbol slotname, Stella_Object value, boolean setvalueP) { if (slotname == Plsoap.SYM_PLSOAP_NRESULTS) { if (setvalueP) { self.nresults = ((nresults)(value)); } else { value = self.nresults; } } else if...
fc0eab06-fd23-4bf2-bcce-442be66666c6
9
static boolean isMultiplicityFree(int[] elements) { int v = vexillarity(elements); int inv = inversions(elements); if (inv == 0) return true; HashSet<Tableau> tableaux = new HashSet<Tableau>(); HashSet<AW> shapes = new HashSet<AW>(); createStack(inv); int reducedW...
91948b89-a3ce-4ba3-bdee-e4f03a5e7216
1
public void leeArchivo() throws IOException { BufferedReader fileIn; try { fileIn = new BufferedReader(new FileReader(nombreArchivo)); } catch (FileNotFoundException e) { File puntos = new File(nombreArchivo); PrintWriter fileOut = new PrintWriter(puntos); ...
506ae009-3b26-44c9-9ffe-9e8bf1c1b309
7
static final String method313(long l, int i) { try { anInt392++; if (l <= 0L || (l ^ 0xffffffffffffffffL) <= -6582952005840035282L) return null; if (l % 37L == 0L) return null; int i_1_ = 0; for (long l_2_ = l; (l_2_ ^ 0xffffffffffffffffL) != -1L; l_2_ /= 37L) i_1_++; if (i >= -8...
89f8de78-dc74-4c5a-8500-a46095223ed8
7
public static KColor fromHSB(double hue, double saturation, double brightness) { int r = 0, g = 0, b = 0; if (saturation == 0) { r = g = b = (int) (brightness * 255.0 + 0.5); } else { double h = (hue - Math.floor(hue)) * 6.0f; double f = h - java.lang.Math.floor(h); double p = brightness * (1.0f - sat...
deb89e95-6be0-4f60-a0a2-802c6426c068
3
public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String line = ""; StringBuilder out = new StringBuilder(); while ((line = in.readLine()) != null && line.length() != 0) { int nCase = Integer.parseInt(line.trim()); for (in...
70cc9f54-068f-4144-81ac-dd590e1ec7d6
4
public Load (String filename, boolean duplications) { try { Scanner scan = new Scanner(new File(filename)); TextParser textParser = new TextParser(scan); for (Item item : textParser.getItemList()) { if (!duplications) { if (!Archive.instance.getLibrary().contains(item)) Archive.instance.addIt...
22a0ae97-d9dd-48d6-9cd3-34b9b24fbd4d
2
public static double[] getLightnessAndSaturation(int color) { double var_R = ( color >> 16 & 0xff ) / 255.0; //RGB from 0 to 255 double var_G = ( color >> 8 & 0xff ) / 255.0; double var_B = ( color & 0xff ) / 255.0; double var_Min = Math.min(Math.min( var_R, var_G), var_B ); //Min. value o...
81e3b2e9-ccc0-4c38-a388-6991fcf637e1
2
@Override public void inputStarted() { gui.updateTime(); if (!Display.isActive()) { gui.clearKeyboardState(); gui.clearMouseState(); if (gui.getRootPane() instanceof RootPane) { ((RootPane) gui.getRootPane()).keyboardFocusLost(); } ...
c04e0ecc-2fe4-467d-bf74-8a95e5b3badf
0
public Queue GetDistributionQueue() { return q; }
41376930-2cea-428c-a7ff-bf3767a37666
5
public CorpusHolder(String base, String locale) { storage = new WordStorage(base, locale); String fileName = base + "." + locale + ".txt"; System.out.println("reading corpus file \"" + fileName + "\"..."); int wordCount = 0; int sentenceCount = 0; int maxSentenceLength = 0; LinkedList<int[]> lines = new L...
27b4e1ab-5fcc-4a8c-955f-da5ded8c48b9
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...
40ef402b-1f07-4738-99ae-91c0af270db5
3
private void jButton1KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jButton1KeyReleased if (evt.getKeyChar() == evt.VK_ENTER) { i++; if (i == 1) { jButton1.doClick(); } else if (i == 2) { i = 0; } } }//GEN-LAST:event_jButton1KeyReleased
fe4afb1a-d642-496d-a220-3cd771d001c0
6
public void drawTransparentSprite(int i, int j, int opacity) { int k = opacity;//was parameter i += anInt1442; j += anInt1443; int i1 = i + j * DrawingArea.width; int j1 = 0; int k1 = myHeight; int l1 = myWidth; int i2 = DrawingArea.width - l1; int j2 = 0; if(j < DrawingArea.topY) { int k2 = D...
84d3fa57-b957-4b43-bf4d-15b976a72a7e
1
private String requestInputWithFallback(String Prompt, String fallback) { console.printf("%s [%s]: ", Prompt, fallback); String r = console.readLine(); if (r.isEmpty()) { r = fallback; } return r; }
03f94d5e-cb62-45ce-90fa-9946e4527b79
5
public String newColumn() { String[] hiragana = { "あ", "か", "さ", "た", "な", "は", "ま", "や", "あ", "か", "さ", "た", "な", "ぱ", "ま", "や", "" }; String sx = "<option style=\"color:blue\">- 男性 "; String[] string_box = namelist.split(","); StringBuilder sb = new StringBuilder(); sb.append("<option>リスト選択</option>"); ...
47eb55b2-c0ed-448a-9ac5-3a4af23f69bc
3
public String selectionSort(String a) { char[] arr = a.toCharArray(); int minIndex; for (int i = 0; i < arr.length - 1; i++) { minIndex = i; for (int j = i + 1; j < arr.length; j++) { if (arr[j] < arr[minIndex]) minIndex = j; } // swap swap(arr, minIndex, i); } return new String(arr);...
cd963935-21c1-4dc6-81cc-03717553b25f
8
void scroll(Directions dir) { // if(tilesize==25) // return; switch(dir) { case N: this.offy = offy-1; break; case S: this.offy = offy+1; break; case E: this.offx = offx+1; break; case W: this.offx = offx-1; break; } if(this.offy<0) of...
8ed42cdc-d95b-4fb1-89bf-f9d71f26b803
2
private static final void parent(long[] x, long[] p) { copy(x,p); if(isRoot(x)) return; if(isLeft(x)) {p[end] = x[end]+(x[end]-x[beg]);} else {p[beg] = x[beg]-(x[end]-x[beg]);}; }
0dcbf560-30d0-4c20-acf0-872aa5d234ca
3
public static void run() { ws = WebServers.createWebServer(Config.i().listening_port); if(Config.i().disable_ssl) log.info("SSL disabled in config"); else try { // To generate new certificate use smth like: // $ keytool -genkey -alias webCrt -keystore keystore -keysize 1024 -validity 3600 ws...
fe9e1506-c94f-415e-a9ea-f96e61e80b59
4
public String toString() { switch(this) { case UP: return "U"; case DOWN: return "D"; case LEFT: return "L"; case RIGHT: return "R"; } return null; }
f0e3c87a-4647-4eb9-b8e2-38606852d15e
1
static public Mantenimiento_Alumno instancia() { if (UnicaInstancia == null) { UnicaInstancia = new Mantenimiento_Alumno(); } return UnicaInstancia; }
9821c094-1ffc-4a45-935d-1c2cf18a95ae
4
public static void cloneObject(Object sourceObj,Object targetObj){ Class souceClazz = sourceObj.getClass(); Class targetClazz = targetObj.getClass(); for (Class superClass = souceClazz; superClass != Object.class; superClass = superClass.getSuperclass()) { for(Field field:superClass.getDeclaredFields())...
e09ca24d-79b8-43ca-8d76-b7febab6ac03
5
public void loadLocales() { Strings.clear(); FileConfiguration locales = plugin.yml.getYMLConfig(Config.getLocale(), true); if (locales != null) { String value; for (String key : locales.getKeys(false)) { value = locales.getString(key); Strings.put(key, ChatColor.translateAlternateColorCodes('&...
3b2c9231-4fc7-431d-b11b-db8b265ec942
9
private void RegistarResultado_ButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RegistarResultado_ButtonActionPerformed buttonGroup1.clearSelection(); HashMap<String, Integer> jogadores_1 = new HashMap<String,Integer>(); HashMap<String, Integer> jogadores_2 = new HashMap<...
5a056b24-c7c2-4b86-8afc-f5b8835d9519
8
private void plantHerbiStartSimulationButtonListener(){ restart.removeActionListener(restartActionListener); restartActionListener = new ActionListener() { public void actionPerformed(ActionEvent e) { if (currentConstructor != null) { synchronized(simulator) { if (simulator.isRunning()) { s...
9215e6fe-79c4-45f7-beae-c3e77fafab7a
7
public static String doubleToString(double d) { if (Double.isInfinite(d) || Double.isNaN(d)) { return "null"; } // Shave off trailing zeros and decimal point, if possible. String string = Double.toString(d); if (string.indexOf('.') > 0 && string.indexOf('e') < 0 ...
38b95602-b171-4a60-8975-26ad0c60a66f
2
public static boolean hasParisForUserAndSchedule(String userId, String schedId) { Key<UserModel> userKey = createUserKey(userId); Key<ScheduleModel> schedKey = createScheduleKey(schedId); int nbscore = ofy().load().type(ParisScoreModel.class).filter("paris_user_key", userKey).filter("paris_sched_key", schedKey).c...
7ad4634e-5865-486f-b41e-5a97505117fd
8
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((author == null) ? 0 : author.hashCode()); result = prime * result + ((dateCreated == null) ? 0 : dateCreated.hashCode()); result = prime * result + ((id == null) ? 0 : id.hashCode()); result = prime * re...
98087a10-2d6b-4811-90ab-b6a972633c40
6
public boolean isUnderSiege() { int friendlyUnits = 0; int enemyUnits = 0; for (ColonyTile colonyTile : colonyTiles) { for (Unit unit : colonyTile.getWorkTile().getUnitList()) { if (unit.getOwner() == getOwner()) { if (unit.isDefensiveUnit()) { ...
bba77e9f-2203-430b-84b7-fe54d7cccd29
2
private void loadTexture(InputStream in) { this.glTexId = GL11.glGenTextures(); BufferedImage img = null; try { img = ImageIO.read(in); } catch(Exception e) { e.printStackTrace(); } if(img != null) { this.textureWidth = img.getWidth(); this.textureHeight = img.getHeight(); this.texData(img...
a218e100-c358-4320-a91a-8ff54d1b7213
6
@Override public void eUnset(int featureID) { switch (featureID) { case boardPackage.BOARD__COUNTRIES: getCountries().clear(); return; case boardPackage.BOARD__BORDERS: getBorders().clear(); return; case boardPackage.BOARD__CONTINENTS: getContinents().clear(); return; case boardPa...
87757536-d804-4683-84f2-2a2a18786183
6
public String getAllTriplesAsDot(Model model) { StringBuffer dump = new StringBuffer(); String temp = ""; StmtIterator statements = model.listStatements(); dump.append("digraph G { "); dump.append('\n'); //dump.append("edge [len=2];"); dump.append("ratio=\"0.2\""); dump.append('\n'); dump.append("...
5872c179-c3c3-49df-8458-fcfa64e55281
7
public VuePartie(BatailleNavale batailleNavale, Jeu jeu, Profil profil, final Partie partie) { try { this.setContentPane(new JLabel(new ImageIcon(ImageIO.read(new File("stockage/"+partie.getParametre().getEpoque().getNom()+"/"+partie.getParametre().getEpoque().getImage()))))); } cat...
5d1a17e3-3140-4e92-b1dd-b63b1ac90f3c
1
public BuscarRegistro() { initComponents(); dir = Directorio.getInstance(); //Botón nuevo this.btn_nuevo.setToolTipText("Agregar un ticket"); //Botón buscar this.btn_buscar.setToolTipText("Iniciar búsqueda"); //Botón excel this.btnExcel.setEnabled(false); ...
6dd27853-6e39-49d6-b0a6-c9a5613f6505
0
public String getName() { return name; }
a4325b4e-62e6-43a3-8619-34e5debbf0ec
5
public String alphabatizeYourName(String first, String middle, String last) { String nameInOrder = ""; if(first.compareTo(middle) < 0) { if(first.compareTo(last) < 0) { if(middle.compareTo(last)< 0) { nameInOrder = first + ", " + middle + ", " + last; } else { nameInOrder = ...
ede11ce5-c53e-4eae-b3ed-293fd40abf59
1
public static void updateEntreprise(int identreprise,int idville,String nom, String adresse1, String adresse2) throws SQLException { String query; try { query = " UPDATE ENTREPRISE SET ID_VILLE=?,ENTNOM=?,ENTADRESSE1=?,ENTADRESSE2=? where ID_ENTREPRISE=? "; PreparedSt...
f31ae686-1ac7-4106-8884-eb80634b0607
1
public void visitNewArrayExpr(final NewArrayExpr expr) { // new t[i] // array-1-of-t <= [new t[i]] if (!expr.elementType().equals(TypeInference.UNDEF)) { start(expr, expr.elementType().arrayType()); } }
31dadfe9-8441-4675-b1b6-d81202169769
3
public void createMatrix() { matrix = new int[nodes.size()][nodes.size()]; for(int i = 0;i < nodes.size(); i++) { for(int j = 0; j < nodes.size(); j++) { int absx = nodes.get(i).getX() - nodes.get(j).getX(); int absy = nodes.get(i).getY() - nodes.get(j).getY(); int abs = absx * absx + absy * ab...
48adc7bc-26ea-48ad-b62b-be90eaf19eae
6
final boolean method2935(int i, int i_2_, int i_3_, boolean bool) { anInt6821++; if (bool != true) anInt6811 = -84; if (i_3_ != anInt6815 || (anInt6820 ^ 0xffffffff) < (i_2_ ^ 0xffffffff) || anInt6806 < i_2_ || (anInt6811 ^ 0xffffffff) < (i ^ 0xffffffff) || anInt6810 < i) return false; return tr...
106c8bbf-2c60-4278-ae04-681886e53947
8
* @param adj_id The block ID of the adjacent block * @param adj_data The data value of the adjacent block */ private STAIR_RENDER shouldRenderStairSide(byte our_data, short adj_id, byte adj_data) { if (adj_id < 0 || blockArray[adj_id] == null) { return STAIR_RENDER.YES; } if (blockArray[adj_id].isSolid...
1862eae6-2b9b-4cd8-a407-99082911e000
3
public void run() { for(int i =0; i < logNum; i++){ try{ if(randomValue.nextInt(100) <= abnormalRandomValue){ randomFlag = false; }else{ randomFlag = true; } //System.out.print(randomFlag); //System.out.println(this.logProducer.ModelParser(randomFlag, "random")); queue.put(this.lo...
56f80055-36b7-4370-b414-01f2d7723d4b
4
public static Image loadRaw(File file, int width, int height) throws IOException { BufferedImage ret; byte[] data = getBytesFromFile(file); ret = new BufferedImage(width, height, BufferedImage.TYPE_BYTE_GRAY); WritableRaster raster = ret.getRaster(); int k = 0; for (int j = 0; j < height; j++) { fo...
bc9c85c3-402e-466a-8bcd-985761479384
5
private void setMultiplier() { switch(multiplierLevel) { case 1: multiplier = 1; break; case 2: multiplier = 3; break; case 3: multiplier = 5; break; case 4: multiplier = 7; break; case 5: multiplier = 10; break; } }
5026c4ea-05f6-479f-b9ba-033dd698e734
8
private void AddLocalMinPoly(TEdge e1, TEdge e2, IntPoint pt) { TEdge e, prevE; if(e2.dx == horizontal || (e1.dx > e2.dx)) { AddOutPt(e1, pt); e2.outIdx = e1.outIdx; e1.side = EdgeSide.esLeft; e2.side = EdgeSide.esRight; e = e1; if(e.prevInAEL == e2) prevE = e2.prevInAEL; else prevE...
4c3ea769-6e5e-43be-abb2-1f22b329cc0f
7
public boolean isHorizontalCombo(int x, int y, Orb[][] arr) { int horCount = 0; for (int j = 1; ((x + j) < X && arr[y][x + j] != null) && arr[y][x].color == arr[y][x + j].color; j++) horCount++; // scan left for (int j = -1; ((x + j) >= 0 && arr[y][x + j] != null) ...
4a373c74-50c3-4349-86c3-574e8a412a63
3
public URI getDefaultErrorDocumentURI( Integer statusCode ) { URI errorDocumentURI = this.errorDocumentMap.get( statusCode ); // Error document defined for given status code? if( errorDocumentURI != null ) return errorDocumentURI; // Error document is not defined. // Try to fetch the DEFAULT error docume...
94ffa9fb-031a-46be-94f5-51e6b630644a
6
public void loadEvent(String id) { if (!StringUtil.isBlank(id)) { PreparedStatement st = null; ResultSet rs = null; try { conn = dbconn.getConnection(); st = conn.prepareStatement("SELECT * FROM events WHERE id = " + id + " limit 1"); ...
2e5650c8-9f87-4155-b959-3b25dc787bbd
0
public boolean isHiddenWithPanel() { return hiddenWithPanel; }
4d0c4e85-42c2-4685-83c3-28fb94008233
2
public void tick(Level level, int xt, int yt) { if (random.nextInt(2) == 0) return; int age = level.getData(xt, yt); if (age < 50) level.setData(xt, yt, age + 1); }
6f30d7dd-dc09-48d7-b802-fbfbea9b21c2
1
private int readByteAsInt() { int ret = readByte(); if (ret < 0) ret += 256; return ret; }
afc814e0-d9c9-4f80-a8e1-4c158cb18ba4
0
public DefaultTempFileManager() { tmpdir = System.getProperty("java.io.tmpdir"); tempFiles = new ArrayList<TempFile>(); }
b2a8252f-6a00-4f32-a1a6-0fe96a642275
9
public double associationAttributeClasses(double[][] counts){ List<Integer> supportSet = new ArrayList<Integer>(); List<Integer> not_supportSet = new ArrayList<Integer>(); double discriminatingPower = 0; int numValues = counts.length; int numClasses = counts[0].length; int total = 0; d...
7c4eaaff-905c-4bcd-941c-11073763b079
2
public Ship (double x, double y,double anangle, double Acceleration, double maxSpeed, double fWidth, double fHeight) { xcor = x; ycor = y; angle = anangle; acce = Acceleration; topSpeed = maxSpeed; //currentLives = lives; framex = fWid...
8b53df9a-b588-41ba-8907-a31338c966fd
0
public String getUri() { return uri; }
c60741be-0ff6-46c5-89b6-34ae735e62dd
2
private void reloadTimer() { new Thread() { @Override public void run() { while (settings.refreshDevices()) { try { reload(); Thread.sleep(settings.getDeviceRefreshInterval()); } catch...
36e24ac4-4c8d-413b-9c89-7e728f96c316
2
public static int search_type_by_name(Type_table type_table, String name) { int num = type_table.type_name.size(); for (int i = 0; i < num; i++) { if (type_table.type_name.get(i).toString().equals(name)) { return i; } } return -1; }
60222cb3-a721-4484-b1c7-92cfd47df5a6
4
private static double getConsensusScoreWithFunction1(Read sequence, Consensus consensus) { double score = 0; // takes into account that S + c(endgap) scores 0; for (int col = sequence.getOffset(); col < sequence.getOffset() + sequence.getLength(); col++) { if (col >= 0 && col < consensus.getSymbols().size()) {...
22fbe388-3c4b-4405-847d-ac03c0382fc0
1
public int hashCode() { return (username != null ? username.hashCode() : 0); }
604521dd-cbe8-47c1-a9d2-8e0e7e332ff2
2
private static int checkFieldTypeSignature(final String signature, int pos) { // FieldTypeSignature: // ClassTypeSignature | ArrayTypeSignature | TypeVariableSignature // // ArrayTypeSignature: // [ TypeSignature switch (getChar(signature, pos)) { case 'L': return checkClassTypeSignature(signature, po...
811498bc-51b0-4740-aa97-9cf76a1b87c5
3
private String generateSignatureBase(URL url, String httpMethod, List<QParameter> parameters, StringBuffer normalizedUrl, StringBuffer normalizedRequestParameters) { Collections.sort(parameters); normalizedUrl.append(url.getProtocol()); normalizedUrl.append("://"); normalizedUrl.append(url.getHost()); ...
eb352be8-6008-4344-9bdd-8fe8bf486a32
2
private void writeIterator(int length, Iterator it) throws IOException { if (length < Ranges.LIST_PACKED_LENGTH_END) { rawOut.writeRawByte((int) (Codes.LIST_PACKED_LENGTH_START + length)); } else { writeCode(Codes.LIST); writeCount(length); } while (it...
35b7713f-4630-484d-9a02-a0decc6f5c80
1
public static void writeVarInt( ByteBuf buffer, int value ) { while((value & 0xFFFFFF80) != 0) { buffer.writeByte(value & 0x7F | 0x80); value >>>= 7; } buffer.writeByte(value); }
b30df83f-6fb7-4f0d-b7a2-c5c2a21eb204
2
@Test public void resolve() { int n = 13; long max = 0; // init for (int i = 1; i < 1000; i++) { long current = calc(i, n); if (current > max) { max = current; } } print(max); }
255867d5-b9c9-48a2-be2e-f87b3203881c
2
public void deleteRow(int index) { // delete row from database EntityTransaction userTransaction = manager.getTransaction(); userTransaction.begin(); fileService.deleteFile((String) getValueAt(index, 0)); userTransaction.commit(); fileResultList.remove(index); int row; int col; for (row = index; row...
d2ef7529-9278-4204-898b-1b75d0dac1e1
4
private void createFromString(String s) { this.initialFile = s; String[] recordLines = s.split("\n"); int lns = 0; for(String sr : recordLines) { if(sr.startsWith(":")) { lns++; } } records = new HEXRecord[lns]; for(int i = 0; i < records.length; i++) { if(!recordLines[i].startsWith(":")) { ...
936b5a71-41c9-4b93-ad49-63652dbf46bb
3
@Override public boolean isCellSelectable(Object cell) { if (cell != null) { if (cell instanceof mxCell) { mxCell myCell = (mxCell) cell; if (myCell.isEdge()) return false; } } return super.isCellSelectable(cell); ...