method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
d53e68a0-40d0-45f4-8283-cd349f913dad | 5 | private boolean jj_3R_52()
{
if (jj_scan_token(WHILE)) return true;
if (jj_3R_9()) return true;
if (jj_scan_token(DO)) return true;
if (jj_3R_9()) return true;
if (jj_scan_token(END)) return true;
return false;
} |
311f7cab-9cb5-499f-988a-b96c3a34953c | 7 | private void setProperFallingAnimation() {
if (facing == -1) {
if (fallTime <= 600) {
if (!getCurrentAnimation().equals(Characters.JUMP_LEFT)) {
setCurrentAnimation(Characters.JUMP_LEFT);
}
return;
}
if (!getCurrentAnimation().equals(Characters.IDLE)) {
setCurrentAnimation(Characters.IDL... |
35204b36-f90e-4c6b-b934-6051ef2e55fe | 1 | public ReceiveTCP(Socket s){
socket = s;
try {
in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
} catch (IOException e) {
System.err.println("Le serveur distant s'est déconnecté !");
}
} |
1e5e2a91-0e22-45ba-ac0d-52b8c54c0365 | 6 | public static int divide(int a, int b){
boolean negative = false;
if(a<0 && b<0) negative = false;
else if(a<0||b<0) negative = true;
a = Math.abs(a);
b = Math.abs(b);
int prod = 0;
int result = 0;
while(prod + b <= a){
prod += b;
result++;
}
if(negative) result = negate(result);
retur... |
d1c02748-b9cd-4ed1-bacb-5be4ef7bc1ae | 8 | public void initGraph(String path){
BufferedReader file ;
String line;
String name, id;
int y = 0;
try
{
file = new BufferedReader(new FileReader(path)) ;
while ((line = file.readLine()) != null)
... |
70b6306b-e328-4ae6-8ef6-9541c93daf3f | 2 | public <L extends Layer> Collection<L> layers(Class<L> cl) {
checkerr();
Collection<L> ret = new LinkedList<L>();
for (Layer l : layers) {
if (cl.isInstance(l))
ret.add(cl.cast(l));
}
return (ret);
} |
2ddcf56f-811d-438a-bad2-168d7b603cfe | 5 | public boolean checkBulletCollision(Bullet bullet){
int xIndex = (int) (bullet.getMovedX() / GRID_SIZE);
int yIndex = (int) (bullet.getMovedY() / GRID_SIZE);
if(xIndex < 0 || yIndex < 0)
return true;
if(grid.size() <= yIndex || grid.get(yIndex).size() <= xIndex)
return true;
if(grid.get(yInd... |
66175064-1ec6-4ca3-8eac-dc0e1c264137 | 6 | public void kill(){
main.removeBody(getBody());
//spawn particle effect
switch(type){
case BOULDER:
new Particle(main, getPixelPosition().x, getPixelPosition().y,
"rock_break", facingLeft);
break;
case ELECTRO_BALL:
new Particle(main, getPixelPosition().x, getPixelPosition().y,
"dissip... |
1d99f2f9-87b2-4b84-b41d-b30062825152 | 6 | public static void resetDatabase() {
try {
Statement stmt = con.createStatement();
BufferedReader bufRead = new BufferedReader(new FileReader("setup.sql"));
String line;
String command = new String();
while ((line = bufRead.readLine()) != null) {
line = line.trim();
if (line.startsWith("--"))
... |
d07935a0-2ae5-4d14-8f46-f9b6b5a8dcbe | 0 | public String getName() {
return this.name;
} |
d9fd204c-3b2f-4a77-abbf-ad5b68b65478 | 4 | private static int wallToRemove(int sq1x, int sq1y, int sq2x, int sq2y)
{
if (sq1x < sq2x)
return Utils.RIGHT;
else if (sq1x > sq2x)
return Utils.LEFT;
else if (sq1y < sq2y)
return Utils.DOWN;
else if (sq1y > sq2y)
return Utils.UP;
else
return 0;
} |
06bbc889-c6d5-4a47-b396-08efa4c0572d | 2 | public boolean releaseLocation(long actor) {
for(EnemyLocation loc : enemyLocations) {
if(loc.release(actor)) {
freeLocations++;
return true;
}
}
return false;
} |
2694dde2-dc46-471d-b6a5-00fba1165b95 | 5 | static final void method1308(int i, int i_14_, int i_15_, int i_16_,
byte i_17_, int i_18_, int i_19_, int i_20_) {
anInt5072++;
if (Class369.anInt4960 <= i_15_ && i_19_ <= Class113.anInt1745
&& i_14_ >= Class132.anInt1910 && Class38.anInt513 >= i_20_)
Class239_Sub3.method1730(i_16_, i_20_, i_14_, i_19... |
2f2cb201-6a8e-493b-b976-bc42d0337213 | 1 | public static void removeRequest(FriendRequestMessage friendRequest) {
try {
String statement = new String("DELETE FROM " + DBTable + " WHERE uid1 = ? and uid2 = ?");
PreparedStatement stmt = DBConnection.con.prepareStatement(statement);
stmt.setInt(1, friendRequest.fromUser);
stmt.setInt(2, friendRequest... |
8d664bfa-c862-4278-8296-bc99bf18de5c | 6 | public void setMaxValue(double maxValue, boolean filterArchivedValues)
throws IOException, RrdException {
double minValue = this.minValue.get();
if(!Double.isNaN(minValue) && !Double.isNaN(maxValue) && minValue >= maxValue) {
throw new RrdException("Invalid min/max values: " + minValue + "/" + maxValue);
}
... |
df0b874c-4c4b-4a2f-a236-c078cbc31acb | 7 | public void run() {
try {
connect();
} catch (IOException e) {
try {
reconnect();
} catch (InterruptedException | IOException e1) {
showLevelMessage(ERROR, "Cannot connect to: " + getServer());
}
}
while (get... |
9ba0196f-d827-4b73-8b89-46dde6708283 | 4 | public String getValue() {
if (value == null) {
//check all possible default values
for (int i = 0; i < env.length; i++) {
if (System.getProperty(env[i]) != null) return System.getProperty(env[i]);
if (System.getenv(env[i]) != null) ret... |
f86dccaa-6165-4eff-bc8f-60ecceab6dfd | 7 | public boolean degradeCompletly(Item item) {
int defaultCharges = ItemConstants.getItemDefaultCharges(item.getId());
if (defaultCharges == -1)
return false;
while (true) {
if (ItemConstants.itemDegradesWhileWearing(item.getId())
|| ItemConstants.itemDegradesWhileCombating(item.getId())) {
charges.r... |
d9a85a3b-85ab-4d12-a7c3-1298e562aef0 | 0 | public Human get(int index) {
return humans[index];
} |
4e856e61-8f26-4a99-93d3-35a715910127 | 5 | public void load(Minecraft mc, MinecraftClass mcClass)
{
Class<?> clazz = mcClass.getClazz();
try
{
property = clazz.getDeclaredField(internalName);
String propType = property.getType().getName();
if (propType.contains("."))
{
S... |
b984230e-98fa-4bf3-90fe-af920a7c63a8 | 7 | VectorDisplay(Frame owner) {
super(owner, "Customize Vector Display", false);
setResizable(false);
setSize(400, 400);
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
JPanel p = new JPanel(new GridLayout(2, 2, 5, 5));
comboBoxLineWidth = new JComboBox();
comboBoxLineWidth.setRenderer(new ComboBoxRenderer.Li... |
91977cfa-2e60-4c54-bbb5-34445cb43e55 | 6 | public static int dehexchar(char c) {
if (c >= '0' && c <= '9') {
return c - '0';
}
if (c >= 'A' && c <= 'F') {
return c - ('A' - 10);
}
if (c >= 'a' && c <= 'f') {
return c - ('a' - 10);
}
return -1;
} |
b12831c8-bf71-4f62-bc0c-3249f00b7268 | 0 | @Override
public void reSize(long newMaxSize) {
// TODO Auto-generated method stub
}; |
7396efc4-b172-40c4-82ed-9bf6559be3f8 | 8 | @Override
public boolean isValidClassDivider(MOB killer, MOB killed, MOB mob, Set<MOB> followers)
{
if((mob!=null)
&&(mob!=killed)
&&(!mob.amDead())
&&((!mob.isMonster())||(!CMLib.flags().isUndead(mob)))
&&((mob.getVictim()==killed)
||(followers.contains(mob))
||(mob==killer)))
return true;
retur... |
5568144e-3479-46ec-aa93-821bf99617e1 | 0 | public String getFunctionName() {
return environmentStack.peek().getFunctionName();
} |
a4d42b36-45e3-454c-8b74-ad708b1dd0da | 8 | private static String escapeJSON(String text) {
StringBuilder builder = new StringBuilder();
builder.append('"');
for (int index = 0; index < text.length(); index++) {
char chr = text.charAt(index);
switch (chr) {
case '"':
case '\\':
... |
fb1470f0-0486-41a6-915f-1254fb8586f0 | 9 | protected String getUserAccessToken()
{
// first, consider a signed request if it's supplied.
// if there is a signed request, then it alone determines
// the access token.
String code;
String access_token;
JSONObject signed_request = getSignedRequest();
if (signed_request != null)
{
... |
6db6d863-dbae-4f02-9066-2a57cf350431 | 2 | public <K, T>
Map<K,T> executeQueryForKeyMappedList(SelectQuery<T> query, boolean sorted) throws DatabaseManagerException {
Connection conn = null;
ResultSet resultSet = null;
PreparedStatement stmt = null;
try {
conn = connectionProvisioner.getConnection();
stmt = query.toPreparedStatement(conn);
log... |
7a34e5c3-3ab9-4d8d-9947-6dc5b5263670 | 2 | public static void processSphereSphereCollision(RigidBody sphere1,
RigidBody sphere2, double restitution, double timeStep) {
// Predicted positions
Vector3d sphere1Position = new Vector3d();
Vector3d sphere2Position = new Vector3d();
Quat4d planeRotration = new Quat4d();
Quat4d sphereRotration = new Quat4... |
08676092-5120-4ddf-91e4-950ab3f91e8c | 8 | protected void initNameNTypeFromInfoFile(URL url) throws MaltChainedException {
if (url == null) {
throw new ConfigurationException("The URL cannot be found. ");
}
try {
JarEntry je;
JarInputStream jis = new JarInputStream(url.openConnection().getInputStream());
while ((je = jis.getNextJarEntry()) ... |
8f00ffb6-67de-4c17-9380-7dfabc93e43a | 2 | public Map<Coordinate, Piece> getPiecesMap() {
Map<Coordinate, Piece> map = new HashMap<Coordinate, Piece> ();
for (int i = 0; i < NUMBER_OF_COLS; i++) {
for (int j = 0; j < NUMBER_OF_ROWS; j++) {
Piece piece = getPiece(i, j);
map.put(new Coordinate(i, j), piece);
}
}
return map;
} |
eaef0dad-6879-48c0-b8e7-3aef3080288e | 8 | public List<Integer> segmentSoe(int start, int end) {
//Initialize array.
List<Element> allNumbers = new LinkedList<Element>();
//Populate with all numbers from start to end.
for (int i=start; i<=end; i++)
allNumbers.add(new Element(i, false));
int N = (int) Math.sqr... |
760d72c0-9aaa-48da-a647-d2e2062b64bd | 6 | public synchronized boolean enque(Packet pnp)
{
double pb;
double avgQueueSize = avgQueueSize();
//System.out.println(super.get_name() + ": enque. MIN_TH: " + MIN_TH);
if ((MIN_TH <= avgQueueSize) && (avgQueueSize < MAX_TH))
{
// when the avgQueueSize is between... |
4f6c1c66-a96c-46cb-a995-b17c0af388ab | 4 | @Test
public void testBFSGraph() throws IOException {
HashMap<String,String[]> fromTo = new HashMap<String,String[]>();
setUp();
fromTo.put("results_wolfeb_178816527_178816525_1_bfs.txt", new String[]{"178816527", "178816525"});
fromTo.put("results_wolfeb_330767681_178817851_1_bfs.txt", new String[]{"330767... |
8518b58e-9ace-4579-b42b-d6eb8901683d | 1 | @RequestMapping(value = "/before-event-comment-list/{hallEventId}", method = RequestMethod.GET)
@ResponseBody
public EventCommentListResponse afterEventCommentList(
@PathVariable(value = "hallEventId") final String hallEventIdStr
) {
Boolean success = true;
String errorMessage = ... |
7925a669-eb68-446e-82b8-430f54484b8d | 2 | public static int indexOfControl(String text)
{
int charAt = 0;
charAt = text.lastIndexOf(CONTROL_1);
if (charAt == -1)
{
charAt = text.lastIndexOf(CONTROL_2);
if (charAt == -1)
{
charAt = text.lastIndexOf(CONTROL_3);
}
}
return charAt;
} |
ec1719ce-fe94-423b-9a6e-b61645c4bb82 | 1 | public void escribirComprasXStream(String rutaFichero, LinkedHashMap<Integer, Compra> compras) {
XStream xstream = new XStream();
rutaFichero = rutaFichero + ".xml";
try {
xstream.toXML(compras, new FileOutputStream(rutaFichero));
} catch (Exception e) {
//e.print... |
da7a7276-114a-4add-ae4e-39bc0c51970e | 9 | @Override
public void endElement(String uri, String localName, String qName)
throws SAXException {
if (!inJavaElem) {
return;
}
if ("java".equals(qName)) { //$NON-NLS-1$
inJavaElem = false;
return;
}
... |
3b13e61c-c1b4-41fa-b5f5-43cf3e2bec03 | 7 | boolean isSpecTerminator(int tok) {
switch (tok) {
case Token.nada:
case Token.slash:
case Token.opAnd:
case Token.opOr:
case Token.opNot:
case Token.percent:
case Token.rightparen:
return true;
}
return false;
} |
e87c0271-c7d2-4435-9326-3b85343da0ae | 9 | private byte[] loadImage(String imgPath) {
byte tableAr[] = new byte[LedTable_Settings.ledX * LedTable_Settings.ledY * 3 + 1];
tableAr[0] = (byte)'4';
try {
URL fileURL = new File(imgPath).toURI().toURL();
BufferedImage img = ImageIO.read(fileURL);
int cell = 1;
for (int y = 0; y < img.getHeigh... |
6d80337e-e87c-4d63-aa57-fc5836c03008 | 8 | private Component cycle(Component currentComponent, int delta) {
int index = -1;
loop : for (int i = 0; i < m_Components.length; i++) {
Component component = m_Components[i];
for (Component c = currentComponent; c != null; c = c.getParent()) {
if (component == c) {
index = i;
break loop;
}
... |
4ca3353d-db46-42b0-a0c0-52cfb7737583 | 5 | public void update(double timeSinceLastFrame) {
aniTime += timeSinceLastFrame;
if (aniTime >= NEEDEDANITIME) {
aniTime = 0;
}
posx += -100 * timeSinceLastFrame;
if (posx <= -getLook().getWidth()) {
posx = 800;
posy = r.nextInt((600 - getLook().getHeight()));
alive = true;
}
for (int i = 0;... |
256d45a3-3d74-4df0-b83a-5486d5475886 | 1 | private void placePiecePair(PieceType type, int column) {
final ChessPiece whitePiece = ChessPiece.from(PieceColor.WHITE, type);
final ChessPiece blackPiece = ChessPiece.from(PieceColor.BLACK, type);
final int edgeOffset;
if (type == PieceType.PAWN) {
edgeOffset = 1;
... |
0b27828f-577a-44e8-9e64-a456df6cbc8b | 3 | static public void ignoreBeaconManager(int ignoreAgentNum){
if( ignoreAgentNum > -1 )
ReceiverThread.ignoreBrokerList.add(ignoreAgentNum);
else
{
if(ReceiverThread.ignoreBrokerList.isEmpty())
{
System.out.println("List of ignoreBrokerAgent is EMPTY ");
}
else
{
for(int i : ReceiverThread... |
5cd9618d-fd19-4abd-a876-978f31be2ffd | 9 | public Long putFeed (String message, String title, String actionTargetUrl, String imageUrl, String description, String subtitle, String actionName, String targetUrl) throws RennException {
Map<String, String> textParams = new HashMap<String, String>();
if (message != null) {
textParams.put(... |
d9a01527-f8d7-4230-8e69-98ebf000847c | 3 | public void doMutation() {
if (this.charCount == 1) {
this.mutations.add(Character.toString(charArray[0]));
} else {
this.charTail = this.charArray[this.charCount - 1];
stringMutation newObj = new stringMutation(this.charArrayNoTail, this.charCountTail);
newObj.doMutation();
for (String s : newObj.mu... |
40d7ea1b-12c1-4916-b810-4ee735ddc1ac | 9 | @SuppressWarnings({"unchecked"})
public static <K, V> Map<K, V> generateMapField(Class<K> keyType, Class<V> valueType) {
Random random = new Random(987654321L);
Map<K, V> map = new HashMap<K, V>();
for (int i = 0; i < 20; i++) {
K key = null;
if (keyType == String.cla... |
03479764-2968-48be-8c92-b2824959d193 | 4 | @SuppressWarnings("unused")
private static void monitorThreads()
{
new Thread("monitoring thread")
{
public void run()
{
while(true)
{
System.out.println(" ");
System.out.println("----------------------");
System.out.println(" ");
System.out.println("monitoring: ");
Se... |
ebcfa050-728c-41cd-9dbe-503a947f558a | 8 | public void EdgeBetweenness(HierarchicalUndirectedGraph hgraph){
Integer nodeCount = hgraph.getNodeCount();
Integer edgeCount = hgraph.getEdgeCount();
// int count = 0;
for (Node s : hgraph.getNodes()) {
Stack<Node> S = new Stac... |
f4ec1349-c5f7-4ef8-9436-fa3c4132a2d1 | 8 | @Override
public void mouseClicked(MouseEvent e)
{
// If this is the first time a position is selected
// and there is a legitimate piece, then mark it
if (from == null)
{
ChessPosition pos = getChessPositionFromClick(e);
ChessPiece p = pieceAt(pos);
if (p == null)
return;
setPieceToMove(p);... |
2636df3d-22b7-42d0-82f3-1af5cd716d7b | 7 | public Changes syncFilesTo(Archive archive, IO sink) throws IOException {
sink.startSync(getKeys(mNameToFileDigest));
HashMap<String, LinkDigest> oldMap = new HashMap<String, LinkDigest>(sink.getFiles());
// Hack so we don't sha1 hash files which are going to be deleted.
Set<String> d... |
64599285-7615-487b-b3f9-9b718c73f6df | 2 | @SuppressWarnings("unchecked")
public synchronized void deleteNodes(String key, List<Long> ids){
for (Long id : ids){
NodeOsm node = ((NodeOsm) getKeyFromValue((Map< String, Map <Object, Long>>) ((Object)totalNodes), key, id));
totalNodes.get(key).remove(node);
for (WayOsm w : totalWays.get(key).keySet()... |
eb39ce7a-ab8e-4e57-b09c-0315265466cd | 2 | public PecaEstoque buscaPeca(long id) {
for (PecaEstoque a : pecas) {
if (a.getPeca().getId() == id) {
return a;
}
}
return null;
} |
dde995ce-553c-45fa-9ea2-72be97d9b595 | 6 | public static void main(String[] args) throws IOException {
Scanner invoer = new Scanner(System.in);
boolean incorrect;
String invoerVerjaardag, invoerInterval;
String[] arrayVerjaardag, arrayInterval;
int jaarInterval1, jaarInterval2;
int dag = 0, maand = 0, jaar = 0;
System.out.println
("Dit program... |
a725db3f-783a-452e-99fe-0dd954948eba | 9 | public static void onDone(Player player) {
// get the various meta datas
String mlText = "";
for(MetadataValue val: player.getMetadata("mleText")) {
mlText = val.asString();
break;
}
MultilineChatHandler mlOnDone = null;
for(MetadataValue val: player.getMetadata("mleOnDone")) {
// see if it's ours
... |
7008e64c-47b5-4141-8f9c-91f1cd946f5d | 6 | public static void choice(int number, int choice) {
if (choice > 4 || choice < 1) {
System.out.println("Invalid Choice.");
main(null);
return;
} else {
Number n = new Number(number);
switch (choice) {
case 1:
System.out.println("The units digit is " + n.getUnits());
break;
case 2:
S... |
6649d206-7e54-4cd8-be49-535ee8cd60b2 | 8 | @Override
public void campoCambio(JTextField e) {
if(e == this.cajaApellidoMaterno){
if(this.cajaApellidoMaterno.getText().equals("")) this.consulta.setApellidoMaterno(null);
else this.consulta.setApellidoMaterno(this.cajaApellidoMaterno.getText());
this.respuesta = control.getAlumnos(this.consulta);
thi... |
84645112-09fc-4a64-826e-b2ff18a374d0 | 4 | @Override
public void mouseMoved(MouseEvent e) {
if(isEmpty() || !ElementGroup.this.getBoundsAsRect().contains(e.getPosition())) {
return;
}
for(UIElement ui : uiElements) {
if(ui.getBoundsAsRect().contains(e.getPosition())) {
setSelection(ui);
e.consume();
return;
}
}
... |
0cf2d37e-074d-423f-b616-c56c1428ff07 | 1 | public Row[] getPath() {
ArrayList<Row> list = new ArrayList<>();
Row parent = mParent;
list.add(this);
while (parent != null) {
list.add(0, parent);
parent = parent.mParent;
}
return list.toArray(new Row[0]);
} |
b3db9af7-d39e-45a6-8cb2-85050bef7938 | 5 | public ThinkTankGUI(String host, int port) {
try {
setTitle("Think Tank");
setDefaultCloseOperation(EXIT_ON_CLOSE);
setSize(Settings.GUI_WIDTH, Settings.GUI_HEIGHT);
setLocationRelativeTo(null);
setVisible(true);
setResizable(false);
this.addWindowListener(new java.awt.event.WindowAdapter() {
... |
230711dc-8175-4a26-82a0-d0f444e8c160 | 6 | public void setOutputReadData(){
if(!_inputMemRead && !_inputMemWrite){
_outputReadData = _inputAddress;
_lastChanged = -4;
}else if(_inputMemRead && !_inputMemWrite){
_outputReadData = loadWord();
_lastChanged = -4;
}else if(!_inputMemRead && _inputMemWrite){
storeWord();
_lastChanged = _inputA... |
b666255f-036c-4c70-a02c-1a392f013348 | 8 | public void receivePacket(Packet packet)
{
//I cant be bothered with ARP packets
if(!(packet instanceof ARPPacket))
{
if(packet instanceof TCPPacket)
{
String data = new String(packet.data);
String[] lines = data.split("\n");
... |
6373359f-e6a9-405b-afe3-14e90866f4f1 | 1 | public void visitInstanceOfExpr(final InstanceOfExpr expr) {
if (expr.expr == from) {
expr.expr = (Expr) to;
((Expr) to).setParent(expr);
} else {
expr.visitChildren(this);
}
} |
a4fb604e-be57-4a4a-884a-10abe77785ba | 5 | @Override
public void execute(CommandSender sender, String[] arg1) {
if (!CommandUtil.hasPermission(sender, PERMISSION_NODES)) {
sender.sendMessage(plugin.NO_PERMISSION);
return;
}
if (arg1.length < 1) {
sender.sendMessage(ChatColor.RED + "/" + plugin.delPortal + " (Name)");
return;
}
try {... |
5262e70a-9c95-4184-8f52-e122f3548cd8 | 8 | private void getPatternCross3x3(int x, int y, double neigh[]) {
if (x >= 1)
if (y >= 1)
if (x < nx-1)
if (y < ny-1) {
int index = (y-1)*nx + x;
neigh[0] = pixels[index];
index += (nx - 1);
neigh[1] = pixels[index++];
neigh[2] = pixels[index++];
neigh[3] = pixels[index];
index += (nx - ... |
f2f6e06a-24e9-49b9-9830-435fa14ccf70 | 1 | public int addition() {
if (stack.stackLength() > 1) {
int firstNum = stack.top();
stack.pop();
int secondNum = stack.top();
stack.pop();
return firstNum + secondNum;
} else {
return error;
}
} |
d1f69248-0c5c-4139-bb9c-97711faabdb5 | 0 | public static void main(String[] args) {
int x, y, z;
x = y = z = 1;
System.out.println("x = " + x + ", y = " + y + ", z = " + z);
System.out.println(32 % 7 % 3); // 1
System.out.println((32 % 7) % 3); // 1
System.out.println(32 % (7 % 3)); // 0
} |
08f39bc8-03cf-4aac-8908-37feb8fbe63c | 4 | @Command(command = "warp",
arguments = {"warp name"},
description = "Warps you to the given warp",
permissions = "warp.self",
playerOnly = true)
public static boolean warp(CommandSender sender, String warpName) throws EssentialsCommandException {
// get our player
Player player = (Player)sender;
/... |
50e235e7-4789-4260-bd28-0ccdb74aa944 | 0 | public ZipIterable(Iterable<T> first, Iterable<TOther> second, Joint<T, TOther, TResult> joint)
{
this._first = first;
this._second = second;
this._joint = joint;
} |
51d11803-d279-4d7a-935a-03cfabf64e48 | 3 | public String ConvertStrategy(int calibType) {
if (calibType == ParameterData.MEAN)
return SimConst.MEAN;
else if (calibType == ParameterData.BINARY)
return SimConst.BINARY;
else if (calibType == ParameterData.INDIVIDUAL)
return SimConst.INDIVIDUAL;
el... |
c62dde0b-e8fe-400f-9235-809ff274b4c4 | 1 | public boolean areMoreVariablesToAddToLambdaSet(Grammar grammar,
Set lambdaSet) {
if (getNewVariableThatBelongsInLambdaSet(grammar, lambdaSet) == null)
return false;
return true;
} |
2becea2c-1a92-48d4-a561-d3e7657118fa | 7 | @Override
public boolean okMessage(Environmental host, CMMsg msg)
{
if(!super.okMessage(host,msg))
return false;
if((affected instanceof MOB)
&&msg.amISource((MOB)affected)
&&(msg.targetMinor()==CMMsg.TYP_WEAR)
&&(msg.target() instanceof Item)
&&((CMath.bset(((Item)msg.target()).rawProperLocationBitmap... |
346b824c-399e-474e-b1b9-32e5fe8e80eb | 3 | public static String randName(){
StringBuffer sb = new StringBuffer();
boolean pre = false;
if(randBool()){ //prefix
sb.append(randPrefix());
pre = true;
}
sb.append(randMiddle());
if(!pre){
sb.setCharAt(0, Character.toUpperCase(sb.charAt(0)));
}
if(randBool()){
sb.append(randSuffix());
}... |
835c9143-8445-455d-b30c-231f48761416 | 5 | public void tarjanSCC(int u) {
dfs_num[u] = dfs_low[u] = dfsNumberCounter++;
s.push(u);
visited[u] = true;
for (int i = 0; i < ady[u].size(); i++) {
int v = ady[u].get(i);
if (dfs_num[v] == -1)
tarjanSCC(v);
if (visited[v])
dfs_low[u] = Math.min(dfs_low[u], dfs_low[v]);
}
if (dfs... |
9543f32a-c37c-4ee3-8c0c-233d7b262696 | 9 | public int compare(Map<String, String> aMap1, Map<String, String> aMap2)
{
if (aMap1.size() != aMap2.size()) return -1;
for (String theKey : aMap1.keySet())
{
String theValue1 = aMap1.get(theKey);
String theValue2 = aMap2.get(theKey);
boolean theEmpty1 = theValue1 == null || theValue1.length() ==... |
d116d18c-9b5e-4f18-9970-5e4e0d934e04 | 2 | private BufferedImage getImage() {
try {
if (this.image == null) {
this.image = ImageIO.read(new File(this.fullFilePath));
}
} catch (Exception ex) {
ex.printStackTrace();
}
return this.image;
} |
427fd3c5-a561-472a-91f4-06a290b2e27a | 1 | private void writeInteger64ToByteArray(long value) {
longintBytes[7] = (byte)value; value >>>= 8;
longintBytes[6] = (byte)value; value >>>= 8;
longintBytes[5] = (byte)value; value >>>= 8;
longintBytes[4] = (byte)value; value >>>= 8;
longintBytes[3] = (byte)value; value >>>= 8;
longintBytes[2] = (byte)value;... |
b900dcb8-1f11-4fbb-99db-85bd8ae8bf73 | 1 | private synchronized void kill() {
resetState();
try {
CharBuffer response = CharBuffer.wrap("{'type': 'dead'}");
outbound.writeTextMessage(response);
} catch (IOException ioe) {
// Ignore
}
} |
b9e6e74d-1307-4191-9343-d4a1e0f250f5 | 0 | public static void scheduleAtFixedRateTest() throws ExecutionException, InterruptedException {
//*1
ScheduledExecutorService service= Executors.newScheduledThreadPool(2);
//*2
Runnable task1=new Runnable()
{
public void run()
{
System.out.p... |
341c032e-0d0c-4b55-9c42-518a93af95d2 | 5 | public static Figur[] erstelleFiguren(Farbe farbe, int figurenAnzahl) {
Figur[] figurenArray = new Figur[figurenAnzahl];
int[][] startPositionen = getStartPositionen(figurenAnzahl, farbe);
boolean[] richtungen = { true, true, true, true, true, true, true, true };
String id = null;
switch (farbe) {
case ROT... |
ad472812-00d1-481d-8d9f-030c9b55df43 | 4 | public void start(){
if(this.running||this.currentCount<this.repeatCount){
return;
}
final Timer timer=this;
TimerTask task=new TimerTask(){
@Override
public void run(){
timer.currentCount++;
if(timer.currentCount<=timer.repeatCount){
Event event=new Event(TimerEvent.TIMER);
timer.di... |
8d4f3b8c-e1fd-4ed0-a403-dc24833d4771 | 8 | private void countPixels() {
System.out.println("counting");
col_count = new int[256]; //zero out count array
if (Color.RED.equals(col)) {
for (int row = 0; row<img.getHeight(); row++) {
for (int col = 0; col<img.getWidth(); col++) {
col_count[(img.getRGB(col, row) >> 16) & 0xFF]++;
}
}
}
e... |
5d0926fa-695e-455f-bd57-c53b193d4a93 | 0 | @Test
public void testScan() throws Exception {
String assertString = "FAADZBBACABZBAC";
assertTrue(assertString.equals(this.terminal.getOrder()));
} |
f7e69803-87d6-46fa-b069-7fdb8ff2a50f | 7 | BufferedImage render(int AREAX, int AREAY, int LOOP_LIMIT, int REEL_MAX, int REEL_MIN, int IMAG_MAX, int IMAG_MIN, String[] coloring) {
BufferedImage image = new BufferedImage(AREAX, AREAY, BufferedImage.TYPE_INT_RGB);
Graphics g = image.createGraphics();
double dpcnt; //Delta percent
dp... |
9bd928e5-f9c7-4c1e-9021-f134f5ca0d7c | 9 | @Override
public boolean equals( Object o ) {
if ( this == o ) return true;
if ( o == null || getClass() != o.getClass() ) return false;
Act act = (Act) o;
if ( Double.compare( act.latitude, latitude ) != 0 ) return false;
if ( Double.compare( act.longitude, longitude ) != ... |
3c139f58-e858-47ad-afbb-ffa68632bb8d | 1 | private HashMap<String, byte[]> downloadFromGitHub(Repository repository, Release release) throws IOException {
String zipUrl = repository.getHtmlUrl();
if (!zipUrl.endsWith("/")) {
zipUrl += "/";
}
zipUrl += "archive/" + release.getTagName() + DataConstants.ZIP_FILE_EXTENSIO... |
94b7214c-dea1-419e-88c7-d48074bdf1b3 | 3 | public int get_bits(int number_of_bits)
{
int returnvalue = 0;
int sum = bitindex + number_of_bits;
// E.B
// There is a problem here, wordpointer could be -1 ?!
if (wordpointer < 0) wordpointer = 0;
// E.B : End.
if (sum <= 32)
{
// all bits contained in *wordpointer
returnvalue... |
2c0be07f-b12e-4540-93bf-cb003ee5eb66 | 0 | @Override
public void update(Observable o, Object arg) {
firePropertyChange(DialogWindowController.PERCENTAGE, (Integer) arg - 1, arg);
} |
f7607a1b-4049-4c3a-a0f8-3b39d0ef33cf | 7 | public int getSelection()
{
if(selectionOvalY == 3)
return 1;
else if(selectionOvalY == 27)
return 2;
else if(selectionOvalY == 51)
return 3;
else if(selectionOvalY == 75)
return 4;
else if(selectionOvalY == 99)
return 5;
else if(selectionOvalY == 123)
return 6;
else if(se... |
b51421c5-7df6-40aa-8047-45a48e00f6cc | 8 | public void updatePowerups(){
boolean powerupsUpdated = false;
int index = 0;
while(!powerupsUpdated)
{
powerupsUpdated = true;
for(int i = index; i < powerups.size(); i++)
{
/*Move the powerup towards the floor if it has been released*/
if(powerups.get(i).isReleased())
{
poweru... |
7a4851dc-528c-4eb8-98e9-8164f7205bd5 | 4 | public static void removeMember(int memberID){
try {
if(conn == null || conn.isClosed()){
conn = DatabaseConnection.getConnection();
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try{
conn.setAutoCommit(false);
PreparedS... |
3d90872b-9a97-4c7e-b84c-0192d00d43de | 2 | public static void main(String[] args) {
Random r = new Random();
ArrayList<Integer> ArrayA = new ArrayList<Integer>();
ArrayList<Integer> ArrayB = new ArrayList<Integer>();
ArrayList<Boolean> ArrayC = new ArrayList<Boolean>();
ArrayA.add(r.nextInt(30));
ArrayA.add(r.nextInt(30));
ArrayA.add(r.nextInt(30)... |
b3d0edae-9bf5-4ca3-aa47-a70a6c487f16 | 5 | @Override
public Collection<Competicao> values() {
try {
Collection<Competicao> col = new HashSet<Competicao>();
Statement stm = conn.createStatement();
ResultSet rs = stm.executeQuery("SELECT * FROM Competicao,Torneio where torneio.cod_torneio=competicao.cod_competicao"... |
15c96616-4e4b-4cfd-a44f-144ed24ddcb4 | 1 | public final EsperParser.while__return while_() throws RecognitionException {
EsperParser.while__return retval = new EsperParser.while__return();
retval.start = input.LT(1);
Object root_0 = null;
Token WHILE55=null;
EsperParser.condition_return condition56 =null;
Espe... |
a45e22d2-da57-4d09-a10f-99b37d7e6ac6 | 0 | @Basic
@Column(name = "name_lang_key")
public String getNameLangKey() {
return nameLangKey;
} |
79a49d4f-37eb-433c-b12c-46d08f5ee3ba | 0 | public TestQueryTrainHandler(String trainId) {
_event = new TicketQueryArgs();
_event.setAction(TicketQueryAction.Query);
_event.setTrainNumber(trainId);
_event.setDate(new LocalDate().plusDays(1));
_event.setDepartureStation("北京南");
_event.setDestinationStation("南京南");
... |
602a54ac-5e13-44f7-8e89-4a898b291b5d | 7 | @Override
public boolean tick(Tickable ticking, int tickID)
{
if(!super.tick(ticking,tickID))
return false;
final MOB mob=(MOB)affected;
if(mob==null)
return true;
if(mob==invoker)
return true;
final boolean oldasleep=asleep;
if(CMLib.dice().rollPercentage()>(50-(2*getXLEVELLevel(invoker()))))
... |
a837eeca-f031-43d7-88a6-bd300c3f7915 | 0 | @Override
public double divide(int a, int b) {
return (double) a / b;
} |
69004333-ab7a-48f7-b865-e2313ad83ab0 | 1 | public int getY(int index) {
if(index <= this.index)
return line[index][1];
else
return -1;
} |
82da02a5-9e4e-4300-9a4f-39b3bf665018 | 9 | @Override
public RunResults run(Context context) {
long from = 0;
long to = 0;
if( context.variableExists(_from) ) {
String sFrom = context.getVariable(_from).toString();
if( !ParsingHelper.isNumeric(sFrom) ) {
context.addError("Invalid variable");
return RunResults.Fail;
}
else
fro... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.