method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
f3db6408-ea60-41b0-afaa-4fb0ed084834 | 2 | private static boolean asExpected(boolean isInsert, int ret, int expected, boolean isDrop) {
// System.out.println(String.format("%s %d %d %s", isInsert, ret, expected, isDrop));
if (isDrop) {
return true;
}
return isInsert ? (asExpectedWhenInsert(ret, expected)) : expected == ret;
} |
a7e3ae80-fc92-4c15-8028-c1cd0fac3929 | 3 | public static byte[] readBytes(String fileName) {
try {
// shows what the path is (for testing/debugging)
// System.out.println(System.getProperty("user.dir"));
// longer form of file name w/ path (if needed)
// FileInputStream fstream = new
// FileI... |
88464269-4a0d-4e0e-be1d-acf715af6e56 | 0 | @Test
@Ignore // Unregistering callbacks is not supported
public void runTestUnregister1() throws IOException {
InfoflowResults res = analyzeAPKFile("Callbacks_Unregister1.apk");
Assert.assertNotNull(res);
Assert.assertEquals(0, res.size());
} |
1eec2315-ee65-4a5e-8fe4-031c7f1da920 | 5 | void MoreLexicalActions()
{
jjimageLen += (lengthOfMatch = jjmatchedPos + 1);
switch(jjmatchedKind)
{
case 10 :
image.append(input_stream.GetSuffix(jjimageLen));
jjimageLen = 0;
image.append(NLI());
break;
case 11 :
image.append(input_stream.GetSuffi... |
2cbe14f0-305b-48ef-9384-6902417bb24c | 9 | public static void copy_byte(int x, int y, int data, int col)
{
char fore, back;
if (y < 32) return;
fore = Machine.pens[(col >> 4) & 0x0f];
back = Machine.pens[0];
plot_pixel.handler(Machine.scrbitmap, x , y, (data & 0x80)!=0 ? fore : back);
plot_pixel.handler(Machine.scrbitmap, x+1, y, (data ... |
99749df1-6bde-43cd-9ffc-1902ebe381d9 | 7 | public DrawableXYG checkPickups(Input input, Part heldItem) {
for (int i = 0; i < craftingSlots.length; i++) {
if(craftingSlots[i].hasBeenClicked() == Button.PRESSED_TRUE){
if(heldItem == null){
return craftingSlots[i].slotContainCheck(heldItem);
}else if(heldItem.canFit(i)){
return craftingSlots... |
0575f902-ca63-45f8-b904-217bd042c435 | 6 | @EventHandler
public void onEntityDamage(EntityDamageEvent e) {
if ((e instanceof EntityDamageByEntityEvent)) {
EntityDamageByEntityEvent event = (EntityDamageByEntityEvent)e;
if (((event.getDamager() instanceof Player)) && ((event.getEntity() instanceof Player))) {
Player attacker = (Player)e... |
9223fdbb-4fe0-45e8-8cfa-a53cff689e87 | 6 | @Override
public final void mapAction(final ICoordinates coord) {
ITile tile = game.getMap().getTile(coord.toTile());
IField field = game.getMap().getField(coord);
IPlayer player = game.getCurrentPlayer();
if (!player.hasRolledPlayer() || tile == null || field == null) {
... |
05e640b5-16e6-4ecc-a702-811f901799b2 | 3 | private int presentar(String[] opciones){
System.out.println("Elija una opción");
int seleccionado;
for (int i=0;i < opciones.length;i++)
System.out.println(i+1+". "+opciones[i]);
/*esperar numero*/
do{
seleccionado = teclado.nextInt();
... |
2958d45c-c5be-4ecb-85b1-a8f08c6bed40 | 8 | public static Fsm uniNLevenshtein(int distance) {
Fsm fsm = new Fsm();
fsm.getShortSymbols().put('_', "01");
fsm.setDefEdgeLabelRot(true);
//fsm.setBlocksize(distance*2+1);
for (int i=0; i <= distance; i++) {
for (int j = -i; j<=i; j++) {
Vertex n = fs... |
b51c96db-47e8-465e-a20d-69c9bac50abc | 1 | private void initialConfigCheck(){
getConfig().options().copyDefaults(true);
try {
getConfig().save(new File(getDataFolder(),"config.yml"));
} catch (IOException e) {
logWarning("Unable to save configuration file!");
}
} |
52e6bf6a-95b7-40b2-b0dd-9b88ae234afa | 0 | Gender (String value) {
this.value = value;
} |
dfaf3119-c6a0-43eb-b81f-8ed110050fdb | 4 | @Override
public void recvDropOfferReq(String buyer, String serviceName) {
// get service's status and properly update the service list
String status = user.getUserServiceStatus(serviceName, buyer);
loggerGui.info(user.getUsername() + "received drop offer packet for service " +
serviceName + " from buyer ... |
28770779-6fcc-42a7-b93d-241884f313bd | 8 | @Override
protected boolean isTheMapMsg(final MOB mob, final MOB srcM)
{
if((mob!=null)&&(srcM!=null))
{
if((mob.riding() !=null)
&& (mob.riding().rideBasis() == Rideable.RIDEABLE_WATER)
&&(mob == srcM))
return true;
if((srcM.riding() instanceof BoardableShip)
&&(mob.location()!=null)
&... |
bf2fb59b-93a1-4050-84ba-bceb89cffc9a | 5 | private static void checkDirectory(File directory, String pkgname,
List<Class<?>> classes) {
if (!directory.exists() || !directory.isDirectory()) {
return;
}
for (String fileName : directory.list()) {
if (!fileName.endsWith(".class")) {
checkD... |
6c8305f8-91b5-4218-9a45-55a56b56528b | 6 | private Game getGame(String gameId) {
DatastoreService datastore = DatastoreServiceFactory
.getDatastoreService();
Filter filter = new FilterPredicate("gameId", FilterOperator.EQUAL,
gameId);
Query q = new Query("Game").setFilter(filter);
// Use PreparedQuery interface to retrieve results
PreparedQu... |
a1a42483-c282-4bc9-ae10-b9e1161bac74 | 7 | private boolean insertAVL(TreeNode currentNode, TreeNode newNode) {
if (currentNode == null) {
this.root = newNode;
} else {
if (newNode.key < currentNode.key) {
if (currentNode.left == null) {
currentNode.left = newNode;
newNode.parent = currentNode;
recursiveBalance(currentNode);
... |
ff6a7a22-a1b8-4ec0-87bc-249b5f5e4a8d | 9 | private static ClassMetadata getClassMetadata (final Class cls,
final Map /* Class->ClassMetadata */ metadataMap,
final ClassAccessPrivilegedAction caAction,
final Fie... |
e90c9b8b-acdd-404b-90dc-92f69b33d815 | 4 | public void render(GameContainer arg0, StateBasedGame arg1, Graphics arg2) throws SlickException {
int mapx = RPG372.gameInstance.getMap().getX();
int mapy = RPG372.gameInstance.getMap().getY();
for(int i = 0 ; i < mapx ; i++){
for(int j = 0 ; j < mapy ; j++){
int type = RPG372.gameInstance.getMap().get(i,... |
a47758de-2c17-463a-94ca-0320ba736bf2 | 5 | public List<Item> getItems() {
List<Item> list = new ArrayList<>();
Connection con = null;
Statement stmt = null;
try {
DBconnection dbCon = new DBconnection();
Class.forName(dbCon.getJDBC_DRIVER());
con = DriverManager.getConnection(dbCon.getDATABASE... |
3e8fe137-6458-4987-ab54-0a3d51858b14 | 1 | public ResultSet select(String query){
try{
Statement stm = this.con.createStatement();
ResultSet rs = stm.executeQuery(query);
// stm.close();
return rs;
}
catch(SQLException e){
LogHandler.writeStackTrace(log, e, Level.SEVERE);
return null;
}
} |
8e319f79-77df-42a3-89b5-43ada61a874b | 4 | public void close() {
try {
if(inf) sc.close();
if(outf) fw.close();
inf = false;
outf = false;
this.filename = null;
} catch (IOException e) {
ExceptionLog.println("Ошибка закрытия файла");
} catch(Exception e) {
... |
8714494b-edac-4e21-b8fb-08f49883c93a | 3 | Data data(double value, int position, int position2, int len) {
double scaledVal = 100 * value / maxY;
ArrayList<Double> data = new ArrayList<Double>();
for( int i = 0; i < len; i++ ) {
if( (i == position) || (i == position2) ) data.add(scaledVal);
else data.add(0.0);
}
return Data.newData(data);
} |
92bbc0c9-62c8-4cd7-a6a1-f94525142745 | 0 | public void setPcaPosId(Integer pcaPosId) {
this.pcaPosId = pcaPosId;
} |
5e9d894b-da66-4ca9-bd93-2d5c112fde5f | 2 | public static String loadText(String path, String filename) {
String fileContent = "";
try {
ByteArrayOutputStream out = new ByteArrayOutputStream();
ZipFile zf = new ZipFile(path);
ZipEntry entry = zf.getEntry(filename);
InputStream in = zf.getInputStream(entry);
Buffere... |
a6c5a84d-807d-4fac-9139-6fdfa7fe11c3 | 4 | public static double calculatePearsonCorrelation(Double[] vectorOne, Double[] vectorTwo, double averageOne,
double averageTwo) {
double enumerator = 0, denominatorOne = 0, denominatorTwo = 0;
for (int i = 0; i < vectorOne.length; i++) {
enumerator += (vectorOne[i] - averageOne) * (vectorTwo[i] - averageTwo)... |
071d81ea-269c-4040-b031-e5c191c929b0 | 6 | private void handlePacket() throws IOException {
DatagramPacket recvPacket = receivePacket();
byte[] data = recvPacket.getData();
String src = translateIP(data, 12);
System.out.println("\nReceived packet from " + src);
int data_length = (int) (((data[2] << 8) | (data[3] & 0xFF)) & 0xFFFF);
// Va... |
c044beaf-0c21-4fe5-a86f-b4a4ab311058 | 6 | public void setDecimals(int decimals)
{
// set decimals
this.decimalSpaces = decimals;
// set the decimal format
switch(decimals){
case 1 : decimalValue = new DecimalFormat("0.#");
break;
case 2 : decimalValue = new DecimalFormat("0.##");
break;
case 3 : decimalValue = new Dec... |
a02a1943-161c-475d-a187-5cbb3b382e94 | 8 | public static void main(String[] args) {
System.out
.println("Enter \"D\" to use deque or \"R\" for randomizedqueue");
String input = StdIn.readString();
if (input == "D") {
Deque<String> deque = new Deque<String>();
while (!StdIn.isEmpty()) {
String item = StdIn.readString();
if (item.equals("... |
8c159df6-9aa8-4ba5-8ddc-0d1215b32f0f | 3 | private void totalSchedule()
{
System.out.println("Showing the total schedule and scores:");
System.out.println();
try
{
ArrayList<MatchScheduling> matches = matchmgr.viewSchedule();
ArrayList<MatchScheduling> matchesPlayed = matchmgr.viewSchedulePlayed();
... |
a93e0b1b-034c-4cc5-a38f-f96aae67b8b9 | 0 | protected JTable initParseTable() {
tablePanel = new LRParseTablePane(table);
return tablePanel;
} |
57373ea9-8824-4922-92f5-4e7bd2763165 | 4 | public String displayPizzaSize(int pizzaSize){
if (pizzaSize == 0){
pizzaDisplayedSize = "Eight-inch";
} else if (pizzaSize == 1){
pizzaDisplayedSize = "Twelve-inch";
} else if (pizzaSize == 2){
pizzaDisplayedSize = "Eighteen-inch";
} else if (pizzaSi... |
16faed9d-ecea-4d43-8740-bd8515da3f96 | 4 | public List<Menu> getMenus(String title, boolean strict){
List<Menu> menus = new ArrayList<Menu>();
for(Menu menu : this.menus){
if(strict){
if(menu.getTitle().equals(title)){
menus.add(menu);
}
}else{
if(menu.getTitle().equalsIgnoreCase(title)){
menus.add(menu);
}
}
}
return ... |
1920a2d2-3e87-4a7a-8d18-f84d33ea4ad6 | 2 | private boolean jj_3R_69() {
Token xsp;
xsp = jj_scanpos;
if (jj_3_79()) {
jj_scanpos = xsp;
if (jj_3_80()) return true;
}
return false;
} |
afabfd16-96d2-418e-8f40-f5dc4739f16b | 7 | private CtPredicates generatePredicates(String[] predicates) {
if (null != predicates && predicates.length > 0) {
List<String> pList = new ArrayList<String>();
if (predicates.length == 1) {
String p = predicates[0];
if (!LITERAL_PREDICATE_DEFAULT_VALUE.equals(p)) pList.add(p);
} else {
for (Stri... |
e27022e9-c217-4938-86a9-65c2e8a30e29 | 3 | private static Method getMethod(Class<?> cl, String method) {
for(Method m: cl.getMethods()) {
if(m.getName().equals(method)) {
return m;
}
}
return null;
} |
42d89d6c-62cf-45cd-9da1-3fd8859a6e2a | 2 | @Override
public int getValues(Component target, int tweenType, float[] returnValues) {
ThePanel tp = (ThePanel) target;
int ret = super.getValues(target, tweenType, returnValues);
if (ret >= 0) return ret;
switch (tweenType) {
case BORDER_THICKNESS: returnValues[0] = tp.borderThickness; return 1;
... |
c120dd7b-733f-4ab8-aa56-ccd4cd684a7e | 5 | public void showTimedSharkDialogs(){
// sequence to make shark dialogs appear
if (postSharkDialog) {
System.out.println("inside postSharkDialog");
sharkStep += 1;
System.out.println(sharkStep);
switch (sharkStep) {
case 1: {
... |
18f51060-d18c-4e32-9d0f-fbb9b453d6d5 | 2 | @Override
public void process() throws ServletException, IOException {
Integer amount = Integer.valueOf(super.request.getParameter(Attributes.PRODUCT_AMOUNT));
String name = super.request.getParameter(Attributes.PRODUCT_NAME);
Integer id = Integer.valueOf(super.request.getParameter(Attribute... |
c41418b7-4eff-4031-b435-e1da793c1d53 | 8 | @Override
protected void doStep() {
int steps = control.getInt("simulations per height");
if (h > maxH) {
control.calculationDone("max height reached");
return;
}
resize();
double rProb[] = new double[100];
// abort on empty list
for (int j = 0; j < steps; ++j) {
int... |
f6b835df-808d-4ff8-ab93-70ebf992dddb | 9 | @Override
public List<String> fuzzySearch(TrieNode node, String query, int count) throws Exception {
if (query.length() < CRITICAL_FUZZY_LENGTH) {
// TODO: Maybe we do regular search here....
return new ArrayList <String> ();
}
List <String> results = null;
// get all fuzzy wo... |
4990c9d6-70a4-4649-8843-f199d51c6122 | 7 | public void Animate() {
int numfiles = filenames.length;
animationState++;
if (animationState == numfiles) {
animationState = 0;
}
icon = icons[animationState];
if (behavior == CYCLE) {
if (count == length) {
x -= dx * length;
... |
03a8733a-7ff7-441d-bec0-07404650915d | 3 | private static String getLogTypeAsString(final int type) {
switch(type) {
case LOG_WARNING:
return "WARNING";
case LOG_ERROR:
return "ERROR";
case LOG_DEBUG:
return "DEBUG";
default:
return "UNKNOWN";... |
e47a6c59-e3a5-476c-b47b-3bebbe954655 | 9 | * @param client
*/
private void cmd_spawn(final String arg, final Client client) {
Class<?> c = getClass("mud.objects.creatures." + arg);
Creature cre = null;
if( c != null ) {
try {
cre = (Creature) c.getConstructor().newInstance();
}
catch (final InstantiationException e) { e.printStackTrac... |
4076013b-6c92-4eaa-8360-7abf311025c6 | 9 | public boolean isMatch(String s, String p) {
int sizep = p.length();
int sizes = s.length();
if(sizep ==0) return sizes==0;
if(sizes ==0)
{
if(p.charAt(0)=='*')
return isMatch(s, p.substring(1));
else
return false;
}else
{
if(p.charAt(0)... |
c3fc0f38-b9c8-4e2b-afa6-fb29221b65fa | 6 | public static void count(int step, int amountOn) {
copyMatrix();
for (int row = 1; row < 10; row++)
for (int col = 0; col < 10; col++)
if ((m2[row - 1] & (1 << col)) != 0) {
amountOn--;
amountOn += change(row, col, m2);
step++;
m2[row] ^= 1 << col;
m2[row - 1] ^= 1 << col;
}
if... |
fe10aede-1dc7-4189-97db-3c69d49c0f30 | 6 | private Node<T> substituteLookUp(Node<T> parent, Node<T> node) {
if (parent == null || node == null) {
return null;
}
if (node.isLeaf()) {
if (node.equals(parent.getLeft()))
parent.setLeft(null);
else
parent.setRight(null);
return node;
} else if (node.getLeft() == null) {
if (node.equals... |
ee9552e1-bca2-4e7f-947a-842340dff866 | 7 | @SuppressWarnings("deprecation")
public void ReceiverUpdate(SpoutBlock block) {
// Check if block exists
if (!CheckBlock(block)) {
System.out.println("The block doesn't exist, returning!");
return;
}
for (int i = 0; i < spout_Reciever_block.size(); i++) {
// If the receiver block is on the same ... |
ff5aaa1b-7c7a-44b1-bfe4-e59356ec20a3 | 8 | protected int partition(int attIdx, int[] index, int l, int r) {
double pivot = m_Instances.instance(index[(l + r) / 2]).value(attIdx);
int help;
while (l < r) {
while ((m_Instances.instance(index[l]).value(attIdx) < pivot) && (l < r)) {
l++;
}
while ((m_Instances.instance(in... |
750baf34-bd46-4182-a0e7-75453afbef81 | 6 | public org.omg.CORBA.portable.OutputStream _invoke (String $method,
org.omg.CORBA.portable.InputStream in,
org.omg.CORBA.portable.ResponseHandler $rh)
{
org.omg.CORBA.portable.OutputStream out = null;
java.lang.Integer __method = (java.lang.Integ... |
2d25b78a-af74-491f-98c6-6933c1667d2c | 0 | @Override
protected Map<String, Object> getSaveData() {
Map<String, Object> mappings = super.getSaveData();
mappings.put("inheritence", inheritence);
mappings.put("rank", rank);
mappings.put("default", defaultGroup);
return mappings;
} |
00d5c9ed-194d-411a-b745-4daced4434c8 | 8 | static boolean isNight(int sunrise,int sunset,int start,int finish) {
if(start>sunrise&&start<sunset&&finish>sunrise&&finish<sunset)return false;
int cota=start-finish/2+(start-finish)%2;
if(start>sunrise&&start<sunrise)return finish-sunset>=cota;
if(finish>sunrise&&finish<sunset)return sunrise-start>=cota;
r... |
0cefee64-55af-4f99-b93c-5c7b96872636 | 1 | protected boolean isFinished() {
if(_goal < 0) {
return _dist <= _goal;
}
else {
return _dist >= _goal;
}
} |
fcaebe84-1bc4-438a-9af7-6e3ad4a8c353 | 9 | @Override
public Object getValueAt(int row, int col)
{
Order o = info.get(row);
switch (col)
{
case 0 : return o.getOrderName();
case 1 : return o.printDate(o.getDueDate());
case 2 : return o.getSleeve().getMaterial().getName();
case 3 : r... |
cfeccb75-a6c3-4744-938e-16c312564b67 | 4 | private void addSpelToList() {
lblSpelprojektError.setVisible(false);
Spelprojekt chosenProj = (Spelprojekt) cbAvalibleSpelprojekt.getSelectedItem();
DefaultListModel<Spelprojekt> dlm = (DefaultListModel<Spelprojekt>) listChosenSpelprojekt.getModel();
boolean exists = false; // check if ... |
86bbe9fc-c9fc-4133-8396-c48c910cc4de | 2 | public void setAge(int newAge) {
if (newAge > Human.MIN_AGE && newAge < Human.MAX_AGE) {
age = newAge;
}
} |
bd4eb041-571c-4ee8-816b-d44296346391 | 8 | @Override
public void update(GameContainer gc, int delta) throws SlickException {
Input input = gc.getInput();
if(input.isKeyPressed(input.KEY_W)||(input.isKeyPressed(input.KEY_UP))){
game.update_player_location(game.getX_loc(), game.getY_loc()-1);
}
if(input.isKeyPressed(input.KEY_A)||(input.isKey... |
ad29f710-06f3-4f63-a4bf-78a062804e1d | 4 | public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
StringBuilder sb = new StringBuilder();
int times = scan.nextInt();
f: for (int i = 0; i < times; i++) {
int l = scan.nextInt();
int k = scan.nextInt();
int[] array = new int[l];
for (int j = l - k; j < array.length; j++... |
7035dece-7669-4a57-bdd7-0491cc64ab0b | 0 | public boolean isEmpty() {
return size == 0;
} |
0f968ddc-d0ad-4859-9aa1-8ccb6956a1ec | 8 | public Tile(String t) {
setPreferredSize(SIZE);
setSize(SIZE.width, SIZE.height);
setOpaque(false);
if (t.equals("Bamboo") || t.equals("Chrysanthemum")
|| t.equals("Orchid") || t.equals("Plum")) {
t = "flower";
}else if(t.equals("Fall") || t.equals("Spring")
|| t.equals("Winter") || t.equals("Summ... |
76dc7de3-4d2e-4a1d-8b7f-af5d74d6bdee | 9 | public static void main(String[] args) {
Scanner keyboard = new Scanner(System.in);
Dice w1[] = {new WeaselFolk(),new AntelopeFolk(),new FalconFolk(),new HoundFolk(),new LynxFolk(),
new BadgerFolk(),new HorseFolk(),new HawkFolk(),new FoxFolk(),new LeopardFolk(),
new WolverineFolk(),new BuffaloFolk(),new Vul... |
201c8bc4-5896-4245-b1b2-d9a6add91539 | 9 | private static void validate(Class target,
String[] getters,
String[] setters,
Class[] types,
Method[] getters_out,
Method[] setters_out) {
int i =... |
9f6c6aed-925f-49b1-9aae-b6757a8f391b | 9 | public static LocalTime parse(CharSequence text) {
int length = text.length();
int errorIndex = 0;
Throwable cause = null;
try {
// "HH:mm".length() == 5, "HH:mm:ss".length() == 8, "HH:mm:ss.SSS".length() == 12,
// "HH:mm:ss.SSSSSS".length() == 15, "HH:mm:ss.SSSSSSSSS".length()==18
if... |
d0c1bbc3-9b47-4ba0-b1e3-a86a7a8c16db | 5 | public void readHistory(DataInput input) {
try {
int unused = input.readInt(); // VERSION == 1
int chainCount = input.readInt();
for (int i = 0; i < chainCount; ++i) {
int filterCount = input.readInt();
JList filterList = createJList();
... |
a801b4cc-530c-4cf2-bc2c-d41b06adf9fa | 4 | public static String[] generateInitialData(final int towerNumber, final int gsmCalls) {
List<Future<String>> futures = new ArrayList<>();
ExecutorService threadPool = Executors.newFixedThreadPool(2);
futures.add(threadPool.submit(new Callable<String>() {
@Override
... |
2b6e5b4b-fc00-4384-9193-7041af2706b1 | 0 | public void setHasBeenRemoved(boolean removed) {
this.hasBeenRemoved = removed;
} |
6117afba-5680-4b33-aeed-fbd1efbe37e8 | 2 | private void setInactiveIfExpired() {
if (whenStarted != NEVER && timeElapsed() > seconds)
whenStarted = NEVER;
} |
7c2f7fc8-47f7-49e4-bfa3-ba7883a06a57 | 4 | @Override
public boolean containsValue(Object value) {
for(LinkedList<MapEntry<K, V>> bucket : buckets) {
if(bucket != null) {
for(MapEntry<K, V> iPair : bucket) {
if(iPair.getValue().equals(value)) {
return true;
}
... |
89348195-694d-430d-8b96-33805b568716 | 3 | public void insertAsc(String token, List<String> l) {
int pos = 0;
while (pos < l.size()) {
if (token.compareTo(l.get(pos)) < 0) {
l.add(pos, token);
return;
} else if (token.compareTo(l.get(pos)) == 0) {
return;
}
pos++;
}
l.add(token);
} |
975e506b-172d-4dba-9e46-d24f22d55f48 | 8 | public void calculateNewPath()
{
if (queueTiles.size() == 0) return;
Tile t = queueTiles.get(0);
if (!owner.isWar(t.owner) && !owner.isOpenBorder(t.owner) && !owner.equals(t.owner))
{
queueTiles.clear();
}
for (int i = 0; i < queueTiles.size(); i++)
{
if (!owner.isWar(queueTiles.get(i).owner) && !o... |
18678136-0c66-46a3-8d29-696dead6cc83 | 8 | private void processMouseActivity(int button, int xPosScaled, int yPosScaled, int modifiers) {
if (button == MouseEvent.BUTTON1 || button == MouseEvent.BUTTON3) {
if (xPosScaled < 0 || xPosScaled >= currentScaledWidth) {
// ignore it
return;
}
... |
63e2f040-a874-42f2-a0df-eb11fe63f293 | 0 | public boolean GetEmpty()
{
return empty;
} |
f8e775ad-e6bb-4b22-9851-dd2c04f8c50c | 8 | private void loadingStages() {
if(lowMem && loadingStage == 2 && ObjectManager.anInt131 != plane) {
inGameScreen.initDrawingArea();
aTextDrawingArea_1271.drawText(0, "Loading - please wait.", 151, 257);
aTextDrawingArea_1271.drawText(0xffffff, "Loading - please wait.", 150, 256);
inGameScreen.drawGraphics... |
ac643c41-7dac-4ea6-a44f-9e32c91da26f | 1 | protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
response.setCharacterEncoding("UTF-8");
request.setCharacterEncoding("UTF-8");
String msj_exito = "Catá... |
b297a88d-3a58-41c4-be5e-4f359a7773ec | 9 | @Override
public void run(){
System.out.println("Session started");
try{
ObjectInputStream ois = new ObjectInputStream(socket.getInputStream());
ObjectOutputStream oos = new ObjectOutputStream(socket.getOutputStream());
while (true){
Object reques... |
12f555d5-e270-48bd-b836-3f0626d5fd97 | 8 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final MOB target=this.getTarget(mob,commands,givenTarget);
if(target==null)
return false;
if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
return false;
if((!auto)&&(target.charSt... |
7c5e7546-aec8-475b-87b6-f5246145ea6b | 6 | public int computeEditDistance(String s1, String s2) {
s1 = s1.toLowerCase();
s2 = s2.toLowerCase();
int[] costs = new int[s2.length() + 1];
for (int i = 0; i <= s1.length(); i++) {
int lastValue = i;
for (int j = 0; j <= s2.length(); j++) {
if (i... |
df8e3b32-2fe4-4b69-9e52-1edad8667ae2 | 8 | public HashMap CountStateGridCase(BOLObject obj, MainFrame frame){
this.obj = obj;
this.frame = frame;
int temp;
caseCount.put(Etat.vide, 0);
caseCount.put(Etat.jeunePousse, 0);
caseCount.put(Etat.arbuste, 0);
caseCount.put(Etat.arbre, 0);
caseCount.put(Et... |
500df780-6b44-49ca-9e02-d4c07010ddb9 | 6 | private void generateChiasma(int a, double chiasmaDist) {
assert(!crossoverFinished);
assert(!armFinished[a]);
assert(slots.length==8);
//select two of the four slots (chromatids) in this arm for chiasma formation:
chromatid[0] = arm[a][rand.nextInt(2)];
chromatid[1] = ar... |
4e721759-8739-46f9-9525-b6fe61ee71e3 | 9 | public Expr evaluate(IEvaluationContext context, Expr[] args)
throws ExprException {
assertArgCount(args, 2);
ExprArray array1 = asArray(context, args[0], false);
ExprArray array2 = asArray(context, args[1], false);
if (array1.length() != array2.length())
return ... |
ad91effc-fa8e-41c3-b5f0-cd4505236927 | 6 | public int[] getEnemyDanger(LevelEntity[][] level){
int[] dangerArray = new int[level.length];
Arrays.fill(dangerArray, Integer.MAX_VALUE);
int distanceFromEnemy = level.length;
for (int xx = 0; xx < level.length; xx++){
for (int yy = 0; yy < level[0].length; yy++){
if (level[xx][yy] == LevelEntity.Enemy... |
476601e3-2b4f-4c0d-bd48-f90b7ac89044 | 3 | public RobotListener() {
mapping = new HashMap<>();
for (int i = 0; i < 20; i++) {
int value = GamepadManager.getMapping("button." + i);
if (value != Integer.MIN_VALUE) {
mapping.put(i, value);
}
}
try {
robot = new Robot();
} catch (AWTException e) {
throw new RuntimeException(e);
}
} |
586f021f-59f4-412c-b9ac-c8dbc09159f5 | 9 | public static void main(String args[]) {
int month = 4;
String season;
switch (month) {
case 12:
case 1:
case 2:
season = "Winter";
break;
case 3:
case 4:
case 5:
season = "Spring";
break;
case 6:
case 7:
case 8:
season = "Summer";
break;
case 9:
case 10:
case 11:
seas... |
69cd27ca-3852-44dc-aaf4-ea57ebf7ea65 | 8 | @SuppressWarnings("deprecation")
public static void main(String[] args) {
try {
CsvReader trips = new CsvReader("C:\\Users\\ThejaSwarup\\Box Sync\\Fall 2014\\CS 424\\Project2\\InputFiles\\trips_updated.csv");
String allHours = "C:\\Users\\ThejaSwarup\\Box Sync\\Fall 2014\\CS 424\\Project2\\TempFiles\\Temp1... |
f326fb1f-2e95-4cf8-8bd8-125c72fd3ca5 | 2 | private void byDepth(BinaryTree node) {
System.out.print(node.getValue() + " ");
if (node.left != null)
byDepth(node.left);
if (node.right != null)
byDepth(node.right);
} |
7bd02586-0d5a-48b3-861b-cf94f096a95e | 9 | public static int getFinalSpeed(Pokemon poke, Field field)
{
double speed = poke.getStats()[5] * poke.getBoosts()[4];
String id = poke.getItem().getID();
if(id.equals("choicescarf"))
speed = Math.floor(speed * 1.5);
else if(id.equals("machobrace") || id.equals("ironball"))
speed = Math.floor(speed / 2... |
c3815fe2-1f05-424e-a275-be437e662e25 | 8 | public void processData(ArrayList<ArrayList<String>> data) throws FileNotFoundException{
for(int i = 0; i < data.size(); i++){
if(data.get(i).get(0).equals("IOMATCH")){
data.get(i).remove(0);
processIO(data.get(i));
}
else if(data.get(i).get(0).equals("LABELMATCH")){
data.get(i).remove(0);
pr... |
453edf8c-d02e-4b42-b1e6-718df00dbf4d | 9 | public void updateArrowCellBox()
{
Cell tempCell;
up(0);
right(0);
down(0);
left(0);
for(int i = 0 ; i < graph().cellSize() ; i++)
{
tempCell = graph().cell(i);
if(tempCell.y()-y()+2>up())
up(tempCell.y()-y()+2);
if(tempCell.y()-y()-2<down())
down(tempCell.y()-y()-2);
... |
6d033a05-804c-46f1-802c-cfb4b4f82a2e | 9 | private void decodeHeader(BufferedReader in, Map<String, String> pre, Map<String, String> parms, Map<String, String> headers)
throws ResponseException {
try {
// Read the request line
String inLine = in.readLine();
if (inLine == null) {
... |
7bdbe3bb-7e4a-40f1-b852-5bbe6bfaef24 | 7 | @SuppressWarnings({ "unchecked", "rawtypes" })
protected static Map<String,Map<String,String>> getPlaneMap()
{
Map<String,Map<String,String>> map = (Map)Resources.getResource("SKILL_PLANES_OF_EXISTENCE");
if(map == null)
{
map = new TreeMap<String,Map<String,String>>();
CMFile F=new CMFile(Resources.makeF... |
f6844acd-c2be-4471-a15d-689cba3d078a | 5 | public static void main(String[] args) {
String fileName = "F:\\tmp\\web.sub.yy.com.log.1";
Pattern pattern = Pattern.compile("(\\[.*?\\]).*?GET /fans/invite/index.*?HTTP/1.1 200 ([\\d]*) [\\d]* ([\\d]*)");
FileReader fr = null;
BufferedReader br = null;
try {
fr = new FileReader(fileName);
br = new Buf... |
16f0c35b-764e-47c6-b171-3f5f1c513bc7 | 5 | public static String toString(TicTacToeBoard board)
{
StringBuffer sb = new StringBuffer("");
for (int i = 0; i < TicTacToeBoard.ROW_COUNT; i++)
{
for (int j = 0; j < TicTacToeBoard.COLUMN_COUNT; j++)
{
Mark mark = board.getMark(i, j);
String string = (mark == null ? " " : mark.toString());
sb.... |
42984b9a-f207-49c8-923a-aa814592b4df | 1 | public String nextValue() throws IOException {
if (labels == null) setLabels();
String nextValue = parse.nextValue();
nextValueLine = getLastLineNumber();
return nextValue;
} |
01a6184e-04cb-4349-9111-e29a0cf3cd59 | 5 | public static void playerMove() {
boolean c = false;
while (!c) {
System.out
.println("Ход Романа\nВведите, сколько спичек выберете?\nОт 1 до 3");
if (sc.hasNextInt()) {
scan = sc.nextInt();
if (scan > spichki) {
System.out
.println("Вы не можете взять больше спичек, чем имеется на... |
f75856e0-c3ca-4e2f-bf55-38e44bf1b4a8 | 6 | public boolean equals(Object obj) {
if (obj instanceof Pair) {
return ((Pair<?,?>) obj).second.equals(second) &&
((Pair<?,?>) obj).second.equals(second);
}
return false;
} |
66a086fe-7278-422f-9556-9ea3605d6574 | 6 | private void addQualifiers(List<Class<? extends Enum<?>>> allQualifiersSorted, Element schemaEl) throws DOMException {
for (Class<? extends Enum<?>> qualClass : allQualifiersSorted) {
Element simpleTypeEl = schemaEl.getOwnerDocument().createElement("xs:simpleType");
schemaEl.appendChild(... |
6d5c8f39-5ec3-4815-9e76-f62993e17ea6 | 0 | public void init() throws ServletException {
// Put your code here
} |
9a2ef50b-9989-4aa1-957d-cfbfa48c87af | 5 | private void select(String comm) {//zapytania
String log = "Select: " + comm;
if(comm == null) {
logger.log(Level.WARNING, "MySQLHandler: query == null");
return;
}
if(st == null) {
logger.log(Level.WARNING, "MySQLHandler: Statement =... |
7b88e512-ae87-4260-8cca-0aa36f7ee8f8 | 7 | @EventHandler
public void onPlayerDeath(PlayerDeathEvent event) {
Player player = event.getEntity().getPlayer();
Player killer = event.getEntity().getKiller();
// プレイヤー以外に殺された場合はなにもなし
if (!(killer instanceof Player))
return;
// 死んだ人がエネミーだった場合
if (plugin.enemyMap.containsKey(player.getName())) {
ev... |
29cf70a9-6c1f-4a51-b63c-630afd1fbb91 | 4 | public boolean exists(int gridX,int gridY){
if(gridX>0&&gridX<Screen.land[1].length&&gridY>0&&gridY<Screen.land.length){
return true;
}
else return false;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.