method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
d5e38096-6467-45bf-a326-aca7a0cc020c | 1 | private void renderPlayerInventory(Graphics2D graphics){
int i = 0;
for (Item item: objectTron.getActivePlayer().getInventory()){
System.out.println("size: "+ objectTron.getActivePlayer().getInventory().size() + " i:" + i);
graphics.drawImage(lightgrenade, startPointXCoordinate + (i*40), + startPointYCoo... |
76446eed-c9c1-4875-b25e-4554cde3af28 | 3 | @Override
public boolean onCommand(CommandSender sender, Command arg1, String arg2,
String[] arg3) {
if (sender instanceof Player) {
Player player = (Player)sender;
if (!player.isOp()) {
return true;
}
Session session = HyperPVP.getSession(player);
if (HyperPVP.getMap().getType()... |
a2270c31-f7ea-46b9-b3d3-adcaabba399f | 0 | public ListWords(){
list = new HashSet<Word>();
} |
4367ff9c-0317-4479-b86e-8d5f31b6c864 | 5 | private void buttonBackActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonBackActionPerformed
//Индексы названий и статуса заявки
final int indexColumnName = 0;
final int indexColumnStatus = 3;
//Определяем индекс выбранной строки в таблице
int selectedRowIn... |
622e4d93-53ab-4b52-ad98-3319efa96542 | 8 | public synchronized boolean write(final File file) {
if (file == null)
throw new IllegalArgumentException("null input file");
FileOutputStream out = null;
try {
out = new FileOutputStream(file);
}
catch (IOException e) {
e.printStackTrace();
}
if (out == null)
return false;
if (progressBa... |
f95ad184-915b-4400-8336-6bce6d141436 | 1 | private void degreejComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_degreejComboBoxActionPerformed
// TODO add your handling code here:
String itemText = (String)degreejComboBox.getSelectedItem( );
if(itemText.equals("Other")){
otherjLabel.setVisible(true);... |
41198e66-0e0f-41ea-b31b-8d9a5b3bc472 | 2 | public void justify(int x)
{
if(1 <= x && x <= 3)
myJustification = x;
} |
cdc90020-5d13-4ebe-be4f-579268c101dc | 8 | public byte[] encoder()
{
//Generates the type of client this is
char typ;
String hld;
if(baseCon != null)
typ = '1';
else if(remCon!= null)
typ = '2';
else
typ = '0';
//The state 1 client
if(state == 1)
{
hld = 1+";"+getName()+";"+typ+";"+getKey()+";"+getScreenChar()+";"+devCon();
}
... |
66468d92-464b-41cd-8e8b-6becbf1e0462 | 2 | public void render(Graphics g){
// Draw History contents table
Font fnt0 = new Font("arial", Font.ITALIC, 10);
g.setFont(fnt0);
g.setColor(Color.green);
g.drawString("(LAST 15 GAMES)", (Cong.WIDTH * Cong.SCALE) / 2 - 45, start_y - 37);
Font fnt1 = new Font("arial", Font.B... |
cefc6e8a-0bbf-4269-b4df-f6a2402c4e57 | 6 | private void jTextField1FocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTextField1FocusLost
// TODO add your handling code here:
try{
if(esCarga){
if((jTextField1==null)||(jTextField1.getText().equals("")))
jTextField1.requestFocus();
... |
60046773-b5d4-4ab4-b1b1-1bec716fc245 | 5 | public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/plain");
PrintWriter out = response.getWriter();
String requestContent = readRequestContent(request);
String ids = retriveIdsFromJson(requestContent);
if (n... |
5a277527-5aa1-4cc5-b2cf-ec716ff81a7d | 7 | public void createOutline(Shape selected) {
selectedShape = selected;
if (selectedShape == null)
return;
if (selectedShape instanceof Square) {
createOutlineForSquare((Square) selectedShape);
}
else if (selectedShape instanceof Rectangle) {
createOutlineForRectangle((Rectangle)selectedShape);
}
e... |
fe57cac4-f8db-44af-8bab-073d6e085fe4 | 0 | public NumMatrix(int[][] matrix) {
this.matrix=matrix;
width=matrix[0].length;
height=matrix.length;
init();
} |
f5e5e5eb-eac3-4afb-8ae4-830a38435df9 | 3 | @Override
public void run() {
// TODO Auto-generated method stub
try {
System.out.println("Sleeping thread for " + timeLeftMs + " ms.");
Thread.sleep(timeLeftMs);
System.out.println("The auction has been expired!");
System.out.println("auctionId = " + auctionId);
} catch (Exception e) {
Sys... |
a02040a3-e8a0-4647-aa8a-952389ab55a3 | 7 | private void setLightSource() {
if (model.getLightSource().isOn()) {
ModelerUtilities.selectWithoutNotifyingListeners(lightSwitch, true);
boolean b1 = model.getLightSource().isMonochromatic();
ModelerUtilities.selectWithoutNotifyingListeners(monochromaticButton, b1);
ModelerUtilities.selectWithoutNotifyin... |
a5b82471-dc4a-4ce3-b92c-f8cdd9f52e33 | 3 | private static GameState weekLoop(GameState state)
{
for(int day = state.getDay(); day <= 5; day++)
{
state.setDay(day);
if(state.getTime() == Time.PICK_CARDS)
{
pickCards(state);
state.log("~DAY PHASE (" + (day+1) + ")~");
state.setTime(Time.DAY);
state.updateGUIs();
}
while... |
61aed662-b6bd-4b4a-a2c2-926ac9b7df58 | 5 | void handleCutCopy() {
// Save the cut/copied style info so that during paste we will maintain
// the style information. Cut/copied text is put in the clipboard in
// RTF format, but is not pasted in RTF format. The other way to
// handle the pasting of styles would be to access the Clipboard directly and
// p... |
d8f08398-fc41-4bd9-8533-4914c91d5353 | 8 | * @param xxx
* @param yyy
* @param zzz
* @param attached Are we attached to the piston body?
* @param override_sticky If attached, are we a sticky piston or a regular piston?
*/
public void renderPistonHead(int textureId, int xxx, int yyy, int zzz, BlockType block, int tex_offset, boolean attached, boolean o... |
9815d226-a332-4c8e-af66-e50236354787 | 2 | public static String[] allUpperCase(String... strings){
String[] tmp = new String[strings.length];
for(int idx=0;idx<strings.length;idx++){
if(strings[idx] != null){
tmp[idx] = strings[idx].toUpperCase();
}
}
return tmp;
} |
89c071cb-2c78-45af-8e85-971df12f3b1d | 7 | protected int getCorrectDirToOriginRoom(Room R, int v)
{
if(v<0)
return -1;
int dir=-1;
Room R2=null;
Exit E2=null;
int lowest=v;
for(int d=Directions.NUM_DIRECTIONS()-1;d>=0;d--)
{
R2=R.getRoomInDir(d);
E2=R.getExitInDir(d);
if((R2!=null)&&(E2!=null)&&(E2.isOpen()))
{
final int dx=com... |
89ae340e-ea7a-431e-a2c7-634de46bc051 | 5 | @Override
public void setValueAt(Object value, int row, int column) {
Object obj = this.items.get(row);
if(this.columnNames.size() > column) {
ColumnDefinition col = this.columnNames.get(column);
if(col != null) {
if(obj != null) {
try {
this.items.set(row, col.getName(), value);
... |
64ddcd75-db05-434e-8e9e-f62b3254e761 | 5 | public int getDiscId(String queryString) {
int i = 0;
for(String[] cd: this.cds) {
// queryString in den beiden ArrayElementen der CD suchen
if(cd[0]!=null && cd[1]!=null) {
if(cd[0].toLowerCase().indexOf(queryString.toLowerCase())!=-1 ||
cd[1].toLowerC... |
14c4f4a8-d135-40ab-9400-9ad9c65b0fd0 | 2 | public static HashMap<String, String> loadSourceMap( String sourceFile){
Repository repo = new SailRepository(new MemoryStore());
HashMap<String, String> cacheNameToSourceMap = new HashMap<String, String>();
try {
repo.initialize();
RepositoryConnection conn = repo.getConnection();
con... |
9b36563e-0b7d-4974-8171-b488c4b10003 | 6 | public boolean getBoolean(int index) throws JSONException {
Object object = this.get(index);
if (object.equals(Boolean.FALSE)
|| (object instanceof String && ((String) object)
.equalsIgnoreCase("false"))) {
return false;
} else if (object.equals(Boolean.TRUE)
|| (object instanceof String && ((Str... |
2dd9fd47-9487-4a5e-af9a-c91ad2eafd0d | 9 | /**
* This function draw the circumscribed circle on the PPM object.
*
* @param PPM
*/
public void drawTo(PPMEC PPM) {
Vector v = new Vector(0, 0);
// Must scale x,y to final ppm dimensions
int c = (int) (xRatio * PPM.getWidth()); // get x-coord
int r = (int) (yRatio * PPM.getHeight()); // get y-coord... |
4b31afce-8a6a-4ea5-a1c0-a480482a647a | 6 | public String toString() {
if (root == null) {
return "There are no students registered";
}
StringBuilder sb = new StringBuilder();
/* inorder traverse the tree */
Stack<StudentNode> stack = new Stack<StudentNode>();
StudentNode currentNode = root;
while (true) {
/* push all the left child nodes t... |
02eb0a88-e0c7-47c6-a95c-4d9a4221a2d2 | 2 | public static String[] removeEmptyStrings(String[] data)
{
ArrayList<String> result = new ArrayList<String>();
for(int i = 0; i < data.length; i++)
if(!data[i].equals(""))
result.add(data[i]);
String[] res = new String[result.size()];
result.toArray(res);
return res;
} |
a5e7f75a-8a8c-4181-8c56-3f516a56bc40 | 7 | public void tick(Enemy enemy) {
super.tick(enemy);
attackData.resetEnemiesTowerHasShoot(); // reset enemies it has shot this frame.
if (attackData.canShootAtThisFrame()) {
if (enemy.isActive() && enemy.isAlive()) { // can only handle active and alive enemies
if (canS... |
bfb4b44e-a710-4f02-afda-f600658d8f97 | 6 | public void trimToSize(int maxSize) {
while (true) {
K key;
V value;
synchronized (this) {
if (size < 0 || (map.isEmpty() && size != 0)) {
throw new IllegalStateException(getClass().getName()
+ ".sizeOf() is repo... |
d2b2c7bd-9d47-432c-811f-b5582cdab538 | 2 | public PossibleState contains(CommunityState cs) {
for (PossibleState ps : possibleStates)
if (ps.getCommunityState().equals(cs))
return ps;
return null;
} |
7a70917f-9ac0-48e0-8081-de030a8a0be5 | 7 | public void run() {
logger.fine("X-Plane receiver listening on port " + datagram_socket.getLocalPort());
DatagramPacket packet = null;
while (this.keep_running) {
try {
// wait for packet or time-out
packet = receiveXPlanePacket();
if ... |
6787481c-e477-4be5-9e93-feba4cff3f00 | 5 | public Document getDocument( String url, String encode ) {
Document doc = null;
try {
if ( encode.equals("UTF-8") ) {
doc = Jsoup.connect(url)
.timeout(50000)
.userAgent("Mozilla/5.0 (Windows NT 6.1; WOW64; rv:7.0.1) Gecko/20100... |
97dfe793-47ee-4055-b06e-9181ac237c67 | 8 | public static double ddot_f77 (int n, double dx[], int incx, double
dy[], int incy) {
double ddot;
int i,ix,iy,m;
ddot = 0.0;
if (n <= 0) return ddot;
if ((incx == 1) && (incy == 1)) {
// both increments equal to 1
m = n%5;
for (i = 1; i <= ... |
c5ab40c2-8ccb-405f-9af3-71469fb7748a | 5 | public static long mult(long flongOne, long flongTwo)
throws FixedPointLongException {
boolean negative = false;
long a = flongOne;
long b = flongTwo;
if (flongOne < 0) {
a = -a;
negative = !negative;
}
if (flongTwo < 0) {
b = -b;
negative = !negative;
}
long intmult = (a >> OFFSET) * (b ... |
7f232ac0-1917-4eb0-9c9c-deb8a3caae76 | 5 | public int threeSumClosest(int[] num, int target) {
assert num.length > 2:"the number of integers < 3!";
if (num.length == 3)
return num[0]+num[1]+num[2];
Arrays.sort(num);
if (num[0] >= target)
return num[0]+num[1]+num[2];
if (num[num.... |
d48300f7-76ee-42e7-a46e-3accb0d1fd82 | 1 | public static void main(String[] args) {
// TODO code application logic here
// Cuenta martin = Actions.create("2321321321", "Martin", 1);
//
// Ingreso ing = new Ingreso("paga navidad", 700);
// martin.doMovement(ing);
//
//
// Cuenta andrea = Action... |
4b17a822-f0da-4f18-aa69-701369500673 | 7 | public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.print("Podaj ilość produktów: ");
int ilosc = scanner.nextInt();
double suma0 = 0, suma7 = 0, suma23 = 0;
for (int i = 1; i <= ilosc; i++) {
int kod = -1;
whi... |
6a90a0a0-2e92-44a0-b0aa-7af091513752 | 8 | public static String compact(String str) {
char[] array=str.toCharArray();
char lastChar='a';
String carrRtn="\\n";
String tabRtn="\\t";
int counter=0;
StringBuffer sb=new StringBuffer();
for (int i=0;i<array.length;i++) {
if (i==0 || array[i]!=lastChar) {
if (counter>1) {
sb.append(counter);
... |
68e863fe-003e-4724-8906-5dd721a76d67 | 0 | public int getDirectionX(){
return directionX;
} |
1c0c1975-143b-479a-9869-0f6ea101c8df | 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... |
0b06c9db-babe-458d-bf0e-c0ce705c375c | 3 | @Override
public String execute() throws Exception {
try {
//camplist=(List<Dvddog>) myDao.getDbsession().createQuery("from Dvddog").list());
Map session = ActionContext.getContext().getSession();
Campaign camp = (Campaign) session.get("campa");
camplist = (L... |
90b426d0-c0e5-4975-8e11-54e176c0dcb6 | 9 | @Override
public synchronized void activate()
{
if (m_lActive)
{
// Already active
return;
}
m_lActive = true;
// Starts the session running in it's own thread to handle it's own commands
Goliath.Threading.ThreadJob loThreadJob = new Thre... |
27cb99eb-0a47-4a7a-9753-31daee406a26 | 5 | public void buildFactory(Map map, Cell c, Boolean aiMove) {
if (aiMove || Teams.comparePlayers(this.getOwner(),game.getCurrentPlayer())) {
if (game.getCurrentPlayer().canAfford(Factory.cost)) {
if (getBuildableCells(map).contains(c)) {
Factory f = new Factory(c, t... |
640adf9a-c692-4681-89f4-597e70f98409 | 3 | public void exportService(Class<T> serviceClass) {
Map<String, String> params = new HashMap<String, String>();
params.put("iface", serviceClass.getName());
tpURL.setParams(params);
// 对一个实际的执行对象进行包装,变身Invoker
Invoker<T> invoker = null;
try {
invoker = proxyFactory.createProxyInvoker(serviceClass.newInst... |
e6265ed5-a388-441e-94d5-d98859c9fe5e | 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... |
1407296b-64a4-41ed-989c-4037cc6c9119 | 8 | private void drawShapes(GraphicsContext gc) {
gc.setFill(Color.GREEN);
gc.setStroke(Color.BLUE);
gc.setLineWidth(1);
gc.fillText(tl.name, 40, 20);
int begin = tl.timelineEvents.firstEntry().getValue().getStartYear();
int end = tl.timelineEvents.lastEntry().getValue().getS... |
94fe759f-667d-4e5a-89b0-267ea5cd6dfa | 1 | public void NotifyPluginUpdateReceived(PluginUpdate update) {
for (IPluginUpdateNotification ti : pluginUpdateNotificationListeners) {
ti.onPluginUpdate(update);
}
} |
fc50149c-66ad-4c08-be11-292163d8a4d4 | 1 | public void visit_dup2(final Instruction inst) {
// If top two values are both category 1, dup them both.
// Otherwise, dup the one category 2 value.
final Set top = atDepth(0);
final int category = checkCategory(top);
if (category == 1) {
final Set top1 = atDepth(1);
checkCategory(top1, 1);
// Fo... |
cd603fd6-f73b-4f1e-8260-e744b7b978f0 | 7 | public void testIterator8() {
List<Message> msgs=createMessages();
MessageBatch batch=new MessageBatch(msgs);
int index=0;
for(Iterator<Message> it=batch.iterator(); it.hasNext();) {
it.next();
if(index == 1 || index == 2 || index == 3 || index == 10 || index == m... |
19eecbb1-2842-4856-b98b-a2852fc246ac | 4 | private String getPlayer(AccountManager manager) {
Player[] bufferPlayer = manager.getAllPlayer();
String s = "";
int counter = 0;
if(bufferPlayer[bufferPlayer.length -1] != null&&bufferPlayer[bufferPlayer.length -1].name.contentEquals("Bot")){
counter = 1;
}
for... |
2946e2ff-1453-4fbf-97dd-81dedd7bcf74 | 5 | @Override
public void ejecutar(Stack<Valor> st, MemoriaDatos md, Cp cp)
throws Exception {
if (st.size() < 2)
throw new Exception("DISTINTO: faltan operandos");
Valor op1 = st.pop();
Valor op2 = st.pop();
if (op1 instanceof Booleano && op2 instanceof Booleano) {
st.push(new Booleano(((boolean) op1.... |
10a4aba1-ab47-4460-afb8-6cb74488d5cd | 1 | public static void main(String[] args) {
try {
Element company = new Element("company");
Document document = new Document();
document.setRootElement(company);
Element staff = new Element("staff");
staff.addContent(new Element("name").setText("Se... |
0707ba8b-7f11-44ae-a34d-df384401cd95 | 7 | private void handleMouseMoved(int x, int y) {
x -= 50;
y -= 50;
x /= 16;
y /= 16;
if ((x < 0) || (y < 0) || (x >= map.getWidthInTiles()) || (y >= map.getHeightInTiles())) {
return;
}
if (selectedx != -1) {
if ((lastFindX != x) || (lastFindY != y)) {
lastFindX = x;
lastFindY = y;
path =... |
acc2f3a8-e264-4e5f-b198-1c51552a0aee | 8 | protected void checkRootDirectory() {
String rootText = selectRootText.getText();
if (rootText == null || rootText.isEmpty())
return;
root = new File(rootText);
if (root.exists() && root.isDirectory()) {
File projectDir = new File(root, "project");
Fil... |
7079272f-6634-4ed1-a084-3739d487b734 | 9 | protected void generatePackageFiles(ClassTree classtree) throws Exception {
PackageDoc[] packages = configuration.packages;
if (packages.length > 1) {
PackageIndexFrameWriter.generate(configuration);
}
PackageDoc prev = null, next;
for (int i = 0; i < packages.length;... |
34531963-f571-4e8d-8c7b-e862376cee88 | 0 | public void entering(final String name, final Object o, String... args) {
// info(StringUtils.shortName(o.getClass()) + "-" + o.hashCode() + " entering " + name + "(" + StringUtils.join(args, ", ") + ")");
} |
5f02b7c4-dac5-4835-91c9-804fab15a396 | 4 | public boolean replaceResponseLine( HTTPHeaderLine statusLine )
throws NullPointerException,
HeaderFormatException {
if( statusLine == null )
throw new NullPointerException( "Cannot replace the response status line with null line." );
if( statusLine.getKey() == null )
throw new HeaderFormatExce... |
37f5573e-c9ae-4159-87d3-5f88479189af | 8 | @EventHandler
public void onInventoryClick(InventoryClickEvent e)
{
// If either item is null (caused by failure to immediately update inventories after cancelled events),
// return as to avoid big ugly errors in console that make me sad.
if(e.getCursor() == null)
return;
if(e.getCurrentItem() == null)
... |
713aa7d0-6ef1-40ff-a3b5-3be0d6213095 | 9 | protected synchronized CtClass get0(String classname, boolean useCache)
throws NotFoundException
{
CtClass clazz = null;
if (useCache) {
clazz = getCached(classname);
if (clazz != null)
return clazz;
}
if (!childFirstLookup && parent !... |
eea812ba-34c5-4219-9d2c-3848bbba495e | 4 | public static void main(String[] args) {
String line = "";
String message = "";
int c;
try {
while ((c = System.in.read()) >= 0) {
switch (c) {
case '\n':
if (line.equals("go")) {
PlanetWars pw = new PlanetWars(message);
DoTurn(pw);
pw.FinishTurn();
message = "";
} e... |
29b43e27-682f-44d4-995b-fafbc1570fdd | 8 | public static double[] lsolve(double[][] A, double[] b) {
int N = b.length;
for (int p = 0; p < N; p++) {
// find pivot row and swap
int max = p;
for (int i = p + 1; i < N; i++) {
if (Math.abs(A[i][p]) > Math.abs(A[max][p])) {
ma... |
77310bb4-7382-43aa-b4ad-e60e320f9ff9 | 6 | public static ItemInfo itemByStack(ItemStack itemStack) {
if (itemStack == null) {
return null;
}
for (ItemInfo item : items) {
if (itemStack.getType().equals(item.getType()) && item.isDurable()) {
return item;
} else if (itemStack.getType().e... |
261e7f1c-e7a9-40c7-91ce-acbcb2992103 | 0 | public String getId() {
return id;
} |
20a1c225-81cc-49bc-9851-2e1d5ceab76e | 9 | @Override
public boolean intersectsBounds(CollisionObject object) {
if (object instanceof PlaneObject) {
return false;
}
Vector3d min = new Vector3d();
Vector3d max = new Vector3d();
object.getBounds(min, max);
if (getLocalSignedDistance(position, rotation, min) < 0) {
return true;
}
if (getLoca... |
875a12bd-6d9f-4060-9198-02f8f1372daa | 6 | public static void main(String[] args) throws Exception
{
if( args.length != 5)
throw new Exception("Example d'appel : source <nom_DNS_du_destinataire> <numero_de_port_destination> <taille_de_fenetre> <fichier> <pourcentage_erreur_crc>");
// configurer le client
int port = Integer.parseInt(args[1]);
if (... |
7990510e-efc8-46ca-b0cd-59a242359405 | 0 | public void setChallengeFormat(AlgorithmParametersType.ChallengeFormat value) {
this.challengeFormat = value;
} |
1f449386-f736-4f75-a9f0-ca0e1eaebd85 | 6 | private Rectangle getDragRowInsertionMarkerBounds(Row parent, int insertAtIndex) {
int rowCount = mModel.getRowCount();
Rectangle bounds;
if (insertAtIndex < 0 || rowCount == 0) {
bounds = new Rectangle();
} else {
int insertAt = getAbsoluteInsertionIndex(parent, insertAtIndex);
int indent = parent !=... |
e872c2ed-9999-47b4-8c03-bdaa18234142 | 4 | public Boolean connect()
{
try {
selectedPortIdentifier = CommPortIdentifier.getPortIdentifier( portname);
} catch (NoSuchPortException e1) {
setConnected(false);
error = "Port <"+portname+"> not found !";
trytolog(error);
return false;
}
//Required port found in system : We c... |
17cc772f-fd81-4e7d-93d2-1bf8b9616765 | 0 | public Order getOrdine() {
return ordine;
} |
a6122fc3-751a-461a-b31b-3a6127c7ce84 | 6 | public static double getDamageModBash(WeaponMaterial type) {
switch (type) {
case COPPER:
return 1.25;
case BRONZE:
return 1.25;
case SILVER:
return 3;
case IRON:
return 1;
case STEEL:
... |
da0e005a-3233-410c-8c38-421516018f41 | 9 | private boolean verifyResponse(byte[] peerHandshake, boolean newPeer)
{
if(peerHandshake == null)
{
return false;
}
else if(peerHandshake.length != 68)
{
return false;
}
// check bit torrent protocol and info hash
for (int i = 0; i < 48; i++)
{
// skip the 8 reserved bytes
if (i > 19 &... |
62e9a6b8-31c9-41be-acc6-987d82341dd8 | 3 | private void updateEntities(GameContext g) {
// UPDATE ALL ENTITIES
for (Mob m : dots) {
m.updateMob(g);
}
// for (Mob m : lines) {
// m.updateMob(g);
// }
for (Mob m : polygons) {
m.updateMob(g);
}
for (Mob m : explosions) {
m.updateMob(g);
}
} |
701d8bfe-5417-42c1-b10d-0bcef3c33b77 | 7 | @Override
public Class getColumnClass(int indiceColonne){
//System.out.println("ModeleListeLocations::getColumnClass()") ;
switch(indiceColonne){
case 0 :
return String.class ;
case 1 :
return String.class ;
case 2 :
return String.class ;
case 3 :
return Date.class ;
case 4 :
r... |
60cdc56d-b6fa-40ae-8f11-63a79c97a195 | 5 | @SuppressWarnings("unused")
private static void CollatzSequence(){
Scanner keyboard = new Scanner(System.in);
int n;
System.out.println("Starting number: ");
n = keyboard.nextInt();
int xPos = 0;
int steps = 0;
int largestValue = 0;
while(n > 1){
if(n > largestValue)
largestValue = n;
i... |
3641953e-2c39-4343-8b06-908bfeffaaec | 5 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final JPcodePK other = (JPcodePK) obj;
if (!Objects.equals(this.IdOrder, other.IdOrder)) {
return f... |
38b19a22-0c25-46a1-bd4d-c9afc4d6787e | 9 | public static List<String> explodeToList(String delimiter, String string) {
if (delimiter == null || string == null)
throw new IllegalArgumentException("Null object");
ArrayList<String> v = new ArrayList<String>();
StringBuffer curToken = new StringBuffer();
StringBuffer delimReader = new StringBuffer()... |
6ba44a21-9a7a-470a-a80b-ea7e1bc5de3f | 9 | public void buildHierarchy() {
String[] keys;
int ancestorCount;
YagoCategoryNodeOld node;
ArrayList<YagoCategoryNodeOld> nodeArray;
// order nodes by how many ancestors they have. Nodes with more ancestors MUST be at a lower level
// than those with less
keys = this.nodeMap.keySet().toArray(new S... |
09ccae2f-0db6-4b36-8461-3e9817abaae3 | 3 | private int getGroupPosition(String name, String fnmPrefix) {
ArrayList groupNames = (ArrayList) gNamesMap.get(name);
if (groupNames == null) {
EIError.debugMsg("No group names for " + name, EIError.ErrorLevel.Error);
return -1;
}
String nm;
for (int i = ... |
1d62203b-2d1d-4422-888d-6f921c1b415f | 5 | public static void main(String[] args) throws Exception {
playerNo = Integer.parseInt(args[0].trim());
int port = portOffset + playerNo;
Socket socket = new Socket("localhost", port);
BufferedReader in =
new BufferedReader(new InputStreamReader(socket.getInputStream()));
PrintWriter out =
new PrintWr... |
160c75ba-5bc9-4fc7-9c38-9c698d72c607 | 1 | private void acao101(Token token) throws SemanticError {
try {
String nomePrograma = token.getLexeme();
IdentificadorPrograma idPrograma = new IdentificadorPrograma(
nomePrograma);
tabela.add(idPrograma, nivelAtual);
} catch (IdentificadorJaDefinidoException e) {
throw new SemanticError(e.getMessag... |
9caee818-a2e7-479d-9bef-1f9e3893b6fc | 9 | public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
log.info("WANcostResummingServlet3h Got a GET...");
caches.reload();
link[][] linkArr = new link[caches.lSources.size()][caches.lDestinations.size()];
for (int i = 0; i < caches.lSources.size(); i++)
for (int j = ... |
027fa1bd-a011-431d-a06c-4564714a68ce | 3 | @Override
public Status execute(String command) throws MenuException {
switch (command) {
case "I":
displayInstructions();
return HELP;
case "H":
displayHints();
return HELP;... |
6fe2bbc5-3e4d-4bd8-9c9a-658b0d71bb4c | 0 | @Override
public void start() {
System.out.println("start the car");
super.start();
} |
119ba197-3341-4f20-9807-44dad0606d2e | 9 | private void checkForIdenticalElements(){
boolean test = false;
for(int i=0; i<this.nItems; i++){
int sum = 0;
double check = this.scores0[i][0];
for(int j=0; j<this.nPersons; j++)if(this.scores0[i][j]==check)sum++;
if(sum==this.nPersons){
... |
2df8b40f-2a18-4752-94ff-a8eafede562f | 8 | public void listen() throws InvalidUIntException {
System.out.println("listening");
int available;
try {
Thread.sleep(2500);
while(true) {
while ((available = sis.available()) == 0)
{
Thread.sleep(100);
}
byte id = sis.readByte();
sVLQ payloadLength = new sVLQ(sis.readByte());
a... |
28bd1fea-e22b-4d1a-9ce3-5e2f97983d27 | 2 | public void setwnd() {
GraphicsDevice dev = getGraphicsConfiguration().getDevice();
if (prefs == null)
return;
try {
dev.setDisplayMode(prefs);
dev.setFullScreenWindow(null);
setVisible(false);
dispose();
setUndecorated(false);
setVisible(true);
} catch (Exception e) {
throw (new Runtime... |
ecc5de7e-006a-42e8-a41e-414360bb5065 | 8 | @SuppressWarnings("unchecked")
private ArrayList<String>[] partFile(String fichier, int nbNodes) {
try {
BufferedReader br = new BufferedReader(new FileReader(new File(fichier)));
String line = null;
ArrayList<String> parts[] = new ArrayList[nbNodes];
for(int i=0; i<nbNodes; i++)
parts[i] = new Array... |
fe7f73cb-b616-404b-9242-25c61478cd3f | 3 | public static void main(String argv[]) {
try {
File fXmlFile = new File("D:\\Java SE\\src\\xml\\staff.xml");
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();... |
ca5d167d-99e5-4369-acb4-a57164d97258 | 1 | private void addRowToTable(List<QuestDTO> usersList) {
for (QuestDTO quest : usersList) {
tableModel.addRow(quest.toArray());
}
} |
2a3a1301-f6f8-4c7a-b6db-de5d9d8071a1 | 8 | private boolean checkwalls(Location loc)
{
Location north = loc.add(0, -1);
Location east = loc.add(1, 0);
Location south = loc.add(0, 1);
Location west = loc.add(-1, 0);
int yes = 0;
if (north.getY() >= 0 && map[north.getX()][north.getY()] == nonWall)
yes++;
if (east.getX() < xSize && map[east.getX(... |
09a0f493-9010-470c-a80d-ab7ad6870f46 | 5 | @Override
public boolean blocked(Node n) {
if (n == null || !walkable(n)) {
return true;
}
if (n.getPrev() == null) {
return false;
}
if (!walkable(n.getPrev())) {
return true;
}
final Node p = n.getPrev();
return checkBlocked(n, p) || checkBlocked(p, n);
} |
8448a110-babf-49a2-a1f7-b8e6c0aefddc | 8 | public FirstTask(List<Float> randomNumbers) throws IOException {
String choice = "";
while (!choice.equals("back")) {
printMenu();
randomNumbers.clear();
choice = reader.readLine();
if (choice.equals("1")) {
System.out.print("Равномерное ... |
d5739d90-8037-4b2b-b262-65b1854d39c9 | 7 | private void deleteSession()
{
System.out.println("Deleting a complete session ...");
// ---------------------------------------------------
// get list of features FESVo IDs:
int [] ids = this.loader.getFeaturesIDs();
// convert into array of Integ... |
2e341150-6bc8-4d41-84b3-61c5f771a632 | 8 | public String getBacklink(String name) throws IOException {
String namelist = WakeBackends.namelist;
if (namelist.split(name.split("[ __]")[0] + ",").length == 2) {
if (namelist.split(name.split("[ __]")[0] + ",")[1].split(",")[0]
.equals("&i=1"))
; // ここ注意 &i=1を読み飛ばしている うかつに消さないように
else if (!namelis... |
4ec1cbe8-9f47-4bb6-a891-d41b84682a2d | 3 | public LocationHeader(String rawHeader) throws MalformedHeaderException {
String[] data = rawHeader.split(" ");
if (!data[0].equals("GET")) {
throw new MalformedHeaderException("Expected get header, received " + data[0]);
}
if (!data[2].matches("HTTP/1.[0-1]")) {
throw new MalformedHeaderException("... |
5f91287b-006e-418a-93e7-5c0793557535 | 6 | private boolean checkforLinearity(Production[] p)
{
int count=0;
for (int i=0; i<p.length; i++)
{
if (ProductionChecker.isRightLinear(p[i]))
count++;
}
if (count==p.length)
{
JOptionPane.showMessageDialog(environment.getComponent(0), "This is a right-linear Grammar (Regular Grammar and Context-F... |
bd61fda2-7f34-485b-8fc7-4962ede7756c | 6 | private static void updateInnerEntry(int mod, String name, CtClass clazz, boolean outer) {
ClassFile cf = clazz.getClassFile2();
InnerClassesAttribute ica = (InnerClassesAttribute)cf.getAttribute(
InnerClassesAttribute.tag);
if (ica == null)
... |
5f59b86f-2b26-4c8f-8e33-9a79d540b0bf | 5 | void connectToServerActionPerformed(ActionEvent e) {
boolean allOk = true;
client.setHost(serverName.getText());
addHistoryItem(oldServers, "serverNameHistory.txt", serverName.getText());
if (!(client.loadGame(theGameClass.getText()))) {
allOk = false;
} else {
client.setProtocolName(t... |
73b9a1c9-f3c4-4bfd-b1bc-8eaba3327c2b | 0 | public boolean isPossibleBreakpoint() {
return possibleBreakpoint;
} |
50e569c3-ddb5-407a-90ce-5be40e1bfbd8 | 0 | @Test
public void testGetS2() {
System.out.println("getS2");
Move instance = new Move(6,9);
int expResult = 9;
int result = instance.getS2();
assertEquals(expResult, result);
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.