method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
f52465e8-8a25-404b-a865-cbc9c8fda6ef | 1 | public double division() {
if (stack.stackLength() > 1) {
int firstNum = stack.top();
stack.pop();
int secondNum = stack.top();
stack.pop();
return firstNum / secondNum;
} else {
return error;
}
} |
c57f8720-4c94-4389-8c70-87411486e824 | 1 | @Override
public void notifyObservers() {
for(int i=0;i<observers.size();i++){
Observer observer=(Observer)observers.get(i);
observer.update(temperature, humidity, pressure);
}
} |
636d718d-de5d-493c-b58a-2eb143387068 | 7 | private int determinePeggingPoints(){
int points = 0;
String s = "";
if (count == 15){
s += "15 is made! ";
points += 2;
}
else if (count == 31){
s += "31 is made! ";
points += 2;
}
int runPoints = getRunPoints();
if (runPoints > 0){
s += "A " + runPoints + " card run is made! ";
... |
7a6e28d3-e031-48ce-bde9-8a0de1a1ded5 | 3 | public int indexOf(int gridletId, int userId) {
int i = 0;
for (SSGridlet gl : this) {
if (gl.getID() == gridletId && gl.getSenderID() == userId) {
return i;
}
i++;
}
return -1;
} |
3d568d32-edc8-45bc-8ff5-1bbb45909057 | 2 | public ArrayList<Confections> findConfectionBySugar() {
ArrayList <Confections> search = new ArrayList <Confections>();
Iterator <Confections> it = confections.iterator();
while (it.hasNext()) {
Confections su = it.next();
if (su.getSugar() <= 3) {
search.add(su);
}
}
r... |
83c6147f-36ea-46c9-bf39-3a8cf2b74d8e | 3 | public void setLogLevel(final String name) {
Level level;
try { level = Level.parse(name); } catch (final Exception e) {
level = CustomPlugin.DEFAULT_LOG;
this.getLogger().warning("Log level defaulted to " + level.getName() + "; Unrecognized java.util.logging.Level: " + name + ";... |
b5079a97-7aa4-4a8c-a150-b3e2f8bac442 | 0 | public void stop() {
log("Execution time " + MSG + ": " + ((System.currentTimeMillis() - startTime) / 1000) + " sec", 5);
} |
9ca6474e-7df1-4bb0-8517-437c5ebafcb4 | 2 | public static CustomButton doPorfolioViewButton() {
final CustomButton a = new CustomButton("show my portfolio");
a.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
JFrame searchResultFrame = new JFrame("my portfolio");
searchResultFrame.setSize(1300,... |
6f6e9554-eb26-4830-8bd8-a86d3a928b79 | 4 | public final void incomingCycle() {
try {
if (socketChannel.read(buffer) == -1) {
disconnect();
return;
}
buffer.flip();
while (buffer.hasRemaining()) {
if (!decoder.decode(buffer))
break;
}
buffer.clear();
} catch (Exception ex) {
ex.printStackTrace();
disconnect();
}
} |
5438f781-1b6e-487a-96a1-270051ab8cea | 5 | public int findSecondMax(int a, int b, int c) {
return a > b ? (b > c ? b : (a > c ? c : a)) : (a > c ? a : (b > c ? c
: b));
} |
afaf9a84-0209-45b3-848a-f2db7a2a4ddd | 3 | private static boolean outOfFarm(int x, int y, int size) {
return (x < 0 || x >= size) || (y < 0 || y >= size);
} |
0f37f6ae-54d4-4702-b572-31ca65f96c7c | 6 | public void calculate(){
int i = 0;
Random rand = new Random();
permutation_.genPermutation();
Permutation permutationPrim = permutation_.clone();
double difference = 0.0;
while(i++ < numberOfIteration_){
permutationPrim.switchValues();
difference = MeanValueCalculator.calculate(matrix_, permutat... |
18f488f2-6cbf-4682-aea7-4f051aa7b917 | 2 | public static int which_side_pn(double x0, double y0, double nx, double ny, double px, double py){
int side;
double dot = nx*(px - x0) + ny*(py - y0);
if(dot < -ACCY)
side = PLANE_INSIDE;
else if(dot > ACCY)
side = PLANE_OUTSIDE;
else
side = ON_PLANE;
return side;
} |
d1e0d4ea-7347-4c22-a82e-af3b866fa466 | 7 | public synchronized Object remove( Object key )
throws IOException
{
if ( key == null ) {
throw new IllegalArgumentException( "Argument 'key' is null" );
}
BPage rootPage = getRoot();
if ( rootPage == null ) {
return null;
}
boolean di... |
58f6fbbe-e0b2-4d3f-bebb-f02c531a8626 | 5 | public void registerPacket(Class<? extends Packet> packet) {
try {
this.mapPacket.put((String) packet.getField(PACKET_ID).get(null), packet);
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (NoSuchFieldException e) {
e.pri... |
e0a468a9-cc73-4c05-9e2f-f2d8517f185d | 8 | @Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if(!(myHost instanceof MOB))
return super.okMessage(myHost,msg);
final MOB myChar=(MOB)myHost;
if(!super.okMessage(myChar, msg))
return false;
if((msg.amITarget(myChar))
&&(msg.targetMinor()==CMMsg.TYP_DAMAGE)
&&(msg.... |
ab73e1f9-24a9-4b02-b145-0aec4a1ec60d | 1 | @Override
public int hashCode() {
int hash = 0;
hash += (username != null ? username.hashCode() : 0);
return hash;
} |
0b809ac9-6a8f-4185-80d2-d9571813c969 | 0 | public void setStudentCategoryId(int studentCategoryId) {
this.studentCategoryId = studentCategoryId;
} |
14850505-e3de-417d-b3e5-a2e71f0c64c2 | 2 | public static void EM_run(Topic root, int iter) {
//System.out.println("Running EM for root level:" + root.Get_depth());
int iterations = iter;
while (true) {
if (iterations == 0) {
break;
}
E(root);
M(root);
iterations--;
}
} |
087061bd-c740-49d1-a7ce-8488bdd1c019 | 2 | public static void main(String[] args){
Scanner in = new Scanner(System.in);
int result = -1;
int p = in.nextInt();
int n = in.nextInt();
int[] A = new int[p];
for(int i=0;i<n;i++){
int num = in.nextInt();
if(A[num%p]==0)
A[num%p]=1;
else{
result = i+1;
break;
}
}
System.ou... |
87a7c85d-31ea-43b8-babf-361c361246c3 | 5 | public String[] getVerbNoun(String str)
{
//remove punctuation
String s = removePunct(str);
POSTaggerME tagger = new POSTaggerME( getModel() );
String[] words = s.split( "\\s+" );
String[] tags = tagger.tag( words );
String verb = "", verbTag = "", noun = "", nounTag="";
for(int i = 0; i < tags.len... |
a011e59e-b4f7-4b2e-97f2-b609cd7bd6a9 | 2 | private void resetColor() {
for (Component c : errorComps)
if (c != null)
c.setBackground(Utils.getThemeBG());
msgLabel.setForeground(Utils.getThemeFG());
msgLabel.setText("");
this.setBackground(Utils.getThemeBG());
} |
c7145ac7-ec99-4444-b996-63eb32416d43 | 3 | @After
public void teardown()
{
try{
if(connection!=null && !connection.isClosed())
{
drop.executeUpdate("Drop table Magazyn");
connection.close();
connection = null;
}}
catch(Exception ex)
{
ex.printStackTrace();
}
} |
e98979e3-dafc-4b05-addb-f8b2eac879eb | 8 | @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof OFAggregateStatisticsRequest)) {
return false;
}
OFAggregateStatisticsRequest other = (O... |
55f2db8f-88fe-4c38-a007-7d80d4b5b1ae | 4 | @Override
public final void scanItem(final RecordStorageStrategy rss) {
ValidationStrategy vs1 = new ValidateRange(0, rss.getDBSize() - 1);
ValidationStrategy vs2 = new ValidateRange(0.1, 999.0);
int merchNumber;
double Qtny;
merchandiseNumberArray = new int[1];
merch... |
d4981c1b-ffef-48af-b1d8-f7422c07716f | 7 | static void dradf2(int ido, int l1, float[] cc, float[] ch, float[] wa1,
int index){
int i, k;
float ti2, tr2;
int t0, t1, t2, t3, t4, t5, t6;
t1=0;
t0=(t2=l1*ido);
t3=ido<<1;
for(k=0; k<l1; k++){
ch[t1<<1]=cc[t1]+cc[t2];
ch[(t1<<1)+t3-1]=cc[t1]-cc[t2];
t1+=ido;
... |
7336f4a8-714b-4ac5-bcd8-313da263f457 | 9 | void delN(){
int maxDelete;
if(slice == 1)
maxDelete = numSlices - 1;
else
maxDelete = numSlices - slice + 1;
int nDelete = 1;
if(maxDelete>1){
nDelete = maxDelete+1;
while((nDelete > maxDelete)||(nDelete < 0 )){
nDelete = (int)IJ.getNumber("Number of slices to delete (max "+maxDelete+")",1);
... |
608d8dbb-71eb-417d-bb42-c62047c6a026 | 3 | public boolean isChecksumValid() {
if(checksum == 0)
return true;
int crc = CRCUtils.getCRC(getHeader());
if(data != null && data.length > 0) {
crc = CRCUtils.getCRC(data, crc);
}
return (checksum == crc);
} |
7aa175ec-ed39-417f-978c-1f88868f780a | 3 | private void consumeWhitespace() {
try {
char current;
do {
current = LA();
consumeChar();
} while ('\n' != current && Character.isWhitespace( current ));
} catch (BufferUnderflowException caught) {
// we've hit the end of the buffer, just return
}
} |
869fff45-08bc-445b-a95d-c30b87bda8b8 | 3 | @Override
public ExecutionContext run(ExecutionContext context) throws InterpretationException {
Value val1 = ((AbsValueNode) this.getChildAt(0)).evaluate(context);
Value val2 = ((AbsValueNode) this.getChildAt(1)).evaluate(context);
if (val1.getType() == VariableType.NUMBER && val2.getType()... |
330da853-fd2c-4663-8ec0-e3e54a357c8a | 4 | public void getMultiMssage(Message message) {
try {
Object content = message.getContent();
// check for string
// then check for multipart
if (content instanceof String) {
maildata.append(content+"\n");
// System.out.println(content);
} else if (content instanceof Multipart) {
Multipart mu... |
1d411186-0d38-4394-a17f-4755135c0255 | 2 | public void refreshImage() {
removeAll();
if (deck.size() <= 0) {
add(new JLabel(new ImageIcon(getClass().getResource(
"resources/53.png"))));
} else {
for (int i = deck.size() - 1; i >= 0; i--) {
add(deck.get(i));
}
}
revalidate();
repaint();
} |
0429bb52-48ec-433f-a5e8-e43c5697cec3 | 2 | public AttributeInfo getAttribute(String name) {
LinkedList list = attributes;
int n = list.size();
for (int i = 0; i < n; ++i) {
AttributeInfo ai = (AttributeInfo)list.get(i);
if (ai.getName().equals(name))
return ai;
}
return null;
} |
3c7575be-a7c8-4caa-a6dd-6eece3de78f5 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Ball other = (Ball) obj;
if (inGame != other.inGame)
return false;
if (onGround != other.onGround)
return false;
if (square == null) {
... |
f05fd15e-24d1-4c7f-a29c-13bfe007098f | 1 | public static void main(String[] args) {
//ExecutorService exec = Executors.newCachedThreadPool();
//ExecutorService exec = Executors.newFixedThreadPool(3);
ExecutorService exec = Executors.newSingleThreadExecutor();
for(int i = 0; i < 10; i++) {
exec.execute(new LiftOff());
... |
8a36e460-c303-4ef0-b496-1ed2aaaff13c | 1 | public Rank getFifthRank() {
return (ranks.size() < 5 ? Rank.Null : ranks.get(4));
} |
c0886e11-3dd2-48c9-87cf-4cd00dad9027 | 8 | public static final Command create(Player player, GamePlay gamePlay) throws IOException {
Command command;
DataInputStream dis = new DataInputStream(player.getInputStream());
byte b = dis.readByte();
System.out.println("Got command: " + b);
System.out.println("Previous command: " + lastCommand);
switch (b) ... |
6e396cac-4e82-4712-9841-d4d0cf7bc007 | 9 | public static void imgClick(String wnd, int pos, int button, int mod) {
if (pos < 1)
pos = 1;
int imgPos = 0;
Widget root = UI.instance.root;
for (Widget wdg = root.child; wdg != null; wdg = wdg.next) {
if (wdg instanceof Window)
if (((Window) wdg)... |
4c5e656e-4d79-4fe0-9d9c-33ad6c1c8a14 | 4 | private int balance() {
if (this.isEmpty() || this.isLeaf())
return 0;
if (this.getLeft() == null)
return this.getRight().height;
if (this.getRight() == null)
return -(this.getLeft().height);
return (this.getRight().height - this.getLeft().height);
} |
8451781a-a884-4d34-b156-d72d46041600 | 7 | public static String doubleToString(double d) {
if (Double.isInfinite(d) || Double.isNaN(d)) {
return "null";
}
// Shave off trailing zeros and decimal point, if possible.
String string = Double.toString(d);
if (string.indexOf('.') > 0 && string.indexOf('e') < 0 &&
... |
c3f12b52-46cf-472b-8134-7fb8bfeb1a68 | 0 | public void setAge(int age) {
Age = age;
} |
69576a40-95a6-4ebc-85c1-418c39545dc5 | 5 | public Space getSpaceAt(final Vector center, final Criterion criterion) {
if(intersects(center)) {
switch(getCriterionReponse(criterion)) {
case PASS:
return this;
case DISBURSE:
disburse();
assert !isLeaf()... |
2895891b-d641-4690-8e1a-506788c00ad1 | 1 | @Test
public void runTestObjectSensitivity1() throws IOException {
InfoflowResults res = analyzeAPKFile("FieldAndObjectSensitivity_ObjectSensitivity1.apk");
if (res != null)
Assert.assertEquals(0, res.size());
} |
a35bd948-acbe-4c82-8a31-6e533d901737 | 6 | public boolean allMosquitoesCaptured(int[][] board) {
boolean captured = true;
for ( int i = 0; i < 100; i++ ) {
for ( int j = 0; j < 100; j++ ) {
if ( board[i][j] > 0 ) {
boolean capturedByLight = false;
for ( Light light : lights ) {
double x = Math.pow(i-light.getX(),2);
double y = ... |
aa22daf4-3e34-4ed5-95f3-4feb0cf67886 | 5 | public void load (Collection<? extends T> data) {
if (root != null)
throw new IllegalStateException ("Tree is already loaded");
numLeafs = data.size ();
XMinComparator<T> xMinSorter = new XMinComparator<T> (converter);
YMinComparator<T> yMinSorter = new YMinComparator<T> (converter);
XMaxComparator<T> xMaxSor... |
a6a51622-2635-4d60-bd7a-c94dedc2aca6 | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Result other = (Result) obj;
if (branch == null) {
if (other.branch != null)
return false;
} else if (!branch.equals(other.branch))
r... |
efe6d9dd-1fb4-41bc-87f4-9ca0c874f077 | 4 | private void trainUnit(BuildRequest request) {
UnitType unitToBuild = request.getUnit();
List<BuildQueue> queues = new ArrayList<BuildQueue>();
for (BuildQueue building : buildings) {
// System.out.println("Can " + building.getBuilding().getType()
// + " train " + unitToBuild + "? "
// + building.canBui... |
cb257810-da59-4258-948b-37779dc2e442 | 2 | @Override
protected void onQuit(String sourceNick, String sourceLogin, String sourceHostname, String reason) {
for (ChannelEventsListener listener : channelEventsListeners) {
if ( listener.contains(sourceNick) )
listener.userQuit(sourceNick, reason);
}
} |
16d6afed-504c-4202-bbbb-21e349d6fb98 | 5 | private void runProtected (final Operation operation, final HttpExchange request) throws IOException
{
final OutputStream responseBody = request.getResponseBody();
try {
request.getResponseHeaders().add("Content-Type", "text/html");
operation.run(request);
} catch (final IllegalURIPathExceptio... |
eb71d137-a1bf-480c-ac9b-261a94b2333a | 5 | public void pKilled(Rank r) {
if (!ourSide) {
// enemy piece killed our piece!
// so it's not bomb, land mine, or flag
// and its rank is definitely greater than the piece
// it has killed, if it didn't killed a land mine
// if we lost land mine, the enemy piece is eng... |
154c12a6-8e19-4a66-88bb-4f5c183cc820 | 1 | public SoundStream(InputStream in)
{
if (in==null) throw new NullPointerException("in");
in = new BufferedInputStream(in);
loadID3v2(in);
firstframe = true;
//source = new PushbackInputStream(in, 1024);
source = new PushbackInputStream(in, BUFFER_INT_SIZE*4);
closeFrame();
//current_frame_number =... |
d52ff3fd-a38c-4632-89b8-5739341cd708 | 4 | public EnemyBullet(Side side, float msPerBeat, GameContainer container, GameState parentState) {
this.side = side;
this.parentState = parentState;
switch(side) {
case RIGHT:
x = container.getWidth();
xSpeedPerMs = -((container.getWidth() / 2) - SHIELD_RANGE)/(msPerBeat);
y = container.getHeight() / 2;
... |
fad954fc-2cf0-4988-86d3-dadcab7bc6a2 | 3 | @Override
public String execute(SessionRequestContent request) throws ServletLogicException {
String page = ConfigurationManager.getProperty("path.page.hotels");
try {
Criteria criteria = new Criteria();
Hotel currHotel = (Hotel) request.getSessionAttribute(JSP_CURRENT_HOTEL)... |
b63dc8b2-e916-4d22-a5e2-bcb9d8465e0e | 1 | public void updateMaxTotalInf(int x) throws InterruptedException {
s2.acquire();
if (maxTotalInf < x)
maxTotalInf = x;
s2.release();
} |
01794153-2693-4286-a931-d1dd5b508553 | 4 | public boolean buildRiver(Land land, int direction){
land.isWeet = true;
int x = land.x;
int z = land.z;
if(land.height > lakeLevel){
if(direction == 0){
buildRiver(world[x-1][z], direction);
}else if(direction == 1){
buildRiver(world[x+1][z], direction);
}else if(direction == 2){
buildRive... |
59e43ef8-4209-47cf-aee3-dd427a6d1565 | 4 | @Override
public void handle(HttpExchange exchange) throws IOException {
System.out.println("In Discard cards handler");
String responseMessage = "";
if(exchange.getRequestMethod().toLowerCase().equals("post")) {
try {
String unvalidatedCookie = exchange.getRequestHeaders().get("Cookie").get(0);
... |
a7b7b50b-8860-4600-9dbe-33cf3b59fc20 | 3 | public AnnotationVisitor visitArray(final String name) {
if (values == null) {
values = new ArrayList(this.desc != null ? 2 : 1);
}
if (this.desc != null) {
values.add(name);
}
List array = new ArrayList();
values.add(array);
return new AnnotationNode(array);
} |
da8b2e2d-5a41-4ade-808a-0f8325832895 | 7 | public void keyPressed(KeyEvent e)
{
int key = e.getKeyCode();
switch(key)
{
case KeyEvent.VK_SPACE:
Main.world = new World(50, Main.pixel.width/4, Main.pixel.height/4, Main.pixel.width/2, Main.pixel.height/2, Main.pixel.height/2);
break;
case KeyEvent.VK_P: case KeyEvent.VK_ESCAPE:
Main.isPaused = ... |
82e678e5-5824-442f-9fe1-f63b8247be7a | 7 | public static Point[] convex_hull(Point[] points) {
int n = points.length;
Point minimin = null;
for (int i = 0; i < n; i++) {
if (minimin == null || points[i].compareTo(minimin) == -1) {
minimin = points[i];
}
}
root = minimin;
Arrays.sort(points, new CounterClockwiseComparator());
int j;
... |
c74205d8-2ffa-4859-8535-a02b66b8ac59 | 3 | Accessible getAccessible(final Accessible accessibleTable) {
if (accessible == null) {
accessible = new Accessible(accessibleTable);
accessible.addAccessibleListener(new AccessibleAdapter() {
public void getName(AccessibleEvent e) {
e.result = getText();
System.out.println("tableColumn getName = " + e.r... |
843399d8-1dc6-4d7b-9081-a6f79fc19cb9 | 2 | public static boolean isPrimitiveOrWrapper(Class<?> clazz) {
Assert.notNull(clazz, "Class must not be null");
return (clazz.isPrimitive() || isPrimitiveWrapper(clazz));
} |
bd6721a2-84d7-478c-9f61-bd51f89131dd | 2 | @Override
public FractalValue sub(FractalValue val) throws FractalException {
if (! val.isNumber()) {
throw new FractalTypeException(FractalTypes.REAL, val.getType());
} else if (val.isInt()) {
return new FractalInt(intValue() - val.intValue());
} else {
r... |
5cb6643b-47c8-4ac6-a0d0-cedaf1eb90f4 | 9 | @EventHandler(priority = EventPriority.LOW)
public void onEntityDamage(final EntityDamageEvent event) {
if (event instanceof EntityDamageByEntityEvent) {
final EntityDamageByEntityEvent edbe = (EntityDamageByEntityEvent) event;
Player player;
if (edbe.getDamager() instanceof Player) { // Prevent from ... |
297ce4ed-8149-4fd7-ab79-d97effca5938 | 0 | private Name() {
title = new SimpleStringProperty("");
firstName = new SimpleStringProperty("");
middleName = new SimpleStringProperty("");
lastName = new SimpleStringProperty("");
suffix = new SimpleStringProperty("");
} |
bff2cedc-9e31-463a-8710-6522fdd6f311 | 6 | public void drawPoint(Graphics2D g2, Point p) {
StringBuilder sb = new StringBuilder();
sb.append("");
sb.append(p.value);
String strI = sb.toString();
double x_in = (dimension*s-ox)/size;
double y_in = (dimension*s-oy)/size;
... |
a04de56a-1226-4d28-8fdd-e2859bfec164 | 7 | protected void ambiguity(Symbol[] sentence, int from, int to, NonTerminal nt, String workerId) {
int len = to - from;
SymbolString s = new SymbolString(len);
for (int z = 0; z < len; z++) {
s.add(sentence[z + from]);
}
boolean isnew;
Relation<Symbol,SymbolString> r = possibleAmbiguities.get(len);
sy... |
f2135cda-79f2-41ae-bd40-f7ad944cbe97 | 2 | public void truncate(double max){
double i;
double length = length();
if(length > .0001){
double test = 0;
}
i = max / length();
i = i < 1.0 ? i : 1.0;
scalarMultVoid(i);
} |
82065682-8616-4a97-aee8-f4fb2f6d5f68 | 1 | @Override
public void updateLayout() {
playerGrid.UpdateLayout();
oponentGrid.UpdateLayout();
if (cmbAvailableShips.getItemCount() > 0) {
cmbAvailableShips.removeItem(game.getShipToPlace());
}
} |
71f81bab-ecd5-4cd0-bffa-83f0648385c7 | 3 | public static boolean checkIfAllDone(char[] words) {
String letter = "";
int correct = 0;
for (int i = 0; i <= words.length -1; i++){
letter = Character.toString(words[i]);
if (!letter.equals("_")){
correct++;
}
}
if (correct == words.length){
return true;
}
return false;
} |
e1ce1304-765c-4151-b59a-7ea2c7ca21e2 | 5 | public String recover(String szUsername,String szEmail,String szQuestion,
String szAnswer)throws IOException
{
Scanner scan = new Scanner(file);
String[] szDec = null;
String szPasscode = null;
while(scan.hasNextLine())
{
szDec = Xor.decrypt(scan.nextLine()).split(":"... |
93e39b88-cabd-4400-be5e-e314b6af4aac | 3 | public String toString()
{
//simple version:
//return _heap.toString();
//prettier version:
String lvlOrdTrav = "heap size " + _heap.size() + "\n";
if ( _heap.size() == 0 ) return lvlOrdTrav;
int h = 1; //init height to 1
for( int i = 0; i < _heap.size(); i++ ) {
lvlOrdTrav += i + ":" + _heap.get(... |
b34f708d-89ed-4499-af6d-e259ece5aa86 | 3 | private void dessineTrajetSansNoeud(NoeudItineraire depart, Graphics g,
Color c, HashMap<String, Integer> nb_passages) {
// Si l'itin�raire n'est pas calcul�, alors il n'y a pas de troncon
if (!calculated)
return;// donc on quitte
// Sinon, pour tout les troncon du trajet qui part du NoeudItineraire
// d... |
d56a650c-c7c4-4074-8392-71ee45e00939 | 9 | public static MoodleGroup[] getGroupsById(long[] groupids) throws MoodleRestGroupException, UnsupportedEncodingException, MoodleRestException {
Vector v=new Vector();
MoodleGroup group=null;
StringBuilder data=new StringBuilder();
String functionCall=MoodleCallRestWebService.isLegacy()?M... |
f7c2ba74-5b21-42c9-b422-2ecad6dbc031 | 4 | public void next(int width, int height) {
alphaValue = (alphaValue+5)%255;
alphaValue2 = reachedMax ? alphaValue2 - 5 : alphaValue2 + 5;
if (alphaValue2 == 255) {
reachedMax = true;
} else if (alphaValue2 == 0) {
reachedMax = false;
}
diameter = (diameter + 10)%(width > height ? width : heig... |
0a9f9e3d-5e83-43b4-9cf8-aefee50c848b | 0 | public SpecialityListResponse(
final Boolean success, final String errorMessage, final List<Speciality> specialityList
) {
super(success, errorMessage);
this.specialityList = specialityList;
} |
2e51f339-3c2d-464c-b8a1-bfd0b5b485c8 | 4 | public List<String> getDataList(String sql){
List<String> list = new ArrayList<String>();
this.conn = connectToDB();
if(this.conn != null){
ResultSet rs = null;
try {
PreparedStatement pstmt = this.conn.prepareStatement(sql);
rs = pstmt.executeQuery();
while(rs.next()){
list.add(rs.getStrin... |
b3cee86e-9928-44b0-9592-800a7ec4b171 | 2 | private ArrayList<Card> createTheFullPack() {
ArrayList<Card> theCards = new ArrayList <Card> (TOTAL_NUMBER_OF_CARDS);
int suitNum = A1Constants.CLUBS;
int cardValue = 0;
for (int i = 0; i < TOTAL_NUMBER_OF_CARDS; i++) {
theCards.add(new Card(cardValue, suitNum));
if( cardValue... |
dd37d406-936b-47fd-a8d3-c69cfe9af7d1 | 3 | @Test
public void test() {
for(Suggestion suggestion : suggestions) {
if (!MongoHelper.delete(suggestion, "suggestions")) {
TestHelper.failed("delete failed");
}
if (MongoHelper.fetch(suggestion, "suggestions") != null) {
TestHelper.fail... |
58be68cf-a6d6-4049-a8b5-24eb766b4fd4 | 0 | public SQLPermissionUser(String n) {
super(n);
} |
441b7c3b-6bd4-4bef-89b5-91c9ebda1ce1 | 2 | public MedKit(Vector3f position)
{
if(mesh == null)
{
Vertex[] vertices = new Vertex[]{new Vertex(new Vector3f(-SIZEX,START,START), new Vector2f(TEX_MAX_X,TEX_MAX_Y)),
new Vertex(new Vector3f(-SIZEX,SIZEY,START), new Vector2f(TEX_MAX_X,TEX_MIN_Y)),
... |
5c84527d-bc44-4f80-bbf6-f66611667bde | 1 | public static Deity getInstance() {
if (sInstance == null)
sInstance = new Deity();
return sInstance;
} |
1d13d9b5-3d52-48d4-baa6-09cd8eae3153 | 0 | @Override
public void keyReleased(KeyEvent e) {
keyboardState[e.getKeyCode()] = false;
keyReleasedFramework(e);
} |
e13ca483-044f-4609-8a67-3b5ae8280867 | 7 | static String[] sort(String[] input){
String temp;
int left=0;
int right=0;
for(int i=1; i<input.length;i++){
left=0;
right=i-1;
while(left<right){
int mid=(left+right)/2;
if(input[mid].compareTo(input[i])>0){
right=mid-1;
}else{
left=mid +1;
}
}
t... |
a61710e5-a71d-4a57-b9ac-60e9a50ea28f | 1 | public void cleanCastles()
{
castles = new ArrayList<core.Castle>();
while (castlesInner.count() > 0) {
castlesInner.takeAt(0).widget().dispose();
}
} |
d9884e7e-ff72-4a57-a9d8-99ac723d21be | 6 | public static <E> void BFSWithLine(KAryTreeNode<E> root) {
if(root == null) {
return;
}
int currentLineNodeCount = 1;
int nextLineNodeCount = 0;
Queue<KAryTreeNode<E>> queue = new LinkedList<KAryTreeNode<E>>();
queue.offer(root);
while(!queue.isEmpty()) {
KAryTreeNode<E> node = queue.poll();
Sys... |
b28a087b-ff5c-4a51-9d5a-d6a5ea7d6572 | 2 | public void removeTailLightTrail(){
if (otherPositions.size() > 2) {
Position newHeadPosition = otherPositions.remove(0);
setPosition(newHeadPosition);
} else if (otherPositions.size() == 0) {
setPosition(null);
}
} |
00b50f9e-8c39-43df-9b66-7f076da1b976 | 4 | public final boolean getGrid(int x, int y) {
if (x < 0 || x > width)
return true;
if (y < 0 || y > height)
return true;
return grid[x][y];
} |
91094190-5819-4378-8aed-160d4186b1f7 | 0 | @Override
public int getStock() {
return stock;
} |
ccb878c2-e6b9-4518-8ba4-4c063f1b6229 | 7 | private Automata<String> createAutomataFromTable() {
Automata<String> guessedAutomata = new Automata<String>(bottomOfTableRow.get(bottomOfTableRow.size() - 1).length(), 1, alphabet);
for ( String rowState : topOfTableRow ) {
//if (rowState.equals("-1")) continue;
for ( String columnExperiment : ... |
c9fb8d4f-1998-4481-95aa-9f1867b6b9db | 2 | public int getBirthYear() {
return (birth == null || birth.getDate() == null) ? 0 : birth.getDate().getYear();
} |
9f12c442-780d-4dcb-9d66-63e29c056d0e | 5 | private boolean isPlayerKingInCheckFromPieceVerticallyDown() {
for (int i=playerKingPiece.pieceLine - 1; i>=1; i--){
BoardSquare boardSquare = chessBoard.getBoardSquare(i, playerKingPiece.pieceColumn);
if (boardSquare.containsBoardPiece()){
if (i==playerKingPiece.pieceLine-1){
if (boardSquare.containsO... |
d6c9279e-7688-4f74-a592-2fc1f429bcb5 | 6 | private int strikeBonus(Frame [] frame, int thisIndex, int frameNum) {
if (thisIndex < 9 && thisIndex + 1 > frameNum)
return -1;
if (!frame[thisIndex + 1].isStrike())
return addFirstSecond(frame[thisIndex + 1]);
if (thisIndex == 9)
return 10 + frame[thisIndex + 1].second;
if (thisIndex < 8 && ... |
f10c9bd1-03c8-4c45-8bd1-20f408f86623 | 8 | public boolean setInputFormat(Instances instanceInfo) throws Exception {
if ((instanceInfo.classIndex() > 0) && (!getFillWithMissing())) {
throw new IllegalArgumentException("TimeSeriesTranslate: Need to fill in missing values " +
"using appropriate option when class ... |
7ca6e1d6-a133-456f-b5e2-e7a70472d244 | 7 | public void file_open()
{
JFileChooser fc = new JFileChooser();
fc.setFileSelectionMode(JFileChooser.FILES_ONLY);
int r=fc.showOpenDialog(this);
if(r==fc.CANCEL_OPTION)
return;
File myfile = fc.getSelectedFile();
if(myfile == null || myfile.getName().equal... |
dad3605c-5ca8-48af-9d95-b661e4cff66e | 2 | public void doHit()
{
if (goinUp < 4) {
setY(getY() - 2);
}
else if(goinUp < 8)
{
setY(getY() + 2);
}
goinUp++;
} |
d972d842-6674-4b1e-9958-c69d616a182d | 8 | private static void addALevel(String inFile, String outFile, boolean fromR,
HashMap<String, Double> pcrMap, HashMap<Integer, Integer> sugarGroupMap ) throws Exception
{
BufferedReader reader = new BufferedReader(new FileReader(new File(
inFile)));
String[] topSplits = reader.readLine().split("\t");
... |
3a46c184-2042-4e89-8935-194f0cb83c05 | 8 | static void ldrun_draw_background(osd_bitmap bitmap, int prioritylayer)
{
int offs;
/* for every character in the Video RAM, check if it has been modified */
/* since last time and update it accordingly. */
for (offs = videoram_size[0]-2;offs >= 0;offs -= 2)
{
if ((dirtybuffer[offs]!=0 || dirtybuffer[... |
f2846ec1-862b-45a4-9c13-4b537ec6b69a | 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 fe... |
7fdfa5ab-6b5b-4ed7-89cb-f6687999d825 | 9 | @Override
public String getOOXML()
{
StringBuffer ooxml = new StringBuffer();
ooxml.append( "<c:dLbls>" );
// TODO: numFmt
if( sp != null )
{
ooxml.append( sp.getOOXML() );
}
if( tx != null )
{
ooxml.append( tx.getOOXML() );
}
// TODO: dLblPos
if( showLegendKey != -1 )
{
ooxml.append(... |
e07cf5dd-b9a8-4f0a-9b61-4cb14b101be3 | 3 | public void run() {
while (true) {
while (!_modelRequests.isEmpty()) {
Integer number = _modelRequests.poll();
_loadedModels.put(number, ResourceLoader
.loadModelFromTxt(baseDir + _filenames.get(number)));
}
try {
Thread.sleep(100000);
} catch (InterruptedException e) {
}
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.