method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
08af4cde-e133-4799-b717-adeb0aaea125 | 5 | private static void checkArgs() {
for (int i = 0; i < arguments.length; i++) {
if (arguments[i].contains("noLauncher")) doLauncher = false;
if (arguments[i].contains("noIntro")) doIntro = false;
if (arguments[i].contains("debug")) DEBUG = true;
if (arguments[i].contains("mute")) MUTE = true;
//if (argu... |
a8e80a84-8299-4999-b1b1-7df6905ab0ec | 3 | private boolean jj_3R_19() {
if (jj_scan_token(RETURN)) return true;
if (jj_3R_76()) return true;
if (jj_scan_token(SEMICOLON)) return true;
return false;
} |
a63f7bf2-0f0c-4356-ab2d-05a293c0c33c | 7 | private void txtcedulaKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtcedulaKeyTyped
char caracter = evt.getKeyChar();//Validacion del campo cedula
if (caracter >= '0' && caracter <= '9' || caracter == 8 || caracter == KeyEvent.VK_BACK_SPACE || caracter == KeyEvent.VK_CAPS_LOCK || caracter =... |
c346bcd4-ff99-4055-b5a2-ec8158841ba8 | 6 | public static int insertMstxInfo(String info_title, String info_dis, String info_lon, String info_lat, String uid,
String info_sort, int info_price, int where, String mshotelName) {
int mid = MstxDao.getMaxNumber("mstx_info");
MstxDao.updateMaxNumber(3);// 将该字段值加1
Connection con = DBUtil.getConnection();
Pre... |
f34bf061-5e38-4883-ab2b-fae2f258c0f3 | 1 | public static Object[] run(String query) throws ClassNotFoundException, SQLException {
System.out.println(query);
if (true) return null;
Class.forName("com.mysql.jdbc.Driver");
Connection connection = DriverManager.getConnection("jdbc:mysql://localhost/Forum?user=root&password=1234");
Statement statement = co... |
100f8bb1-a687-4b11-92b7-e84c30491916 | 1 | public double repeatNFoldCrossValidation(Matrix features, Matrix labels, int n, int repetitions){
double mseTotal = 0.0;
long seed = System.currentTimeMillis();
for (int i = 0; i < repetitions; i++) {
Matrix shuffledFeatures = features.shuffle(new Random(seed));
Matrix s... |
7518e1f5-88ef-4c7c-87e0-25e7603929b5 | 3 | public List<R> getResults() {
Iterator<TaskItem<R,C>> items = iterator();
List<R> results = new ArrayList<R>();
while(items.hasNext()) {
TaskItem<R,C> item = items.next();
if(item.future.isDone()) {
try {
results.add(item.future.get());
} catch(Exception e) {
... |
fb293296-f04b-4bda-a52b-2c12abf17df6 | 4 | public static void main(String[] args) {
// TODO code application logic here
//10. Дан двумерный массив целых чисел. Сформировать одномерный
//массив, каждый элемент которого равен наибольшему по модулю
//элементу соответствующего столбца двумерного массива.
System.out.println... |
c52ff6b2-6f93-48dc-b717-12fc38130aa5 | 0 | public void addMessage(IMessage message) {
history.add(message);
setChanged();
notifyObservers(ModelNotification.MESSAGE_RECEIVED);
} |
94381d0c-e2f9-4c4a-9ee2-30ad17e72a4a | 6 | public PlaySound(GbAudio audio) {
int[] samples = audio.samples;
int[] soValues = audio.soValues;
if (samples.length != soValues.length * 2)
throw new IllegalArgumentException("samples length " + samples.length + " does not match twice so length " + soValues.length);
if (soValues.length < 1)
... |
709d34a2-b8f7-4fc9-9e20-66df6ad76eae | 4 | private void autonomousScoreFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_autonomousScoreFocusLost
// TODO add your handling code here:
try{
Integer.parseInt(autonomousScore.getText());
}
catch(Exception e){
autonomousScore.setText("0");
}
... |
8d4ecdc6-63dd-48ad-9d3c-000b7fb58061 | 8 | public void stop() {
// Pass on to upstream beans
if (m_trainingProvider != null && m_trainingProvider instanceof BeanCommon) {
((BeanCommon)m_trainingProvider).stop();
}
if (m_testProvider != null && m_testProvider instanceof BeanCommon) {
((BeanCommon)m_testProvider).stop();
}
... |
aaf29c0c-2e53-40f8-9ea7-115becb8fff1 | 9 | public Wave07(){
super();
MobBuilder m = super.mobBuilder;
for(int i = 0; i < 75; i++){
if(i < 5){
if(i % 2 == 0)
add(m.buildMob(MobID.RATTATA));
else
add(m.buildMob(MobID.PIDGEY));
}
else if (i > 5 && i < 45){
if(i % 2 == 0)
add(m.buildMob(MobID.PIDGEY));
else
add(m.b... |
56a2a56a-da9e-404c-8cae-80939cef1e96 | 5 | public void euthanize() {
ArrayList<Fish> magikarps = new ArrayList<Fish>();
for (Fish a : fishies) {
if (a.getAge() == a.getMaxAge()) {
a.setHealth(0);
if (a instanceof Magikarp) {
magikarps.add(a);
}
}
... |
87990619-6935-4013-9792-05047dcc81e5 | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Jogador other = (Jogador) obj;
if (posicao == null) {
if (other.posicao != null)
return false;
} else if (!posicao.equals(other.posicao)... |
49c1d8f6-9036-46dd-995e-362765a66b05 | 3 | @Override
public double get(int i, int j) {
outOfBound(i - 1, j - 1);
for (Element e : elems) {
accessCount += 1; // access auf das Element
if (e.getI() == i && e.getJ() == j) {
return e.getValue();
}
}
return 0.0;
} |
a6b90ad7-f354-47fa-acb4-9383bd4b7a0d | 8 | @Override
public boolean equals(Object that) {
if (that == null) {
return false;
}
if (that.getClass() != this.getClass()) {
return false;
}
SpriteElement thatSprite = (SpriteElement) that;
return this.mAlignX == thatSprite.mAlignX && this.mAl... |
e69650eb-5869-4b77-8fc4-621d7affc85d | 3 | public static IautosStatusCode getByDesc(String desc) {
if (null == desc) {
throw new IllegalArgumentException(
"IautosStatusCode desc is null");
}
for (IautosStatusCode iautosStatusCode : IautosStatusCode.values()) {
if (iautosStatusCode.getDesc().equals(desc)) {
return iautosStatusCode;
... |
78febfba-aaf5-4007-9a66-8849c9cbb8ca | 9 | protected int computeScore () throws IncompatibleScoringSchemeException
{
int[] array;
int rows = seq1.length()+1, cols = seq2.length()+1;
int r, c, tmp, ins, del, sub, max_score;
// keep track of the maximum score
max_score = 0;
if (rows <= cols)
{
// goes columnwise
array = new int [rows];
... |
139c37ac-09b9-45ee-941c-fa10ef9ad849 | 0 | private String getNameTypeObj(String objName) {
return objName.substring(nameGameWorld.length());
} |
4509b658-8765-4522-881c-35a50d716b65 | 3 | @Override
public void render(Drawer drawer) {
for (int x = 0; x < tileColumns; x++) {
for (int y = 0; y < tileRows; y++) {
if (tiles[x][y] != null) {
drawer.draw(tiles[x][y], (x * tileWidth) + getRenderableX(), (y * tileHeight) + getRenderableY());
... |
6cfa3f74-fa98-4619-9c3e-9721409929ac | 0 | public void countTail(){
//for(int i = 0; i < m.length;i++){
//if(m[i].equals("Tail")){
countT++;
//}
//}
} |
f3d45263-9862-448f-8699-5f904785b69a | 7 | private String startSetToString() {
StringBuffer FString = new StringBuffer();
boolean didPrint;
if (m_starting == null) {
return getStartSet();
}
for (int i = 0; i < m_starting.length; i++) {
didPrint = false;
if ((m_hasClass == false) ||
(m_hasClass == tru... |
741030f1-bd4d-4722-9fe1-fefce65512d0 | 0 | public ViewHandler() {
mainPage = new MainPage("Computer Test Programe");
mainPage.setJMenuBar(new CbtMenuBar());
} |
dc3b2efb-dc33-4378-bb81-3f5084fb99f6 | 6 | private static String codeAnswerAux(String answer,String question){
question=question.replace("[???]", answer);
MainInfo.submittedQuestion = question;
log.finer("\n"+question);
try {
try {checkForbiddenKeyWords(answer);}
catch (Error e) {
return "Wrong! Try again.\n You are trying to do ... |
b8287a65-168e-4565-ad87-a59e639645f0 | 2 | public Map<String, Groop> getGroopMap()
{
if (groops.size() == 0)
try
{
execute();
}
catch (SQLException e)
{
e.printStackTrace();
}
return groops;
} |
0dda9e20-5382-41cb-a8f0-cd5fc3c4276e | 6 | public String nextCDATA() throws JSONException {
char c;
int i;
StringBuffer sb = new StringBuffer();
for (;;) {
c = next();
if (c == 0) {
throw syntaxError("Unclosed CDATA");
}
sb.append(c);
i =... |
58b139f3-2d41-4a00-abc2-26c2463dcaf3 | 2 | public String encrypt(String plainTextStr) {
final byte[] cipherTextBytes;
final Cipher cipher;
final SecretKeySpec SKSAESKey;
final int blockSize;
final byte[] ivBytes;
final SecureRandom random;
final IvParameterSpec iv;
final byte[] ivWithCipherTextByte... |
3a42b260-0058-48f8-8d12-71c979b309fd | 4 | private Case getNextCase() {
Case tete = this.listeCasesSerpent.getFirst();
switch(this.directionActuelle) {
case VERS_LE_HAUT :
return new Case(tete.getPosX(), tete.getPosY()-1);
case VERS_LA_DROITE :
return new ... |
52bb4f6f-b1cf-4366-806c-0c4f199ab803 | 8 | public void update() {
super.update();
if (level.player != null) {
int xd = level.player.x - x;
int yd = level.player.y - y;
Rectangle r3 = level.player.getBounds();
Rectangle r2 = getBounds();
//if (xd * xd + yd * yd ... |
160b8fa7-69bb-49f2-9e9e-f84f8676d1c2 | 5 | public static TileFlags swigToEnum(int swigValue) {
if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue) {
return swigValues[swigValue];
}
for (int i = 0; i < swigValues.length; i++) {
if (swigValues[i].swigValue == swigValu... |
4a2feb69-e2bd-41cd-b2e2-5bab0994952c | 1 | protected void addLine(String line) {
if (line == null) {
IllegalArgumentException iae = new IllegalArgumentException("The line must not be null!");
Main.handleUnhandableProblem(iae);
}
this.uiFileLines.add(line);
} |
292ff19f-2b7e-4e3f-89f3-ea94b77d5ee2 | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
User other = (User) obj;
if (username == null) {
if (other.username != null)
return false;
} else if (!username.equals(other.username))
... |
17db8478-e8ec-4f24-87cd-b40c6f9f204e | 8 | private boolean r_postlude() {
int among_var;
int v_1;
// repeat, line 56
replab0: while(true)
{
v_1 = cursor;
lab1: do {
// (, line 56
... |
a101f5df-11a0-4bdb-a7c5-c20ed3ef0a20 | 3 | public String toStringPositionPossible()
{
// affiche le tableau des positions possible les & represente les cases possibles
int cpt = 0;
StringBuffer res = new StringBuffer("");
for (int i = 0; i < 8; i++)
for (int j = 0; j < 8; j++)
{
if (cpt == 8)
cpt = 0;
cpt++;
res.append(Posi... |
2f9d03b9-6a6e-4d13-80bf-4628965cadc3 | 0 | public boolean isActive() {
return isActive;
} |
dfadb141-e733-4648-a596-0128182d68f6 | 8 | private static void generateSearchMethod(ClassFile cf,
Class beanType,
BeanProperty[] properties)
{
MethodInfo mi;
{
TypeDesc[] params = {TypeDesc.OBJECT, TypeDesc.OBJECT};
mi = cf.addMe... |
bcd4d734-d762-4941-88ef-aa3a95c8e206 | 6 | public static boolean canCarry(Actor carries, Actor actor) {
if (carries == null || actor == null) return false ;
for (Mobile m : actor.aboard().inside()) {
if (m instanceof Suspensor) {
final Suspensor s = (Suspensor) m ;
if (s.passenger == actor) {
if (s.followed == carries) re... |
51e1cf99-aa64-4092-86e0-f2c8634e223b | 6 | public static void transferSynonyms(Stella_Object oldobject, Stella_Object newobject) {
{ List originatedprops = Logic.originatedPropositions(oldobject);
{ LogicObject synonym = null;
Cons iter000 = Logic.getSynonyms(oldobject);
for (;!(iter000 == Stella.NIL); iter000 = iter000.rest) {
... |
d83e7d4a-8e06-47fe-bc97-e42048570183 | 1 | @Override
public void addUmlDiagramListener( UmlDiagramListener listener ) {
if( listener == null ) {
throw new IllegalArgumentException( "listener must not be null" );
}
umlDiagramListeners.add( listener );
} |
01fc98a3-70e6-44c1-8a24-6cc533e5a93d | 3 | private ByteBuffer decodeStream(Set<String> filterLimits) throws IOException {
ByteBuffer outStream = null;
// first try the cache
if (decodedStream != null && filterLimits.equals(decodedStreamFilterLimits)) {
outStream = (ByteBuffer) decodedStream.get();
}
// no lu... |
e80bee9e-77e9-4f62-a0f9-569c283541c0 | 2 | public LocalInfo findSlot(int slot) {
for (int i = 0; i < count; i++)
if (locals[i].getSlot() == slot)
return locals[i];
return null;
} |
faddb8cc-dbf8-4736-a311-9189945f5cbe | 4 | public void executeSetMethod(Object instance, Method method, Object value) {
if(method == null)
return;
try {
method.invoke(instance, value);
} catch (IllegalArgumentException e) {
System.err.println("<ClassInspect> Failed to execute SET Method <" + method.getName() + ">. Arguments passed to method is wr... |
d3c298c7-ae71-4152-aba2-8189192b44f8 | 4 | public void searchEngineMenu1(DataSource ds) {
System.out.println("\n"
+ "Enter Name or health care number of patient: ");
Scanner s1 = new Scanner(System.in);
String patient_info = s1.nextLine();
try {
ResultSet rs = ds.searchEngineInfo(patient_info);
int counter = 0;
while (rs.next()) {
if (c... |
57b0aa34-353c-412e-a7f2-3281860a8513 | 5 | @EventHandler(priority = EventPriority.HIGHEST)
public void PlayerDamage(EntityDamageEvent e) {
if (e.getCause() == DamageCause.FALL) {
if (Settings.world
|| WorldSettings.worlds.contains(e.getEntity().getWorld()
.getName())) {
if (e.getEntity() instanceof Player) {
final Player p = (Player) ... |
48d13938-4c06-4656-a302-43d3072f883d | 6 | public static HashMap<String, HashMap<String, Integer>> getMap(String filePath) throws Exception
{
HashMap<String, HashMap<String, Integer>> map =
new HashMap<String, HashMap<String,Integer>>();
BufferedReader reader = filePath.toLowerCase().endsWith("gz") ?
new BufferedReader(new InputStreamReader(
... |
abc2ce3c-50c7-43d5-80ce-62bda507256c | 0 | private List<ISocketServerConnection> getConnections() {
return connections;
} |
a3f0b91e-caf4-40fa-9f39-bc90c91d0217 | 0 | public Milk(String brand, Integer price, Integer volume) {
this.brand = brand;
this.volume = volume;
this.price = price;
init();
} |
92104cab-2d97-4bf4-9810-3f0eda5e77f6 | 9 | void remove() {
final int oldn = n;
n -= k;
if (k > n) {
k = n;
indices = new int[k];
for (int i = 0; i < k; ++i) {
indices[i] = i;
}
} else if (n == k) {
if (indices[0] == 0) {
for (int i = 0; ... |
8b33031f-ac04-446a-8e1b-aef27d972a49 | 6 | static void orderHand(Hand testHand)
{
while (true){
for (int x = 1; x < testHand.size();x++){
if (testHand.get(x).getValue() < testHand.get(x-1).getValue())
{
Card card1 = testHand.get(x);
Card card2 = testHand.get(x-1);
testHand.setElementAt(ca... |
4d7910b1-f072-4851-b3eb-a71279981dc2 | 5 | @Override
public int span(int row, int column) {
switch (column) {
case 0:
SpanInfo si1 = columnMap.get(0).get(row);
return si1.num;
case 1:
case 2:
case 3:
case 6:
SpanInfo si2 = columnMap.get(2).get(row);
return si2.num;
default:
return 1;
}
} |
872de60e-892b-48e4-b815-f350b6d20071 | 1 | public int romanToInt(String s) {
int value =0;
for(int i =0; i< s.length();i++){
System.out.println(s.charAt(i));
value += getValue(s,i);
}
return value;
} |
683ba2bc-3a58-4d48-b632-6025a32cec3b | 6 | public static void enemyMeleeAttackPlayer(Enemy me, Polygon p)
{
boolean[] hits = {false, false, false, false};
boolean contact = false;
if(p == null)
{
//System.out.println("fuck");
}
if(intersectionOf2Shapes(p, CoreClass.mainCharacter.getUpBox()))
{
hits[0] = true;
contact = t... |
3e6e7da4-f58e-40ce-9aef-42fa30a3f06f | 4 | public void getNeighbors(int x, int y){
int reps = culture[x][y].getParameter("HoodSize");
if(reps == 0){return;}
int[] info = new int[reps];
for(int d = 0; d <= reps-1; d++){
int tempx = checkAddress("X", culture[x][y].getParameter("NextX"));
tempx = mothership.checkLoc("X", tempx);
int ... |
ce0e0fd2-d326-43ea-a202-1b3ebe6dfe73 | 8 | @Override
protected void processpacketforward(SimEvent ev) {
// search for the host and packets..send to them
if (uplinkswitchpktlist != null) {
for (Entry<Integer, List<NetworkPacket>> es : uplinkswitchpktlist.entrySet()) {
int tosend = es.getKey();
List<NetworkPacket> hspktlist = es.getValue();
i... |
3aa13895-bcfd-431b-94d9-c3db48ff87fc | 4 | public static void main(String[] args) {
for (int z = 997; z >= 335; z--) {
for (int y = (1000 - z - 1); y + z <= 999 && ((1000 - (y + z)) < y); y--) {
int x = 1000 - (y + z);
if (x*x + y*y == z*z) {
System.out.println(x * y * z);
}
}
}
} |
f817faf2-4695-4875-ac1f-23d1d8cbdcb9 | 0 | public ArrayList<Account> getAccounts(){ return accountsCatalog; } |
0a0bdf7b-8b3f-44c5-a650-acc401220129 | 9 | @Override
public List<Environmental> removeSellableProduct(String named, MOB mob)
{
final Vector<Environmental> V=new Vector<Environmental>();
final Environmental product=removeStock(named,mob);
if(product==null)
return V;
V.addElement(product);
if(product instanceof Container)
{
DoorKey foundKey=nu... |
d3785f7b-a755-4552-b3fc-b8fff2bbf805 | 0 | @Override
public void close() {
hide();
} |
c707a9c9-9c74-45e6-b044-4ceed3b8d452 | 7 | public int compareTo(Object arg0) {
DataRow row = (DataRow) arg0;
DataHeader header = getTable().getHeader();
DataColumn column;
int result = 0;
if (header.isDefaultSort()) {
for (int i = 0; i < header.getColumnCount(); i++) {
column = header.getColumn(i);
if (column.isSorted()) {
result = he... |
ae51a779-511e-44f6-966e-dc8cbec78aef | 8 | @Test
public void testIterator() {
ThriftyList<Integer> list = new ThriftyList<Integer>();
ListIterator<Integer> i = list.listIterator();
try {
i.next();
Assert.fail();
} catch (NoSuchElementException e) {
}
try {
i.remove();
Assert.fail();
} catch (IllegalStateEx... |
a505f02e-a4ab-4d69-919f-b70c7237aaf3 | 8 | protected void generateRowData(RowDetails rowDetails) {
List<Column> columns = rowDetails.getTable().getColumns();
List<Object> cellValues = new ArrayList<Object>();
//If column is configured as 'generates own data', then there would
//be less number of cell values in the row. W... |
64ab6847-7175-4a32-900e-aae35830424a | 3 | public boolean contains(int x, int y) {
return (x > this.x && x < this.width + this.x && y > this.y && y < this.height + this.y);
} |
2a696b00-3d4e-47c6-ab52-895cc111ba22 | 6 | public void startIteration() {
// has timestep been changed?
if (sim.getTimeStep() != savedTimeStep) {
setParams();
}
v = Math.sin(freqTime) * maxV;
freqTime += frequency * 2 * pi * sim.getTimeStep();
frequency = frequency * fmul + fadd;
if (frequency ... |
b33db6ef-696b-46fe-b1d4-df3fab0fe6bc | 7 | private boolean shouldBeSwapped(int index1, int index2){
if (index1>=size() || index1<0 || index2>=size() ||
index2<0)
return false;
E object1 = theHeap.get(index1);
E object2 = theHeap.get(index2);
//Causes issues if one of them is null
if (object1 == null || object2 == null)
return false;
//This... |
b2f3f81d-8a76-4021-885d-4013c052e928 | 0 | public int getSequence_Id() {
return sequence_Id;
} |
02c48a8d-719b-40ed-adb6-355fce890954 | 7 | @Override
public void draw(Graphics g) {
if (_card.isVisible(_playerID)) {
Rectangle bounds = new Rectangle(_bounds);
if (bumpUp) {
bounds.y += 5;
}
g.setColor(Color.white);
g.fillRect(bounds.x, bounds.y, bounds.width, ... |
b9fe82ce-1b9d-476f-9730-d075069581ed | 9 | private long readLong_slow (boolean optimizePositive) {
// The buffer is guaranteed to have at least 1 byte.
position++;
int b = niobuffer.get();
long result = b & 0x7F;
if ((b & 0x80) != 0) {
require(1);
position++;
b = niobuffer.get();
result |= (b & 0x7F) << 7;
if ((b & 0x80) != 0) {
req... |
60424302-1bf8-4682-aa4b-f5d7c94b107c | 9 | private void colchete() {
// <colchete> ::= “[“ <inteiro> “]” <colchete> | λ
if (!acabouListaTokens()) {
nextToken();
if (tipoDoToken[1].equals(" [")) {
contadorColchete++;
if (!acabouListaTokens()) {
nextToken();
... |
1f2598fc-8251-4cfd-9dec-d733cf796716 | 2 | public ArrayList<Object> subarray_as_ArrayList(int start, int end){
if(end>=this.length)throw new IllegalArgumentException("end, " + end + ", is greater than the highest index, " + (this.length-1));
ArrayList<Object> arrayl = new ArrayList<Object>(end-start+1);
for(int i=start; i<=end; i++)array... |
332d58c9-3aa9-44ed-a4e2-6906c62beb6e | 7 | private boolean isDragOk( final java.io.PrintStream out, final java.awt.dnd.DropTargetDragEvent evt )
{ boolean ok = false;
// Get data flavors being dragged
java.awt.datatransfer.DataFlavor[] flavors = evt.getCurrentDataFlavors();
// See if any of the flavors are a file list
int... |
1632f5de-7d9d-46c6-a1cf-5f1a8d6c7776 | 3 | void checkType(int index, Class<?> value) {
if ((value != null) && (value != types.get(index))) {
throw new ColumnFormatException();
}
} |
0f4a12ff-a0d3-47c1-a959-e02bd8bcc3e3 | 1 | public BitOutputStream(OutputStream out) {
if (out == null)
throw new NullPointerException("Argument is null");
output = out;
currentByte = (byte) 0;
numBitsInCurrentByte = 0;
} |
a20f26eb-a881-4c75-b8e6-fec8022ab8d7 | 8 | public static void main(String[] args) {
Result result;
result = JUnitCore.runClasses(BetTest.class);
System.out.println("Classe Bet: " + result.getRunCount() + " tests réussis.");
for (Failure failure : result.getFailures())
{
System.out.println("Classe Bet: " + failure.toString());
}
result = J... |
813112e3-4656-47ba-bfbe-e07fc9593783 | 5 | public com.quickserverlab.quickcached.client.CASValue gets(String key, long timeoutMiliSec)
throws TimeoutException, com.quickserverlab.quickcached.client.MemcachedException{
com.quickserverlab.quickcached.client.CASValue value = null;
try{
OperationFuture <CASValue<Object>> f = getCache().asyncGets(key);
... |
bfefb4e6-a096-47cc-8691-88683fbf30bc | 5 | @Override
public void bfs(String label, Function<Vertex, Vertex> action) {
Vertex v = getVertex(label);
if (v.wasVisited() == false) {
v.setVisited(true);
action.apply(v);
pQueue.add(v);
}
JList<Vertex> listOfAdjacent = getEdges(mapOfVerticeIndex.get(v.getLabel()));
for (Vertex neighbor : listOfA... |
2bbcc999-5dc7-43ed-ad26-30ab5a372351 | 2 | protected int loadShader(String filename, int type) {
StringBuilder shaderSource = new StringBuilder();
int shaderID = 0;
try {
BufferedReader reader = new BufferedReader(new FileReader(filename));
String line;
while ((line = reader.readLine()) != null) {
shaderSource.append(line).append("\n");
... |
8e66a33b-72ea-41b5-b09b-4459b967cd7c | 5 | public void doWork() {
Thread thread1 = new Thread(new Runnable() {
public void run() {
for (int i = 0; i < 10; i++) {
try {
increment(Thread.currentThread().getName());
} catch (InterruptedException ex) {
... |
e36311ad-1f48-46aa-90e7-676176d4ecde | 9 | @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
IntegerSequenceSweep other = (IntegerSequenceSweep) obj;... |
07e23e34-9fcd-48f5-818d-eae9487edd25 | 1 | public Item removeBefore(DNode<Item> nd)
{
if (nd.prev == head)
return null;
return remove(nd.prev);
} |
83374bc9-1f64-4d8f-8bb9-6e29bbafeb0f | 1 | private void check(boolean val) {
if (!val) {
throw new IllegalArgumentException();
}
} |
c03631b6-ae18-41e7-a1b9-aed8ea32abd4 | 5 | void setCodeValues(HTreeNode root){
/* Does nothing if root node is null. */
if (root == null)
return;
/* Checks if the root is null. */
if (root != null)
{
/* Checks if the left subtree is null. */
if (root.getLeft() != null)
/* Set code of left subtre... |
1dd2d5c0-f3cc-4989-9d2a-9d11ab59a653 | 9 | public Modules()
{
this.list = new ArrayList<String> ();
String packageName = "jmxattacks";
File file = new File(Modules.class.getProtectionDomain().getCodeSource().getLocation().getPath());
// Test if program is launched from jar file
String path = file.getPath();
boolean test = path.matches(".*\\.jar... |
763420e7-17bc-470f-adca-34bc8966f6a5 | 6 | public static void main(String[] args) throws Exception
{
HashSet<Integer> set = new HashSet<Integer>();
BufferedReader reader = new BufferedReader(new FileReader(new File(
ConfigReader.getChinaDir() + File.separator +
"Kathryn_update_NCBI_MostWanted" + File.separator + "otuModel_pValues_otu.txt"
)... |
e94665b2-84a5-411f-9845-116781ab851d | 5 | @Override
public Object getValueAt(int rowIndex, int columnIndex) {
DeliveryPacket packet = deliveryPackets.get(rowIndex);
if (columnIndex == DELIVERY_PACKET_ID) {
return packet.getId();
} else if (columnIndex == MEMBER_NAME) {
return packet.getMember().getFullName();... |
864909f1-a1de-4462-954f-aec08a79b1f2 | 1 | @Override
public String toString() {
return (Platform.isWindows() ? '/' : '-') + mNames[0];
} |
d2784561-3ba7-4cef-9224-cfd749e320ce | 6 | public Integer isResult(boolean win, boolean lose, boolean cut) {
// 0 - win
// 1 - lose
// 2 - cut
Integer num = 2;
if ( win == true
&& lose == false
&& cut == false ){
num = 0;
} else if ( lose == true
&& win == false
&& cut == false ){
num = 1;
} else {
num = 2;
}
r... |
93727387-f09f-4f84-9b1a-5d579a9003e1 | 4 | public void paint(GC gc, int width, int height) {
if (!example.checkAdvancedGraphics()) return;
Device device = gc.getDevice();
if (bc[0] == null) {
bc[0] = new BallCollection(0, 0, 5, 5, 20, 20, new Color[] { device
.getSystemColor(SWT.COLOR_GREEN) });
bc[1] = new BallCollection(50, 300, 10, -5, 50, ... |
2a87bea0-151e-41ed-855f-d4b3deb86756 | 2 | public Object[] getValues()
{
for (int i = 0; i < editors.length; i++)
if (editors[i] != null)
values[i] = editors[i].getValue();
return values;
} |
fcb31ccc-f8df-4ff9-88f7-3f70cca487c5 | 7 | @Override
public boolean setObject(String name, JOSObject<?, ?> value) {
boolean n = this.getObject(name) == null;
srcJOSCompound comp = this;
String[] path = name.split("\\\\");
if(path != null && path.length >= 1){
srcJOSCompound ccomp = comp;
srcJOSCompound parrent = comp;
for(int i = 0 ; i < path.... |
827bdf0e-8a38-4c23-8cb2-c3ef92df679f | 7 | public void supprimerLignes() {
int i, j, k;
boolean full;
for (i = 0; i < hauteur; i++) {
full = true;
for (j = 0; j < largeur; j++) {
if (tab[j][i] == 0) {
full = false;
}
}
if (full == true)... |
c0ae821a-3f40-41c5-9034-2d5f9d8e8539 | 1 | private BufferedReader readFile(){
FileReader fr = null;
BufferedReader br = null;
try {
fr = new FileReader(fileName);
br = new BufferedReader(fr);
}catch(FileNotFoundException ex){
ex.printStackTrace();
}
return br;
} |
83be8d7e-225b-42cf-97a6-db0ecb64bd0a | 5 | public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line = "";
StringBuilder out = new StringBuilder();
ArrayList<Integer> list = new ArrayList<Integer>();
int size = 0;
do {
line = in.readLine();
if (line == null... |
a3a1c7cb-bc08-45c8-bec5-6e68f1ee1873 | 0 | public HandlerList getHandlers() {
return handlers;
} |
ea480723-a751-46f8-9690-860b04ebd262 | 6 | @Override
public void animatedEntityTick(double time) {
// tick lifetime, kill if expired
lifeTime += time;
if(lifeTime >= def.lifeTime){
kill(null);
return;
}
// move to target
loc.travelTo(targetLoc, time * def.speed, true);
// if target is reached, deal damage and kill self
if(loc.hammingDista... |
b528b42f-100d-4001-9641-30b7ba8fe8bd | 0 | public final int getOffsize() { return offsize; } |
8125a27a-5409-4dbe-9a68-2fa1e30de86b | 6 | public void setImgPath_PWBtn(Path img, Imagetype type) {
switch (type) {
case MOUSEFOCUS_KEYFOCUS: // HD simplified
this.imgPWBtn_KFocMFoc = handleImage(img, UIResNumbers.PWBTN_KFOCMFOC.getNum());
if (this.imgPWBtn_KFocMFoc == null) {
this.imgPWBtn... |
09d832de-4b11-47ce-a633-372e3bdb333b | 4 | public void setFieldValue(_Fields field, Object value) {
switch (field) {
case WHAT:
if (value == null) {
unsetWhat();
} else {
setWhat((Integer)value);
}
break;
case WHY:
if (value == null) {
unsetWhy();
} else {
setWhy((String)value);
... |
98635937-da70-4b56-80ab-7637b23b96fe | 2 | public static String padToMax(String pValue, int padLength)
{
String text = "";
if (pValue != null)
{
text = pValue;
}
while (text.length() < padLength)
{
text += " ";
}
return text;
} |
831868da-52a6-4870-b8bd-c00c58dc8bc9 | 8 | static int f(int cant, int usados, int ant) {
if(cant>M)
return 0;
if(mem[cant][usados][ant]>-1)
return mem[cant][usados][ant];
int result=0;
if(usados==(1<<N)-1)
result++;
for(int i=0;i<N;i++)
if((cant==0&&i!=0)||(cant>0&&abs(ant-i)==1))
result=(result+f(cant+1,usados|(1<<i),i)%1000000007)%10... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.