method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
f11c7192-c3b7-4f30-9913-6f38afbf6edc | 7 | public List<InetAddress> discoverHosts (int udpPort, int timeoutMillis) {
List<InetAddress> hosts = new ArrayList<InetAddress>();
DatagramSocket socket = null;
try {
socket = new DatagramSocket();
broadcast(udpPort, socket);
socket.setSoTimeout(timeoutMillis);
while (true) {
DatagramPacket packet ... |
206252ac-6c91-47d9-8b20-12ca17743418 | 9 | protected ProtocolPacket[] receivePacket(Tcp tcp, Ip4 ip)
throws InvalidPacketProtocolParserException,
UnknownPacketProtocolParserException,
UnknownPartTypeProtocolParserException {
// since only clients starts connections, we can use this to match the
// client IP and it is not necessary to ask the user w... |
2b4d2d59-32f7-4af5-858e-0a8b0d07c483 | 1 | public SAXCodeAdapter(final ContentHandler h, final int access) {
super(h);
labelNames = new HashMap();
if ((access & (Opcodes.ACC_ABSTRACT | Opcodes.ACC_INTERFACE | Opcodes.ACC_NATIVE)) == 0)
{
addStart("code", new AttributesImpl());
}
} |
47dc347c-3e23-4fe8-9ce0-acf708945422 | 3 | public void setBounds(int x, int y) {
setBoundsDoor(x, y);
if (direction == 1) {
doorBounds.x = x;
doorBounds.y = y;
}
if (direction == 2 || direction == 3) {
doorBounds.x = x;
doorBounds.y = y;
}
} |
321d0685-31be-483c-9333-2e48434e7767 | 4 | public void repaintNewTheme()
{
char currentDirection = this.direction;
String directionString=null;
switch(currentDirection)
{
case 'v': directionString = "down"; break;
case '^': directionString = "up"; break;
case '>': directionString =... |
f60c8cdc-54c4-4d4e-9a18-206dd1e39f64 | 6 | public void adjustBeginLineColumn(int newLine, int newCol)
{
int start = tokenBegin;
int len;
if (bufpos >= tokenBegin)
{
len = bufpos - tokenBegin + inBuf + 1;
}
else
{
len = bufsize - tokenBegin + bufpos + 1 + inBuf;
}
int i = 0, j = 0, k = 0;
int ... |
9bc13423-0d70-45d8-9852-3cecbb764665 | 4 | public <T extends Interactive & Locatable> boolean combineCamera(final T entity, final int pitch) {
if (!entity.valid()) {
return false;
}
if (entity.inViewport()) {
return true;
}
final Thread angleThread = new Thread(new Runnable() {
@Override
public void run() {
ctx.camera.turnTo(entity);... |
8512f303-3580-4ecc-9f8a-9554a04fa6e9 | 4 | public Topic parseTopic(Document dom) throws ParserConfigurationException, SAXException, IOException, XMLStreamException {
Topic topic = new Topic();
if(dom.getElementsByTagName("num").item(0).getFirstChild() != null){
String[] nums = dom.getElementsByTagName("num").item(0).getFirstChild().getNodeValue().... |
91e480e5-77fa-4b33-81ae-8e0fcff91f0f | 8 | @SuppressWarnings("resource")
private void executaComando(String escolha) {
try {
Scanner linha = new Scanner(escolha.toLowerCase());
int cmd = converterComando(linha.next());
if (!linha.hasNext())
throw new Exception(
"COMANDO INCOMPLETO: esta faltando o segundo atributo");
String s = linha.... |
636a5af1-a737-478a-bab9-7485e3372bd0 | 4 | @Override
public boolean equals(Object obj) {
if (obj == null) return false;
if (!obj.getClass().isAssignableFrom(Vec.class)) return false;
Vec other = (Vec) obj;
return x == other.x && y == other.y && z == other.z;
} |
b661d388-7e90-4d71-97f7-cae7ae55faac | 3 | private void pollInput() {
while (Keyboard.next()) {
if (Keyboard.getEventKeyState()) {
if (Keyboard.getEventKey() == Keyboard.KEY_SPACE) {
log.dbg("Key pressed: SPACE");
}
}
}
} |
d61b1f73-582f-4e92-bb8a-39d363dd4ed5 | 2 | public static boolean isTypePrimitive(Class<?> type) {
return (type != null && type.isPrimitive());
} |
9645d8f1-cfe9-46d5-a51d-0f2ea06eaadc | 0 | public static void question2() {
/*
QUESTION PANEL SETUP
*/
questionLabel.setText("Do you feel like dressing fancy?");
questionNumberLabel.setText("2");
/*
ANSWERS PANEL SETUP
*/
//resetting
radioButton1.setSelected(false);
radioBut... |
17f8a0dd-6397-41e5-a764-23b18056a02a | 9 | public void move() {
lastX = x;
lastY = y;
/* If we can make a decision, pick a new direction randomly */
if (isChoiceDest()) {
direction = randomDirection();
}
/* If that direction is valid, move that way */
switch (direction) {
case 'L'... |
bade5176-1b99-4407-9c6d-351f0d6a4f37 | 0 | public Game(){
startGame();
} |
9e990142-93e3-4a1a-90e3-5840559f43e4 | 5 | @Override
public void validarSemantica() {
Tipo cond=null;
try {
cond =expr1.validarSemantica();
} catch (Exception ex) {
Logger.getLogger(SentenciaWhile.class.getName()).log(Level.SEVERE, null, ex);
}
if(cond instanceof TipoBooleano){
Sente... |
8f99e242-4f8b-45bc-8ef8-955e1720da9e | 7 | public void move(int xa, int ya) {
if (xa != 0 && ya != 0) {
move(xa, 0);
move(0, ya);
numSteps--;
return;
}
numSteps++;
if (!hasCollided(xa, ya)) {
if (ya < 0)
movingDir = 0;
if (ya > 0)
... |
e7d5b543-983e-4867-b69e-950725a5810a | 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... |
934a14cd-b5fe-4e0e-954a-69ce85b55228 | 4 | public void schrijf()
throws DbException{
// Create a XMLOutputFactory
XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
// Create XMLEventWriter
XMLEventWriter eventWriter;
try {
eventWriter = outputFactory
.createXMLEventWriter(new FileOutputStream(handler.getBestand()));
} catc... |
f2c42843-3b99-4ee0-a828-f124c82acd44 | 3 | public ClassST parse() throws UnexpectedTokenException, SyntaxError
{
ClassST ret = null;
String _package = this._package();
List<String> imports = this.imports();
String signature = this.classSignature();
String name = this.getToken().data;
Type type = Type.parse(signature.toString());
this.nextToken(... |
8b0e7ef4-e093-4e63-a9ff-1d8eb513a326 | 2 | public static void main(String[] args) throws InterruptedException {
BlockingQueue<Runnable> workQueue = new ArrayBlockingQueue<Runnable>(1);
Runnable runnable = new Runnable() {
@Override
public void run() {
System.out.println("r1 running");
try {... |
e4da5594-db02-4db0-b2a6-f638021cf522 | 8 | public static void main(String[] args) {
Random gen = new Random();
for (int times = 0; times < 1000; ++times) {
int n;
if (args.length == 1) {
n = Integer.valueOf(args[0]);
} else {
n = gen.nextInt(100) + 1;
}
List<Integer> A = rand_vector(n);
int pivot_index = gen.nextInt(A.size());
... |
3338cf92-2554-4d05-b950-93846c7ec09c | 7 | public boolean fireMedium(TableroDos enemy, int x, int y){
if(this.respaX!=0 && this.respaY!=0 && this.pasa){
return this.fireHard(enemy, x, y);
}
else if(enemy.shipMap[x][y]!=" " && this.map.fireMap[x][y]!="x" && this.map.fireMap[x][y]!="o"){
this.map.fireMap[x][y]="x"; ... |
9b33af0c-6d27-43f5-a9d8-2b9324fbc04f | 1 | @Override
public void testFinished(Description description) {
if (hasPassed()) {
final Xpp3Dom testCase = getCurrentTestCase();
testCase.addChild(createResult(TestState.passed));
testCase.addChild(createNotes(String.format("'%s' PASSED.", description.getDisplayName())));
... |
7ccc5990-4e67-4eed-a3a8-8700baf3be5a | 3 | public void run() {
while (true) {
Object obj = receive();
if (obj instanceof ICamera)
deportedClient.update((ICamera) obj);
else if (obj instanceof IObject)
deportedClient.update((IObject) obj);
}
} |
7b073020-ae60-4aed-babe-77d6b704ebf5 | 1 | public void writeXml(DataCompiler p, String namefile) {
String to = System.getProperty("user.dir"); // recupero el directorio del proyecto
String separator = System.getProperty("file.separator"); //recupero el separador ex: Windows= '\' , Linux='/'
to = to + separator + "src" + separator + "src"... |
1195ff88-6d11-4bff-8416-06cab3045d6b | 5 | */
private void ionChange(boolean isChange) {
// Cookie情報用リスト
ArrayList<String> valueList = new ArrayList<String>();
for (Iterator i=isIonRadio.keySet().iterator(); i.hasNext(); ) {
String key = (String)i.next();
boolean before = (boolean)isIonRadio.get(key);
boolean after = ((JRad... |
7bfbb2c6-4c0e-4920-8949-40d8b36e6c5d | 0 | public JTextField getjTextFieldCP() {
return jTextFieldCP;
} |
b3334e1a-8d13-4625-9707-14580d372ed0 | 7 | @EventHandler
public void SkeletonPoison(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getZombieConfig().getDouble("Skeleton.Pois... |
e5915023-5abb-477f-814e-fdb69a807153 | 9 | @Override
public String get(int start, int end) {
StringBuilder sb = new StringBuilder(end-start+10);
Feature f = null;
int pos = start;
//Find the first overlapped structure variant.
int SVOffset = findFirstOverlappedSV(start, end);
if (SVOffset<0)
SVOffset = 0;
for (int i=SVOffset; i<s... |
3d75f05a-0cca-4c71-a739-b991f52f28ce | 6 | public static int parseMultiplier(String value) {
value = value.toLowerCase();
if (value.contains("b") || value.contains("m") || value.contains("k")) {
return (int) (Double.parseDouble(value.substring(0, value.length() - 1))
* (value.endsWith("b") ? 1000000000D : value.en... |
72c3ee2c-8b9a-4bea-90e3-06cc157ae793 | 5 | @PUT
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
@Produces(MediaType.APPLICATION_JSON)
public TaskList modify(@PathParam("id") int id,
@FormParam("title") @DefaultValue("null") String title,
@FormParam("list_id") @DefaultValue("0") int list_id) {
if (OwnershipDatabase.userOwnsTask(
(String) sr.getA... |
9a0429e2-ca37-4f2d-965d-7168c211e5c7 | 3 | private String extractSessionKey() {
StringBuilder sb=new StringBuilder();
int a,o;
sb.append("Session Key is ");
for (a=44;a<(44+70);a=a+7) {
o=extractIntFromStart(a);
if (checkITA3Char(o)==true) {
sb.append("0x");
if (o<16) sb.append("0");
sb.append(Integer.toHexString(o)+" ");
}
else ... |
ea18a59d-e7bb-49d2-a02d-4235ba8811a1 | 6 | public void handleOpenWindow(Packet100OpenWindow par1Packet100OpenWindow)
{
EntityPlayerSP var2 = this.mc.thePlayer;
switch (par1Packet100OpenWindow.inventoryType)
{
case 0:
var2.displayGUIChest(new InventoryBasic(par1Packet100OpenWindow.windowTitle, par1Packet10... |
063e2a24-8edf-4026-89be-11c0ae5327be | 1 | public final Instruction getNextByAddr() {
if (nextByAddr.opcode == opc_impdep1)
return null;
return nextByAddr;
} |
e3db71e1-bf35-4960-8ceb-64f8599dda82 | 7 | @Override
public void controleEtAjoute(Entretien entretien) throws ValidationException {
if (entretien == null) {
throw new ValidationException("L'entretien est invalide");
}
if (entretien.getDescription() == null || !StringValidation.VerifString(entretien.getDescription())) {
... |
e3d33562-b1ce-4136-bcc9-b214d352f92d | 6 | public static String GameChoice()
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
// Ask for user input
PrintSeparator('#');
System.out.println("Welcome To The Checkers Game developed by:");
System.out.println(" \t1. Ashish Prasad ashishp@... |
e5b7e095-fb2e-48fa-972f-e55d1ac79a0d | 6 | @Override
public void execute(CommandSender sender, String[] arg1) {
if (!CommandUtil.hasPermission(sender, PERMISSION_NODES)) {
sender.sendMessage(plugin.NO_PERMISSION);
return;
}
ChatPlayer cp = plugin.getChatPlayer(sender.getName());
ArrayList<String> channelList = cp.getChannels();
String current =... |
9dda2ad9-a489-4e75-b1e4-c50bea4768a9 | 6 | public static byte linear2ulaw(int sample) {
int sign, exponent, mantissa, ulawbyte;
if (sample>32767) sample=32767;
else if (sample<-32768) sample=-32768;
/* Get the sample into sign-magnitude. */
sign = (sample >> 8) & 0x80; /* set aside the sign */
if (sign != 0) sample = -sample; ... |
1bb6d8f7-b0fc-4324-b05a-75a6ae020d72 | 0 | public CoffeescriptEditor() {
colorManager = new ColorManager();
setDocumentProvider( new CoffeescriptDocumentProvider() );
setSourceViewerConfiguration(new CoffeescriptConfiguration( colorManager ));
} |
1e57d42b-3719-4a84-8bee-ca7801f548f6 | 0 | public RouterWorker(Socket clientSocket) {
this.clientSocket = clientSocket;
Setup.println("[RoutingService.run] Conexion abierta desde: " + clientSocket.getInetAddress().getHostAddress());
} |
972b513e-8664-496a-82cf-10f4ec923727 | 0 | @Test
public void testDelete() {
fail("Not yet implemented");
} |
676469a6-d90d-419b-9beb-641f4ea96b27 | 5 | public static void main(String args[]) {
try {
if (args.length > 1) {
printUsage();
return;
}
PS3TestDriver td;
if (args.length == 0) {
td = new PS3TestDriver(new InputStreamReader(System.in),
... |
e086fb03-7812-4c68-ac03-35e7e84721b3 | 2 | private void varDecl(boolean global) throws Exception
{
Type type = typeDecl(global);
Identifier varName = ident();
env.put(varName, defaultVariableValue(varName));
env.putType(varName, type);
while(scan.sym == Token.comma) {
scan.next();
varName = ide... |
c6c1abb5-1da9-4ef8-96c9-73570c5020e7 | 6 | public DefaultMutableTreeNode LoadDLLImport(DefaultMutableTreeNode IMPORT,VraReader b)
{
//get the phisical address to data drectory array links to dll import table
int pos2=((int)DataDir[2]);
System.out.println("DLL RVA ARRAY POSITION "+pos2+"");
Vector<JTable> v1=new Vector<JTable>();
//for dll names
Vector<Str... |
f4c6421b-1e1e-45f1-8d97-003cbc69c7e0 | 1 | public Interface(BufferedImage bg, Sprite sprite)
{
this.bg = bg;
this.sprite = sprite;
this.cX = Game.fieldWidth;
this.cY = Game.fieldHeight;
buttonMap = new HashMap<>();
barMap = new HashMap<>();
selectColor = new Color(255, 255, 255, 128);
line1 = l... |
c5e7c125-c086-41b2-adb7-3d38744bfeee | 7 | protected final void loadHandlers() {
for (Method m : this.getClass().getMethods()) {
InternalTask itask = m.getAnnotation(InternalTask.class);
if (itask == null)
continue;
Class<?> handledClass = itask.type();
if (handledClass == null)
... |
0606c825-b9ce-4e84-8990-f474aefa375e | 0 | @Override
public int getAge() {
return age;
} |
fa343270-8566-486c-8dbb-84916388ce5c | 9 | public List<Client> searchClient(String usernameOrName) {
Connection conn=null;
try{
conn = dbConnector.getConnection();
if (conn==null) //cannot connect to DB
return null;
Statement st;
ResultSet rs;
String sql;
boolean searchAll = false;
if (usernameOrName==null )
searchAll=tr... |
738b0408-62a2-4429-ba65-74aff1ad907f | 8 | private static void rsaDecrypterFile(CryptobyConsole console) {
// Input Path to File for decryption
scanner = new Scanner(System.in);
System.out.println("Enter Path to File for Decryption (Type '" + quit + "' to Escape):");
scanner.useDelimiter("\n");
if (scanner.hasNext(quit))... |
45578044-f401-4483-bc51-fe5df18a3b8c | 2 | private Node decide() {
char c = input.charAt(offset);
if (c == '(') {
offset++;
return parseDecision();
}
else if (c == '[') {
offset++;
return parseRange();
}
else {
return parseLiteral(true);
}
} |
f39ac15d-302f-46ca-bfe6-38b45b79fd7f | 7 | @Override
public boolean tick(Tickable ticking, int tickID)
{
if(!super.tick(ticking,tickID))
return false;
if(affected==null)
return false;
if(!(affected instanceof MOB))
return true;
final MOB mob=(MOB)affected;
MOB diseaser=invoker;
if(diseaser==null)
diseaser=mob;
if((!mob.amDead())&&((... |
91ca1e19-06b4-462b-b9c0-dc704cae1381 | 3 | public synchronized void fileWriter(Quiz quiz)throws RemoteException{
String filePath = "C:/JavaFiles/QuizManager/QuizMasterFile.csv";
File file = new File(filePath);
Set<Question> questionListForNewQuiz=new HashSet<Question>();
BufferedWriter bufferedWriter = null;
//BufferedWriter bufferedWriterForQuest... |
f2c79687-1cab-4e2a-9601-ebde2d910587 | 4 | public void setPlayer1Piece(JLabel label) {
boolean test = false;
if (test || m_test) {
System.out.println("Drawing :: setPlayer1Piece() BEGIN");
}
if (test || m_test)
System.out.println("Drawing:: setPlayer1Piece() - END");
m_player1Piece = label;
} |
39e0b1e0-7695-4264-8773-e3f772ea6498 | 5 | private void validarDatos(String usuario, String contrasenha) throws BusinessException {
String mensaje = "";
if(usuario == null || usuario.isEmpty())
mensaje += "El usuario no puede ser nulo o vacio\n";
if(contrasenha == null || contrasenha.isEmpty())
mensaje += "La cont... |
a1780cbf-1544-4e13-b6cc-4a3bc4167350 | 7 | public void menu() {
String s;
Boolean exit = false;
Integer option = null;
while (!exit) {
UI.printHeader();
System.out.println("Selecciona una opción a continuación:");
System.out.println("1) Editar servicios");
System.out.println("2) Editar agentes");
System.out.println("3) Editar conexiones... |
e9d9ccbf-25ac-4ef4-8a3d-7f8455eaa83a | 4 | private void updatePosition(Entity entity) {
int timePassed = entity.tickStart - tick;
int differenceX = entity.startX * 128 + entity.boundaryDimension * 64;
int differenceY = entity.startY * 128 + entity.boundaryDimension * 64;
entity.x += (differenceX - entity.x) / timePassed;
entity.y += (differenceY - ent... |
80ee830e-97d2-4fe6-896a-e86b54ee49be | 5 | public PercolationStats(int N, int T) {
if (T <= 0) {
throw new IllegalArgumentException("Provided number of experiments (" + T + ") is not positive.");
}
if (N <= 0) {
throw new IllegalArgumentException("Provided size (" + N + ") is not positive.");
}
if (Integer.MAX_VALUE / N < N) {
... |
11466bf0-1dc8-4805-8e5f-689eea890c71 | 8 | private void costruisciDamiera() //si occupa della costruzione della damiera del pannello.
{
for(int i=0;i<8;i++)
for(int j=0;j<8;j++)
{
damieraGrafica[i][j]=new Quadrato(damiera, i, j);
this.add(damieraGrafica[i][j]);
aggiungiListener(i, j, damieraGrafica[i][j]);
}
try //una volta costrui... |
77098bfb-85ed-4f8e-9c24-36c938e4b67d | 6 | public Piece getDarkKing(Tile[][] board, boolean isWhite)
{
Piece darkKing = null;
for(int i = 0; i < 8; i++)
{
for(int j = 0; j < 8; j++)
{
//If the space isn't null
if(board[j][i] != null && board[j][i].getPiece() != null)
{
//Get a piece with the name "K" (which should be a king)
... |
494026b4-b8d2-4dac-8f9a-379b04925472 | 1 | public TreeRow getFirstRow() {
List<TreeRow> children = mRoot.getChildren();
if (!children.isEmpty()) {
return children.get(0);
}
return null;
} |
e16b2af8-8957-4a18-a4ce-0f69cc57ee5b | 8 | private static void diffImages(BufferedImage goodImage, PixImage studentPixImage) {
BufferedImage studentImage = ImageUtils.pixImage2buffer(studentPixImage);
int diffCount = 0;
System.out.println("The difference is:");
if (studentImage.getWidth() != goodImage.getWidth()) {
System.out.println("The ... |
827f8f94-efc3-4816-bafa-814d6d2d4897 | 5 | public TabButton(DataTabButton data) {
this.data = data;
setPreferredSize(new Dimension(BUTTON_WIDTH, BUTTON_ACTIVE_HEIGHT));
setMinimumSize(getPreferredSize());
setMaximumSize(getPreferredSize());
setLayout(null);
setOpaque(false);
... |
02f74bdc-54e2-410b-ac14-5cef2fb576a1 | 0 | public void setExp(){
hero.setExperience(hero.getExperience() + 3);
} |
47566413-46fa-4465-9f08-3327a86f0eae | 4 | public int getComboBox4 () {
if (jComboBox4.getSelectedIndex() == 0) return 70;
else if (jComboBox4.getSelectedIndex() == 1) return 75;
else if (jComboBox4.getSelectedIndex() == 2) return 80;
else if (jComboBox4.getSelectedIndex() == 3) return 85;
return 90;
} |
8abda0c4-76b2-4dd2-88f4-b78d4023c4db | 4 | private void updateButton() {
// [srk] same protection added to updateColors
// make sure node is not null
if (node == null) {
return ;
} // end if
if (node.isAncestorSelected()) {
button.setSelected(true);
} else {
button.setSelected(false);
}
if (node.isLeaf()) {
button.setNode(false... |
58af45d9-104e-43ec-a51f-43dd8dbedfa3 | 8 | @Override
public void addColumn(TableColumn column) {
super.addColumn(column);
switch (getColumnCount()) {
case 1:
column.setPreferredWidth(400);
break;
case 2:
column.setPreferredWidth(80);
break;
c... |
5f9e0849-0d85-4b03-9576-de7e38e908db | 2 | @Override
public void run() {
init();
while(running){
tick();
render();
try{
Thread.sleep(5);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
} |
b753c58b-1cb3-4966-a9cc-c6fd2dc9baa5 | 1 | public void disegnaAlbero(AlberoBin<Integer> a) {
if (a != null) {
altezzaAlbero = altezza(a);
setPreferredSize(new Dimension(NodoGrafico.WIDTH * Mat.pow(2, altezzaAlbero),
(altezzaAlbero + 1) * 3 * NodoGrafico.HEIGHT / 2 + 20));
assegnaNodiGrafici(a);
} else nodiGrafici.clear();
repaint();
select(... |
2c7ba2fb-61eb-44e6-8f0e-870c1d646539 | 7 | public boolean addToPrintQueue(GCode code,boolean manual){
if(!state.connected){
// cons.appendText("Not connected");
try {
Thread.sleep(500); //test only
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return true;
}
if(manual && state.printi... |
b1f7c66a-8f91-4d7e-8a92-11bdba1b0d84 | 7 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
HostAndPort other = (HostAndPort) obj;
if (addr == null) {
if (other.addr... |
c4d292cd-ad0b-44ad-9093-32c69af53e81 | 3 | public static List<Dependency> applyIgnoreRules(List<Dependency> dependencies, Set<DependencyRule> ignoreRules) {
if (dependencies == null) {
return null;
}
List<Dependency> result = new ArrayList<Dependency>();
for (Dependency dependency: dependencies) {
if (depe... |
6d549a8f-568f-4303-8925-85df31bb8ac1 | 5 | private void bfsTravel(TreeNode root, int level, List<List<Integer>> result){
Queue<TreeNode> maintain = new LinkedList<TreeNode>();
Queue<TreeNode> visited = new LinkedList<TreeNode>();
List<Integer> list = null;
TreeNode tmp = null;
maintain.offer(root);
while(!maintai... |
b879922c-24cd-41ce-abae-5a3b1e2ba48d | 5 | public Object nextEntity(char ampersand) throws JSONException {
StringBuilder sb = new StringBuilder();
for (; ; ) {
char c = next();
if (Character.isLetterOrDigit(c) || c == '#') {
sb.append(Character.toLowerCase(c));
} else if (c == ';') {
... |
42d68120-ff99-4431-a6f3-64a7804e9549 | 5 | private void leaveEssenceMine() {
if (Util.inEssenceMine() && !Players.getLocal().isMoving()) {
if (Util.walkToAndClick("Enter", Util.portalId)) {
int time = 0;
while (Util.inEssenceMine() && time <= 4000) {
time += 50;
Time.sleep(50);
}
}
}
} |
bb9ef216-bc9d-47fa-9011-8e431ceb8ff9 | 3 | public void showAll()
{
Graphics g = null;
long startTime = 0;
long endTime = 0;
int timeToSleep = 1000 / framesPerSec;
for (int i = 0; i < imageList.size(); i++)
{
startTime = System.currentTimeMillis();
this.currIndex = i;
g = this.getGraphics();
draw(g);
g.dis... |
77ffe8f0-09c9-4071-ae7c-912841a5ec4c | 6 | public void paintComponent(Graphics g) {
// probably draws the tiles
for(int i = 0; i < tilesHeight; i++) {
for(int j = 0; j< tilesWidth; j++) {
g.drawImage(tiles.get(tilesWidth*i + j), j*50, i*50, null);
}
}
////////////////////ACTUAL TREASURES////////////////////////////////
for (int i = 0; i <... |
b8f98369-fec6-4620-82ad-dff7f9962d45 | 1 | private int jjMoveStringLiteralDfa0_1()
{
switch(curChar)
{
case 10:
return jjStopAtPos(0, 6);
default :
return 1;
}
} |
336996c1-bd70-49c9-a241-504bec380a36 | 6 | public static GsArtist[] parseArtists(String data,Gs parent) {
Pattern re=Pattern.compile("\\{result:\\[(.*)\\}");
Matcher m=re.matcher(data);
GsArtist[] res=new GsArtist[1];
if(!m.find()) {
res[0]=null;
return res;
}
String realData=m.group(1);
int size=0;
int pos=0;
for(;;) {
in... |
9805f2ba-009f-44cd-b047-e2f2d406450c | 0 | public String getName() {
return this.name;
} |
501ff0fd-d487-4455-8c0d-0e3998c826b3 | 3 | private String formatDoubleValue(double d)
{
String s;
if(Math.abs(d) > 1000)
{
s = " kJ";
d = d/1000;
if (Math.abs(d) > 1000)
{
s = " MJ";
d = d/1000;
if (Math.abs(d... |
9fba56b6-aa88-49e5-98fe-2b1c2fe46f17 | 6 | public boolean baca(String kode_buku){
boolean adaKesalahan = false;
Connection cn = null;
try{
Class.forName(Koneksi.driver);
} catch (Exception ex){
adaKesalahan = true;
JOptionPane.showMessageDialog(null,"JDBC Driver tidak ditemukan atau rusak\n"+ex... |
c85023d0-e79b-46c5-9495-0a3d0789d659 | 0 | public void setDepartmentId(int departmentId) {
this.departmentId = departmentId;
} |
9d662295-1f42-4724-ae58-2a2e7348f1e5 | 0 | public static void main(String args[]) {
Color first = Color.black;
Color second = Color.red;
Comparator comp = new ColorComparator();
// //System.out.println(comp.compare(first, second));
} |
f4c8c739-2c80-4ab0-86b3-e99ca3c8ce5f | 9 | public String nextToken() throws JSONException {
char c;
char q;
StringBuffer sb = new StringBuffer();
do {
c = next();
} while (Character.isWhitespace(c));
if (c == '"' || c == '\'') {
q = c;
for (;;) {
c = next();
... |
ba813bb3-e8f7-43bf-9eae-30128eb7bd01 | 8 | private ReportDefinition getReportDefinitions(Element documentRootElement) {
ReportDefinition reportDefinition = new ReportDefinition();
reportDefinition.setReportDirectory(AppConstants.REPORT_DIRECTORY);
reportDefinition.setReportType(ReportType.Both);
try {
NodeList reportList = documentRootElement
... |
3d041875-2c59-4d50-a706-ec318f201f23 | 0 | public int getFunctionStartLine() {
return environmentStack.peek().getStartLineNumber();
} |
f3eb3994-310d-433d-8c04-5dbb7c266be7 | 5 | public int getRoadSpeed(int city1, int city2) {
for (int i = 0; i < roads.size(); i++) {
String[] s = (String[]) roads.get(i);
int c1 = Integer.valueOf(s[0]);
int c2 = Integer.valueOf(s[1]);
int spd = Integer.valueOf(s[2]);
if ((c1 == city1) && (c2 == ... |
88f53b56-def3-4534-ab3c-6c71993bcdb4 | 5 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((country == null) ? 0 : country.hashCode());
result = prime * result + ((flag == null) ? 0 : flag.hashCode());
result = prime * result + foundationYear;
result = prime * result + idTournament;
... |
49527f34-c5d2-4d12-a937-3f6904ed16a8 | 3 | static long [] getChunkByOffset(int []vsize, int []csize, long offset)
{
long []start = new long[vsize.length];
int [] volume = new int [vsize.length];
volume[0]=1;
for(int i = 1; i < volume.length; i++)
{
volume[i] = volume[i-1]*vsize[i-1];
}
int dsize = 1;
for(int i = volume.length - 1; i >... |
e89d6070-536a-4789-bf8c-3a59cf075e32 | 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... |
e2d5243b-1de3-49bb-b1b7-047b7719b3a6 | 7 | @Override
public void actionPerformed(ActionEvent e) {
String cmd = e.getActionCommand();
if("exit".equals(cmd)) {
setVisible(false);
} else if("start".equals(cmd)) {
setVisible(false);
owner.startBattle();
} else if("add".equals(cmd)) {
addRobot(availableRobotList.getSelectedIndex());
} else if(... |
0d536293-7f2b-4118-9552-eeb2658ca215 | 5 | public int kmeans(Data data) throws OutOfRangeSampleSize{
int numberOfIterations = 0;
C.initializeCentroids(data);
boolean changedCluster=false;
do{
numberOfIterations++;
changedCluster = false;
for(int i=0; i<data.getNumberOfExamples(); i++){
Cluster nearestCluster = C.nearestCluster(data.g... |
047aee8f-d247-4ba2-bdbe-13886f87bf81 | 8 | public void drawCMaps(Graphics g)
{
Rectangle r = getBounds();
int elements = data3d.GetNumElements();
int elem = data3d.GetActiveElement();
double sizex = (r.width-1)/(double) elements;
int sizey = (r.height-1)/ 4;
for (int e=0;e < elements;e++)
{
for (int y=... |
925e08e4-9dbc-4340-87cf-a29d99cf89d2 | 9 | public void update(){
if(happen){
/* ウィンドウ更新 */
mes_window.update();
command_window.update();
/* 敵とエフェクト更新 */
enemy.update();
effect_manager.update();
/* 状態遷移 */
final STATE st = this.now_state;
if(this.mes_window.get_printing_message()) return;//メッセージ表示中は戦闘を進めない
... |
4c68e074-d65e-498e-8e48-69de7b63bf07 | 5 | @Override
public Role createRole(Role role) {
Connection cn = null;
PreparedStatement ps = null;
ResultSet rs = null;
try {
cn = ConnectionHelper.getConnection();
ps = cn.prepareStatement(QTPL_INSERT_ROLE,
new String[] { "role_id" });
... |
14e06e1c-a084-4179-820d-b3d7796b76a8 | 3 | public int numOwned() {
int ret = 0;
final String tag = getTag();
for (int i = 1; /* loop until broken */; i++) {
GenericObject prov = dataSource.getProvince(i);
if (prov == null)
break;
if (prov.getString("owner").equals(tag))
... |
9b36961f-cb66-429a-aa27-8e5a796d4215 | 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... |
e1555a56-112e-43db-89d9-1044fa22a183 | 6 | public static void main(String[] args)
{
int i;// only used in first loop. Other variables are declared in the for statements
Scanner keyboard = new Scanner(System.in);
do{
System.out.println();
System.out.print("Enter a positive integer that is no greater than 15: ");
i = keyboard.nextInt();
if(i ... |
531f81c1-1002-4789-a57c-561e4c508f58 | 8 | public boolean canJump(int[] A) {
// Note: The Solution object is instantiated only once and is reused by each test case.
int maxr = 0;
int i = 0;
while (i < A.length) {
maxr = A[i];
if (A[i] == 0 && i < A.length-1) return false;
if (i+A[i] >= A.length... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.