method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
93463a32-dcd6-44cc-9395-21303b8c8754 | 6 | @Override
public void actionPerformed(ActionEvent e)
{
if ("Timer".equals(e.getActionCommand())) {doTimerActions();}
if ("Display Log".equals(e.getActionCommand())) {displayLog();}
if ("Display Help".equals(e.getActionCommand())) {displayHelp();}
if ("Display About".equals(e.getActionCommand())) {di... |
056a5d9a-699b-4182-9ebc-94931c011b49 | 1 | public boolean valueWasChanged(Stat previousStat) {
if (previousStat == null)
return true;
return !previousStat.getValue().equals(getValue());
} |
9e613fca-68cb-4034-a30d-b0852fc53b42 | 1 | public void Fire(int deviceIndex, ARPPacket p) {
try {
sender=JpcapSender.openDevice(devices[deviceIndex]);
sender.sendPacket(p);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} |
344a22bd-99e2-44fb-b950-5645b0e7e788 | 6 | public boolean isConstant() {
if ((Options.options & Options.OPTION_ANON) == 0)
return super.isConstant();
ClassInfo clazz = getClassInfo();
InnerClassInfo outer = getOuterClassInfo(clazz);
ClassAnalyzer clazzAna = methodAnalyzer.getClassAnalyzer(clazz);
if (clazzAna != null && outer != null && outer.oute... |
16d5b2a7-df6d-488e-86a7-35958c9af936 | 8 | public Updater(Plugin plugin, int id, File file, UpdateType type, boolean announce) {
this.plugin = plugin;
this.type = type;
this.announce = announce;
this.file = file;
this.id = id;
this.updateFolder = plugin.getServer().getUpdateFolder();
final File pluginFile... |
608bbfa2-61c9-4220-8a13-5bc006d76695 | 3 | @Override
public AbstractComponent parse(String string) throws BookParseException {
if (string == null) {
throw new BookParseException("String is null");
}
try {
CharacterComponent component = (CharacterComponent) factory
.newComponent(EComponentType.CHARACTER);
if (string.length() != 0) {
comp... |
deaecef4-0f82-48d9-ac44-e66b571306a8 | 9 | public void setFormula(String formula) {
// 組成式設定
this.formula = formula;
// 組成式からソート用組成式設定
StringBuffer sortFormula = new StringBuffer();
if (!formula.equals("") && formula.length() != 0) {
int current = 0; // 現文字インデックス
int next = 0; // 次文字インデックス
char[] c = formula.toCharA... |
93fede42-3f8c-4a86-b612-62e911b2f39a | 1 | public Class<?> getColumnClass(int columnIndex) {
return String.class;
} |
7dfd98a5-b189-4c82-a12a-b14b7128a068 | 0 | public List<EventComment> getEventCommentList() {
return eventCommentList;
} |
bc7ee0d0-d5ef-4d79-a877-1185538ebe17 | 5 | public void run() throws IOException {
List<Stack> stacks = opsworksUtil.getStacksByName(stackName);
if (stacks.isEmpty()) {
throw new IllegalArgumentException("No stack found with name '" + stackName + "'");
}
for (Stack stack : stacks) {
UpdateStackRequest requ... |
62a8f867-cc87-460f-a896-e886e615b2cf | 2 | public static Image getImage()
{
if(!crawlOff)
for(int x = 0; x < list.length; x++)
{
drawTurtle(graphics2, list[x].xPos, list[x].yPos,
list[x].heading, list[x].turtleColor);
}
return buffer2;
//g.drawImage(buf... |
692af3e7-8da7-4953-8f04-cb008bd6bdaf | 2 | public DockTab(Dockable dockable) {
super(new PrecisionLayout().setMargins(2, 4, 2, 4).setMiddleVerticalAlignment());
mDockable = dockable;
setOpaque(false);
setBorder(new EmptyBorder(2, 1, 0, 1));
addContainerListener(this);
mTitle = new JLabel(getFullTitle(), dockable.getTitleIcon(), SwingConstants.LEFT);... |
c9e4f7b1-8a11-4462-99f6-90225e425fec | 0 | public BufferedReader getAccountFile(){
InputStream file = this.getClass().getResourceAsStream("/basicslick/server/Players.txt");
BufferedReader freader = new BufferedReader(new InputStreamReader(file));
return freader;
} |
872eb3e8-20f5-463b-9f78-13f93b9968c8 | 1 | public void valueReport () {
//Send the user this entity's statistical values, detecting if the enemy's level was scaled.
System.out.println("Stat values for " + name + ": ");
if (upped) {
System.out.println("Level (scaled from: " + scaleLevel + "): " + level + ".");
} else {
System.out.println("Level:... |
68347b15-2cab-49c4-bead-57ab87d9896d | 9 | public int iterate() throws Exception {
// make sure we have a page to render
if (page == null) {
return Watchable.COMPLETED;
}
// check if this renderer is based on a weak reference to a graphics
// object. If it is, and the graphics is no longer valid, then just q... |
359c282c-c332-4e71-82fe-f06eac86caf7 | 0 | public static double getPrice(final String ticker) throws IOException{
final URL url = new URL("http://ichart.finance.yahoo.com/table.csv?s=" + ticker);
final BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
return 0;
} |
72706706-85bb-45b7-9775-247ff4339281 | 7 | private void cbperfilItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_cbperfilItemStateChanged
try {
if (!flag) {
if (newPerfilSelect == null || newPerfilSelect.isEmpty()) {
newPerfilSelect = cbperfil.getSelectedItem().toString();
... |
0b21186b-e9f5-46ed-9b73-86ab90d1ee60 | 7 | public void addWord(Word word) {
//ǂƂԂ疳
if(word.conflictwall(rows, columns)){
return;
}
// lςݒPƋȂ疳
for ( Word w : obtainedList ) {
if ( w.conflictWith(word) ) {
return;
}
}
// l\PƋȂ㏑
// ɂ܂BCΏ㏑ł邩ȂǁEE?????
for ( Word w : wordList ) {
if ( w.conflictWith(word) ) {
//wordList.remove(... |
71a57d8e-2b02-4922-a4ba-81a86247969b | 6 | private void getDataFromLink(Sim_event ev)
{
Object obj = ev.get_data();
if (obj instanceof Packet)
{
// decrypt the packet into original format
Packet pkt = (Packet) ev.get_data();
if (pkt instanceof InfoPacket)
{
processPingR... |
d2029ca7-71c7-429d-b8a5-1f73797b19c9 | 2 | public static Integer composition(Matrix A){
Integer I=0;
boolean b = A.getN() == A.getM();
if(!b) return null;
int n = A.getN();
int [] pi = new int[n+1];
for(int i = 1; i<=n; i++)
pi[i]=i;
Rojok rj = new Rojok(n);
func(1,n,pi,rj, I, A);... |
00bcdb2c-5bb2-4f3b-a243-0b8ebc2d154b | 0 | public BusStop GetCurrentbusStop()
{
//get the current bus stop
return currentBusStop;
} |
5dc7e23f-2172-41d0-ab3b-6708b4b04470 | 2 | public boolean intersects(Entity move) {
float distX = Math.abs(x - move.x);
float distY = Math.abs(y - move.y);
float combX = (width + move.width) / 2;
float combY = (height + move.height) / 2;
if (combY > distY && combX > distX) {
return true;
} else {
return false;
}
} |
c281b0bc-b498-473e-817e-bfd23e22aacb | 7 | private void acao153(Token token) throws SemanticError{
operador = operadorAdd;
if(operador.equals("+") || operador.equals("-")){
if(tipoExpressaoSimples != Tipo.INTEIRO && tipoExpressaoSimples != Tipo.REAL){
throw new SemanticError("Operador e Operando incompatíveis", token.getPosition());
}
}else if(o... |
a40c71f8-22c9-4719-a065-224f2c0e945a | 8 | public static int countNeighbours(long world, int col, int row){
int total = 0;
total = getCell(world, col-1, row-1) ? total + 1 : total;
total = getCell(world, col , row-1) ? total + 1 : total;
total = getCell(world, col+1, row-1) ? total + 1 : total;
total = getCell(world, col-1, row ) ? total + 1 : total... |
06226262-f34f-4c5a-8ecd-392250b1a6dd | 1 | public String toString() {
JSONObject jo = new JSONObject();
try
{
jo.put("id", getId());
jo.put("username", username);
jo.put("passwordHashed", passwordHashed);
return jo.toString();
} catch (JSONException e)
{
e.printStackTrace();
return super.toString();
}
} |
47aaaf4b-624f-420f-9717-062604432032 | 7 | public synchronized DataInputStream getChunkDataInputStream(final int x,
final int z) {
if(outOfBounds(x, z)) {
debugln("READ", x, z, "out of bounds");
return null;
}
try {
final int offset = getOffset(x, z);
if(offset == 0) // debugln("READ", x, z, "miss");
return null;... |
eb10e9d1-19be-429f-8fdf-f5fd8fa2d2a9 | 3 | public static boolean childsHasTag(Element element, String tag)
{
NodeList nl = element.getChildNodes();
boolean has = false;
if (nl != null)
{
int length = nl.getLength();
for (int i = 0; (i < length) && !has; i++)
{
has = (nl.item(i)).getNodeName().equals(tag);
}
}
return has;
} |
fe752c5e-b171-4daa-ab25-960b80f7c6c5 | 7 | private static Zona identificaZona(Ruolo r){
if(r==Ruolo.GK) return Zona.PORTA;
if(r==Ruolo.DR || r==Ruolo.DC || r==Ruolo.DL) return Zona.DIFESA;
if(r==Ruolo.MR || r==Ruolo.MC || r==Ruolo.ML) return Zona.CENTROCAMPO;
return Zona.ATTACCO;
} |
227de26a-bcb4-4a3f-8234-fcb8644d116f | 9 | public void start(){
// Just put sample-data into the interest-point
float [] descriptors = new float[64];
for(int b = 0; b < 64; b++){
descriptors[b] = 0.0000002f;
}
int numberOfInterestPoints = 4000;
final List<InterestPoint> interestPoints = new ArrayList... |
87e79044-3dd6-4671-b871-e3bf6a085700 | 4 | private long getCPtrAddRefLoomServer(LoomServer element) {
// Whenever adding a reference to the list, I remove it first (if already there.)
// That way we never store more than one reference per actual contained object.
//
for(int intIndex = 0; intIndex < elementList.size(); intIndex++)
{
Object theObject = ele... |
2ef87a1c-9d50-471e-adb4-d038b6572a50 | 4 | public static String numericToString(String text)
{
if(text.equalsIgnoreCase(""))
{
return "";
}
String[] split = text.split(",");
byte[] byteArray = new byte[split.length];
int num = 0;
for (String s : split)
{
if(!s.equalsIgnoreCase(""))
{
int intvalue = Integer.valueOf(s);
b... |
3d16deaa-891a-4f5a-ba60-c37b4758dcb0 | 4 | private Quartet<Double, Double, Double, Double> errors(List<OpenCellIdCell> cells, int n, double d) {
double errorDistance = 0.0;
double errorRSS = 0.0;
double timeDistance = 0.0;
double timeRSS = 0.0;
int cellCounter = 0;
for(OpenCellIdCell cell : cells) {
int currN = n;
if(cell.getMeasu... |
250e0341-4a85-4b2a-b7d5-117743157436 | 5 | public List<ABObject> findPigs()
{
int xMin = 0;
if (_sling != null)
xMin = _sling.x + 100;
List<ABObject> pigs = new LinkedList<ABObject>();
for (ConnectedComponent c : _components)
{
if (c.getType() == ImageSegmenter.PIG)
{
... |
ec721f12-7cc1-49b8-8379-7a61607a979c | 5 | @Override
public void execute(CommandSender sender, String worldName, List<String> args) {
this.sender = sender;
if (worldName == null) {
error("No world given.");
reply("Usage: /gworld allowanimals <worldname> <true|false>");
} else if (!hasWorld(worldName)) {
reply("World not found: " + worldName);... |
e9b61455-5d0f-46b3-82a2-7632b9f0c990 | 3 | DesEncrypter(SecretKey key) {
try {
// Create cipher and initialize it for encryption.
ecipher = Cipher.getInstance("DES");
dcipher = Cipher.getInstance("DES");
ecipher.init(Cipher.ENCRYPT_MODE, key);
dcipher.init(Cipher.DECRYPT_MODE, key)... |
a402dbd0-cf61-41a6-b955-dfe90bb7156a | 2 | public <T> void add(T object){
if(object instanceof Town){
towns.add((Town) object);
}
if(object instanceof Airport){
aports.add((Airport) object);
}
} |
bc373e23-1c6a-4946-8664-4091ad81fbb6 | 0 | public TakeWhileIterator(Iterable<T> source, Predicate<T> predicate)
{
this._source = source.iterator();
this._predicate = predicate;
} |
3e5dbaea-cfcd-4d34-b786-4384cd25d1ee | 4 | public static void removeGFX(int castId, int enemyX, int enemyY) {
for (int i = 0; i <= 150; i++) {
if(GFXspot[i] == castId && targetX[i] == enemyX && targetY[i] == enemyY) {
GFXspot[i] = 0;
castID[i] = 0;
moveID[i] = 0;
endID[i] = 0;
gfxX[i] = 0;
gfxY[i] = 0;
offX[i] = 0;
offY[i] = 0;
gfxA[i] = ... |
fb9bd3ba-9fd0-4626-858d-f747bb28d93b | 1 | private String requestPassword(String Prompt) {
char[] p = console.readPassword("%s []: ", Prompt);
String r = new String(p);
// Security overwriting
for (int i = 0; i < p.length; i++)
p[i] = 0;
return r;
} |
71737ee0-467d-4d98-b17c-b7ec6e41151f | 9 | public void saveXML ( ) {
JFileChooser chooser = new JFileChooser();
chooser.setFileSelectionMode( JFileChooser.FILES_ONLY );
chooser.setAcceptAllFileFilterUsed( false );
chooser.addChoosableFileFilter( new XMLFileFilter() );
int option = chooser.showSaveDialog( MenuApp.getFrame() );
if ( option == JFileCho... |
59ede082-61db-45b4-bce6-308d54776ef0 | 2 | public Reward getReward(String type, Integer id) {
String path = "types." + type + ".rewards." + id + ".";
String message = plugin.configData.config.getString(path + "message");
Double money = plugin.configData.config.getDouble(path + "money");
List<String> action = null;
if(plugin.configData.config.... |
65dc3259-1269-4086-b754-166e8f40d55b | 9 | public void editTags(JTable source) throws CannotReadException, IOException, TagException, ReadOnlyFileException, InvalidAudioFrameException, CannotWriteException {
String[] lib = listLib();
// String[] playlistLib = PlaylistPanel.listLib();
if (source.getSelectedRowCount() < 2) {
int modelRow = source.conv... |
710b70d2-f93e-4928-94e6-377df5748db0 | 6 | public void openMap() {
try {
File file = new File("saves/SaveList.set");
Scanner scan = new Scanner(file);
int n = Integer.parseInt(scan.nextLine());
if (n == 0) {
scan.close();
return;
}
Object[] options = new Object[n];
for (int i = 0; i < n; i++) {
options[i] = scan.nextLine();
... |
e9068a51-c798-4561-a086-47ca645d7f2e | 9 | public void actionPerformed(ActionEvent e) {
if (e.getSource() == update) {
Graph g = graphPanel.getGraph();
g.plotSettings.setMinX(Double.parseDouble(minX.getText()));
g.plotSettings.setMaxX(Double.parseDouble(maxX.getText()));
g.plotSettings.setMinY(Double.pars... |
bbd4ba52-78c7-4776-bf3b-e5b872b8a130 | 8 | private void radixSort(int from, int to, int k) {
int[] histogram = histograms[k];
if (histogram == null) {
histogram = histograms[k] = new int[HISTOGRAM_SIZE];
} else {
Arrays.fill(histogram, 0);
}
buildHistogram(from, to, k, histogram);
// short-circuit: if all keys have the same... |
ac3bb639-7ce7-47a0-83ac-0d1ed525f287 | 7 | public static byte[][] createAndValidateUndergroundMap(int w, int h, int depth) {
int attempt = 0;
do {
byte[][] result = createUndergroundMap(w, h, depth);
int[] count = new int[256];
for (int i = 0; i < w * h; i++) {
count[result[0][i] & 0xff]++;
}
if (count[Tile.rock.id & 0xff] < 100) contin... |
7f251a8a-a95c-4938-9770-2e22d11a09a3 | 4 | private boolean isInsideBoard(int col, int row) {
if (col >= 0 && row >= 0 && col < model.numOfColumns() && row < model.numOfRows()) {
return true;
}
return false;
} |
ddddf19a-6652-478d-820e-ef326d4bb702 | 6 | @Override
public UserSkillSet employeeSkillSet(String employeeId) {
UserSkillSet userSkillSet = new UserSkillSet();
String sql = SELECT_EMPLOYEE_SKILLS_RATINGS + employeeId
+ "' order by givenBy, skillId";
Connection connection = new DbConnection().getConnection();
// Map<String, Map<String, Integer>> comp... |
45d4a22a-ea40-4508-a5aa-bd246bfc670a | 4 | public static void callback(IRenderable renderable, IModel model) {
if (model != null) {
if (!PersistentModelCache.table.containsKey(renderable)) {
int orientation = 0;
if (renderable instanceof IActor) {
orientation = ((IActor) renderable).getOrientation();
}
MutableCachedModel m = new Mutabl... |
2aba3074-6320-4030-a933-a248322a7b67 | 3 | protected void download(String downloadPath,String fileName){
try {
ftp.changeWorkingDirectory(downloadPath);
FTPFile[] files=ftp.listFiles();
for(FTPFile file:files){
if(file.getName().equals(fileName)){
System.out.println("Downloading "+fileName);
File localfile=new File(fileName);
Ou... |
9a4afc90-d764-43f4-bfa2-82a9c91fe8ff | 4 | public static boolean isValidPhone(String phoneNumber) {
if (phoneNumber.length() != 10) {
return false;
}
for (int i = 0; i < phoneNumber.length(); ++i) {
char c = phoneNumber.charAt(i);
if (c < '0' || c > '9') {
return false;
}
... |
189bd045-c8c0-4298-b5e3-211e2d322901 | 8 | private boolean _reverseGhosts(EnumMap<GHOST,MOVE> moves,boolean force)
{
boolean reversed=false;
boolean globalReverse=false;
if(Math.random()<GHOST_REVERSAL)
globalReverse=true;
for(Entry<GHOST,MOVE> entry : moves.entrySet())
{
Ghost ghost=ghosts.get(entry.getKey());
if(currentLevelTim... |
fd2e78c7-6657-42c4-b95a-a97eba94b63a | 0 | @Test
public void testKill() throws IOException {
System.out.println("kill");
AntBrain b = new AntBrain("cleverbrain1.brain");
Ant instance = new Ant(b,true,1);
boolean expResult = true;
boolean result = instance.isAlive();
assertEquals(expResult, result);
... |
7e655b60-ecc6-48c7-b909-da9b148571fa | 5 | public void extract_naive() throws IOException {
build_dicos();
String line = input_r0.readl();
LinkedList<Tuple<String, String>> sentence = new LinkedList<Tuple<String, String>>(); // Sentence tokens
String true_sentence = ""; // Sentence in String format
Hashtable<String, LinkedList<Triple<String, String... |
1eaa751f-381d-481f-a6c1-482a107c96cc | 1 | public static void setPlayer(int i, Player p) {
if (players.size() > i) {
players.set(i, p);
}
} |
f622bb88-cf37-44ad-b1ba-0791678940f6 | 0 | protected void initMenuBar() {
this.setJMenuBar(gui.menu.MenuBarCreator.getMenuBar(this));
} |
f4fc4cf1-27bc-4e15-90b5-e9a8a7142d60 | 3 | public static Utilisateur getUtilisateurById(int id_utilisateur) {
Utilisateur utilisateur = null;
Statement stat;
try {
stat = ConnexionDB.getConnection().createStatement();
stat.executeUpdate("use nemovelo");
ResultSet res = stat.executeQuery("select * from... |
302dbca9-5065-4d22-a9ba-a1a97925220f | 5 | private void initNoiseFunctions() {
Random rand = new Random();
// Fill empty
for (int i = 0; i < permutation.length; i++) {
permutation[i] = -1;
}
// Generate random numbers
for (int i = 0; i < permutation.length; i++) {
while(tr... |
850b7df5-e931-4556-819f-0b31b7abb4e7 | 3 | public static void encodeToFile( byte[] dataToEncode, String filename )
throws java.io.IOException {
if( dataToEncode == null ){
throw new NullPointerException( "Data to encode was null." );
} // end iff
Base64.OutputStream bos = null;
try {
... |
daaa7be0-97f6-410e-ae17-ea3f211081b5 | 9 | @Override
public boolean onCommand(CommandSender sender, Command cmd, String cmdLabel, String[] args) {
if (!(sender instanceof Player)) {
sender.sendMessage(ChatColor.RED + "This command can't run in console!");
return true;
}
Player player = (Player) sender;
if (!player.hasPermission("VanishCommand.hid... |
edf36965-ae32-4234-9972-e045854440bc | 0 | public void setName(String name) {
this.name = name;
} |
aa2c0bb4-42b3-4833-a55e-adb7ec4a6027 | 7 | public void setRace(RaceTypes race) {
switch (race) {
case GOBLIN:
this.race = "Goblin";
break;
case ORC:
this.race = "Orc";
break;
case HUMAN:
this.race = "Human";
break;
case ELF:
this.race = "Elf";
break;
case DWARF:
this.race = "Dwarf";
break;
case GNOME:
this.race = "... |
66c53f49-fa19-4075-b620-768bcd77ac80 | 3 | public void setPrices(List<Price> prices)
{
if (prices.size() == 0)
prices.add(new Price(Currency.USD, "0.00"));
// see if the price contains duplicate currencies
Currency previous = null;
for(Price price : prices)
{
if (price.getCurrency() == previous)
throw... |
645b05b4-1a0c-47fc-8185-369202852834 | 0 | public int GetY()
{
return this.y;
} |
9b174393-e9f0-41aa-80f2-0fb12a87f05d | 0 | public String getStreetName() {
return streetName.get();
} |
11def4ae-6f22-4ad4-9ee4-2c73c2ac7ef0 | 0 | public String getAuthor() {
return author;
} |
1e079394-5eba-4584-b4b5-c5d37bacf35e | 9 | private final void method3424(int i, ByteBuffer class348_sub49) {
try {
if (i == 925) {
anInt7266++;
if (class348_sub49 != null
&& (((ByteBuffer) class348_sub49).payload
!= null)) {
int i_4_ = class348_sub49.getUByte();
if ((i_4_ ^ 0xffffffff) <= -24) {
if (i_4_ > 24)
method3423... |
3c1913b7-fb0e-4786-8262-8490baa2bcb3 | 7 | public static ArrayList<String> selectNoRecursion(char arr[], int num, boolean print) {
ArrayList<String> arrayList = new ArrayList<String>();
int resultCount=0;
int index = 0;
int arrLen = arr.length;
if (arrLen < num) {
return arrayList;
}
int[] tmp = new int[num];
tmp[index] = 0;
while (true) {
... |
efae18a7-67af-4ee7-b347-a56d37d9bc1c | 5 | public List<String> getNewHeaderLines() {
ArrayList<String> newLines = new ArrayList<String>();
newLines.add("##SnpEffVersion=\"" + version + "\"");
newLines.add("##SnpEffCmd=\"" + commandLineStr + "\"");
// Fields changed in different format versions
if (formatVersion == FormatVersion.FORMAT_SNPEFF_2) newL... |
baeffcfe-03cd-4572-b8ab-a1da3cd6a935 | 3 | public void executeProgram() {
runStack = new RunTimeStack();
pc = 0;
returnAddrs = new Stack<Integer>();
running = true;
dumping = false;
while (running) {
ByteCode code = program.getCode(pc);
code.execute(this);
if (dumping && code.ge... |
c4fac98c-126e-41e3-b15e-78860d404ac5 | 6 | public static void visitDirectoriesRecursively(FileVisitor visitor, File directory, String pattern, boolean recursively) {
if (!directory.isDirectory()) directory = directory.getParentFile();
if (!directory.getName().matches(pattern)) return;
visitor.visitDirectory(directory);
final ArrayList<File> childDirect... |
e26fb161-89f1-4565-bb4c-4a5ecfbd781b | 5 | public void initializeNetwork()
{
PrintWriter out = null;
Random rng = new Random();
network = new Graph();
try
{
out = new PrintWriter("rover_netwrok.dot");
}
catch(Exception e)
{
System.err.println(e.getMessage());
}
network.setDirected(true);
network.setWeighted(true);
out.print... |
a89d00aa-eb1f-4be6-877e-ce11cb04a361 | 5 | public static void main(String[] args) {
DBHandler dbh = null;//DBHandler class to help database operations
Connection connection = null;//Pure Connection class
Fonksiyon ins = new Fonksiyon();
try {
new GUI().show();
String sql = "SELECT * FROM Employee";
... |
f11212b0-aec1-4ffa-9d49-9c3316b8f04c | 4 | @Override
public String toString() {
boolean isActive = player.isActive();
StringBuilder b = new StringBuilder();
b.append("<html>");
if (isPlaying) b.append("<b>");
if (!isActive) b.append("<strike>");
b.append(player.toString());
if (!isActive) b.append("</strike>");
if (isPlaying) b.append(... |
51d1ae1e-6ab7-4fc9-88b3-70d1b6e3058f | 4 | public Finger getFinger(DoublyLinkedList<?> dll) {
for(int i=0; i<numberOfUsedFingers; i++) {
Finger f = list.elementAt(i);
if(f != null && f.list == dll) {
return f;
}
}
return null;
} |
6427528e-f1f7-458a-bc85-843f99ec82a4 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (!(obj instanceof Pair))
return false;
Pair other = (Pair) obj;
if (fst == null) {
if (other.fst != null)
return false;
} else if (!fst.equals(other.fst))
return false;
if (snd... |
73257a3b-5775-4e7e-b78d-6175c7cdb67d | 4 | public int compareTo(Reservation reservation) {
int result = 0;
double objStartTime = reservation.getStartTime();
if(objStartTime < startTime) {
result = 1;
} else if(objStartTime > startTime) {
result = -1;
} else {
int objDuration = reservation.getDurationTime();
if(objDuration < duration) {
... |
8ba0a12c-c2a8-4c58-aa9b-2adf2e4cf0e6 | 5 | private static int numCharToInt(char c) {
switch(c) {
case 'T':
return 10;
case 'J':
return 11;
case 'Q':
return 12;
case 'K':
return 13;
case 'A':
return 1;
default:
return c - Integer.valueOf('0'); // eg. '4' to 4
}
} |
5d5152ee-912f-45cc-b48a-0e597634cf6a | 8 | @Test
public void resizeWithoutProblem() {
for (int i = 0; i < 1000000; i++) {
mh.insert(Math.random() * 999999, new Double(Math.random() * 1000));
}
assertEquals(1000000, mh.heap_size);
for (int i = 0; i < 1000000; i++) {
mh.delete_min();
}
a... |
5bfd5dab-5f64-46e9-87a2-d2f579b7853c | 8 | public void skipWhitespace() throws IOException {
// skip spaces, carriage returns, and newlines
while(src.peek() == ' ' ||
src.peek() == '\r' ||
src.peek() == '\n' ||
src.peek() == '\t')
{
if (src.peek() == '\n')
line++;
src.next();
}
// skip comments
if (src.peek() == ';') {
... |
47849fd4-5d44-4113-a9cb-1e959cf964fb | 9 | @Override
public boolean onCommand(CommandSender sender, Command command,
String label, String[] args)
{
if (!(sender instanceof Player))
{
sender.sendMessage("Commands are designed to be run by players only.");
return true;
}
Player player = (... |
448c2513-30cd-4ac5-ad24-a9a246d28db6 | 3 | public void start() {
flooders = new ArrayList<>();
System.out.println("Startiing up with "+threads+" threads. . .");
running = true;
System.out.println("Starting attack. . .");
for (int i=0; i<threads; i++) {
try {
flooders.add(new Flooder(target));
... |
fb54f11b-8ad2-4835-9b23-a592f7671dbf | 9 | public static void main(String [] args){
Hangman game = new Hangman();
File dictionary = new File(args[0]);//dictionary
int number = Integer.parseInt(args[1]);//wordlength
game.startGame(dictionary, number);
int numGuesses = Integer.parseInt(args[2]);
int numGuessesToStart = Integer.parseInt(args[2]);
List<Cha... |
f5df2512-e01a-460b-a210-4df73b45d84e | 7 | public static void main(String[] args) throws IOException {
SSWTBuildManager manager = new SSWTBuildManager();
String buildNumber = manager.getBuildNumberFromWeb();
LOG.info("Last Successful build: " + buildNumber);
manager.setBuildNumber(buildNumber);
manager.quit();
if... |
3ad235e0-d9bb-47d0-8488-640c65c1e3b3 | 1 | public void insert(Key v) {
if (N == pq.length - 1)
resize(pq.length * 2);
pq[++N] = v;
swim(N);
} |
bff14a11-bdc1-4afc-9bae-fbcc8c364b2a | 9 | public void run() {
while (true) {
byte[] receiveData = new byte[50];
DatagramPacket receivePacket = new DatagramPacket(receiveData, receiveData.length);
try {
socketReception.receive(receivePacket);
byte[] packetData_2 = receivePacket.getData();
for (int l = 0; l < Utils.IntegerSize... |
cf031df0-1190-4998-97e5-665257c16969 | 2 | public static String generateFileCheckSum(File file) throws NoSuchAlgorithmException, IOException {
MessageDigest md = MessageDigest.getInstance("SHA1");
FileInputStream fis = new FileInputStream(file);
byte[] dataBytes = new byte[1024];
int nread = 0;
while ((nread ... |
0d5ed222-64d1-45cb-8b4b-3204c2441e43 | 3 | public static Velo getVeloById(int id_velo) {
Velo velo = null;
Statement stat;
try {
stat = ConnexionDB.getConnection().createStatement();
stat.executeUpdate("use nemovelo");
ResultSet res = stat.executeQuery("select * from velo where id_velo="+ id_velo);
... |
ae41f2e9-21ce-4643-b9c0-a1c8690607a2 | 5 | public static <A, O extends A> A[] addObjectToArray(A[] array, O obj) {
Class<?> compType = Object.class;
if (array != null) {
compType = array.getClass().getComponentType();
}
else if (obj != null) {
compType = obj.getClass();
}
int newArrLength = (array != null ? ... |
67eee2fa-4e62-4341-b00f-c8715014e2ff | 0 | public static void main(String[] args) {
System.out.println(-5 % 3);
} |
b71005d4-5a8a-4155-9044-e28445e57eb0 | 8 | public boolean searchMatrix(int[][] matrix, int target) {
int rows = matrix.length;
if (rows == 0) {
return false;
}
int cols = matrix[0].length;
if (cols == 0) {
return false;
}
int lo = 0;
int hi = rows - 1;
while (lo < hi... |
0fde2194-0f2c-4029-95bd-63c11e8bb87a | 5 | static final void method893() {
Class348_Sub40_Sub22.setMapSize(((Class348_Sub51) BitmapTable.aClass348_Sub51_3959).aClass239_Sub6_7226.getMapSizeId(-32350));
anInt1595++;
int chunkX = ((Class286_Sub4.anInt6246 >> 239567308) + (za_Sub2.baseRegionX >> 515880227));
int chunkY = ((Class90.baseRegionY >> 591146499) + (... |
a5775567-70a5-463f-bc6d-c036bfa0258e | 9 | private void meleeAttack()
{
if(attacking == false)
{
attacking = true;
switch(this.getDirection())
{
case 1:
this.setxPos(this.getxPos() + (this.idleImages(1).getWidth(null) / 2) - (this.attackImage(1).getWidth(null) / 2));
this.setyPos(this.getyPos() - (... |
9fac5ae9-781a-40ad-995f-b5d04cbddf30 | 7 | public static <T extends Number> ArrayList<ArrayList<T>> mul(ArrayList<ArrayList<T>> a, ArrayList<ArrayList<T>> b, Class<T> type) {
ArrayList<ArrayList<T>> result = new ArrayList<ArrayList<T>>();
try {
if (a == null || b == null) {
throw new NullPointerException();
}
int rows = a.size();
int col... |
840fa908-b7c1-46bf-afe1-b619e4d17959 | 6 | @Override
protected Object getObjectFromElement(Element _e) {
Annonce a = null;
if(GestionnaireAnnonces.isTypeValide(_e.getAttributeValue("type")))
{
try {
a = new Annonce(Integer.valueOf(_e.getChildText("Id")), _e.getChildText("Auteur"), _e.getChildText("Contenu"... |
8679b000-8322-45b1-95b0-c95f8b8a319c | 9 | private FieldDoc getFieldDoc(Configuration config, Tag tag, String name) {
if (name == null || name.length() == 0) {
//Base case: no label.
if (tag.holder() instanceof FieldDoc) {
return (FieldDoc) tag.holder();
} else {
// If the value tag doe... |
b8293de5-fadb-4d57-a8ed-b54cfe4c6f18 | 5 | public void otaEnPassantMahdollisuusPois() {
for (int i = 0; i <= 7; i++) {
if (getNappula(3, i) != null && getNappula(3, i).getTyyppi() == Nappula.Tyyppi.MSOTILAS) {
getNappula(3, i).kasvataSiirtojenMaaraa();
}
if (getNappula(4, i) != null && getNappula(4, i)... |
e76d1290-c98d-493a-bc07-72209a6df406 | 2 | public void close() {
if (sequencer != null && sequencer.isOpen()) {
sequencer.close();
}
} |
b3bc5142-4a0c-4b77-94a9-e670b66f0cf3 | 7 | private void waveGenerator() {
ticksSinceLastWave++;
if (waveInProgress) {
if (map.getTile(TerrainMap.spawn).getEnemy() == null
|| Point2D.distance(map.getTile(TerrainMap.spawn).getEnemy().getTileX(), map.getTile(TerrainMap.spawn).getEnemy().getTileY(), TerrainMap.spawn.x... |
1c93b46f-ad8b-47f1-a0b4-8848617a6915 | 7 | private void updateTile(int x, int y, int z, int side) {
if (x >= 0 && y >= 0 && z >= 0 && x < width && y < height && z < length) {
Block var5;
if ((var5 = Block.blocks[blocks[(y * length + z) * width + x]]) != null) {
var5.onNeighborChange(this, x, y, z, side);
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.