method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
a2528804-96b7-4c0d-ae9a-901eb3585a56 | 4 | private boolean isMouseOnButton(int x, int y, int mouseX, int mouseY) {
if (mouseX < x - 10) {
// Mouse is left of button
return false;
}
if (mouseX > x + buttonWidth - 10) {
// Mouse is right of button
return false;
}
if (mouseY < y) {
// Mouse is above button
return false;
}
i... |
640f985a-7651-4bd1-adf9-a70d763479ae | 8 | @FXML protected void handlePlaceCritter() {
P.rint("* Place Crittesr button clicked. (Controller)");
if(!princessBubblegum.hasWorld()) {
//return some error statement here.
critterErrorMessage.setText("Error: No World initialized yet");
P.rint("!!Tried to add critters before initializing world!");
retur... |
01582be9-0e50-471a-9817-3fb0cbb98a77 | 0 | public Cody()
{
super("Cody", 10000, 150, 40, 150, as);
as.setSkill(0, "Calm", 80, 10, "Cody is very calm in every situation.");
as.setSkill(1, "Flying Kick", 450, 50, "Cody jumps up and kicks his enemy in the face.");
as.setSkill(2, "Face Palm", 800, 100, "Cody facepalms at his enemy.");
as.setSkill(3, "Cal... |
c6c0ad25-32c4-442e-b57d-e60dd36bbcbb | 4 | public void testResponseXML(){
DomainTools domainTools = new DomainTools("username", "key");
String xml = "";
try {
xml = domainTools.use("whois").on("domaintools.com").toXML().getXML();
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setValidating(true);
factory.setName... |
8fa064ca-fec6-4134-acfb-9148875d3927 | 7 | public Expr pop(final Type type) {
final Expr top = (Expr) stack.remove(stack.size() - 1);
final Type topType = top.type();
height -= topType.stackHeight();
if (type.isAddress()) {
if (!topType.isAddress()) {
throw new IllegalArgumentException("Expected " + type
+ ", stack = " + toString());
... |
5e49bc72-01f3-4b8e-845f-c8d59ffd4bf6 | 5 | @Override
synchronized public void addBook(final Book book) {
Connection conn = null;
PreparedStatement stmt = null;
try {
conn = dataSource.getConnection();
stmt = conn.prepareStatement("INSERT INTO book(BOOK_NAME,BOOK_AUTHOR,BOOK_PUBLISHER,BOOK_PRICE,BOOK_DATE) VAL... |
7ca09dca-bac6-48b2-a3a7-01514f6ac204 | 5 | public void run () {
// se realiza el ciclo del juego en este caso nunca termina
startTime = System.currentTimeMillis();
while (true) {
/* mientras dure el juego, se actualizan posiciones de jugadores
se checa si hubo colisiones para desaparecer jugadores o corregir
... |
d490aeb5-07e4-40e4-a796-914e906f8dda | 4 | public void healthCorrect()
{
if (playerPokemon[userSelected].health < 0)
playerPokemon[userSelected].health = 0;
else if (playerPokemon[userSelected].health > playerPokemon[userSelected].healthMax)
playerPokemon[userSelected].health = playerPokemon[userSelected].healthMax;
if (enemyPokemon[enemySelected]... |
f6214dd7-070f-40e9-9424-981fac46f5ab | 7 | public static void main(String[] args) {
//get data
Scanner in = new Scanner(System.in);
char[] message = in.nextLine().toCharArray();
//convert data into binary format
StringBuilder binary = new StringBuilder();
for(char c : message) {
String res = Integer.toBinaryString(c);
//for non-lette... |
717a7ea8-cf43-4e23-9b2c-d83961e83132 | 0 | @Test
public void testFindStrings() throws Exception
{
Assert.assertEquals(
Arrays.asList("this is a test", "another"),
_xpath.findStrings("//p/text()")
);
} |
f0ff2b6d-ff37-4e8a-8963-a46908d3e499 | 7 | private final void method2048(byte byte0, int i, int j, Stream stream) {
if (byte0 < 106) {
anInt2499 = 112;
}
if (i != 1) {
if (i == 2) {
aBoolean2504 = true;
} else if (i == 3) {
anInt2502 = stream.readShort();
... |
ca4834cc-0422-46ba-9d7a-44bb9b31ab65 | 8 | public void reserveSmallConstants(GrowableConstantPool gcp) {
next_instr: for (Iterator iter = instructions.iterator(); iter
.hasNext();) {
Instruction instr = (Instruction) iter.next();
if (instr.getOpcode() == opc_ldc) {
Object constant = instr.getConstant();
if (constant == null)
continue ne... |
53e4c550-fba2-4825-abf4-eccd6b6224db | 0 | public double getMoney(){
return this.money;
} |
5d5a21a8-1bf9-4d10-a959-7e3cb701468d | 7 | public static void main(String[] args) {
ByteBuffer bb = ByteBuffer.wrap(new byte[]{0, 0, 0, 0, 0, 0, 0, 'a'});
bb.rewind();
System.out.print("Byte Buffer:");
while (bb.hasRemaining()) {
System.out.print(bb.position() + " -> " + bb.get() + ", ");
}
System.out.... |
3896b132-d038-490c-9447-989d2159a16d | 8 | private boolean r_postlude() {
int among_var;
int v_1;
// repeat, line 75
replab0: while (true) {
v_1 = cursor;
lab1: do {
// (, line 75
// [, line 77
bra = cursor;
// substring, line 77
among_var = find_among(a_1, 3);
if (among_var == 0) {
break lab1;
}
// ], line 77
... |
1293a655-a663-401e-b026-03dd99cdaf3b | 6 | private static void errorMessage(String message, String expecting) { // Report error on input.
if (readingStandardInput && writingStandardOutput) {
// inform user of error and force user to re-enter.
out.println();
out.print(" *** Error in input: " + message + "\n");
out.... |
b3d8b1a3-b86c-49a9-9181-c3a36ec101ed | 3 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Punctuation other = (Punctuation) obj;
if (!Objects.equals(this.value, other.value)) {
return... |
4d38fea0-b67e-41c0-8fec-c8ab39cbd80e | 2 | public int haeMyytyjenPizzojenLukumaara() throws DAOPoikkeus {
Connection yhteys = avaaYhteys();
int lukumaara = 0;
String sql = "SELECT COUNT(*) AS lkm "
+ "FROM TilauksenTuote "
+ "JOIN Tuote ON TilauksenTuote.tuoteID = Tuote.tuoteID "
+ "JOIN Tuoteryhma ON Tuoteryhma.tuoteryhmaID ... |
1df7447d-8ae3-4331-87ef-92f54098e22e | 5 | public Bag() {
for (int x = 0; x < 6; x++) {
for (int i = 0; i < 5; i++) {
add(new Tile(x, x));
}
}
for (int x = 0; x < 6; x++) {
for (int y = x + 1; y < 6; y++) {
for (int i = 0; i < 6; i++) {
add(new Tile(x, y));
}
}
}
shuffle();
} |
920c590f-e43b-4b4c-b428-f3f89fd89553 | 9 | private void dominateLabels(RouteLabel newLabel, ArrayList<RouteLabel> activeLabels) {
// For all existing labels
for (RouteLabel oldLabel : activeLabels) {
// if existing label has not been dominated (if so, dominater will have better chance of dominating)
// and both labels end at same node
if(!oldLabel.... |
ceb5bfc8-7d2b-4218-9296-1c0ffc3ad3f4 | 0 | public void setContacterPhone(String contacterPhone) {
this.contacterPhone = contacterPhone;
} |
54070e23-b001-447f-996b-7a3147229e0b | 7 | private void spellButtonMouseClicked(MouseEvent evt) {
if (spellButton.isSelected()) {
HashSet<String> possibilities = new HashSet<String>();
for (Spell spell : ((CanMagicAttack)onTurn).getAvailableSpells()) {
if (CombatHandler.canCastSpell((CanMagicAttack)onTurn, spell)) {
possibilities.add(spell.getN... |
b0d135aa-23da-4c2c-b825-01350e5da809 | 4 | @SuppressWarnings("static-access")
@EventHandler(priority = EventPriority.HIGH)
public void onMobDeath (EntityDeathEvent event) {
Entity entity = event.getEntity();
World world = event.getEntity().getWorld();
if (entity instanceof Creeper) {
Creeper CC = (Creeper) entity;
... |
ac1dcc9c-2921-4b3f-9013-5462908c7fc5 | 0 | public void setFunFechaCambioClave(Date funFechaCambioClave) {
this.funFechaCambioClave = funFechaCambioClave;
} |
72b200ca-93e1-4c0a-b746-ccb92a7467b4 | 1 | public double[] getKeys() {
double[] keys = new double[heap_size];
for (int i = 1; i <= heap_size; i++) {
keys[i - 1] = ar[i].getKey();
}
return keys;
} |
5dc23e97-8a09-4476-945a-ba6ca03d24dd | 8 | public static String encode(String s) {
int buffer = 0x0;
int bufferIndex = 2;
int lsBytes = 0;
System.out.print("B64 Value: ");
for(int i=0;i<s.length();i++) {
buffer |= (int)(s.charAt(i)) << 8*bufferIndex;
if(i == s.length()-1) {
lsBytes = 3-(s.length()%3);
lsBytes = lsBytes == 3 ? 0 : lsBy... |
e85e7517-8e52-4dfa-bb47-b3aaa7fe1ee3 | 2 | public static final PageSides get(Sides sides) {
for (PageSides one : values()) {
if (one.getSides() == sides) {
return one;
}
}
return SINGLE;
} |
e1eb617b-fc88-493b-99c3-187a506d9ef4 | 5 | @Override
public void onEnable () {
setupPermissions();
File backupDir = new File("plugins".concat(FILE_SEPARATOR).concat("Backup"));
if (!backupDir.exists())
backupDir.mkdirs();
backupDir = new File("backups");
if (!backupDir.exists())
backupDir.mkd... |
b283f693-427a-4694-b9ce-6d3e4fb8daa5 | 2 | public void createNewWorkbook()
{
XSSFWorkbook wb = new XSSFWorkbook();
try
{
FileOutputStream fileOut = new FileOutputStream("workbook.xls");
try
{
wb.write(fileOut);
fileOut.close();
}
catch(IOExcep... |
af7cdb87-1a90-427c-b6f7-b51cc0bf26dd | 6 | public static void createInsFile(String genomeName, String outFile, double prob) throws IOException {
Config config = new Config(genomeName, Gpr.HOME + "/snpEff/" + Config.DEFAULT_CONFIG_FILE);
config.loadSnpEffectPredictor();
Random rand = new Random(20140129);
StringBuilder out = new StringBuilder();
int ... |
a74f3c40-91f0-4b34-9cf0-41ff8529a815 | 6 | public int addProperty(String name, Object value) {
int index = -1;
try{
if(isPath(name)){
SectionPath sp = new SectionPath(name);
if(sp.isValid() && sp.addressesProperty()){
Property prop = new Property(sp.getPropertyPart(), value);
Section s =... |
b08bbf10-d015-45e3-a376-317c56e399dd | 8 | @Override
public void emitCode(GluonOutput code) {
if (subExpression != null){
subExpression.emitCode(code);
} else if (literal != null) {
literal.emitCode(code);
} else {
if (preIncrement)
code.code("INC " + variable.getLabelName());
else if (preDecrement)
code.code("DEC " + variable.getLabe... |
9905d99c-f6c7-4053-882c-8e4b339bcc3a | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Jpa20Employee other = (Jpa20Employee) obj;
if (divisionName == null) {
if... |
5ae281fc-238a-43d8-aeea-a7a1f25f0bb2 | 7 | @Override
public void genExceptionTypeComment(StringBuffer buff, ExceptionType e) {
genBeginSeperator(buff);
buff.append(String.format("# ExceptionType: %s\n", e.name));
String description = e.description.replaceAll("[\\t\\n]", " ");
description = description.replaceAll("\\s+", " ")... |
23f5dd53-aee4-49ff-8e93-4c04dc98d003 | 6 | private static void dataBaseData()
{
teacherList = new ArrayList<Teacher>();
postList = new ArrayList<Post>();
//Through testing, we know that the code GETS here successfully.
Gson gson = new Gson();
String json;
try {
json = getJSON("http://dev.mhsnews.org/json_db/updates.php");
... |
670849a5-82cb-43b7-be57-8e3695d85f9f | 4 | public Object callMethod(String method, List<Object> params) throws InvalidResponseException, ConnectionLostException {
try {
return client.execute(method, params);
} catch (XmlRpcException xe) {
switch (xe.code) {
//Non-fatal exception
case 1: thr... |
4ad1a7a5-5958-408a-ad54-e7f1bdb0ac63 | 1 | public JSEquip jsFunction_getJSEquip(){
deprecated();
if(JSBotUtils.haveWindow("Equipment"))
return new JSEquip();
return null;
} |
2a38c32b-138c-4cf4-a934-fdaf87cdb2e2 | 1 | public static String getClassName(String value){
String fileds[] = value.split("_");
StringBuffer sb = new StringBuffer();
for (int i = 0; i < fileds.length; i++) {
String string = fileds[i];
String next = string.substring(1);
String first = string.substring(0, 1);
String pinjie = first.toUpperCase(... |
abd607af-c202-4645-a592-726d98292c5d | 9 | public void decompress(
LodEntry lodentry,
byte[] data,
OutputStream outputstream,
ExtractionObserver extractionobserver,
boolean bool)
{
allowCancel = bool;
cancelSignalled = false;
// IMPLEMENT: dump the bytestream
ByteArrayInputStream in = ... |
a0cd1396-30d5-48a7-8b16-bef98230acc4 | 3 | @Test
public void test() {
GameConfiguration conf = new GameConfiguration();
conf.setAgentCount(1);
conf.setInitialFoodAmount(1);
conf.setFoodAmountIncrese(1);
conf.setHiddenLayers(1);
conf.setNodesPerHiddenLayer(1);
conf.setWorldSize(1000);
WorldDescriptor wd = new WorldDescriptor(conf);
try {
En... |
f071a560-0b6a-4265-a1a6-def280495097 | 3 | private static void alterRasterRGB2PColorSpace(WritableRaster wr, PColorSpace colorSpace) {
//System.out.println("alterRasterRGB2PColorSpace() colorSpace: " + colorSpace);
if (colorSpace instanceof DeviceRGB)
return;
float[] values = new float[3];
int[] rgbValues = new int[3];
... |
40165cd4-8000-4d7c-83a4-5fec93fbf70f | 5 | public static boolean isOnScreen(Entity e){
final WidgetChild actionBar = Widgets.get(640, 6);
return e != null && e.isOnScreen() && (actionBar == null || !(actionBar != null && actionBar.isOnScreen()
&& actionBar.getBoundingRectangle().contains(e.getCentralPoint())));
// return ... |
83cbdb47-7a2e-4b84-bcab-068e98f988a8 | 3 | public static Status fromHttpCode(final int code) {
for (Status status : values()) {
if ((status.begin <= code) && (status.end >= code)) {
return status;
}
}
return UNSPECIFIED_ERROR;
} |
a392939c-9014-4ba2-bccc-a4ec248b5a57 | 9 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof EnrollmentPK)) {
return false;
}
EnrollmentPK other = (EnrollmentPK) object;
if ((this.uid == null && other.uid... |
ef83b448-2af7-4ffc-a193-0020e21efbfd | 5 | public static boolean containsText(String string) {
if (string == null || string.isEmpty()) {
return false;
}
if (string.startsWith(" ")) {
return false;
}
for (int i = 0; i < string.length(); i++) {
if (!Character.isDefined(string.charAt(i))... |
438751ee-ad60-4951-8b78-5789a78dff87 | 9 | private static BswabePolicy parsePolicyPostfix(String s) throws Exception {
String[] toks;
String tok;
ArrayList<BswabePolicy> stack = new ArrayList<BswabePolicy>();
BswabePolicy root;
toks = s.split(" ");
int toks_cnt = toks.length;
for (int index = 0; index < toks_cnt; index++) {
int i, k, n;
t... |
274f3051-ec4e-40bb-b417-ba1c705e264c | 7 | public JSONArray execute() throws QueryException {
// Build request url using the query
URL requestUrl = null;
try {
requestUrl = new URL(HOST + query);
} catch (MalformedURLException e) {
throw new QueryException(QueryExceptionType.MALFORMED_URL, this, HOST + qu... |
e769ed4a-71fd-42b7-8a92-cbeafdb5aab1 | 8 | public void update() {
if (fading != 0) {
padding += fading == -1 ? 3 : 0;
opacity += fading * (0.0333f + (fading + 1) * 0.00165f);
if (opacity <= 0) {opacity = 0; }
if (opacity >= 1f) {opacity = 1f;}
if (padding >= maxPadding) {
supe... |
0651a437-8af5-4b3b-822f-14c07388f8db | 1 | public static void writeStringToFile(String s, File file)
{
makeFile(file, false);
try
{
BufferedWriter b = new BufferedWriter(new FileWriter(file));
b.write(s);
b.close();
}
catch(IOException e)
{
//only possible if file hasn't been created
e.printStackTrace();
}
} |
d357abdd-e96a-4ae9-adb0-96cbdc928710 | 5 | public StartView(DinnerModel model) {
this.model = model;
model.addObserver(this);
setBounds(100, 100, 680, 440);
SpringLayout springLayout = new SpringLayout();
setLayout(springLayout);
// Create leftPanel [TabbedPane]
springLayout.putConstraint(SpringLayout.NORTH, leftPanel, 10,
SpringLayout.NORT... |
377bba15-6a59-4de1-ac3d-3e5aaa40d799 | 9 | public static double solve(Node node) //TODO: make for (x/y)/(a/d)
{
if(node.data.length() == 0)
return 0;
if(node.child.size() == 0)
return Double.parseDouble(node.data);
double ans, leftArgument, rightArgument;
switch( node.data.charAt(0) )
{
... |
2aba4634-ddcb-48b9-8a8e-41dad572ad9b | 6 | @Override
public void actionPerformed(ActionEvent e) {
Response response = null;
if (loginForm.getLoginValue().length() < 1
|| loginForm.getPasswordValue().length() < 1) {
JOptionPane.showMessageDialog(loginForm,
"You should fill both fields",
... |
99d05e9e-6bce-4f2e-b5f4-8a1c08da9f28 | 6 | public static void startupExplanations() {
{ Object old$Module$000 = Stella.$MODULE$.get();
Object old$Context$000 = Stella.$CONTEXT$.get();
try {
Native.setSpecial(Stella.$MODULE$, Stella.getStellaModule("/POWERLOOM-SERVER/GUI-SERVER", Stella.$STARTUP_TIME_PHASE$ > 1));
Native.setSpeci... |
727c2b2b-11c9-4a87-bbfb-9b30aaa0b44a | 7 | private static void addIntersection(S2Point a0,
S2Point a1,
S2Point b0,
S2Point b1,
boolean addSharedEdges,
int crossing,
List<ParametrizedS2Point> intersections) {
if (crossing > 0) {
// There is a proper edge crossing.
S2Point x = S2EdgeUtil.getIntersection(a0, a1, ... |
0bf170c9-1396-4337-947e-3168b342e321 | 0 | public void setDataModel(DataModel dataModel) {
this.dataModel = dataModel;
dataModel.addObserver(this);
} |
c3a28e88-5473-48e8-b98c-8f7279e4a2b0 | 8 | protected int partition(double[] array, int[] index, int l, int r,
final int indexStart) {
double pivot = array[(l + r) / 2];
int help;
while (l < r) {
while ((array[l] < pivot) && (l < r)) {
l++;
}
while ((array[r] > pivot) && (l < r)) {
r--;... |
9c6d3a2c-416e-4866-bc0a-a524248a7132 | 1 | public void decreaseMoveCount() {
if (this.moveCount > 0) {
this.moveCount--;
}
} |
3487eac7-555a-4448-b2eb-9d7cded4b524 | 0 | public Command getTurnOnCommand() {
return turnOnCommand;
} |
d9090af2-a007-4d57-ae02-3e3c00e6b499 | 7 | @Override
public int percentVisited(MOB mob, Area A)
{
if(A==null)
{
long totalRooms=0;
long totalVisits=0;
for(final Enumeration<Area> e=CMLib.map().areas();e.hasMoreElements();)
{
A=e.nextElement();
if((!CMLib.flags().isHidden(A))
&&(!CMath.bset(A.flags(),Area.FLAG_INSTANCE_CHILD)))
... |
c3b34d70-3bdb-4ef8-a2ab-9b4b21ec12c2 | 1 | private int getDecimalValueFromBinary(String binary)
{
int value = 0;
int length = binary.length();
int idx = length;
for (int i = 0; i < length; i++) {
idx--;
value += Integer.parseInt(binary.substring(idx, idx + 1)) * Math.pow(2, i);
}
return... |
8b66602e-1c0f-46da-b19e-263f7b94b8ec | 8 | public HashMap getTags(RandomAccessFile s) throws IOException {
long offset = 0;
int retry = 64;
boolean need_tags = true;
boolean need_id = true;
HashMap tags = new HashMap();
HashMap identification = new HashMap();
for( ; retry > 0 ; retry-- ) {
PageInfo pi = parse_stream_page(s, offset);
if... |
1c89cf80-ba44-49bc-bd22-75eab5d5a712 | 5 | private static Farbe farbeAussuchen() {
Farbe farbe = null;
GamePrinter.printFarben();
String ausgabe = scan.next().toLowerCase();
scan.nextLine();
switch (ausgabe) {
case "rot":
farbe = Farbe.ROT;
break;
case "blau":
farbe = Farbe.BLAU;
break;
case "gruen":
case "grün":
farbe = Farbe.G... |
d694f0e9-6e41-4aea-94eb-4e6b41301017 | 4 | private void updateDataColors()
{
//We need to find the range of the data values,
// in order to assign proper colors.
double largest = Double.MIN_VALUE;
double smallest = Double.MAX_VALUE;
for (int x = 0; x < data.length; x++)
{
for (int y = 0; y < data[0... |
50d1914b-e889-4554-9715-0eeb13396421 | 5 | protected CoderResult encodeLoop(CharBuffer in, ByteBuffer out) {
CoderResult result;
while (true) {
// output buffered data
if (buf.hasRemaining()) {
result = pack(buf,out);
if (result == CoderResult.OVERFLOW)
... |
14338bb9-7d71-4a74-87f7-8eb44477c79e | 2 | public static final List<Integer> getEnabledExtSecTypes() {
List<Integer> result = new ArrayList<Integer>();
for (Iterator<Integer> i = enabledSecTypes.iterator(); i.hasNext();) {
int refType = (Integer)i.next();
if (refType != secTypeVeNCrypt) /* Do not include VeNCrypt to avoid loops */
r... |
ca1856d1-7cfc-4e0c-9ce2-a36b4b2a9d54 | 6 | private void calculateCharWidths(BufferedImage fontTexture, int width, int height) {
int[] fontData = new int[width * height];
fontTexture.getRGB(0, 0, width, height, fontData, 0, width);
int maxCharWidth = width / 16;
int maxCharHeight = height / 16;
for (int character = 0; cha... |
b7aa6f01-c773-4d53-a947-a78940c7d89b | 0 | protected boolean canBreed()
{
return getAge() >= getBreedingAge();
} |
02f6e890-c9ef-4690-a881-ec3c27c98fff | 1 | */
@Override
public String toString() {
if (cycConnection == null) {
return "CycAccess: no valid connection";
}
return cycConnection.connectionInfo();
} |
cfb171b9-2ece-4a5b-a6e9-66d83831cd92 | 6 | public boolean equals(Object tape) {
if (tape == this)
return true;
Tape t;
try {
t = (Tape) tape;
} catch (ClassCastException e) {
return false;
}
// These variables are necessary for going into the tape so we
// can consider everything other than the "blank" prefix.
int[] first = new int[2], ... |
65cbc3a7-dea2-4405-a319-63ddfd122982 | 3 | @Override
public int releaseRenderTarget(int fbo) {
if (fbo != 0 && fbo != -1) {
glDeleteFramebuffersEXT(fbo);
framebuffers.remove(fbo);
if (fbo == boundFbo) {
boundFbo = -1;
}
}
return 0;
} |
4bdd76da-5fd2-4937-891f-286df246055a | 9 | private static boolean updateHashEquiJoinCardinality(HashEquiJoin j,
Map<String, Integer> tableAliasToId,
Map<String, TableStats> tableStats) {
DbIterator[] children = j.getChildren();
DbIterator child1 = children[0];
DbIterator child2 = children[1];
int child1Ca... |
bc7b5afb-c435-4474-becd-34ff7b44d8df | 3 | static String[] toStringArray(Object[] array) {
if (array.length == 0) {
return null;
}
if (array[0] instanceof String) {
return (String[]) array;
}
String[] stringArray = new String[array.length];
for (int i=0;i<array.length;i++) {
str... |
93ccf96e-3c14-4c66-b005-148ffdf911be | 5 | @Test
public void testReceiveNegativeTimeout_IsImmediate() {
try {
consumer = new AbstractMessageConsumer(mockTopic) {
};
} catch (DestinationClosedException e) {
fail("Unexpected exception on constructor");
}
assertNotNull(mockTopic.getTopicSubscriber());
Message msg = new MockMessage("TestMessage"... |
2513dfe8-34e7-4c13-8d31-f9ec5d0dcee4 | 5 | @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final StreamCreated other = (StreamCreated) obj;
... |
c9d99c98-e26a-47db-927d-8a2bbaef2e96 | 6 | public void resetCentroid() {
int size= this.songMap.size();
// if there are no songs, there can be no centroid
if(size == 0)
return;
// if there's only one song, the centroid will be in the same position as that song
if(size == 1) {
Iterator<Song> iterm= this.songMap.values().iterator();
... |
6d539112-7f94-40bb-b017-b7c51dd9024c | 8 | @Override
public boolean remove(String constrain) {
// remove all fingerprints for the location, then remove location
String locationCnst = (constrain != null && constrain.length() > 0) ? constrain : "1=1";
String fingerprintsCnst = HomeFactory.getFingerprintHome().getTableIdCol() + " IN (SELECT " + HomeFactory.... |
c6822fb5-988d-470a-8ff6-e7cb7de0a069 | 2 | public void actionPerformed(ActionEvent e)
{
if (e.getSource() == yesButton)
{
yes = true;
this.setVisible(false);
visible = false;
Battle.confirmEvolution(true);
}
else if (e.getSource() == noButton)
{
yes = false;
this.setVisible(false);
visible =... |
a8a5c886-0d95-436e-891d-17c30c237ba5 | 7 | public void checkCollisionsAndMove(Mesh world) {
// Only check and move if the couch is moving
if (velocity.length() != 0 || gravityVelocity.length() != 0) {
// Create a new collision checker
collisionChecker = new WorldCollision(
new Vector(velocity)
.mult(KouchKarting.getSecondsPerFrame()),
... |
e8163c36-89de-4f59-9ce7-b349f8ba214c | 0 | public void setMaxValue(Double max) {
this.maxValue = max;
} |
d3f7a53a-bf8b-47ee-ac84-d1441c33a921 | 6 | public boolean merge(final Subroutine subroutine) throws AnalyzerException {
boolean changes = false;
for (int i = 0; i < access.length; ++i) {
if (subroutine.access[i] && !access[i]) {
access[i] = true;
changes = true;
}
}
if (subr... |
7346d0ba-c891-454d-b791-b4f9d8d5cf68 | 8 | @Override
public long skip(long n) throws IOException {
fireBeforeDecorateHead();
if (head != null && hPoint < head.length) {
int dlen = head.length - hPoint;
int r = dlen < n ? dlen : (int) n;
hPoint += r;
fireAfterDecorateHead();
return r;
}
fireAfterDecorateHead();
long i = super.skip(n);
... |
ab5fbd46-59bd-4463-b183-3c21b3cdf503 | 8 | public SubstitutionMatrix<Integer> parseSubstitutionMatrix() {
SubstitutionMatrix<Integer> matrix = null;
ArrayList<String> labels = new ArrayList<String>();
int gapWeight = 0;
int lengthWeight = 0;
// For every line in the file...
while (scanner.hasNextLine()){
// Get the line...
String line = sca... |
f64685b0-2bca-49f4-b9b4-00adaabcec8b | 8 | public void clamp()
{
if (r < 0)
{
r = 0;
}
else if (r > 1)
{
r = 1;
}
if (g < 0)
{
g = 0;
}
else if (g > 1)
{
g = 1;
}
if (b < 0)
{
b = 0;
}
else if (b > 1)
{
b = 1;
}
if (a < 0)
{
a = 0;
}
else if (a > 1)
{
a = 1;
}
} |
57688fbd-eca5-4844-aecf-be4d6684ed2c | 5 | protected void setChannel(SocketChannel channel_) {
try {
if (channel != null)
channel.close();
if (readSelector != null)
readSelector.close();
if (writeSelector != null)
writeSelector.close();
channel = channel_;
channel.configureBlocking(false);
writeSel... |
8c2074f1-bada-42f3-b1d1-caa2dcd0fa7b | 5 | @Override
/**
* Movement allowed, 8 destination cases : L-like move 2/1 in one direction, 1/2 orthogonally
* RETURNS true if the move is allowed
*/
public boolean checkMove(int Px, int Py,Player J,Piece[] B){
int Dx = Px - getPosx();
int Dy = Py - getPosy();
boolean W = J.isWhite();
if ((Math.abs(Dx)... |
0b4b27a3-e837-4ef5-9cc5-ebfafbdf6484 | 8 | public boolean AStarSearch(int root_id,int value){
rootNode=g.all_nodes.get(root_id);
g.setHeuristics(value); // set heuristic values based on distance to the goal
frontier.insert(rootNode,3);
rootNode.is_discovered=true;
rootNode.astarcost=0;
rootNode.totalcost=0;
while(!frontier.isEmpty()){
No... |
c3815702-2fe9-4866-809b-d57d53df63f2 | 2 | public double getEtxToMeFromNode(int nodeID) {
Iterator<Edge> it2 = this.outgoingConnections.iterator();
EdgeOldBetHop e;
while (it2.hasNext()) {
e = (EdgeOldBetHop) it2.next();
if (e.endNode.ID == nodeID){
e = (EdgeOldBetHop) e.getOppositeEdge();
return e.getEtx();
}
}
return 0.0;
} |
b0a503aa-a1d2-4228-88fa-1fb4f30a1052 | 7 | @Override
public MoveResult makeMove(HantoPieceType pieceType, HantoCoordinate from,
HantoCoordinate to) throws HantoException, HantoPrematureResignationException {
if(gameIsOver) {
throw new HantoException("game is already over");
}
MoveResult result = checkresign(pieceType, from, to);
if(piece... |
b608a2e5-22e5-48ef-9015-6b3a549c0177 | 8 | public static String convertToPostfix(String in) {
StkChar opstk = new StkChar();
StringBuffer out = new StringBuffer();
String opers = "+-*/()";
char topsym = '+';
boolean empty;
for (int i = 0; i < in.length(); i++) {
if (opers.indexOf(in.charAt(i)) == -1) {... |
d220a0dc-d4cc-4b4d-8715-76f016b46a36 | 9 | @Override
public void paintComponent(Graphics g)
{
super.paintComponent(g);
// slots
for (int i=0; i<slotList.size(); ++i)
{
Slot slot = slotList.get(i);
slot.draw(g);
}
// dragged slots
for (int i=0; i<slotList.size(); ... |
07850d60-dd60-43ff-90bb-219c333a451f | 1 | public DefaultBox<?> getBox(){
return box;
} |
41af450a-75ce-47b5-9459-287369fcd656 | 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... |
bd11bdc2-934d-468c-9e71-f6cb4c264715 | 5 | @EventHandler
public void onPlayerUses(PlayerInteractEvent event) throws IOException {
if (event.getAction() == Action.RIGHT_CLICK_BLOCK){
String whatClicked = event.getClickedBlock().getType().toString();
if (
whatClicked.contains("DOOR") ||
w... |
6e1dfbc5-53b0-42b6-9ba8-6976daf37449 | 5 | private List<String> getLinesIfFileExists(String fileName) {
List<String> list = new ArrayList<>();
File file = new File(fileName);
BufferedReader reader = null;
try {
reader = new BufferedReader(new FileReader(file));
String text = null;
while ((tex... |
ac3be11d-7a16-4ea0-b4f7-a9e000accaef | 9 | public static void fixType(Type from, Type to, CodeAttr code) {
// boxing
if (from instanceof PrimType && to instanceof ClassType) {
PrimType from_prim = (PrimType) from;
Method valueOf = from_prim.boxedType().getMethod("valueOf", new Type[] { from });
code.emitInvoke(valueOf);
}
// unboxing
else i... |
b8dfe826-12cd-486b-96e5-90044dd4f2ff | 4 | public static String selectUserType(){
Scanner scan = new Scanner(System.in);
do{
System.out.printf("\n***TIPOS DE USUARIO***\n1-%s\n2-%s\n3-%s\nEscoja uno: ",
ADMINISTRADOR, CONTENIDO, LIMITADO);
int opt = scan.nextInt();
switch(opt){
... |
4762cf3d-b938-496d-b69c-34f8d1238baa | 1 | public void executeActiveCiphers(String code) {
int activatedCiphersAmount = getComponentCount();
for(int i = 0; i < activatedCiphersAmount; i++) {
((CipherPanel) getComponent(i)).executeCipher(code);
}
} |
1355bf69-b477-4130-80ca-3fcdd492e03e | 2 | @Test
public final void testLeafInterator() {
int count = 0;
Iterator<SpatialTree<Sphere>> it;
SpatialTree<Sphere> tree = new SpatialTree<Sphere>(objects);
it = tree.leafInterator();
while (it.hasNext()) {
assertTrue(it.next() instanceof SpatialTree<?>);
... |
211a0e16-4ba7-43c2-aa85-e7a4bbdd99ba | 1 | public static void main(String[] args) {
Handler handler1 = new ConcreteHandlerA();
Handler handler2 = new ConcreteHandlerB();
Handler handler3 = new ConcreteHandlerC();
handler1.setSuccessor(handler2);
handler2.setSuccessor(handler3);
int[] requests = { 4, 2, 3, 1 };
... |
2c567284-4758-4d85-8c72-223f5ee9b628 | 9 | public void javadocInvalidType(ASTNode location, TypeBinding type, int modifiers) {
if (javadocVisibility(this.options.reportInvalidJavadocTagsVisibility, modifiers)) {
int id = IProblem.JavadocUndefinedType; // default
switch (type.problemId()) {
case ProblemReasons.NotFound :
id = IProblem.JavadocUndefine... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.