method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
016cd5b5-b51f-43ce-bd64-f3ac2afc16ab
3
public void close() { if (State.CLOSED == getState()) return; setState(State.CLOSED); RotateTransition rotate = new RotateTransition(); rotate.setNode(cross); rotate.setToAngle(0); rotate.setDuration(Duration.millis(200)); rotate.setInterpolator(Interpolator.EASE...
44b24e68-78ff-47e9-b53a-1d70cb48f741
8
public Set<Light> getLights(int[][] board) { lights = new HashSet<Light>(); objective = new HashMap<Integer,Tuple<Integer,Integer>>(); lightArr = new Light[numLights]; sectors = getSectors(); for( int i=0; i<numLights; i++) { int x = 0; int y = 0; double theta = i*(360/numLights) + (360/numLights)/2; log...
1d76ce18-3b52-46c3-bfad-f722c6f9b922
6
public void move() { if (!inTarget) { double a = Math.round(Math.cos(angle) * speed); curPosX += (int)a; double b = Math.round(Math.sin(angle) * speed); curPosY -= (int)b; if(curPosX <= 0 || curPosX >= rightBorder || curPosY <= 0 || curPosY >= downBorder) { needsDelete = true; } } else...
622b9640-b60d-40aa-9e2e-fd7827d2d606
0
@Override public String toString() { return "First State"; }
76a66b08-b25c-4c85-aeba-1a2900d3375a
4
public static int[] connections(int from) { int[] count = new int[nNodes]; Queue<Point> q = new LinkedList<Point>(); BitSet vis = new BitSet(nNodes + 1); Point e = new Point(from, -1); int next = 0; q.add(e); vis.set(from, true); while (!q.isEmpty()) { e = q.poll(); if (e.y != -1) count[e.y]++...
8228d761-b853-4b70-8c67-08ea3a18efe2
7
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof Border)) return false; Border other = (Border) obj; if (neighbour == null) { if (other.neighbour != null) return false; } else if (!neighbour.equals(other.neighbou...
04edef5b-8b34-45ae-affa-aefb09313b78
1
public void testSetMilliOfSecond_int2() { MutableDateTime test = new MutableDateTime(2002, 6, 9, 5, 6, 7, 8); try { test.setMillisOfSecond(1000); fail(); } catch (IllegalArgumentException ex) {} assertEquals("2002-06-09T05:06:07.008+01:00", test.toString()); }
c972cdc7-7166-42a2-a2cb-15d74ad9a7a1
8
@Override public SingleObjectiveSolution run() { int outer = schedule.getOuterLoopCounter(); int inner = schedule.getInnerLoopCounter(); double temp = schedule.getNextTemperature(); T omega = startWith; omega.value = function.valueAt(decoder.decode(omega)); omega.fitness = minimize ? -omega.value : omega.v...
d4f7d539-23b7-4eb2-b3e9-36ea896b75e8
2
private static final void traverse( final File file, final String path, final Collection<ClassPathHandler> handlers, final ClassLoader classLoader, final ErrorHandler errorHandler ) { if ( file.isDirectory() ) { ...
9082d95b-e061-44be-ac65-c5bf317deeb3
2
public void mostrarProcesos(){ //mbLog.setBounds(1, 81, 485,347); //mbLog.setVisible(true); NodosListaProceso aux = this.PrimerNodo; int i = 0; while (aux.siguiente!=null && i<cant) { //aux.proceso.setVisible(true); i++; aux=aux.siguiente; } //aux.proceso.setVisible...
a3ed65e1-9ee6-4e3f-a2dd-3690fa09053d
4
@Override public int getMetricInternal() { int add = curGb.step(Move.A,curGb.pokemon.owPlayerInputCheckAAddress); // after IsSpriteOrSignInFrontOfPlayer call if(add == 0) { System.out.println("OverworldInteract: IsSpriteOrSignInFrontOfPlayer call not found"); return 0; } int id = curGb.readMemory(...
28eb5e08-7ea6-4a76-9851-53915c941bc3
6
private void initFileMenu(JMenuBar menuBar) { JMenu menu = new JMenu("File"); menuBar.add(menu); JMenuItem menuItem = new JMenuItem("Load RDC data..."); menuItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // Bring up the Load File dialog browse...
b52a0f76-3589-460a-b96f-1fcf142d8e70
3
public TrackingWnd(int direction, int delta, int a1, int a2) { super(new Coord(100,100), Coord.z, UI.instance.root, "Direction"); this.a1 = a1; this.a2 = a2; justclose = true; new Label(Coord.z, this, "Direction: "+direction+"o, delta: "+delta+"o"); pack(); Gob pl; if((ui.mapview.playergob >= 0) && ((pl = ui.se...
726ef414-bd48-4146-9fb8-d5b63f85cd44
7
public double propositionWeight(Proposition proposition) { { WhynotPartialMatch self = this; if (proposition == null) { return (1.0); } else if (proposition.kind == Logic.KWD_ISA) { return (0.25); } else if ((proposition.kind == Logic.KWD_NOT) && (((Propositi...
e4da0d49-779c-4278-a312-01675788f5db
5
public static void solveNearestNeighbor() { //Parse file Parser p = new Parser(); p.parse(); long startTime = System.nanoTime(); Graph g = new Graph(); //All cities g.cities = p.out; //Copy of cities LinkedList<Double[]> linkCities = new LinkedList<Double[]>(); g.bestTour = null; ...
824ea22b-5557-4e94-99af-744c98d9aca1
0
public UsuarioFacade() { super(Usuario.class); }
973cd731-729e-4802-95bd-3bfb6a065790
1
public void Remove(Tick t) { synchronized(ticks) { if (ticks.contains(t)) ticks.remove(t); } }
8e7d08d1-5d51-4f03-85ab-c5f52a7178d9
0
public int hashCode() { return (String.valueOf(String.valueOf(Arrays.hashCode(currentCells)) + String.valueOf(intelligentX) + String.valueOf(intelligentY))) .hashCode(); }
6116182d-b040-4fe8-a289-3acc1eec38c1
5
public PolyLinje generateRandomPolylinje() { // Antalet horn på linjen int antalPunkter = 2; // Skapar en Punkt vektor som håller Punkterna Punkt[] punktVektor = new Punkt[antalPunkter]; for(int i = 0; i < antalPunkter; i++) { // X koordinat för Punkten int x = new Random().nextInt(10) + 1; // ...
d8b81198-06e3-47f2-a586-e40bdc44cdec
2
public synchronized boolean seatPlayer(Player player, int index) throws IndexOutOfBoundsException { if (index > players.length) throw new IndexOutOfBoundsException( "The max number of players is four."); if (this.players[index] == null) this.players[index] = player; else return false; return tr...
c359d6db-a45f-4137-80fa-0edd20dbe290
1
public static void loadProperties() { try { PropertiesLoader.getInstance(); } catch (IOException e) { logger.error(e.getMessage(),e); System.err.println(e.getMessage()); } }
480b178e-5faf-4b3c-99b4-f45e852888b2
5
public boolean accept(File file) { if (file.isDirectory()) { return false; } String name = file.getName(); // find the last int index = name.lastIndexOf("."); if (index == -1) { return false; } else if (index == name.length() - 1) { ...
b39cd38a-3c64-4322-b518-4afd7f2d9082
3
public void run(){ ReadingMessages serverReder; try { while(true) { SOCKET = serverSocket.accept(); System.out.println("New connection accepted..."); serverReder = new ReadingMessages(SOCKET, LOCAL_IP); serverReder.start(); ...
83115578-0e37-4e47-8a44-82b4910b6cb8
9
private OperationSignature(String opName, MBeanParameterInfo...infos) { this.opName = opName; List<Class<?>> sig = new ArrayList<Class<?>>(infos==null ? 0 : infos.length); List<String> strSig = new ArrayList<String>(infos==null ? 0 : infos.length); if(infos!=null) { for(MBeanParameterInfo pinfo: infos...
731a91fd-41d8-4736-a0a4-38077bf040d4
7
public void insert(Collidable c) { if (nodes.get(0) != null) { int index = getIndex(c); if (index != -1) { nodes.get(index).insert(c); return; } } stuff.add(c); if (stuff.size() > MAX_OBJECTS && level < MAX_LEVELS) { if (nodes.get(0) == null) { split(); } int i = 0; while (i < s...
2f8fc16f-59dd-4524-b59c-1bfa812f67fd
8
@Override public boolean setHelm(Wearable helm) throws NoSuchItemException, WrongItemTypeException { if (helm != null) { if (helm instanceof Helm) { if (helm.getLevelRequirement() > level || helm.getStrengthRequirement() > stats[0] || helm.getDexterityRequirement() > stats[1] || helm.getMagicRequirement...
a86b306c-77f5-4b3a-b785-e4e8a9565a80
2
public void test_06() { String seqStr[] = { "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" }; // Two almost equal sequences (first one is longer) SuffixIndexerNmer<DnaSequence> seqIndex = new SuffixIndexerNmer<DnaSequence>(new DnaSubsequenceComparator<DnaSequence>(true, 0), NMER_SIZE); fo...
64d3a1c2-fbdf-4f15-b1ec-443afdd62340
4
public static void main(String[] args) { SpiralIterator sp = new SpiralIterator(); int nums = 0, primes = 0; while (true) { nums++; int n = sp.next(); if (isPrime(n)) { primes++; } ...
fdc688a0-3abc-439c-b28d-3698e5c1fba2
8
public void readNeuron (LineNumberReader inputFile, boolean readInterConnections) { String inputLine,paramString,toNetName; StringTokenizer tokenizedLine; int testID=-1; double Weight = 0.0; int toNeuronID = 0; int axonsToRead=0; Double tempDouble; //read the neuron ID try { i...
c0215950-9cd5-425c-9a5c-809419c27892
6
@Override protected void paintSafely(Graphics g) { super.paintSafely(g); JTextComponent comp = getComponent(); if(fontOriginal==null){ fontOriginal=comp.getFont(); hintFont = new Font(fontOriginal.getName(), fontOriginal.getStyle() | Font.ITALIC, fontOriginal.getSize(...
d97013b3-2ed7-4266-acce-d8959830c7c5
4
public StructuredBlock prevCase(StructuredBlock block) { for (int i = caseBlocks.length - 1; i >= 0; i--) { if (caseBlocks[i].subBlock == block) { for (i--; i >= 0; i--) { if (caseBlocks[i].subBlock != null) return caseBlocks[i].subBlock; } } } return null; }
5480f942-1e41-4aa3-af2b-66619bb2a911
8
public double energy() { double d = 0.0; if (hasCharge_i && hasCharge_j) d += cou_ij; if (hasDipole_i && hasDipole_j) d += dipoleDipoleEnergy(); if (hasCharge_i && hasDipole_j) d += pjqi * rijuj; if (hasDipole_i && hasCharge_j) d += piqj * rijui; return d * rCD; }
c6351d93-a378-4996-a8e1-a3c58a56d94b
5
@Override public void run() { if (args.length == 2) { try { if (args[1].equalsIgnoreCase("all")) { int j = 0; ArrayList<String> cs = api.getCoupons(); for (String i : cs) { api.removeCouponFromDatabase(i); j++; } sender.sendMessage(ChatColor.GREEN+"A total of "+ChatColor.G...
87d62e1b-e22f-46de-aceb-ae4be1c6f166
1
public ArrayList<User> getUsers() { ArrayList<User> userList = new ArrayList<User>(); for(int i = 0; i < serviceList.size(); i++) { userList.add(serviceList.get(i).getUser()); } return userList; }
877eb613-5136-43d8-bbd4-9cdbe539976e
6
@Override public void connect() throws NotConnectedException, IOException, AuthenticationNotSupportedException, FtpIOException, FtpWorkflowException { setConnectionStatusLock(FTPConnection.CSL_INDIRECT_CALL); socketProvider = new SocketProvider(); tr...
48093db3-0701-43c0-9af7-d99c0a50ed42
0
@Override public TKey getKey() { return this._key; }
42c4ed73-4f1c-4b9e-a606-46f3099785d0
8
* @param aspect der Aspekt * @param usage die Verwendung der Attributgruppenverwendung * @param isExplicitDefined gibt an, ob die Verwendung explizit vorgegeben sein muss * * @throws ConfigurationChangeException Falls der konfigurierende Datensatz nicht am Objekt gespeichert werden konnte...
1df715a3-94c2-4df6-b213-4833d5047805
3
@Override public void init(GameContainer gc) { if(_spriteSheet == null) { try { _spriteSheet = new SpriteSheet("res/sprites/followers.png", 32, 32, new Color(160, 176, 128)); } catch (SlickException e) { // TODO Auto-generated catch block e.printStackTrace(); } } _animation = new Animation[4...
45bc58e8-4abc-416e-97ef-244d5f8edd19
6
public void dumpSource(TabbedPrintWriter writer) throws java.io.IOException { if ((GlobalOptions.debuggingFlags & GlobalOptions.DEBUG_LOCALS) != 0) { if (declare != null) writer.println("declaring: " + declare); if (done != null) writer.println("done: " + done); writer.println("using: " + used); } ...
bdc7637b-5f0b-4d16-a7d4-2e2045a76429
6
private List<String> scanLocal(File file) { List<String> messages = new ArrayList<String>(); InputStream stream = null; BufferedReader reader = null; String line; try { stream = new FileInputStream(file); reader = new BufferedReader( new InputStreamReader(stream)); while ((line = reader.read...
21e762b5-a480-461d-8905-f5a12c7f26cc
1
public void connectDb() { startSQL(); try { Class.forName("com.mysql.jdbc.Driver").newInstance(); con = DriverManager.getConnection(url, user, password); st = con.createStatement(); } catch (Exception e) { e.printStackTrace(); ...
ae26e9e3-ecd2-4c48-a60c-a7d2a7ea9979
5
@EventHandler public void OnPlayerDeath(PlayerDeathEvent event) { if (plugin.GameStarted == true) { Player p = event.getEntity(); if (plugin.sbHandler.goodTeam.getPlayers().size() >= 1) { if (plugin.sbHandler.goodTeam.hasPlayer(p)) { for(String str : plugin.PlayersInGame){ Bukkit.getPl...
200edf33-3569-4afd-bd80-aa946bb4c671
4
public static void sqlQuery(String csvName,String characterSet,String valSeparator,String strSql) { Logger logger = Logger.getLogger(ProcessData.class); try { logger.info("Main Start"); String currentPath = System.getProperty("user.dir"); logger.info("GET Porperties File:\"" + currentPath + Fil...
f5b80d64-eca0-40cf-a8d5-e9532d1b35ce
0
public int size() { return this.list.size(); }
799e1147-4112-4379-8ec1-459b0293a904
2
public void guardar() { try { if (!fichero.contains(".chp")) { fichero = fichero + ".chp"; } FileOutputStream fs = new FileOutputStream(fichero); ObjectOutputStream os = new ObjectOutputStream(fs); os.writeObject(principal); ...
d58fb351-1d42-4e33-9e88-a3b17fe4dee8
6
private void ReadData() throws Exception { //As an exception could occur in the loading process, an exception handler is used. String key="", value=""; try { Scanner sc; InputStream stream = getClass().getClassLoader().getResourceAsStream(this._exceptionFileName); if (stream...
dde0ba4d-051e-436b-8c25-92f561823e7d
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 Usuario)) { return false; } Usuario other = (Usuario) object; if ((this.idUsuario == null && other.idUsuario !=...
19cfb3f2-79e1-45ba-a5a2-d65aea4c011e
2
public int getInt(String key) throws JSONException { Object object = this.get(key); try { return object instanceof Number ? ((Number) object).intValue() : Integer.parseInt((String) object); } catch (Exception e) { throw new JSONException("JSONObject[" ...
ec17da21-781c-4537-89bd-4a53050ac0f2
2
private void checkState() { if (!start) { throw new IllegalStateException( "Cannot visit member before visit has been called."); } if (end) { throw new IllegalStateException( "Cannot visit member after visitEnd has been called."); } }
69ff6faf-610f-4848-8679-fc09b0805876
3
public EnumRemoteScriptErrorType isBuildFileValid() throws Throwable { List<String> lines = Files.readAllLines(Paths.get(new File("build.hoppix").toURI()), Charsets.ISO_8859_1); String line = lines.get(0); if (line.startsWith("error")) { int indexOfSeparator = line.indexOf("|"); String errorMsg = line.su...
69c9f1de-f8b4-45fc-801d-8c7edddd9fc1
3
@Override public void deserialize(Buffer buf) { super.deserialize(buf); int limit = buf.readUShort(); spellCooldowns = new GameFightSpellCooldown[limit]; for (int i = 0; i < limit; i++) { spellCooldowns[i] = new GameFightSpellCooldown(); spellCooldowns[i].dese...
0946a13b-20a6-405c-95b0-94418fbb6273
3
private void _getLock() throws WriterException { try { this.file = new RandomAccessFile(ConfigurationManager.read.getConfigFile(), "rw"); this.channel = this.file.getChannel(); try { this.lock = this.channel.tryLock(); } catch (OverlappingFileLockException e) { throw new WriterException(lockExcep...
8cce013f-f38d-48c0-ab57-e70e7a4af9b5
7
public double getMeanofDuration(RequestType type) { long sum = 0; int cnt = 0; switch (type) { case ONDEMAND: for(OndemandRequest on: getOndemand()) { long duration=on.getDuration(); sum+=duration; cnt++; } break; case SPOT: for(SpotRequest on: getSpot()) { long duration=...
0e39fd8d-a547-463e-aeef-22624755206b
5
final public Value getValue() throws ParseException { Attribute.Type type; String val; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case INT_LITERAL: jj_consume_token(INT_LITERAL); type = Attribute.Type.INT; val = token.image; break; case DECIMAL_LITERAL: jj_...
be46beec-fc4a-4bef-bce2-4f7c66a6f5ca
0
@Override public void startSetup(Attributes atts) { Outliner.menuBar = this; Outliner.outliner.setJMenuBar(this); }
2b16d26e-bdbc-47ab-92b3-0ae879749461
9
static public int[] InitialSolutionFromFile(int noOfPeaks, int noOfAA){ int[] initialSol= new int[noOfAA+1]; boolean[] aaCheck= new boolean[noOfAA+1]; try { BufferedReader br_solution; br_solution = new BufferedReader(new FileReader("initialsolution.txt")); for(int i=1;i<=noOfPeaks;i++){ Stri...
0f958c32-3d5b-4636-9c31-202de022ae23
1
@SuppressWarnings("deprecation") public synchronized void flush(String tableName) throws IOException { HTableInterface hTable = tablePool.getTable(tableName); try { hTable.flushCommits(); } finally { if (hTable != null) { tablePool.putTable(hTable); } } }
63ca0f35-73ca-43a8-8e30-d5ea22eca409
2
@Override public void itemStateChanged(ItemEvent event) { Object object = event.getSource(); if (object == portComboBox) { portComboBox_itemStateChanged(event); } else if (object == baudComboBox) { baudComboBox_itemStateChanged(even...
0291c174-cfa6-4bcd-be3b-f47215472190
7
public ArrayList<String> letterCombinations(String digits) { String[] digitalMap = {"", "", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"}; ArrayList<String> result = new ArrayList<String>(); if (digits.length() == 0) { result.add(""); return result; }...
ef73f3ee-4328-4d40-8ed5-cca1c837bcd0
3
public static final long hash(byte[] b, long m) { long h = 1125899906842597L; // prime for (int i = 0; i < b.length; i++) h = 31*h + b[i]; return (h & 0x7fffffffffffffffL) % (m > 0 && m < p ? m : p); }
ca4618bd-6e77-462d-864a-314808b06f40
3
public void run() { try { this.MPrio.acquire(); this.MReading.acquire(); if(this.counter == 0) this.MWriting.acquire(); this.counter++; this.MReading.release(); System.out.println("Lecture"); Thread.sleep(100); this.MReading.acquire(); this.counter--; ...
cda53385-f230-4218-90d2-124101a16095
8
public static void readFile(String filePath) { int lineFlag = 0; int caseCounter = 0; int vectorLength = 0; try { FileInputStream fstream = new FileInputStream(filePath); DataInputStream in = new DataInputStream(fstream); BufferedReader br = new BufferedReader(new InputStreamReader(in)); String strL...
fc2d035c-df66-4bbe-b463-aa92eb771191
3
public static void putf(String format, Object... items) { if (format == null) throw new IllegalArgumentException("Null format string in TextIO.putf() method."); try { out.printf(format,items); } catch (IllegalFormatException e) { throw new IllegalArgumentException("Ill...
370e38fa-463a-4e5b-9923-6474c7cd666f
9
void performTest(int mask, boolean watchSubtree, ArrayList<Command> commands, ArrayList<Event> expectedEvents) throws IOException { System.out.println("JUnit : -------------- performTest -------------- :"); String rootDir = "$$$_TEST_$$$/"; File testRoot = new File(rootDir).getAbsoluteFile(); // make sure th...
3ef7f9a7-6612-406a-b6ba-af51f433edba
7
public static String encrypt(String input, String key){ int inputLength = input.length(); char[] out = new char[inputLength]; int code = key.hashCode(); Character[] mapping = randomizeArray(getMasterMapping(), code); for(int i = 0; i < inputLength; i++){ char x = input.charAt(i); if(x < 32 && x != 9 && ...
1b17ad29-2ec8-483c-9f18-d8cf753290f4
3
public void resetTableau (){ for (int i=0; i<this.getRowCount()+hauteurZoneFantome;i++){ for (int j=0;j<this.getColumnCount(); j++){ images[i][j]=frame; if (i>=hauteurZoneFantome){ this.setValueAt(images[i][j], i-hauteurZoneFantome, j); ...
282e101e-3adb-4da2-8417-b576518fbdc9
9
private void temporalProcessing(){ System.out.println("Rate of non null results: " + pitches.length/nonNullPitches); System.out.println("Results under examination: " + postModeNotes.length); System.out.println("Pitch per Second: " + (float) (AudioData.SAMPLE_RATE/(pitches.length/pitchSampleGroup.length))); S...
93d154b6-5370-4fa2-bdb2-c6183799282b
0
@Override public String toString() { return getDescription(); }
2d89c8c4-3268-4a9f-8486-787aaddc4627
7
private void wordSelectHandler(Page currentPage, Point mouseLocation) { if (currentPage != null && currentPage.isInitiated()) { // get page text PageText pageText = currentPage.getViewText(); if (pageText != null) { // clear the currently sel...
8e1f80fd-3b51-47f1-9f66-227f5e7618ea
1
public void addAccount(BankAccount account) throws IllegalArgumentException { if (! canHaveAsAccount(account)) throw new IllegalArgumentException(); accounts.add(account); }
b570e3d6-3a41-4bf2-b9d2-f6cf589ea0f4
3
public void randomDeck(ArrayList<Card> cards) { Random r = new Random(); r.setSeed(System.currentTimeMillis()); do { int numLands = r.nextInt(15) + 15; for (int i = 0; i < (60 - numLands)/4; i++){ Card c = cards.remove(r.nextInt(cards.size() - 1)); for(int j = 0; j < 4; j++) this.cardList.ad...
e2f63fb8-f9e7-4a46-9f85-6a1062ad1544
2
public void getInitialLocation(SensorInterface si) { if (si == null) { return; } if (!hasSentInitialLocation) { hasSentInitialLocation = true; si.startingXCoord = floorPlan.getInitialX(); si.startingYCoord = floorPlan.getInitialY(); } else { ...
c3517744-ddd7-459f-9dd5-9e9c9f986d07
8
public static long to_long(String aString) { if (aString.equalsIgnoreCase("")) { // Default noDataValue return Long.MIN_VALUE; } try { return new BigInteger(aString).longValue(); } catch (NumberFormatException aNumberFormatException) { Stri...
bb04fb43-46ca-4568-ae4a-a4202e3c2a3e
6
public TestInfo runInTheCloud(String userKey, String testId) { TestInfo testInfo = null; String error = null; if (userKey == null || userKey.trim().isEmpty()) { error = "Test cannot be started in the cloud, userKey is empty"; BmLog.debug(error); testInfo = new...
6fae3fc5-2779-422e-8a87-388741332d08
1
public List<String> getArgs(){ ArrayList<String> args = new ArrayList<String>(); for (int i = 1; i < command.size(); i++) args.add(command.get(i)); return args; }
adb7683e-1a5c-4268-affe-e846063d4cbd
8
private void cftrec4_th(final int n, final float[] a, final int offa, final int nw, final float[] w) { int idiv4, m, nthread; int idx = 0; nthread = 2; idiv4 = 0; m = n >> 1; if (n > ConcurrencyUtils.getThreadsBeginN_1D_FFT_4Threads()) { nthread = 4; ...
e7f1b0c3-891a-42c6-8f61-a4a128b57895
9
private void processCyclisedChain(Element chainGroup, Element cycloEl) throws ComponentGenerationException { String smiles=chainGroup.getAttributeValue(VALUE_ATR); int chainlen =0; for (int i = smiles.length() -1 ; i >=0; i--) { if (Character.isUpperCase(smiles.charAt(i)) && smiles.charAt(i) !='H'){ chainl...
2f8b933d-1dec-410a-9f65-779bf51b3715
8
public void put(String atrName, Object val) { if (atrName.equals(LABEL)) { g.setLabel((String) val); } else if (atrName.equals(ZOOM)) { g.setZoom((ArrayX<String>) val); } else if (atrName.equals(FONT)) { g.setFont((Font) val); } else if (atrName.equals...
5fafe750-ba43-4d66-9d03-c2e3fd7cffb5
3
public void run() { if (Fenetre._list_birds.size() != 0) Fenetre._fenster.changeBird(Fenetre._list_birds.get(0)); while (Fenetre._state == StateFen.Level) { this.printObj(); try { Thread.sleep(_REFRESH_AFF); } catch (InterruptedException e) { e.printStackTrace(); } } }
db93a24a-ca08-460f-a893-ad493bf35572
4
public void mouseClicked(MouseEvent me) { int clickCount = me.getClickCount(); int button = me.getButton(); if (popup != null) { popup.setVisible(false); if (clickCount == 2) { if (journals != null) AccountDetails.getAccountDetails(selectedAccount, journal...
9da56008-f82a-455c-8bd6-4ebce3c8e5ed
5
private static double[] getSupportPoints(int lineNumber, double[] lowPrices) { double[] sPoints = new double[lineNumber]; for(int i =0;i<lineNumber-1;i++){ double price = 999999999; for(int j=-5;j<=0;j++){ if((i+j>=0) && (i+j<lineNumber-1) && lowPrices[i+j]<pri...
142f968a-2b8f-42b0-9e0d-bee99f32b6ea
8
@Test public void removeAt() { RandomAccessDoubleLinkedList test = new RandomAccessDoubleLinkedList(); try { test.removeAt(2); // empty list fail("ValueException"); } catch (InvalidAccessException e) { } catch (Exception e) { fail("Unexpected Exception"); } try { test.insertAt(2, 3); test...
1c6690ec-4069-4a45-bcb4-a7d20d400a8e
7
public void RSAEncrypt(int length, int modulus_size) throws RdesktopException { byte[] inr = new byte[length]; // int outlength = 0; BigInteger mod = null; BigInteger exp = null; BigInteger x = null; this.reverse(this.exponent); this.reverse(this.modulus); System.arraycopy(this.client_random, 0, inr...
d6998da9-dfee-408f-9366-8cf1cfeb4d05
4
@Override protected final void finalize() throws Throwable { synchronized (Path.finalizerMonitor) { final Set<PathReference> ss = new HashSet<>( this.successors.values()); for (final WeakReference<Path> s : ss) { if (!s.isEnqueued()) { s.get().finalize(); } } if (this.parent != null) { ...
156e19e4-a940-4c99-90ed-15a2d5063df3
3
private Sprite getClosestTarget(LinkedList<Sprite>targets){ Sprite closestTarget = null; if(targets == null){ closestTarget = null; }else{ closestTarget = targets.get(0); for(int i = 0; i < targets.size(); i++){ if(distanceBetween(this, closestTarget) > distanceBetween(this, targets.get(i))){ cl...
9b886a77-38ca-43bf-8813-9f464d85aeeb
2
public List<WorldName> sendRequest(String lang) { List<WorldName> result = new ArrayList<WorldName>(); RestTemplate rest = new RestTemplate(); String json = rest.getForObject("https://api.guildwars2.com/v1/world_names.json?lang="+lang, String.class); ObjectMapper mapper = new ObjectMapper(); try { JsonNode...
7c8b718e-fe3f-4223-b1ec-bcd1c0eda15d
7
public boolean canBuild(Player player, Block block) { // Default FALSE return unless conditions are true boolean canwg = false; boolean canps = false; if (pstones != null) { if (PreciousStones.API().canBreak(player, block.getLocation())) canps = true; ...
8a55e7f1-6085-4d2d-8f5b-dac098901e86
8
@Override public String toString() { if (symbol >= '1' && symbol <= '9') { return "Character " + symbol; } else if (symbol == 'N') { return "North Wind"; } else if (symbol == 'E') { return "East Wind"; } else if (symbol == 'W') { return "West Wind"; } else if (symbol == 'S') { ...
7a8ea4b1-0e28-4dbb-84ff-0b30f43d17e2
0
public boolean isObfuscated() { return isObfuscated; }
0483478b-a229-4425-bd61-c4263075e333
7
public static ArrayList getSerialResumo(String arg_serial) throws SQLException, ClassNotFoundException { SimpleDateFormat sdf3 = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss"); ArrayList<ja_jdbc_plpgsql.bean.bRegistro> aobj = new ArrayList<ja_jdbc_plpgsql.bean.bRegistro>(); ArrayList<ja_jdbc_plpgs...
c153dd0a-8bc7-4f96-bff4-3b0ced5b5cd8
1
public static void registerSignal(Signal signal) throws SignalNameInUseException { if (linker.containsKey(signal.getSignalName())) { throw new SignalNameInUseException("Error: This signal name is currently in use"); } SignalStructure struct = new SignalStructure(signal.getParams(), new ArrayList<Slot>(), si...
f26ad49e-4767-46e1-bbf1-239255b9955c
0
public int getRemotePort() { return remotePort; }
a601b76f-c218-4091-8b2f-9a6b2364dddb
1
public static void main(String[] args) { try { AppGameContainer app = new AppGameContainer(new Game("Forgotten Space")); app.setDisplayMode(640, 480, false); app.setTargetFrameRate(60); app.start(); } catch (SlickException e) { Logger.getLogger(Game.class.getName()).log(Level.SEVERE, null, e); } ...
638dd5fc-53fe-4e0d-ac5a-97c918677508
7
@Override public void undo() { // Find the node we will change focus too, note may end up null Node youngestNode = ((PrimitiveUndoableInsert) primitives.get(primitives.size() - 1)).getNode(); Node newSelectedNode = youngestNode.prev(); // Shorthand JoeTree tree = youngestNode.getTree(); OutlineLayoutMan...
29e5e44b-45de-4eb5-9b59-860a7f70dfc2
5
public String printAST() { StringBuilder ret = new StringBuilder(); int len = rhs.size(); for(int i=0; i < len; i++){ if(rhs.get(0) instanceof Expr && i > 0) ret.append(" "); if(rhs.get(i) instanceof Terminal){ ret.append(((Terminal)rhs.get(i)).printAST()); }else if(rhs.get(i) instanceof Call){ ...
20cea4d4-0e2d-4def-ab33-c36f28c4b388
7
public void resolveCollision(int ix, int jx, Player player, boolean isHorizontal) { // First resolve in y // move upward until not touching Rectangle tileRec = new Rectangle(ix * tileSizeX, jx * tileSizeY, tileSizeX, tileSizeY); // Rectangle playerRec = p1.getBounds(); double ...
f3bbeaee-b7e9-49f4-ba89-fd4b82b71f9b
9
public PreferencesDialog(Frame owner) { super(owner, "Recipe Preferences", true); opts = Options.getInstance(); sb = owner; Enumeration<NetworkInterface> interfaces; try { interfaces = NetworkInterface.getNetworkInterfaces(); while (interfaces.hasMoreElements()){ NetworkInterface current = ...
f699c196-8b15-44c0-ae0a-1674010a02f0
4
private void addFriend(String friend) { if (currentProfile != null) { if (!friend.equals(currentProfile.getName())) { if (database.containsProfile(friend)) { if (currentProfile.addFriend(friend)) { database.getProfile(friend).addFriend(currentProfile.getName()); canvas.displa...
e76f2c59-5ff2-4a53-a548-a9b89356ec68
0
@Override public void finishPopulate() { setBbox(new double[]{getCoordinates().getLongitude(), getCoordinates().getLongitude(), getCoordinates().getLatitude(), getCoordinates().getLatitude()}); }
7444fa59-75d0-4fa7-bf03-30934a35f633
9
private byte[] buildMultipartBody(Map<String, String> params, byte[] photoData, String boundary) throws JinxException { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); try { String filename = params.get("filename"); if (JinxUtils.isNullOrEmpty(filename)) { ...