method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
93d022ed-3906-4923-954a-92350dd609da
3
@Override protected int getAvgIndex(ChannelType c) { switch (c) { case RED: return 0; case GREEN: return 1; case BLUE: return 2; default: throw new IllegalArgumentException(); } }
eab9a69d-f621-41ed-83bb-2dda109008e9
0
public boolean isClosed() { return isClosed; }
7706ca7d-083c-4b6c-95f1-fc27d80de12a
7
private final void step6() { j = k; if (b[k] == 'e') { int a = m(); if (a > 1 || a == 1 && !cvc(k - 1)) k--; } if (b[k] == 'l' && doublec(k) && m() > 1) k--; }
30d7d612-1edb-451e-8179-dbea34315000
8
public boolean createAccount() { Scanner sc = new Scanner(System.in); boolean success = false; String posUsername, posPassword, firstName, lastName; //Possible username/password. int attempts = 0; while (attempts < 3) { //At three attempts, the user is booted back to the main screen. System.out.print("E...
da60dcec-7927-4970-bb29-26984837cdab
8
private void addResources(int dices) { // Liste des tuiles correspondante au nombre des des. LinkedList<ResourceTile> tiles = new LinkedList<ResourceTile>(); // Pour chaque tuile ressource. for(int i: resourceIndexes) { ResourceTile t = (ResourceTile)grid[i]; if (t.isNumber(dices) && !t.hasThief()) ...
658aa42c-9243-4ebe-8d76-6d1924f6cb13
9
public String getAnswer() throws Exception { String [] input = getResource("problem59.txt").readLine().split(","); int[] letters = new int[input.length]; int[] key = new int[3]; List<Map<Integer,Integer>> freqAnalysis = new ArrayList<Map<Integer,Integer>>(key.length); int retVal...
60a516a5-b2ad-4e77-9887-057a939d6493
9
@Override public void panelResize() { for (Node current : reachable) { for (Node to : current.expand()) { //from is not in cover if (reachable.contains(to)) { publish(new HighlightEdge(layer, current, to, Color.RED)); } ...
90ec8c96-eb28-405b-8107-4bf4d898d138
9
protected int getSquareIndex(int x, int y) { int squareIndex = 0; int offy = resx*y; int offy1 = resx*(y+1); if (posDiscrimination == false) { if (gridValue[x+offy] < isovalue) squareIndex |= 1; if (gridValue[x+1+offy] < isovalue) squareIndex |= 2; if (gridValue[x+...
5f53f39d-a716-4892-9338-6fc07ac6460a
4
private void proveedormedicamentoFieldKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_proveedormedicamentoFieldKeyTyped // TODO add your handling code here: if (!Character.isLetter(evt.getKeyChar()) && !Character.isISOControl(evt.getKeyChar()) && !Character.isWhitespace(evt.getKeyChar())) ...
64a6ca8e-6ab7-4f69-b9ae-18498759dcd9
1
public static double getSleepFactor() { double min = getSleepFactorMin(); double diff = getSleepFactorMax() - min; if (diff == 0) { return min; } return min + (new Random()).nextDouble() * diff; }
5d8d37d2-72f1-4192-95f0-1134848457a6
7
private void listForGuessing(){ ArrayList<WordStructure> list = new ArrayList<WordStructure>(GuiBuilder.wordListAll); try { FileInputStream fileInputStream = new FileInputStream("settings.txt"); ObjectInputStream objectInputStream = new ObjectInputStream(fileInputStream); ...
b4e0f8ad-d86d-4bf5-8744-ef8663eca9ad
2
@Override public String getPref(String key) { for (String _key : preferences.keySet()) if (_key.equals(key)) return String.format("{0}; {1}", key, preferences.get(key)); return null; }
70df6513-8518-4698-ab31-7841a8298fac
1
@Test public void testCreatingPhoneNumberWithNullLabelShouldFail() { try { new PhoneNumber(null, "12345678"); fail("Was expecting an Exception when no label is provided."); } catch (IllegalArgumentException iae) { Assert.assertEquals("Please provide a value for Label as it is a non-nullable field.", iae.g...
45c01a37-d4e4-4e5e-86e4-720f915d238f
2
public static synchronized void updateCoreVersion(String coreVersion) { if (Main.coreVersion != null) { if (!Main.coreVersion.equals(coreVersion)) { logger.error("You use different Versions of Dynmaps"); System.exit(-1); } } else { Main...
a543f0e8-57bb-4549-b98d-a89780efcb9e
4
@Override public void paint(Graphics g) { super.paint(g); if (running) { if (state == 0) { paintGame(g); } else if (state == 1) { paintGame(g); paintPauseMenu(g); } else if (state == 2) { paintGame(g); paintReconnect(g); } } }
b140024a-80a7-4346-9841-71e332e1f95e
8
public void renderProjectile(int xp, int yp, Projectile p) { xp -= xOffset; yp -= yOffset; for (int y = 0; y < p.getSpriteSize(); y++) { int ya = y + yp; for (int x = 0; x < p.getSpriteSize(); x++) { int xa = x + xp; if (xa < -p.getSpriteSize() || xa >= width || ya < 0 || ya >= height) break; if...
f82d7342-9ad6-4b09-a17b-0c071192b27b
5
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Software)) { return false; } Software other = (Software) object; if ((this.idSoftware == null && other.idSoftwa...
7038ea0d-faac-48f0-b59c-59039343e4fb
2
public static ParticleEffect fromId(int id) { for (Entry<Integer, ParticleEffect> entry : ID_MAP.entrySet()) { if (entry.getKey() != id) { continue; } return entry.getValue(); } return null; }
b4a34f2f-71a3-4506-bc66-8d1edd2cfe83
7
static final void method3198(boolean bool, byte i) { anInt9547++; if (i != -45) aShort9555 = (short) -74; if (bool) { if ((r.anInt9721 ^ 0xffffffff) != 0) Class14.method235(r.anInt9721, (byte) -113); for (Class348_Sub41 class348_sub41 = (Class348_Sub41) Class125.aClass356_4915.method3484(0); ...
91c78386-d974-49a8-9033-b1d44b994dc0
8
public static String stripNonLongChars(final String value) { final StringBuilder newString = new StringBuilder(); for (int i = 0; i < value.length(); i++) { final char c = value.charAt(i); if (c == '.') { // stop if we hit a decimal point break; ...
3833c51c-d36a-4c9f-84f0-ffcb0c6339f3
5
public boolean canJump(int[] A) { // Note: The Solution object is instantiated only once and is reused by // each test case. // boolean[] reach = new boolean[A.length]; // for (int i = 0; i < A.length; ++i){ // reach[i] = false; // } // reach[0] = true; // int r = 0; // if(A.length == 1){ // return true; ...
e45ec78f-ce3e-44b3-a0b8-b01812a6f39e
7
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Diff other = (Diff) obj; if (operation != other.operation) { return false; } if (text...
682437cc-af1d-45d9-842b-cd21b76205a1
9
private String getHeaderName(String columnName) { String headerName = columnName; if (columnName.equalsIgnoreCase(Buyer.getBuyerColumn())) { // Buyer name headerName = Buyer.BUYER_HEADER; } else if (columnName.equalsIgnoreCase(Buyer.getLocationColumn())) { // Location headerName = Buyer.LOCATION_HEAD...
786fb70e-3a19-4bc5-8d15-76cb2a422f07
4
public static HashMap<String, ClassNode> parseJar(JarFile jar) { HashMap<String, ClassNode> classes = new HashMap<>(); try { Enumeration<?> enumeration = jar.entries(); while (enumeration.hasMoreElements()) { JarEntry entry = (JarEntry) enumeration.nextElement(); if (entry.getName().endsWith(".class")...
dddd0769-25ab-4954-9bfd-e0d465ff2974
2
public void actionPerformed(ActionEvent event) { if (event.getActionCommand() == null) { fadeEffect.start(); this.setTimerDelay(); } else { switch (event.getActionCommand()) { case "Effect Complete": changePin(pinLoader.getRandomPin...
8bc0728d-0747-4ec2-b260-f1ef02ccd558
7
@Override public Item findDepositInventory(String depositorName, String itemName) { final List<PlayerData> V=getRawPDDepositInventory(depositorName); if(CMath.s_int(itemName)>0) { for(int v=0;v<V.size();v++) { final DatabaseEngine.PlayerData PD=V.get(v); if(PD.xml().startsWith("COINS;")) retu...
1de9a24e-ba93-4d23-af46-a9b03038974f
8
void solve() { for (int i = 0; i < numberOfPoints; i++) { // zeros wavefunction phi[i] = 0; } for (int i = 0; i < numberOfPoints; i++) { phi[i] = state[0]; // stores wavefunction x[i] = state[2]; solver.step(); // steps Schroedinger equation if (Math.abs(state[0]) > stepThresh...
2fafb142-031a-491e-8161-f78bf45881f0
6
private boolean testFilterProperty_Thorough(SpecialFile other) { List<Byte> one = new ArrayList<Byte>(this.BYTES); List<Byte> two = new ArrayList<Byte>(other.BYTES); double matchCount = 0.0d; double totalCount = 0.0d; if (one.size() > two.size()) { double first = two.size(); double second = one.size(); ...
45f667d4-a250-4379-ba07-0b64b719803b
8
protected boolean sting() { if (CMLib.flags().isAliveAwakeMobileUnbound(this,true)&& (CMLib.flags().canHear(this)||CMLib.flags().canSee(this)||CMLib.flags().canSmell(this))) { final MOB target = getVictim(); // ===== if it is less than three so roll for it final int roll = (int)Math.round(Math.random()...
e4c32454-eeda-4565-9eda-d080599323bc
0
@Test public void compareHands_HighCardHandsHaveSameCardsExceptLastCard_HandsWithHigherFifthCardWins() { Hand p1 = Hand.HighCard(Rank.King, Rank.Jack, Rank.Nine, Rank.Six, Rank.Five); Hand p2 = Hand.HighCard(Rank.King, Rank.Jack, Rank.Nine, Rank.Six, Rank.Six); assertTrue(p1.compareTo(p2) < 0); }
12e070ab-f904-474f-a5ab-d10d47d91d8b
8
void attributeValueLiteral(String value) { buf.append('\''); for (int i = 0, len = value.length(); i < len; i++) { char c = value.charAt(i); switch (c) { case '<': buf.append("&lt;"); break; case '&': buf.append("&amp;"); break; case '\'': bu...
67bad0e9-6f66-4c52-97a9-2a18865c9057
8
public void configure() { if (this.mandatory) { value = true; } else { if (Config.getInstance().allno_config()) { value = false; } else if (Config.getInstance().allyes_config()) { if (this.ignore_autoconf) { value = false; } else { value = true; } } else if (Config.getInstance(...
e570e704-41d3-4500-9305-a9e8937d82e4
9
private static void appendTypeAnnotations(TextBuffer buffer, int indent, StructMember mb, int targetType, int index, Set<String> filter) { for (String name : TYPE_ANNOTATION_ATTRIBUTES) { StructTypeAnnotationAttribute attribute = (StructTypeAnnotationAttribute)mb.getAttributes().getWithKey(name); if (at...
fa0e010e-0b25-4b48-a965-c664683a3c7b
6
static final AbstractToolkit method958(boolean bool, int i, d var_d, int i_61_, Canvas canvas, IndexLoader class45) { try { if (bool != true) aClass221_1620 = null; anInt1610++; int i_62_ = 0; int i_63_ = 0; if (canvas != null) { Dimension dimension = canvas.getSize(); i_63_ = d...
8f6ff6da-b175-497b-829f-9d9c22cd4696
8
private static String initialise(Token currentToken, int[][] expectedTokenSequences, String[] tokenImage) { String eol = System.getProperty("line.separator", "\n"); StringBuffer expected = new StringBuffer(); int maxSize = 0; for (int i = 0; i < expe...
75036a38-5dba-4b1b-b765-ebd06eb24977
1
public static synchronized BusinessObjectDAO getInstance() throws DataException { if (instance == null) { instance = new BusinessObjectDAO(); } return instance; }//getInstance
f422bf13-5f2b-40b4-a586-c894e666a519
9
BigInt multiply(BigInt n) { BigInt result = new BigInt(digits_.length + n.digits_.length); result.sign_ = sign_ * n.sign_; int i = 0, j = 0; for (i = 0; i < n.digits_.length; ++i) { if (n.digits_[i] != 0) { int carry = 0; for (j = 0; j < digits_.length || carry > 0; ++j) { int n_digit = result.d...
6a86e677-3d13-4e12-adde-d4b55f04587c
0
@Override public void actionPerformed(ActionEvent e) { exportOutlinerDocument((OutlinerDocument) Outliner.documents.getMostRecentDocumentTouched(), getProtocol()); }
ad31da22-a466-4a4e-8ac8-ccab940c99e4
2
public List<String> getPasswordUser(){ List<String> res = new ArrayList<String>(); NodeList methodNodes = getDocument().getElementsByTagName("user"); if (methodNodes.getLength() == 0){ System.err.println("Couldn't read XML"); return null; }else { for (...
beca4b3d-714e-40e5-b64c-fe2b251043f2
6
public void checkForDuplicates(String outputFolder,boolean contentDuplicate, boolean nameDuplicate) throws SQLException, FileNotFoundException, IOException, ProcessingException { if (!contentDuplicate && !nameDuplicate) { return; } // Set this to true then the method starts. // The GUI can set this to f...
8cc9187d-fef7-411d-963f-b16a7e4e05bf
5
private OperatingSystem checkUserAgent(String agentString) { if (this.isInUserAgentString(agentString)) { if (this.children.size() > 0) { for (OperatingSystem childOperatingSystem : this.children) { OperatingSystem match = childOperatingSystem.checkUserAgent(agentString); if (match != null) { r...
876e9a6f-3188-4bcc-b66d-dab7bba49eff
0
public ConcreteFlyweight(String data) { this.data = data; }
e324d98d-2af3-4871-a12e-8ac73b906ae9
1
public void paint(Graphics g) { updateLocation(); Graphics2D g2d = (Graphics2D) g; Line2D l = new Line2D.Double(x1, y1, x2, y2); g2d.setColor(Color.black); g2d.draw(l); if (Math.abs(x1 - x2) > Math.abs(y1 - y2)) g2d.drawString(cardMin + ", " + cardMax, (...
29b6972f-1097-4961-be34-2b0609162b25
4
public Fraction evaluate(Fraction fraction, String inputString) { // create variables String operator = ""; Fraction current = fraction; String item; // create Scanner Scanner s1 = new Scanner(inputString); s1.useDelimiter(" "); ...
8d39f82f-468a-476a-a9b1-0c9d58cfffec
8
public static double getOctave(Octave octave) { switch ( octave ) { case O0: return 1; case O1: return 2; case O2: return Math.pow(2, 2); case O3: return Math.pow(2, 3); case O4: ...
222763e3-d76c-452d-abda-b057088d8920
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 ...
f886fd7e-c184-426f-87ab-0ed60ebe23cb
8
public int compare(String o1, String o2) { String s1 = (String)o1; String s2 = (String)o2; int thisMarker = 0; int thatMarker = 0; int s1Length = s1.length(); int s2Length = s2.length(); while (thisMarker < s1Length && thatMarker < s2Length) { ...
c083cf24-e353-4dc5-81ab-d12d120ace0b
3
public Pointer put(byte[] key, byte[] value, long ttl) throws IOException { // First try to store in the current active block Pointer pointer = activeBlock.store(key, value, ttl); if (pointer != null) { return pointer; } else { // Current active block overflow ...
e507e265-d39c-4dc9-a303-427aa2c904d0
9
public FailureDetector createFd(String fdName, String className, Map<String, String> properties) throws Exception { if (fdName == null) { throw new IllegalArgumentException( "No failure detector name was defined."); } Class<?> fdClass...
2fd214b8-b67f-47c8-b3b2-bfb707baf48b
8
public List<Node> calc(int ns, int nt) { System.out.println(String.format("A*: Started @%s, goal: %s", start, goal)); List<Node> path = null; int steps = 0; while (!open.isEmpty() && steps++ < ns) { // System.out.println(String.format("open list size: %d", open.size())); Node n = open.remove(); // Sys...
9190400b-5df3-4ffe-a4ff-1649c54f2b55
9
public static String getIPAddress() { if(LCARS.ipAddress == null) { LCARS.ipAddress = "127.0.0.1"; try { InetAddress ipAddress = null; Enumeration<NetworkInterface> netInterfaces = NetworkInterface.getNetworkInterfaces(); while(netInterfaces.hasMoreElements()) { Enumeration<InetAddress> inetAd...
097ffc28-2dcd-46cb-a8a5-3a77f8a936b7
4
public static PDFPattern getPattern(PDFObject patternObj, Map resources) throws IOException { // see if the pattern is already cached PDFPattern pattern = (PDFPattern) patternObj.getCache(); if (pattern != null) { return pattern; } // get the patt...
1326ed6a-1c86-4fc7-bdad-79bcdf88ada0
8
private void updateCurrentState() { if (hitWumpus) { endGame(); this.currentState = "You aim and fire you weapon of choice. Your trusty bow.\n" + "The arrow whistles through the air. Your aim is true.\n" + "The beast is dead.\n" + "You return home a hero."; } else if (hitSelf) { endGame(); thi...
ddbef165-9cb2-480d-8ae5-d8fb4e5c3775
9
private void persisteInformacoes(List<AvaliacaoDocente> listaAvaliacaoDocente, BeanPopulate beanPopulate) { System.out.println("Salvando Avaliação.."); avaliacaoDao.salvar(beanPopulate.getAvaliacao()); System.out.println("Avaliação salva.. id: " + beanPopulate.getAvaliacao().getId()); f...
85c020d6-d5af-48ce-ab75-82d1ce96cec4
1
private void configureAbstractButton(AbstractButton button, String resource) { String title = resources.getString(resource); int i = title.indexOf('&'); int mnemonic = 0; if (i >= 0) { mnemonic = title.charAt(i + 1); title = title.substring(0, i) + title.substring(i + 1); button....
82c80bb6-4e70-4c22-81c4-515309268cdf
1
private static boolean checkIfVampire (int a, int b, int x) { //cast to strings char[] charsAB = (a + "" + b).toCharArray(); char[] charsX = ("" + x).toCharArray(); Arrays.sort(charsAB); Arrays.sort(charsX); if (Arrays.equals(charsAB,charsX)) return true; else r...
ddc74489-dd00-4c4d-8abf-d4d736363967
8
protected void loadParser() throws ClassNotFoundException, NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException { ClassLoader cl = Thread.currentThread().getContextClassLoader(); if ( !startRuleName.equals(LEXER_START_RULE_NAME) ) { String parserName = gramma...
481a119b-3c7b-49a5-be3b-11f80f50cb31
8
public boolean isOppositeOf(Direction direction) { switch (this) { case UP: if (direction == Direction.DOWN) { return true; } break; case DOWN: if (direction == Direction.UP) { return true; } break; case LEFT: if (direction == Direction.RIGHT) { return ...
b5ebb9dd-b02e-45d2-a7db-f90678d7a0de
7
private boolean jj_3R_50() { if (jj_scan_token(LET)) return true; if (jj_3R_17()) return true; if (jj_scan_token(EQUAL)) return true; if (jj_3R_9()) return true; if (jj_scan_token(IN)) return true; if (jj_3R_9()) return true; if (jj_scan_token(END)) return true; return false; }
69e75d86-4f84-4bca-b0f0-7c7e9e492563
3
public static void sort(Comparable[] a) { for (int i = 0; i < a.length; i++) for (int j = 1; j < a.length - i; j++) if (less(a[j], a[j - 1])) exch(a, j - 1, j); }
e2aa2de4-bb5a-4437-bc85-f5efa3e2263c
5
@Override public void onResultsAvailable( BiDiInterproceduralCFG<Unit, SootMethod> cfg, InfoflowResults results) { // Dump the results if (results == null) { print("No results found."); } else { for (SinkInfo sink : results.getResults().keySet()) { print("Found a flow to sink " + sink...
df19747b-244e-40dd-b735-e5d00fb8ae53
2
private void cleanEffects() { for(int c = 0; c<effectList.length;c++) { if(!effectList[c].isActive()) { System.out.println(effectList[c].NAME +" wore off."); effectList[c] = Effect.CLEAR; effectList[c].duration = -1;...
e81a5ae7-88a8-4cb4-bed1-98a465b82bed
6
public boolean isKingInCheck() { Point kingsLocation = null; for (Entry<Point, Piece> p : b.entrySet()) { if (p.getValue() instanceof King && isWhitesTurn == p.getValue().getColor()) { kingsLocation = p.getKey(); } } for (Entry<Point, Piece> p : b.entrySet()) { if ((isWhitesTurn != p.g...
1fc044fd-a475-4882-b56e-9d4ef2ff5136
7
public static MoodleCourse[] getAllCourses() throws MoodleRestException, UnsupportedEncodingException { Vector v=new Vector(); MoodleCourse course=null; StringBuilder data=new StringBuilder(); String functionCall=MoodleCallRestWebService.isLegacy()?MoodleServices.MOODLE_COURSE_GET_COURSE...
e34ae778-478c-4910-b0b5-738584c01b04
1
public static int executeAndCountSqlFile(String path) throws ClassNotFoundException, SQLException, IOException { Class.forName("org.postgresql.Driver"); Connection connection = null; connection = DriverManager.getConnection( Configuration.getJdbcString(), Configuration.user, Conf...
17aa9cde-f9da-43ea-9092-3c373866902f
5
public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); double n1, n2, result = 0; String operator; System.out.print("Please enter first number: "); n1 = sc.nextDouble(); System.out.print...
a67fbaad-b04b-42c2-aa39-d6592c0407f5
2
public List<String> findSolutions(final LetterGen letGen, final List<String> words) { final List<String> solutions = new ArrayList<String>(); for (final String word : words) { if( wordContainsLettersInOrder(letGen, word) ) { solutions.add(word); } } return solutions; }
d68e8e9e-3cbf-4ce2-afef-4724bf32c503
2
public double getDouble(int index) throws JSONException { Object object = this.get(index); try { return object instanceof Number ? ((Number) object).doubleValue() : Double.parseDouble((String) object); } catch (Exception e) { throw new JSONException("J...
df89952b-cf54-43c1-a5cd-37fd9766d3d8
5
public boolean checkDangerFor(Castle castle, Hero dummy) { int strength = 0; if (castle.getGarission() != null) { strength += castle.getGarission().getStrenght(); } if (castle.getHero() != null) { strength += castle.getHero().getStrenght(); } for (Hero h: p2h.objects()) { if (h.getStrenght() > ...
71852667-9b24-493c-b509-e53077c4a4e1
5
private void compileAndRun(ICompilationUnit unit) { Map settings = new HashMap(); settings.put(CompilerOptions.OPTION_LineNumberAttribute,CompilerOptions.GENERATE); settings.put(CompilerOptions.OPTION_SourceFileAttribute,CompilerOptions.GENERATE); CompileRequestorImpl requestor = new CompileRequestorImpl(...
4db3343e-8666-4f12-a69e-c13a615856fd
9
public void generateTask(Message.TaskInitMessage message){ if(message.getType() == Message.TaskInitMessage.TaskType.BUILDER_TASK){ if(message.getId() != null && message.getDataSourceCount() > 0){ String commId = "LS " + message.getId(); CommClient localSchedulerClient...
2128c043-7c0b-49af-9cb2-f8c829b9b253
4
public static int utfSizeOf(String str) { int strlen = str.length(); int utflen = 0; int c = 0; /* use charAt instead of copying String to char array */ for (int i = 0; i < strlen; i++) { c = str.charAt(i); if ((c >= 0x0001) && (c <= 0x007F)) { utflen++; } else if (c > 0x07FF) { utfle...
ccb5f9ed-f9fc-4008-97f4-bb51dccbdcce
6
protected void attackEntity(Entity par1Entity, float par2) { float var3 = this.getBrightness(1.0F); if (var3 > 0.5F && this.rand.nextInt(100) == 0) { this.entityToAttack = null; } else { if (par2 > 2.0F && par2 < 6.0F && this.rand.nextInt(10) ...
eb787d82-b1c2-4f8a-8337-c8427dec9afa
7
public void CambiarRealmlistPor(int Seleccion){ try { String Realmlist = Config.Configuracion(4); FileReader ArchivoConfiguracion = new FileReader("Configuracion.txt"); BufferedReader _ArchivoConfiguracion = new BufferedReader(ArchivoConfiguracion); String LineaInform...
ce15ceda-3c6b-4a13-8acd-56a1037a24fb
3
void out_close(){ try{ if(out!=null && !out_dontclose) out.close(); out=null; } catch(Exception ee){} }
ef7272d7-180a-4c1e-8db1-ef3267982cc3
5
public int[][] readMap() throws IOException { int[][] mapTab = new int[nbLine][nbCol]; String lign; seekFile(1); for(int i1 = 0; i1 < nbLine; i1++) { lign = readString(nbCol); for(int i2 = 0; i2 < nbCol; i2++) { ...
0d4b29de-2dcd-40ab-bbcf-a5c25089ee88
9
public void collsionDetection(){ new Thread(new Runnable() { @Override public void run() { while(true) { for (GameObject gobj : gameObjects) { if (getBounds().intersects(gobj.getBounds())) { switch(go...
95061f37-54b8-4965-8ead-c579c9663694
0
private Object _getItem(JSONObject obj, String name) { return obj.get(name); }
e3649d1a-b879-4c32-8ded-56252ce968a8
6
private Color translateColor(se.liu.ida.danan391.TDDC69.tetris.Color color) { switch (color) { case BLACK: return Color.BLACK; case BLUE: return Color.BLUE; case GREEN: return Color.GREEN; case RED: r...
c8ce191d-a5c1-4a29-a1d0-8f15f53fbee1
3
public static void readCompressed(File f, byte[] buf, int nbytes) throws FileNotFoundException, IOException { if (COMPRESSION_ENABLED) { BufferedInputStream bis = new BufferedInputStream(new FileInputStream(f)); InflaterInputStream iis = new InflaterInputStream(bis); int read...
a5a4de0d-7565-47d0-9d5d-3e5bdd576b67
6
public boolean peutCreerCategorie(Utilisateur utilisateur) { return ( utilisateur != null && ( utilisateur.getRole().getValeur() >= Role.Administrateur.getValeur() || ( utilisateur.getRole().getValeur() >= Role.Moderateur.getValeur() ...
a5f92f7c-d7f2-48ec-973b-f5a71325f9fa
4
void update(){ x+=dx; y+=dy; if(dx > 0){ dx--; }else if(dx < 0){ dx++; } if(dy < 0){ dy++; }else if(dy > 0){ dy--; } }
cefb642e-bd87-4839-8fa5-906de6972de7
2
public void setGuid(Guid newGuid) { if (newGuid == null) { throw new RuntimeException("Guid must not be null."); } if (guid != null) { throw new RuntimeException("Can only set GUID on a constant with an existing NULL guid."); } guid = newGuid; }
84198062-b4f9-4909-905f-630bd45543a7
7
public boolean addTypeWorkFrame(){ boolean ret = false; String name; JTextField text = new JTextField(); JComponent[] components = new JComponent[]{ new JLabel("Введите название типа работы"), text }; do { boolean result = SMS.dialog(th...
dddfca82-f663-479f-bcd7-ef5ac7211a05
6
public void drawSprite2(int i, int j) { int k = 225;//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 = DrawingArea.topY - j; k1 -= ...
8fd35774-b0c5-455f-86c9-19e24f7a432d
0
private void initializeSound (){ new Sound ("music/soundTrack.wav").start(); }
81a30485-d0cb-43d8-965d-53917c3ee410
4
public Competition(){ super("Competition"); try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch(Exception e) { } setSize(400, 250); final JLabel namelabel[] = new JLabel[7]; final JLabel timelabel[] = new JLabel...
85b9233b-003e-4dee-a4c6-bddb2cb4bde2
2
public double getInfoFloat(String key) { if (info == null) parseInfo(); String f = info.get(key); if (f == null) return Double.NaN; return Gpr.parseDoubleSafe(f); }
daac9700-c04d-4d38-98ea-80a042a8d474
3
public int minMaxLookback( int optInTimePeriod ) { if( (int)optInTimePeriod == ( Integer.MIN_VALUE ) ) optInTimePeriod = 30; else if( ((int)optInTimePeriod < 2) || ((int)optInTimePeriod > 100000) ) return -1; return (optInTimePeriod-1); }
3a5d941f-7a5c-485a-985c-a4d41313c9aa
4
@EventHandler(priority = EventPriority.HIGHEST) public void onBowHit(EntityDamageByEntityEvent e) { if (e.getDamager() instanceof Arrow) { Arrow arrow = (Arrow) e.getDamager(); if (arrow.getShooter() instanceof Player) { if(parent.isInNation((Player)arrow.getShooter())) { ...
c0bea725-3e56-4120-b8b8-cc1e91087529
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...
12763d71-9bff-452d-bde2-b5594f4db1ca
8
private VarInfo getVar(final String aVarName, final Visibility aVisibility) throws ParsingException { final VarInfo var = mVariables.get(aVarName); if (var == null) { if (mParentScope == null) { return DUMMY_VAR; } final VarInfo closed = mParentScope.getVar(aVarName, aVisibility); if (closed == DU...
22374f19-4c77-4650-9846-367b2c96e890
1
public int reserve(int x){ int newNum = 0, left =0; while(x!=0){ left = x%10; newNum = newNum*10+left; x = x/10; } return newNum; }
19e091d1-74ba-4f9f-8040-2a4e933480c3
3
private ArrayList<Cellule> watchBois(){ // Methode qui renvoie ce que regarde le villageois (les cellules adjaçantes à la sienne + la sienne) sans les diagonalles) ArrayList<Cellule> autour = curent.env.getenv(curent); for (int i =0 ; i<autour.size() ; i++){ if (autour.get(i) ==null){ autour.remove(i); ...
c049d1f4-5e66-4eaf-82e0-a7c88c8c75a1
3
public boolean isPair() { boolean retBoo = false; for (int i = 0; i < _cards.size()-1; i++) { for (int x = (i+1); x < _cards.size(); x++) { if (_cards.get(i).compareTo(_cards.get(x)) == 0) { retBoo = true; break; } } } return retBoo; }
90dfa4f6-7f77-4be6-9215-7b060cb4a825
2
@Test @Ignore public void test_RoomListGet() { RoomList laRoomList = laClient .getRoomList("2012-01-01-08.00.00.000000"); System.out.println(laRoomList.getRoomList().size()); if (laRoomList.getRoomList().size() > 0) { for (Room laRoom : laRoomList.getRoomList()) { System.out.println(laRoom.toString(...
b8633c7e-0eb8-4320-ae76-95aecd1406c1
3
@Override public float getCusto() { // TODO Auto-generated method stub float cus; switch (marca) { case ATI:if(gab.getDescricao().contains("AMD")) cus = 104;else cus = 130; break; case NVIDIA: cus = 120; break; default: cus = 0; break; } return cus + gab.getCusto(); }
4f16ccfe-b482-41d8-aab3-ccb7a2b77b32
5
private void addEmptyThings(){ SortedSet<String> keys = new TreeSet<String>(data.keySet()); for (String path : keys) { while(true){ path = deleteLastLevel(path); if(path == null || path.equals("")) break; if(data.get(path) == null){ data.put(path, " "); } } } }
bf110eb0-ba4f-4bbe-82a5-7a84c16d3aad
7
public static void pprintOntosaurusObject(Stella_Object self, OutputStream stream) { { Object old$LogicDialect$000 = Logic.$LOGIC_DIALECT$.get(); Object old$PprintAtomicObjectRenderer$000 = OntosaurusUtil.$PPRINT_ATOMIC_OBJECT_RENDERER$.get(); try { Native.setSpecial(Logic.$LOGIC_DIALECT$, Onto...
9fd9f924-9339-4cbc-ac68-208707fc2af3
6
public static StorageSlot LOOKUP_ELEMENT_SLOT(XMLObject renamed_Object, Cons elementExpr) { { XmlElement tag = ((XmlElement)(elementExpr.value)); Cons general_slots = Stella.NIL; { Slot slot = null; Cons ITER_000 = XMLObject.GET_MAPPED_SLOTS(renamed_Object).theConsList; for (;!(ITER_00...