method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
18cdfba4-71ba-4ce3-98aa-08f13cfae62c | 2 | private static HashMap<String, Integer> addFiles(File fileFile) throws FileNotFoundException {
HashMap<String, Integer> m = new HashMap<String, Integer>();
Scanner sc = new Scanner(fileFile);
sc.useDelimiter("\\s*\n");
while(sc.hasNext()){
String s = sc.next();
if (s.matches("\\s*")) { break; };
File f... |
c8aa417c-2432-497f-aa5c-f54ce0785172 | 2 | public int[][] divideNConquer(final int[][] X, final int[][] Y) {
try {
int half = X.length / 2;
int full = X.length;
int[][] result = new int[full][full];
if (full == 2) {
result[0][0] = X[0][0] * Y[0][0] + X[0][1] * Y[1][0];
resu... |
53f3162c-bfea-4371-a612-d3686f1db7df | 2 | private void authorized(boolean isAuthorized, String destination) {
when(request.getPathInfo()).thenReturn(destination);
frontend.updateUserSession(new UserSession(TEST_USER, SSID, isAuthorized ? AccountServiceMessages.AUTHORIZED : "", isAuthorized ? 12L : null));
} |
870ef6bc-7d5b-43ad-99a8-1b86561965a0 | 0 | public String getToolTip() {
return "State Expander";
} |
e8225843-41ef-48a4-8232-010b607b5d55 | 3 | public BitFeld sub(BitFeld b) {
/*
* TODO: hier ist die bitweise Operation sub zu implementieren. Die
* Verwendung von toInt ist hier nicht gestattet, da die BitFeldklasse
* auch fuer >32Bits funktionieren soll.
*/
BitFeld result = new BitFeld (b.getSize()+1);
boolean borrow = false;
for (int i = 0... |
fbccd9b0-c106-4535-ab99-20d5c6816849 | 1 | public SpriteSheet(String path, int size){
SIZE = size;
pixels = new int[SIZE * SIZE];
Image i = new Image(path);
for(int x = 0; x < pixels.length; x++){
pixels[x] = i.pixels[x];
}
} |
ed61b282-bba0-422b-a842-b7f6ee3d4699 | 3 | public IronDome(String id) {
this.id = id;
try {
War.theLogger.addHandler((new Handler(this.getClass().getName(),
id, this)));
} catch (SecurityException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
// TODO Auto-generated catch block
e.pr... |
cd6faba5-1954-4230-b698-4b7d1bd055aa | 9 | public static boolean createDefaultConfiguration(File destination, String defaultName, boolean replace) {
Validate.notNull(destination, "destination can not be null.");
Validate.notNull(defaultName, "defaultName can not be null.");
PlayerNamesPlugin plugin = PlayerNamesPlugin.getInstance();
... |
ed760b14-d8b8-4259-a40d-107b06e847e5 | 2 | public static void saveSchema()
{
File fOS = null;
fOS = new File(Launcher.SCHEMA_LOC);
try
{
Factory.saveSchema(fOS, MyUnits.class);
}
catch (JAXBException e)
{
System.out.println(e.getMessage());
e.printStackTrace();
}
catch (IOException e)
{
System.out.println(e.getMessage())... |
3e0d503f-58bb-47f0-99e4-4dab4af8b0b7 | 1 | public boolean matches( Class<?> clazz )
{
return !this.delegate.matches( clazz );
} |
a753854d-f797-430c-9352-8a7e49660af9 | 5 | public void delete(Key key) {
if (!contains(key)) return;
// find position i of key
int i = hash(key);
while (!key.equals(keys[i])) {
i = (i + 1) % M;
}
// delete key and associated value
keys[i] = null;
vals[i] = null;
// rehash all... |
32c56519-a67b-4c34-9ae1-f53f40073985 | 9 | @Override
protected void toASCIIGnuStep(StringBuilder ascii, int level) {
indent(ascii, level);
ascii.append(ASCIIPropertyListParser.ARRAY_BEGIN_TOKEN);
int indexOfLastNewLine = ascii.lastIndexOf(NEWLINE);
for (int i = 0; i < array.length; i++) {
Class<?> objClass = array... |
d4cb3854-2781-46ec-adab-8ccb6587781e | 9 | @Override
public boolean runTest(){
return ((missingChar("kitten", 1).equals("ktten")) &&
(missingChar("kitten", 0).equals("itten")) &&
(missingChar("kitten", 4).equals("kittn")) &&
(missingChar("Hi", 0).equals("i")) &&
(missingChar("Hi", 1).equals("H")) &&
(missingChar("code", 0).equals("ode")) ... |
89108070-e143-48a1-bbde-504b63abbc6b | 7 | private static JsonObject getObjectAfterBrace( TokensInFileParser tifp)
throws Exception
{
JsonObject json = new JsonObject();
boolean keepParsing = true;
while(keepParsing)
{
String key = tifp.nextToken().replaceAll("\"", "");
if( key.equals("}"))
{
keepParsing = false;
}
else ... |
3e1f09ac-f521-4afd-b818-9ffec05a54e7 | 0 | private void clinicPage(){
clinicPane = new JPanel();
clinicPane.setBackground(SystemColor.activeCaption);
clinicPane.setLayout(null);
JLabel lblClinic = new JLabel("Clinic Setup");
lblClinic.setHorizontalAlignment(SwingConstants.CENTER);
lblClinic.setFont(new Font("Arial", Font.BOLD, 30));
lblClinic.s... |
7ef48091-44b8-4e4e-9b6f-a4f56795d5ed | 0 | public boolean checkMonsterAvailable(){
return isMonsterAvailable;
} |
785de3e8-caef-4ff4-a717-7e1b05b0d547 | 2 | public MenuKeyPreferences(PreferencesWindow owner) {
super(MENU_KEYS, owner);
setLayout(new BorderLayout());
mPanel = new BandedPanel(MENU_KEYS);
mPanel.setLayout(new ColumnLayout(2, 5, 0));
mPanel.setBorder(new EmptyBorder(2, 5, 2, 5));
mPanel.setOpaque(true);
mPanel.setBackground(Color.WHITE);
for (Co... |
e66ed190-8fcd-41c9-82c8-a1e6344d32bc | 3 | public String processCommand(String req) {
System.out.println("Procesor: Processing Command: " + req);
// AuftragsNr erstelleAuftrag(AngebotsNr nr) throws NotFoundException, TechnicalException;
// Input: "erstelleAuftrag;15"
// wird umgewandelt in
// Output: "23" oder "NotFoundE... |
874020d8-f60e-43db-a73e-4bba151e0857 | 6 | public void move(EntityManager em) {
int nx = c.x;
int ny = c.y;
if(!c.isDancing){
if (Keyboard.isKeyDown(Keyboard.KEY_S)) {
ny++;
}
if (Keyboard.isKeyDown(Keyboard.KEY_W)) {
ny--;
}
if (Keyboard.isKeyDown(Keyboard.KEY_A)) {
nx--;
}
if (Keyboard.isKeyDown(Keyboard.KEY_D)) {
... |
1ccec797-a44e-42f6-854a-e522e75412f7 | 5 | public void encodeRegisterListBinary(String list, int[] encoding) {
//throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
String regs[]=list.split(",");
//System.out.println("in reglist "+list);
for(int i=0;i<reg... |
9282dd42-69c5-4d6f-a4da-245c5acfc737 | 5 | @Override
public void run() {
DistributedBackupSystem.fManager.backupFile(filename, replicationDegree);
BackupFile file = DistributedBackupSystem.fManager.getFileByName(filename);
if(file != null) {
for(Packet p : messages) {
if(p.getPacketType().equals("DELETE") && Packet.bytesToHex(p.getFileID()).equals... |
0e959849-fa71-42d8-9289-463a4be1d7e3 | 4 | private boolean existNeighbor(int i, int j) {
if (i < 0 || i > this.high - 1) return false;
if (j < 0 || j > this.width - 1) return false;
return true;
} |
7f156f5d-a78d-4517-8279-1fb8fc192e24 | 7 | @Override
public boolean pickUpItem(Item i) {
if(i instanceof Supply){
Supply s = (Supply)i;
switch(s.getType()) {
case AMMO:
if(this.ammo >= 100){
return false;
}else{
this.increaseAmmo(s.getAmount());
return true;
}
case FOOD:
if(this.food >= 100){
ret... |
c0cfd9a8-7fc2-4901-ba47-840a014fd669 | 2 | @Override
protected void setReaction(Message message) {
Cmds cmd = getCommand(message.text);
if(cmd == Cmds.CMD_INVALID)
return;
String result = executeCmd(cmd, message.text, message.author);
if(result != null)
reaction.add(result);
} |
442a1d7e-12e2-48d5-a8bf-28da79d99e9a | 4 | public void write(String chunk_uuid, String chunk) {
Socket client = null;
try {
client = new Socket(InetAddress.getLocalHost(), port); // port˿ڷͻ
} catch (Exception e) {
// TODO: handle exception
System.out.println("No server");
}
ObjectOutputStream out = null;
try {
out = new ObjectOutpu... |
e5a5d26f-1359-48db-8b3d-2e41505f674f | 8 | public void thirdClickNpc(int npcType) {
c.clickNpcType = 0;
c.npcClickIndex = 0;
switch(npcType) {
case 70:
case 1596:
case 1597:
case 1598:
case 1599:
c.getShops().openShop(109);
break;
case 548:
if (!c.ardiRizal()) {
c.sendMessage("You must remove your equipment before changing your appear... |
72dff38d-d6cc-4c50-805e-4def30a7354f | 4 | @Override
protected void process(int bits[])
{
double signal = -1.0;
for ( int i = 0 ; i < bits.length ; i++ )
{
int bit = bits[i];
if ( bit == 0 )
signal *= -1;
int j = i * SignalPlot.DIVISIONS;
in... |
2a9241f4-1d23-4345-b2ba-8dad256a1f0d | 1 | @Override
public String removeProperty(String name) {
String property = properties.get(name);
if(property != null){
properties.remove(property);
return property;
}
return null;
} |
88f86ea4-e1a7-475b-8899-e0c4a32d02e9 | 3 | private static <T> void generateGenerators(GameAIInterface<T> ai,
GameMapConverter<T> converter, int populationSize, int generations, int mapSampleSize, int numGens) {
long timeStamp = System.currentTimeMillis();
for (int i = 0; i < numGens; i++) {
Generator<T> gen = runGA(ai, converter, populationSize, gene... |
7efa4663-c982-43a3-93a4-8a0b295bf68d | 8 | public static void main(String[] args) {
// Exercício 03
Scanner entrada = new Scanner(System.in); // Esse é o Sacanner que captura dados do teclado. Para utilizá-lo é preciso importar a classe java.util.Scanner
int dia_da_semana = 1;
while (dia_da_semana != 0) {
System.out.p... |
15d88119-1f9d-4d64-b67c-b59fd08de7a8 | 4 | @Override
public Iterator<Integer> iterator() {
// TODO Auto-generated method stub
switch (_type) {
case FORWARD:
return new me.marksinclair.ranges.Iterator(this);
case REVERSE:
return new ReverseIterator(this);
case FORWARD_STEP:
return new IteratorS(this);
case REVERSE_STEP:
return new Revers... |
c8fa7976-831a-4300-a168-9c79bc8fd909 | 1 | public void dropInfo(int howMuch) {
if ((howMuch & KNOWNATTRIBS) != 0)
constant = null;
super.dropInfo(howMuch);
} |
c5af0ee3-9504-458b-ba98-2b4b99883562 | 2 | public static void main(String[] args) throws Exception
{
if (args.length == 0)
System.err.println("Usage: java HTTPDownload url [file]");
if (args.length > 1)
download(args[0], args[1]);
else
System.out.println(readFirstLine(args[0], 0));
} |
849d0596-2dde-405b-b9d7-a1b162ca2be3 | 2 | public static Ville selectVilleById(int id) throws SQLException {
String query = null;
Ville ville1 = new Ville();
ResultSet resultat;
try {
query = "SELECT * from VILLE where ID_VILLE =? ";
PreparedStatement pStatement = ConnectionBDD.getInstance().getPrepared... |
53b60c3d-1fe7-4f4a-a7a0-f7a2273fe1c0 | 9 | @Override
public long read(T target) throws IOException {
int totalRead = 0;
Date started = timeout == 0 ? null : new Date();
// if we still need to read something and we haven't done so already, do so
while (target.remainingSpace() > 0) {
long read = parent.read(target);
if (read == -1) {
return tot... |
c34426d6-421f-4363-9e51-4fdc99b5f8ef | 5 | public boolean clickButton(final IClientContext ctx, final MakeSword makeSword) {
final int cooldown = makeSword.getCooldown();
final int current = getCurrent(ctx);
if (getTarget(ctx) > getCurrent(ctx)) {
final Component button = ctx.widgets.component(MakeSword.WIDGET_SWORD_INTERFACE, buttonWidgetId);
if (b... |
8b8034d2-f3c3-4a7f-a589-341e6fc8890d | 6 | public void load() {
Configuration config = this.plugin.getConfig();
if (config.isString("map." + this.game.getName() + ".sp1"))
this.sp1 = SerializableLocation.stringToLocation(config.getString("map." + this.game.getName() + ".sp1"));
else {
this.sp1 = null;
}
if (config.isString("map."... |
6efc2bbf-b1ad-45d9-8d97-0efad95f798c | 5 | public void search(String name)
{
String searchable = name;
System.out.println(searchable);
if(searchable.length() <= 0)
{
JOptionPane.showMessageDialog(null,"Nothing to search.");
}
String doc = t.getText();
int index = doc.indexOf(searchable,0);
if(index >= 0... |
bc8394cd-b561-409d-bcf6-55dd1f9770d8 | 9 | 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... |
f22d7c44-3bed-428f-b371-73b42361ef50 | 1 | public void enableComponent(String comp) {
Iterator<GameActor> it = actors.values().iterator();
while(it.hasNext()) {
GameActor actor = it.next();
actor.enableComponent(comp);
}
} |
263dbdb5-54de-4614-a94c-9d3786b682d2 | 8 | private boolean r_un_accent() {
int v_3;
// (, line 215
// atleast, line 216
{
int v_1 = 1;
// atleast, line 216
replab0: while(true)
{
lab1: do {
if (!(out_groupin... |
50f7d745-3177-4187-8291-1e1564d06c43 | 7 | public static void testValidity(Object o) throws JSONException {
if (o != null) {
if (o instanceof Double) {
if (((Double)o).isInfinite() || ((Double)o).isNaN()) {
throw new JSONException(
"JSON does not allow non-finite numbers.");
... |
68c3e2eb-fdc0-4078-be2c-7b037c1febc9 | 2 | public int maxProfit2(int[] prices) { // only get profit >= 0
int maxp = 0;
int diff = 0;
for (int i = 0; i < prices.length - 1; i++) {
if (diff >= 0)
diff += prices[i + 1] - prices[i];
else
diff = Math.max(0, prices[i + 1] - prices[i]);
maxp = Math.max(diff, maxp);
}
return maxp;
} |
a248bffa-5e7f-47ea-83d2-a22b17bf8836 | 3 | protected void writePrimitiveAttribute(mxCodec enc, Object obj,
String attr, Object value, Node node)
{
if (attr == null || obj instanceof Map)
{
Node child = enc.document.createElement("add");
if (attr != null)
{
mxCodec.setAttribute(child, "as", attr);
}
mxCodec.setAttribute(child, "value... |
6aa0e7b7-e27d-436d-887c-bc87c75c042d | 0 | public void updateP1(String stats)
{
p1.setText(stats);
} |
f710cfa0-4c21-4e24-8bcf-c7f8bd840cd1 | 0 | public void setActionType(int actionType) {
this.actionType = actionType;
} |
7024d4d0-95d2-4d57-be77-465b22d10f2f | 5 | public static void checkInput(Stage stage) {
Keybinds.update();
playerInput(stage);
if(Keybinds.MENU.clicked()) {
stage.menu.openMenu(stage);
}
if(Keybinds.DEBUG.clicked()) {
Theater.debug = !Theater.debug;
}
if(Keybinds.EDIT.clicked()) {
Editor.open(stage);
}
if(Keybinds.PAUSE.clicked()... |
06a1ccad-8013-4f27-b2c2-5a475fcf0870 | 5 | public void testReadWriteRead() throws IOException {
InputStream[] testFiles = new InputStream[] {
getTest09File(), getTest11File()
};
boolean[] hasFullTags = new boolean[] { false, true };
for (int i=0; i<testFiles.length; i++) {
InputStream inpStream = testF... |
ef0d818a-fbb2-48a1-bcf0-61254cfbc234 | 7 | public void shutdown() {
try {
registry.unbind(bindingName);
} catch (AccessException e) {
logger.error("couldn't unbind the Registry");
} catch (RemoteException e) {
logger.error("couldn't unbind the Registry");
} catch (NotBoundException e) {
logger.error("couldn't unbind the Registry");
}
try... |
8f548a91-572d-4523-82d6-5b71fd8a3882 | 3 | private void closeChannel(){
try {
if(this.fileInput != null){
this.fileInput.close();
this.fileInput = null;
}
if(this.fileChannel != null){
this.fileChannel.close();
this.fileChannel = null;
}
}catch (IOException ex) {
ex.printStackTrace();
... |
ffd24daf-d5cc-4b60-b1c5-cb16dabb9c28 | 8 | protected void decodeRequestAttributes(String sharedSecret)
throws RadiusException {
// detect auth protocol
RadiusAttribute userPassword = getAttribute(USER_PASSWORD);
RadiusAttribute chapPassword = getAttribute(CHAP_PASSWORD);
RadiusAttribute chapChallenge = getAttribute(CHAP_CHALLENGE);
RadiusAttribu... |
3bf8be66-dc7c-44fe-a603-d311e94e6ea9 | 6 | @Override
public void run() {
if (Updater.this.url != null) {
// Obtain the results of the project's file feed
if (Updater.this.read()) {
if (Updater.this.versionCheck(Updater.this.versionName)) {
if ((Updater.this.versionLi... |
fcb2e694-4339-425a-b929-5a1494453df2 | 0 | public Boolean isOnline(String id) {
return participants.get(id).isOnline();
} |
c20367d1-0940-4265-ac88-8648982d5f3f | 7 | public static String[] toStringA(byte[] data) {
// Advanced Technique: Extract the String array's length
// from the first four bytes in the char array, and then
// read the int array denoting the String lengths, and
// then read the Strings.
// ----------
if (data == null || data.length <... |
43536f40-23de-4008-8208-c168bea953e7 | 3 | public void removeNode(int id){
processServerMap.get(id).stop();
//processServerMap.remove(id);
//workersMap.remove(id);
workerStatusMap.put(id, -1);
Set<Integer> procIdSet = processesMap.keySet();
Iterator<Integer> idIterator = procIdSet.iterator();
int procId;
... |
05ce0103-c1b3-4500-9b2b-42f4429ba1e3 | 1 | public synchronized boolean remover(int i)
{
try
{
new PalavraChaveDAO().remover(list.get(i));
list = new PalavraChaveDAO().listar("");
preencherTabela();
}
catch (Exception e)
{
return false;
}
return true;
} |
5c01612f-e0f5-417a-8265-33e4a032a73a | 2 | public static void win(int elapsedTime, int numMoves) {
prefs.putInt("wins", prefs.getInt("wins", 0) + 1);
if (getLowestMoves() > numMoves) {
setLowestMoves(numMoves);
}
if (getBestTime() > elapsedTime) {
setBestTime(elapsedTime);
}
} |
82d3f6dd-379a-4fca-8d02-be722506351b | 3 | private boolean checkSpace() {
// TODO Auto-generated method stub
for (int i = 0; i < clientObj.length; i++) {
if(clientObj[i]!=null)
count++;
}
if(count<5){
return true;
}
else{
return false;
}
} |
85234f00-aa07-4d73-b1eb-f5da1b6cbebe | 2 | public String[] getAllAddresses() {
int ct = getAddressCount();
String[] addresses = new String[ct];
if (ct == 0) {
return addresses;
}
for (int add = low(), j=0; add <= high(); ++add, ++j) {
addresses[j] = format(toArray(add));... |
3173a324-9b55-45ac-9921-4ba06727d3ca | 4 | public Column(String columnName, String type) {
this.columnName = columnName;
if (type.equals("character varying")) { this.type = Type.VARCHAR; return; }
if (type.equals("number")) { this.type = Type.NUMBER; return; }
if (type.equals("integer")) { this.type = Type.INTEGER; return; }
... |
e41b93e3-4698-4ca5-8116-e85f09295d9a | 3 | private static String readRealString() { // read chars from input following syntax of real numbers
skipWhitespace();
if (lookChar() == EOF)
return null;
if (floatMatcher == null)
floatMatcher = floatRegex.matcher(buffer);
floatMatcher.region(pos,buffer.length());
if (fl... |
c04e74d7-e982-4595-a0e6-09dbbe7c8d33 | 5 | public void put(int key, int value) {
HashPrinter.tryPut(key, value);
/** Index that moves through array slots */
int runner = 0;
int hash = (key % table.length);
if (table[hash] == null) {
table[hash] = new Node(key, value);
HashPrinter.successfulInsertion(key, hash);
size++;
} else {
/... |
4dac5a42-a446-415f-9c16-cd5c49411a48 | 3 | static private int jjMoveStringLiteralDfa12_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return jjStartNfa_0(10, old0);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(11, active0);
return 12;
}
switch(curChar)
{
... |
4dcc120b-101e-4c0a-a8a1-57b9153d8382 | 7 | @Override
public void processPacket(final Client c, int packetType, int packetSize) {
c.pItemY = c.getInStream().readSignedWordBigEndian();
c.pItemId = c.getInStream().readUnsignedWord();
c.pItemX = c.getInStream().readSignedWordBigEndian();
if (Math.abs(c.getX() - c.pItemX) > 25 || Math.abs(c.getY() - c.pItemY) >... |
fb83f1a9-c473-4cd4-bab3-7d64ac82ca1f | 1 | @FXML
private void handleBtnModifyAction(ActionEvent event) {
if (table.getSelectionModel().isEmpty()) {
return;
}
mode = Mode.MODIFY;
selected = table.getSelectionModel().getSelectedItem();
txtName.setText(selected.getName());
} |
bc631458-f28f-4c7b-a58a-ec01c17be2b6 | 7 | @Test
public void testMessageObserver() {
System.out.println("testMessageObserver");
try {
assertTrue(c.registerToServer(GlobalConstants.IP_LOOPBACK));
} catch (Exception ex) {
fail("Registration from client to server failed - " + ex);
}
final String... |
d8ea887d-95cd-47af-bd1c-0c363d046081 | 8 | public List<Entity> getNeighorSlice(int row, int col, int dist) {
List<Entity> neighbors = new LinkedList<>();
for (int x = row - dist; x <= row + dist; x++) {
if (isInBounds(x)) {
for (int y = col - dist; y <= col + dist; y++) {
if (isInBounds(y) && this... |
1a1e065b-febd-447c-8272-d8463f6907d3 | 5 | @Test
public void testGetSearchGenre() throws Exception {
Connection conn = DriverManager.getConnection("jdbc:mysql://localhost/librarysystem?user=admin&password=123456");
Statement st = conn.createStatement();
ResultSet rs = null;
try {
//Unmatched isbn
ArrayList<SearchGenre> auths = bh.getSearchGenres... |
46b89627-208b-4d97-807a-d4f55d332c08 | 4 | public void loadChildDoc(String fileName) {
if (fileName == null || fileName.isEmpty())
return;
JSONObject json = LoadJSON(fileName);
String content = Utils.getJSONValue(json, "content");
String name = Utils.getJSONValue(json, "name");
String parent = Utils.getJSONValue(json, "parent");
String title = U... |
100a6524-6bed-4b82-802d-812a68293db8 | 6 | public String getNextComponent(Identifier ident) {
String prefix = ident.getFullName();
if (prefix.length() > 0)
prefix += ".";
int lastDot = prefix.length();
if (!wildcard.startsWith(prefix))
return null;
int nextDot = wildcard.indexOf('.', lastDot);
if (nextDot > 0 && (nextDot <= firstStar || firs... |
495984ac-8ac0-40b2-9e3f-0ff0e66861ba | 7 | private void sendUpdates()
{
ItemInfo itemInfo = null;
// System.out.println("Updating " + _itemReqTable.size() + " items");
Iterator<Token> iter = _itemReqTable.keySet().iterator();
while (iter.hasNext())
{
Token rq = (Token)(iter.next());
itemInfo = ... |
17a7bef9-f06a-4865-ba99-f4503e606276 | 4 | int median(int qual[], int i) {
// Create a list
LinkedList<Integer> list = new LinkedList<Integer>();
for( int k = 0, j = i - runningMedianLength + 1; k < runningMedianLength; k++, j++ )
if( (j >= 0) && (j < qual.length) ) list.add(qual[j]);
Collections.sort(list);
int size = list.size(), med = 0;
if( ... |
1d802a8e-a70f-4380-8535-c1921e524bbf | 6 | public static void removePlayingPlayer(Player player, int team) {
playing[team].remove(player);
player.reset();
player.setCanPvp(false);
// remove the items
setCape(player, null);
int weaponId = player.getEquipment().getWeaponId();
if (weaponId == 4037 || weaponId == 4039) {
CastleWars.setWeapon(playe... |
535701ff-1a60-4e2f-8087-00b5130185af | 5 | public Collection<DistritoDTO> buscarPorProvincia (int idprov)
{
Connection con = null;
PreparedStatement pstm = null;
ResultSet rs = null;
try {
con = UConnection.getConnection();
String sql = "SELECT d.* "
+ "FROM ubdist... |
9a7ca0ac-9a27-4639-b616-e0660592af93 | 9 | @Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if(!(affected instanceof MOB))
return super.okMessage(myHost,msg);
final MOB mob=(MOB)affected;
if((msg.amITarget(mob))
&&(CMath.bset(msg.targetMajor(),CMMsg.MASK_MALICIOUS))
&&(msg.targetMinor()==CMMsg.TYP_CAST_SPELL)
&... |
70ed7695-f1d1-4b67-b9e3-2aab5e8d2d41 | 4 | public static String getLibraryDescription(Class<?> libraryClass) {
if (libraryClass == null) {
errorMessage("Parameter 'libraryClass' null in method"
+ "'getLibrayDescription'");
return null;
}
if (!Library.class.isAssignableFrom(libraryClass)) {
errorMessage("The specified class does not extend cl... |
cb2c164b-16b5-4d6f-a9b1-3ce993cf875d | 4 | private int getCommentsNum(File file) {
if (!file.exists()) {
return 0;
}
try {
int comments = 0;
String currentLine;
BufferedReader reader = new BufferedReader(new FileReader(file));
while ((currentLine = reader.readLine()) != null... |
41dd0159-e5d3-4c0c-84f9-93396318bc91 | 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... |
48ec1d6b-d011-4e7b-ac59-d28de062e38d | 2 | public Slugger(TileMap tm) {
super(tm);
moveSpeed = 0.3;
maxSpeed = 0.3;
fallSpeed = 0.2;
maxFallSpeed = 10.0;
width = 30;
height = 30;
cwidth = 20;
cheight = 20;
health = maxHealth = 20;
damage = 1;
try {
BufferedImage spritesheet = ImageIO.read(getClass().getResourceAsStream("/Sprites/E... |
ca236bad-e6ee-4f31-8bc7-70b90949c2ec | 3 | private ArtistLogger()
throws LogException {
ArtistLogger.log= Logger.getLogger(ArtistLogger.class.getName());
FileHandler fh= null;
try {
fh = new FileHandler("LogArtist " + new Date().toString());
ArtistLogger.log.addHandler(fh);
ArtistLogger.log.setUseParentHandlers(false);
} catch ... |
fcde7b93-b40e-45b6-a523-dd882617b5d3 | 0 | private static void printEventInformation(Event event) {
DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.FULL, Locale.getDefault());
DateFormat timeFormat = DateFormat.getTimeInstance(DateFormat.MEDIUM, Locale.getDefault());
System.out.println("Event date: " + dateFormat.format(eve... |
54d0e2ca-a8eb-46fe-8176-edefa880eb28 | 9 | protected void FillBuff() throws java.io.IOException
{
if (maxNextCharInd == available)
{
if (available == bufsize)
{
if (tokenBegin > 2048)
{
bufpos = maxNextCharInd = 0;
available = tokenBegin;
}
else if (tokenBegin < 0)
bufpos = maxN... |
86aa3718-8016-402e-8f06-43186e315304 | 9 | @Override
public boolean equals(Object obj)
{
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Card other = (Card) obj;
if (suit == null)
{
if (other.suit !... |
ca901da1-5bce-49fe-af31-168106b3a088 | 7 | public static String javaChangeCase(GeneralizedSymbol symbol, Keyword caseconvention) {
{ Module module = ((Module)(symbol.homeContext));
String name = symbol.symbolName;
boolean allUpperP = Stella.allUpperCaseStringP(name);
Keyword capsBreakKeyword = (allUpperP ? Stella.KWD_CLEVER : Stella.KWD_YE... |
24374a15-be51-42c2-8e47-ee4c11a78775 | 3 | private void btnEliminarClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEliminarClienteActionPerformed
/*Obtenemos el cliente seleccionado de la tabla:*/
Cliente clienteQueSeEliminara = obtenerInformacionDeRenglonSelecccionado();
//checamos si se se... |
c9bd99d7-ef47-4934-959f-237cde3a9c7c | 3 | private void updateHaggleButton() {
if(model.getHaggleData() != null && model.getHaggleData().getHaggleState() != HaggleData.HaggleState.ACCEPT &&
model.getHaggleData().getHaggleState() != HaggleData.HaggleState.DECLINE) {
haggle.setEnabled(false);
} else {
haggle.setEnabled(true);
}
} |
bd0085cc-7cf6-4246-85e9-1714559c8ed6 | 8 | public void setGapStat(IntVO gap) {
gaps.add(gap);
int v=gap.val();
switch (v) {
case 0:
//gap 0, 1
spg0++;
break;
case 1:
//gap 0, 1
spg1++;
break;
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
//gap 2,3,4,5,6,7
spg2++;
break;
default:
//gap 2,3,4,5,6,7
spg... |
402babc6-1cf2-4562-8cd7-c7e7179e327d | 5 | @Test
public void testGetNetIncome4() {
MyHashTable<String, Integer> sales = new MyHashTable<>(10, 10);
sales.put("A", 123);
sales.put("B", 234);
sales.put("C", 345);
sales.put("D", 456);
sales.put("E", 567);
sales.put("F", 678);
sales.put("G", 789);
... |
6ae72780-be64-41f2-8629-2737aa64d3b7 | 4 | public static void dictionary_test() {
try {
Dictionary d = new Dictionary(Constants.dictionaryPath);
Set<String> ws = d.getWordSet();
for (String w : ws) {
if (w.length() > 0) {
Word w2 = new Word(w);
System.out.println(w2 + " " + w2.getSubWordBeforeLastSyllable() + "-" + w2.getLastSyllableSub... |
fd3818e6-ba61-4973-84e9-3250ef332b2e | 1 | public void map_click(int x, int y, int btn, int mod) {
Gob pgob;
synchronized (glob.oc) {
pgob = glob.oc.getgob(playergob);
}
if (pgob == null)
return;
Coord mc = tilify(pgob.position());
Coord offset = new Coord(x, y).mul(tileSize);
mc = mc.add(offset);
wdgmsg("click", JSBotUtils.getCenterScreen... |
e444f957-20fd-4a28-beea-8aaa463973ef | 7 | public void jouer() {
pw.println("mouseClicker newclient " + this.nom);
pw.flush();
Thread threadClientInput = new Thread(new Runnable() {
@Override
public void run() {
playing = true;
boolean quitter = false;
while (!quitter) {
String rep;
try {
rep = br.readLine();
Syst... |
e1fed450-2920-4253-8151-518839e6f1ca | 7 | public void setTileForce(){
switch(style){
case 1:
setForce(new Vector2f(0,0));
break;
case 2:
setForce(new Vector2f(0,-0.150f));
break;
case 3:
setForce(new Vector2f(0.150f,0));
break;
case 4:
setForce(new Vector2f(0,0.150f));
break;
case 5:
setForce(new Vector2f(-0... |
d3f17c2c-b3a4-402d-83f5-b447945c07fa | 1 | public static HttpServletRequest listBills(HttpServletRequest request) {
ArrayList<Models.ViewModel.Bill> viewBills = new ArrayList<>();
ArrayList<Models.DatabaseModel.Bill> bills = Models.DatabaseModel.Bill.listBills();
for (Models.DatabaseModel.Bill bill : bills) {
Models.Database... |
fd0965f3-4ddb-42b2-8f60-02b2ab36ef2c | 8 | private void doToolkitCalibration() {
if (toolkitCalibrationIndex == null) {
// starting
toolkitCalibrationIndex = 0;
}
else if (lastDelay == TOOLKIT_CALIBRATION_DELAY_NOTIFY) {
toolkitCalibrationIndex++;
}
else if (currentTuioObject != null) {
saveToolkitCalibration(
tangibles.get(toolkitCa... |
ca0bf80f-46fa-434b-b094-9f4c2861b531 | 8 | private void buildHTMLLine( StringBuffer lineBuffer,
File file ) {
if( this.isHTMLFormat() )
lineBuffer.append( "<tr>\n" );
for( int i = 0; i < 5; i++ ) {
if( this.isHTMLFormat() ) {
lineBuffer.append( " <td" );
if( i == 0 || i == 2 ) // icon or size
lineBuffer.append( " a... |
b0a3646d-c446-44a3-826f-eb692b6ea009 | 5 | public static String decode(String input) {
if (input == null) return null;
if (input.indexOf("\\")!=-1) {
int pos = input.indexOf("\\");
StringBuffer output = new StringBuffer("");
while (pos!=-1) {
// is it dec or hex encoding ?
if (input.charAt(pos+2) == 'x') {
output.append(input.substring... |
28e440db-a2de-44bb-97d8-c51b7fc566b5 | 0 | public JoeTree getTree() {return this.tree;} |
ef7c741b-6515-4edf-99f4-184928a0a9b6 | 6 | @Override
public boolean equals(Object o)
{
if (o == null)
return false;
if (o == this)
return true;
if (!(o instanceof ArbeitsplanDTO))
return false;
ArbeitsplanDTO a = (ArbeitsplanDTO) o;
if(a.getId() != this.getId())
retu... |
66dcf8be-7e7c-4ae7-a95c-957d2a5eea37 | 0 | public int numberSelectedTransitions() {
return selectedTransitions.size();
} |
b510c0fd-a2c6-4de2-bcb7-86773eb4b222 | 3 | @Override
public boolean equals(Object o)
{
if (super.equals(o)) {
StringLargeArray la = (StringLargeArray) o;
return this.maxStringLength == la.maxStringLength && this.data == la.data && this.stringLengths.equals(la.stringLengths);
}
return false;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.