method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
d3fafb1c-a2f7-49d8-a5f1-ac89d173ed94 | 8 | protected void updateBoundariesAndWeights() {
// Get values and keys from tree map
double[] values = new double[m_TM.size()];
double[] weights = new double[m_TM.size()];
Iterator<Map.Entry<Double,Double>> itr = m_TM.entrySet().iterator();
int j = 0;
while(itr.hasNext()) {
Map.Entry<Double... |
327d3d88-7a45-44b5-83b3-ab682032707c | 9 | public void findMinUnsortedSubArray(int[] a) {
/* STEP #1: Find first "unsorted" element from left */
int s = 0;
for (; s < a.length; s++) {
if (a[s] > a[s + 1]) {
break;
}
}
if (s == a.length) {
System.out.println("Array is fully sorted!");
return;
}
/* STEP #2: Find first "uns... |
b89f27df-b070-49b1-b4b7-e9f7e5cfde03 | 7 | public void playCapturedSound() {
if (tile != null) {
if (tile instanceof Bear) {
AUDIO_BEAR.play();
}
else if (tile instanceof Duck) {
AUDIO_DUCK.play();
}
else if (tile instanceof Fox) {
AUDIO_FOX.play();
}
else if (tile instanceof Human) {
... |
d8dd0048-05d9-4524-96fc-4a1f8dcdf5b0 | 0 | private void drawPlayer() {
g.drawImage(Main.player.getImage(), (Main.player.getX() - viewX)*ZOOM, (Main.player.getY() - viewY)*ZOOM, Player.width/8*ZOOM, Player.height/8*ZOOM, null);
} |
e5c18f61-175a-432a-b1fc-aef73a764914 | 2 | public ParkingPlace getParkingPlace(long maxWaitMillis)
throws ParkingException {
try {
if (SEMAPHORE.tryAcquire(maxWaitMillis, TimeUnit.MILLISECONDS)) {
return getItem();
}
} catch (InterruptedException e) {
throw new ParkingException(e);
}
throw new ParkingException("Timeout");
} |
1b787366-4d31-4f93-b71b-a95c0f58ba0d | 5 | void printMetaData()
{
long n = readU32();
printOffset();
out.println(n + " Metadata Entries");
for (int i = 0; i < n; i++)
{
int start = offset;
printOffset();
String s = stringConstants[(int)readU32()];
long val = readU32();
... |
fa41200a-775e-4070-bdb9-c367b092f07b | 6 | private String contentMix(ArrayList<String> bodyTxt,ArrayList<String> bodyPic,String IP_PORT,String apiKey,String curl){
FileService fileService = new FileService();
String cont = "";
int i;
for(i=0;i<bodyTxt.size() && i<bodyPic.size();i++){
String paragraph = bodyTxt.get(i).... |
2af5bdd8-0459-42a3-b9a5-14b189496f81 | 7 | @Override
public void execute() {
target = NPCs.getNearest(sheepFilter);
sheared = false;
Paint.status = "Shearing sheep...";
if (target != null) {
if(!target.isOnScreen() && Calculations.distanceTo(target) >= 7){
Walking.walk(target);
}else i... |
bd6f5de7-19dd-4a45-8d8b-510aacdd527c | 2 | @Override
public String toString() {
if (section == null) return "";
VcfEntry vcfEntry = (VcfEntry) section;
if (needAddInfo) addInfo(vcfEntry);
return vcfEntry.toString();
} |
bbcb6112-502e-4f0b-b24b-b4548fd094bb | 4 | public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
args = CommandLineTokenizer.tokenize(args);
if (sender instanceof Player) {
xAuthPlayer p = plugin.getPlyrMngr().getPlayer((Player) sender);
if (args.length < 2) {
plugin.getMsgHndlr().sendMessage("changepw.us... |
0ebdbe94-0149-4464-a60b-5c5d1496c1cc | 6 | public double interpolate(double[] unknownCoord){
int nUnknown = unknownCoord.length;
if(nUnknown!=this.nDimensions)throw new IllegalArgumentException("Number of unknown value coordinates, " + nUnknown + ", does not equal the number of tabulated data dimensions, " + this.nDimensions);
sw... |
338d2827-93fe-4f79-b5c3-80bc8218e94a | 5 | @Override
public void Write(IOClient p, Server server) {
PacketPrepareEvent event = new PacketPrepareEvent(p, this, server);
server.getEventSystem().callEvent(event);
if (event.isCancelled())
return;
Player player;
if (p instanceof Player) {
player = (Player)p;
}
else
return;
try {
while (p... |
4ab0a488-1e7c-4909-864e-67def12b5778 | 4 | @Override
protected void paintComponent(Graphics g) {
g.clearRect(0, 0, getWidth(), getHeight());
final float pageWidth = currentPage.getClipBox().getWidth();
final float scalingScalar = pageSize.width / pageWidth;
for (Text t : currentPage.getText()) {
... |
f9227437-acf9-4cf4-b558-f38be16edc26 | 1 | public static void addSample(JSONObject jsonObject) {
try {
samplesQueue.put(jsonObject);
} catch (InterruptedException ie) {
BmLog.error("Failed to add sample to uploader: Interruptedexception");
}
} |
67fb80d8-049d-48ae-be69-117954a7db9e | 1 | public int getTotalNum() {
List<Park> list = getParkList();
int num = 0;
for(Park park : list) {
num += park.getTotalNum();
}
return num;
} |
17219b01-9095-4d0f-b493-40b719d2b981 | 4 | private void setDisciplina(Disciplina disciplina) {
int index = 0;
int indexDisciplina = -1;
//evitar disciplina duplicada
while(index < cmbDisciplinas.getItemCount() && indexDisciplina < 0){
String codDisciplina = ((Disciplina)cmbDisciplinas.getItemAt(index)).getCodigoDiscip... |
91a8fc26-faae-4216-a648-114f436dd5a2 | 7 | public boolean collapseZeroGap() {
boolean ret = false;
introns = null; // These need to be recalculated
//---
// Collapse Exons
//---
Markers markers = new Markers();
markers.addAll(subintervals());
Map<Marker, Marker> collapse = MarkerUtil.collapseZeroGap(markers); // Create a map of collapsed exons
... |
8dd1b28c-dc80-42a9-83aa-7597c8282f4e | 5 | private static final void deleteBBSReply(final MapleClient c, final int replyid) {
if (c.getPlayer().getGuildId() <= 0) {
return;
}
int threadid;
Connection con = DatabaseConnection.getConnection();
try {
PreparedStatement ps = con.prepareStatement("SELECT postercid, threadid FROM bbs_replies WHERE repl... |
4042d1cc-b165-4eac-b5bb-ce499bbb380f | 1 | @Override
public void interrupt() {
if(screenElement != null) {
//((GameSetup) source.getContainer()).getUI().remove(screenElement);
}
//screenElement = new TextBox(reader.getZBody().getX(), reader.getZBody().getY(), null, "See ya later faaaag", false);
((TextBox) screenElement).setKillTimer(2.5f);
//((Ga... |
df909a8c-f0de-42ae-a9a7-f9064e3244e1 | 8 | public static void main(String[] args) {
logger.setLevel(Level.SEVERE);
ConsoleHandler handler = new ConsoleHandler();
handler.setLevel(Level.SEVERE);
logger.addHandler(handler);
if (args.length == 0) {
logger.warning("Invalid arguments count.");
return;
... |
17b85475-e7ce-4112-94e2-f0f2dffe3c92 | 3 | @Override
public void execute(VGDLSprite sprite1, VGDLSprite sprite2, Game game)
{
ArrayList<Integer> subtypes = game.getSubTypes(itype);
if (!subtypes.isEmpty()) {
int[] types = new int[subtypes.size()-1];
int j = -1;
for (Integer i : subtypes) {
... |
4cb2a647-0159-457e-b534-4315b07ce96b | 1 | @Before
public void setUp(){
classUnderTest = new TheWheel();
for(int i = 0; i < 20; i++){
testSolutions.put(i, (double) i);
}
classUnderTest.setSolutionFitness(testSolutions);
} |
f5a61959-bf1e-471b-a708-736a8546cc3e | 0 | public void show() {
// 根据内容调整窗口大小
// frame.pack();
// Dimension d = frame.getSize();
// frame.setSize((int)d.getWidth() + 10, (int)d.getHeight() + 15);
int x = (int) Toolkit.getDefaultToolkit().getScreenSize().width;
int y = (int) Toolkit.getDefaultToolkit().getScreenSize().height;
frame.setSize(x - 200,... |
c00475f7-2452-4741-8074-886d3e1aa1a3 | 3 | @Override
public boolean evaluate(Auction t) {
ArrayList<Auction> temp = new ArrayList<Auction>(searches.values());
for(Auction auc : temp){
if(auc.getName().equalsIgnoreCase(criteria)){
temp.add(auc);
}
}
return t.getName().contains(criteria) || t.getDescription().contains(criteria);
} |
b7b67333-ba31-4076-ac2d-48738643dfb2 | 3 | public static String[][] getCompanyRelationship() {
String [][] relationship;
ArrayList<String> companyRelationship = new ArrayList<String>();
String read;
try {
BufferedReader reader = new BufferedReader(new FileReader("fieldPlacement.txt"));
while((read = reader.readLine()) != null) {
companyRelatio... |
0ed9a56e-ebc5-4936-963f-3b4da2e46720 | 6 | public void run() {
// Ensure we have a compatible line for our format.
AudioFormat format = Utils.getFormat();
TargetDataLine line = this.getAudioLine(format);
if (null == line) {
System.err.println("Unable to get line");
return;
}
// Record!
... |
83b7faac-9449-405f-8937-dd936f2615a9 | 4 | protected Instruction prev(MethodNode m, Instruction insn) {
MethodEditor editor = m.editor();
@SuppressWarnings("rawtypes")
List code = editor.code();
int index = code.indexOf(insn);
int offset = 1;
Object e = null;
while((index - offset) >= 0 && !((e = code.get(index - offset++)) instanceof Instruct... |
73a7510d-69ce-4925-a73f-c1dc16b437cb | 6 | protected void loadContestantByWeek(int week) {
GameData g = GameData.getCurrentGame();
List<Contestant> temp = new ArrayList<Contestant>(g.getAllContestants());
data = new ArrayList<Contestant>(temp.size());
Collections.sort(temp, Utils.getComparator(Utils.CompType.CONTNT_DATE,
Contestant.class));
... |
5215c2db-37b3-480f-aa48-86daea7442c5 | 1 | public void mouseExited(MouseEvent e) {
if(!checked) {
textColor = "gray";
} else {
textColor = "white";
}
} |
6b306fd5-479e-4edf-a9f6-56ce7c6177c3 | 9 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final MOB target=this.getTarget(mob,commands,givenTarget);
if(target==null)
return false;
if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
return false;
final boolean success=prof... |
5bca7cc9-d1b2-41c6-aee9-1df18ffba086 | 5 | @SuppressWarnings("unchecked")
private PairNode<T> combineSiblings(PairNode<T> firstSibling) {
if (firstSibling.nextSibling == null) {
return firstSibling;
}
int numSiblings = 0;
for (; firstSibling != null; numSiblings++) {
treeArray = doubleIfFull(treeArray... |
2843d887-166c-4b50-b350-4458e75fff1f | 8 | public static int pickEnemy(int level){
int spread = RandomNumber.getNormalRand(0,4, 2, 1);
int itr = 0;
int tries = 0;
do{
itr = RandomNumber.getRand(1, enemys.size());
tries++;
}while(tries < 100 &&(enemys.get(itr).level > level + spread|| enemys.get(itr).level < level-spread));
if... |
5ad18fc2-dd02-4ee1-9131-5288ceffc382 | 0 | @Test
public void runTestImplicitFlow1() throws IOException {
InfoflowResults res = analyzeAPKFile("ImplicitFlows_ImplicitFlow1.apk", true);
Assert.assertEquals(1, res.size()); // same source and sink, gets collapsed into one leak
} |
8c16bb0d-1df5-48b3-ae6a-5daa726af1de | 5 | private static void appendJSONPair(StringBuilder json, String key, String value) throws UnsupportedEncodingException {
boolean isValueNumeric = false;
try {
if (value.equals("0") || !value.endsWith("0")) {
Double.parseDouble(value);
isValueNumeric = true;
... |
a0041ba0-2c5b-4c52-acb6-9d4e29805973 | 9 | @Test
public void testGetBytesInRange() {
try {
ByteUtils.getBytesInRange(-1, 3);
fail("Expected illegal argument exception");
} catch (IllegalArgumentException expected) {};
try {
ByteUtils.getBytesInRange(1, -3);
fail("Expected illegal argument exception");
} catc... |
d5ad960e-d4ed-41eb-9120-2e8ef20d436f | 3 | @Override
public void deserialize(Buffer buf) {
slaveId = buf.readInt();
int limit = buf.readUShort();
spellCooldowns = new GameFightSpellCooldown[limit];
for (int i = 0; i < limit; i++) {
spellCooldowns[i] = new GameFightSpellCooldown();
spellCooldowns[i].des... |
cacab3f9-f644-43ec-9958-a8391c1647a9 | 4 | protected void readVvAdd(float[][] a, BitInputStream source, int offset, int length)
throws VorbisFormatException, IOException {
int i,j;//k;//entry;
int chptr=0;
int ch=a.length;
if(ch==0) {
return;
}
int lim=(offset+length)/ch;
for(i=offset/ch;i<lim;){
... |
bf197016-1a5a-4010-af66-21c92a0f0790 | 4 | @SuppressWarnings("unchecked")
public static <T> T readObj(String absPath) {
ObjectInputStream ois = null;
try {
ois = new ObjectInputStream(new BufferedInputStream(new FileInputStream(absPath)));
return (T) ois.readObject();
}
catch (IOException e) { e.printStackTrace(); }
catch (ClassNotFoundExceptio... |
8453c70c-2d66-4f25-af07-0bb41c6142b9 | 4 | @Test
public void testOnderdeelBestellen() throws Exception {
File f = new File("C:/Users/Jacky/Dropbox/Themaopdracht 4/CSVTestdata/OnderdelenBestellenTest.csv");
if (f.exists() && f.isFile()) {
String voorraadnaam;
String minimalevoorraad;
String voorraad;
String producten;
FileReader fr = new File... |
afc69eb3-074c-471e-9366-2b0144122c6d | 1 | public static WriteConcern getWriteConcern(DBCollection collection, WriteConcern concern) {
return concern == null ? collection.getWriteConcern() : concern;
} |
51479d88-b4a1-4b17-bad5-ca0f4900f627 | 0 | @Test
public void oneChanceShouldBeEqualToAnother(){
Chance coinToss = new Chance(0.5);
Chance dieThrow = new Chance( ((double) 1.0)/6);
assertFalse(dieThrow.equals(coinToss));
assertEquals(coinToss, new Chance(0.5));
assertEquals(new Chance(0.5), coinToss.not());
... |
e7bf7444-1d09-40cf-bd4f-73ac6eec3369 | 8 | @Override
public double convertTo(int type) {
switch (type) {
case UnitConstants.FEET_SECOND:
return getValue();
case UnitConstants.FEET_MINUTE:
return getValue() * 60;
case UnitConstants.MILES_MINUTE:
return getValue() * 0.... |
58e0f3e6-37ec-4aa6-9c8d-7a7c2ecb56d9 | 2 | public String[] extractMinimumParentheses(){
Pattern pattern = Pattern.compile("[(][0-9¥+¥-¥*/]+[)]");
Matcher matcher = pattern.matcher(expression);
String[] extractedExpression = new String[matcher.groupCount()];
if (matcher.find()) {
for(int i = 0; i < matcher.groupCount(... |
194b62ee-9183-4db7-9c87-17493acdb72e | 1 | public List<TreeNode> generateTrees(int n) {
Map<Integer, List<TreeNode>> DP = new HashMap<Integer, List<TreeNode>>();
if(n == 0) return new ArrayList<TreeNode>();
generateTreesDP(n, DP);
return DP.get(n);
} |
dee6d0e7-b41d-42a6-9c92-3d2d44ad2349 | 9 | public static String infoPledgepaymentContribution(Logger logger, Connection connection, Pledgepayment pledgepayment, Contribution contribution, Enum_status status) {
String entity;
String message_contribution = "";
String receivedate;
try {
SimpleDateFormat simpledateformat ... |
bb310630-b61a-47d1-a7c2-4ede8aa02314 | 3 | public void read_command(String command, Client c, String channelname){
ArrayList<String> lists = config.getProperties();
for(String com: lists){
String[] pieces = com.split(" ");
if(pieces.length > 1){
String reply = pieces[1];
for(int i = 2; i < pieces.length; i ++){
reply += " " + pieces[i]... |
a368e589-9be5-4a53-b863-ab342b008616 | 2 | @Override
public void mouseClicked(MouseEvent e) {
if ((e.getModifiers() & InputEvent.BUTTON1_MASK) == InputEvent.BUTTON1_MASK) {
try {
GuiUtils.navigate(BmUrlManager.getPluginPage());
} catch (Throwable exception) {
BmLog.error("Wrong URL", exception... |
7eaf23bb-ffcf-4cd7-aa75-3fb93ed6f3d0 | 5 | public MovingEntity getClosestMovingEntity(int x, int y){
int closestX, closestY, closestDistance = 999;
int xe, ye;
Entity closest = null;
for(Entity e: entities){
xe = e.getxPos();
ye = e.getyPos();
if(Util.getDistance(x, y, xe, ye) < closestDistance && xe !=x && ye != y && e instanceof MovingEntity)... |
e5d00f62-405d-4780-81a7-29af4788c2e7 | 4 | @Override
public Color chooseColorByPoint(Vertex point)
{
if (point == firstLeft || point == firstRight)
return Color.green;
if (point == lastLeft || point == lastRight)
return Color.yellow;
return super.chooseColorByPoint(point);
} |
cde26dfc-1add-4e53-87df-e3e379abaa39 | 0 | @Override
public void addConnectionDisconnectListener(ConnectionDisconnectListener listener) {
connectionDisconnectListenerList.add(ConnectionDisconnectListener.class, listener);
} |
2fed6823-711e-4496-9bad-d4da40df51ce | 6 | @Override
public void mouseClicked(final MouseEvent e) {
this.e = e;
player.setActivityTimer(1000);
//if(player.getActivityTimer()==0){
new Thread(new Runnable(){
@Override
public void run() {
BenchOverlay overlay = (BenchOverlay)((JLabel) e.getSource()).getParent();
overlay.progress... |
00799d62-4699-4a99-b0fc-4dac0ec8e484 | 1 | public void testFactory_FromCalendarFields() throws Exception {
GregorianCalendar cal = new GregorianCalendar(1970, 1, 3, 4, 5, 6);
cal.set(Calendar.MILLISECOND, 7);
YearMonth expected = new YearMonth(1970, 2);
assertEquals(expected, YearMonth.fromCalendarFields(cal));
try {
... |
965067e4-67b3-4b1c-820f-ec4c4387ffe0 | 4 | public void saveAs() {
try {
String chemin = Tools.showSaveDialog(
Tools.getLocalizedString(ActionType.SAVE_AS.name()
+ ".Name")).getAbsolutePath();
if (!chemin.endsWith(".ks"))
chemin += ".ks";
fileName = new File(chemin);
BufferedWriter bw = new BufferedWriter(new FileWriter(fileName));
... |
08640839-02f1-40ec-8fcf-35fa9b069825 | 8 | public void setup(GuiController wham, Game game) {
removeAll();
this.game = game;
// Build score grid. First column is labels; then 3 columns for each player, with top and bottom row spanning all 3.
setLayout(new GridBagLayout());
// Add column names to left.
GridBagConstraints c = new GridBag... |
a5e86886-87fa-4216-badf-a574e4ebf892 | 2 | public void addTile(int x, int y, Tile type) {
if (y == size && type == Tile.FLOOR_STONE) {
Log.print("You aren't supposed to be here!");
}
tiles.put(x + y * size, type);
} |
25800899-6818-47a6-b5fd-b643f3e42d1b | 9 | public static ArrayList<Production> readProductionFromFile(String filePath)
throws IOException {
ArrayList<Production> productions = new ArrayList<Production>();
File file = new File(filePath);
if (!file.exists() || file.isDirectory()) {
System.out.println("Error!File not exists or it's a directory!");
... |
07f395bf-1c4d-47c7-a635-1d1a74cbb006 | 9 | public boolean readJPEG(InputStream in, int chanW, int chanH) throws java.io.IOException {
int len=readInt(in);
newjpegLen=len;
//System.out.println("len="+len);
if(!_isConnected) return false;
if(len>=_newjpeg.length) {
System.out.println("Not enough tmp room");
return false;
}
readBytes(_newjpeg,i... |
e4cf6a58-089e-4df0-adbc-d79acfff4fae | 8 | @Override
public boolean okMessage(Environmental host, CMMsg msg)
{
if(((msg.sourceMinor()==CMMsg.TYP_QUIT)
||(msg.sourceMinor()==CMMsg.TYP_SHUTDOWN)
||((msg.targetMinor()==CMMsg.TYP_EXPIRE)&&(msg.target()==shelter))
||(msg.sourceMinor()==CMMsg.TYP_DEATH)
||(msg.sourceMinor()==CMMsg.TYP_ROOMRESET))
&&... |
521db464-17d1-4e05-9e2d-3dfe13b58dcd | 6 | @Override
public void keyReleased(KeyEvent e) {
// TODO Auto-generated method stub
switch (e.getKeyCode()) {
case KeyEvent.VK_UP:
System.out.println("Stop moving up");
break;
case KeyEvent.VK_DOWN:
currentSprite = anim.getImage();
robot.setDucked(false);
break;
case KeyEvent.VK_LEFT:
robo... |
1c584296-79bc-4db0-9fba-812497b2c296 | 4 | private void func_22181_a(File var1, ArrayList var2, int var3, int var4, IProgressUpdate var5) {
Collections.sort(var2);
byte[] var6 = new byte[4096];
Iterator var7 = var2.iterator();
while(var7.hasNext()) {
ChunkFile var8 = (ChunkFile)var7.next();
int var9 = var8.getXChunk();... |
78870565-3f14-4eb0-b954-bf9b88f8591a | 6 | public static void main(String args[]) {
/* Set the Windows look and feel */
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Windows".equals(info.getName())) {
javax.swing.UIManager.setLookAndFe... |
0329dd26-8cf5-45b5-8c1e-607f8f660e90 | 0 | public static Torrent create(File source, String announce, String createdBy)
throws NoSuchAlgorithmException, IOException {
logger.info("Creating torrent for " + source.getName() + "...");
Map<String, BEValue> torrent = new HashMap<String, BEValue>();
torrent.put("announce", new BEValue(announce));
torrent.p... |
598e0766-8f4b-4ed8-8e74-8bfc71f62306 | 3 | private void initGraphics() {
final int NO_OF_LEDS = getSkinnable().getNoOfLeds();
if (getSkinnable().getOrientation() == Orientation.VERTICAL) {
bargraph = new VBox();
((VBox) bargraph).setSpacing(0);
//bargraph.setPadding(new Insets(0, 0, 0, 0));
for (in... |
61f9bf81-7321-45a8-9861-66972294fc37 | 0 | public void play(Note note) {
System.out.println("DoubleBass.play() " + note);
} |
66bc8a15-92c9-433f-b615-ad7efdfe1781 | 4 | public void buildTitleMenu() {
switch(titleMenuType) {
case TITLE:
titleMenu = new SelectBox(false) {{
setCenterPosition((float) (Theater.get().getScreen().camera.getX() + (Theater.get().getScreen().camera.getWidth() * 0.4f)),
(float) (Theater.get().getScreen().camera.getY() + (Theater.get().getScreen... |
e68bf8f1-df57-48bd-becc-45b260253752 | 9 | public void Wander() {
Random rndGen = new Random();
direction = rndGen.nextInt(9) + 1;
switch (direction) {
case 1: x--;
z--;
break;
case 2: x--;
break;
case 3: x--;
z++;
break;
case 4: z--;
break;
case 5: break;
case 6: z++;
break;
case 7: x++;
z-... |
bf52cc62-7e98-4176-b5a7-865c27850d19 | 5 | private ArrayList<Edge> selectEdgesForSitePoint(Point coord, ArrayList<Edge> edgesToTest) {
ArrayList<Edge> filtered = new ArrayList();
for (Edge e : edgesToTest) {
if (((e.get_leftSite() != null && e.get_leftSite().get_coord() == coord)
|| (e.get_rightSite() != null && ... |
e2407507-dc62-42a0-acf1-1ba950fffbf6 | 8 | public XMLExpression parseObject(JSONObject jsonObject) {
Iterator iter = jsonObject.entrySet().iterator();
XMLObjet object = new XMLObjet();
XMLPaire p = null;
Map.Entry entry = null;
while (iter.hasNext()) {
entry = (Entry) iter.next();
p = new XMLPaire();
p.setNom(String.valueOf(entry.getK... |
1e9f0b5f-70e8-46f4-a1bd-f472841b9c09 | 0 | public void clear()
{
type=-1;
} |
250083c6-0294-4ea0-b65e-32d944e02ff4 | 7 | private static int parseNumber(String str) {
try {
return Integer.parseInt(str);
} catch (NumberFormatException e) {
if (str.matches("one")) {
return 1;
} else if (str.matches("two")) {
return 2;
} else if (str.matches("three")) {
return 3;
} else if (str.matches("four")) {
return 4;
... |
2b12d9e8-62db-40d0-ae65-e848651a783f | 0 | public void turnOn() {
System.out.println("灯开了!");
} |
16584fe0-10f3-4225-a44c-d33a8349544a | 9 | private String isValide() {
String errormessage = "";
if (_dialog.getFirstName().equals("")) {
errormessage += "Vorname \n";
}
if (_dialog.getLastName().equals("")) {
errormessage += "Nachname \n";
}
if (_dialog.getGender() == null) {
e... |
60dcf8c2-0f7c-40c2-a0cf-16960db0fbfc | 6 | private int quicksort(int low, int high) {
int i = low, j = high;
int pivot = numbers[low + (high - low) / 2];
while (i <= j) {
while (numbers[i] < pivot) {
i++;
}
while (numbers[j] > pivot) {
j--;
}
if (i <= j) {
exchange(i, j);
i++;
j--;
}
}
if (low < j)
quicksor... |
a04a9e10-766b-42e3-bfa2-ca96de5fef0c | 8 | public String getFieldName(Integer field) {
switch (field) {
case 1:
return channel.field1;
case 2:
return channel.field2;
case 3:
return channel.field3;
case 4:
return channel.field4;
cas... |
783a107a-862f-44ce-8c0b-c455585c8928 | 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... |
725178f7-db43-43b8-b479-1282e91028f3 | 5 | public GameLoader(String fileName){
try {
m_fXmlFile = new File(fileName);
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
m_doc = dBuilder.parse(m_fXmlFile);
m_doc.getDocumentElement().normalize();
m_game =... |
c26f9208-ea30-4e5e-a031-c82bf29da1d2 | 6 | private void gameNameChanged() {
if (client.getCommunicator() != null) {
popUpWindow dialog = new popUpWindow(this, "Wollen Sie sich wirklich vom Server abmelden ?");
if (dialog.getResult()) {
client.disconnect();
}
}
if (client.getCommunicator() == null) {
isGameLoaded = (... |
2e7d019a-a372-466c-8263-ef8eedaa6d9b | 6 | private static final int method2912
(int i, int i_106_, byte[] is, int[] is_107_, int i_108_, int i_109_,
int i_110_, int i_111_, int i_112_, int i_113_, int i_114_,
Class348_Sub16_Sub5 class348_sub16_sub5, int i_115_, int i_116_) {
class348_sub16_sub5.anInt8970
-= class348_sub16_sub5.anInt8971 * i_109_;
cl... |
062b1d15-2bd2-4d83-8686-76844d383c17 | 4 | void radf3(int ido, int l1, final double cc[], double ch[],
final double wtable[], int offset)
{
final double taur=-0.5D;
final double taui=0.866025403784439D;
int i, k, ic;
double ci2, di2, di3, cr2, dr2, dr3, ti2, ti3, tr2, tr3;
int i... |
524a63b1-031a-4fd0-a1aa-c0dd0d6393e2 | 5 | @Override
public void paintComponent(Graphics graphics) {
graphics.setColor(new Color(48, 0, 48));
graphics.fillRect(0, 0, 640, 480);
graphics.setFont(descent.getFont());
Graphics2D graphics2D = (Graphics2D) graphics;
graphics2D.translate(-camera.getLocation().getX(), -camera... |
8ac34797-ed5b-4a0c-a3eb-d6cc1f4426bb | 3 | public static boolean isDelimitedString(Object object) {
if (! (object instanceof String))
return false;
String string = (String) object;
if (string.length() < 2)
return false;
if (! string.startsWith("\""))
return false;
return string.endsWith("\"");
} |
925bcbc9-f63f-4a23-95cd-d33df28de09f | 9 | private boolean reveal(int x, int y, int i, boolean top, boolean right, boolean bottom, boolean left, int iteration) {
if (iteration > width || iteration > height) {
return false;
}
if (inRange(x, y)) {
data[x][y] = VISIBLE;
if (i == 0 || obstacles[x][y]) {
return false;
}
... |
7b0fb249-6a33-4ceb-8dc9-0b091dcd71b2 | 7 | public Node firstAncestor_bad(Node r, Node n, Node m){
if(r == null) return null;
if(r == n || r == m) return r;
Node x = firstAncestor_bad(r.left,n,m);
Node y = firstAncestor_bad(r.right,n,m);
if(x == null && y == null)
return null;
else if(x == null)
return y;
else if(y == null)
return x;
els... |
35cb37e4-d875-4807-be66-f160094bb42e | 0 | public void setId(Long id) {
this.id = id;
} |
a1ad4755-b53a-434a-a503-e1c2b9ba1a67 | 4 | public static double[] getObs(ObjFunc of, Date start, Date end, CSTable tobs, String columnName, int timeStep, int startMonth,
boolean[] periodMask, boolean[] sdMask) {
double[] obsval;
// System.out.println("CacheValid = " + of.getCacheValid());
if (of.getCacheValid()) {
... |
9f0aceda-8edd-4050-a181-c57e91fe825d | 7 | @Override
public final V get(char[] searchArr, int startOffset) {
// there are existing children. binary search them to see if there are any with
// matching prefixes
int lower = 0;
int upper = children.length - 1;
char keyPrefixFirst = searchArr[startOffset];
while (lower <= upper) {
//... |
91de0775-b139-48c4-89e9-6edbe049fb7a | 0 | void back(int velocity) {
} |
ea0568b9-25c0-41f0-9990-2558dd3570b5 | 4 | public void invoerNieuwePersoon() {
Geslacht geslacht = null;
while (geslacht == null) {
String g = readString("wat is het geslacht (m/v)");
if (g.toLowerCase().charAt(0) == 'm') {
geslacht = Geslacht.MAN;
}
if (g.toLowerCase().charAt(0) ==... |
7b45451f-09bc-487e-8cbd-735ca7f28f9e | 4 | public void DDZ()
{
if(IsAttackingNPC && playerEquipment[playerWeapon] == 4214)
{
setAnimation(426);
setAnimation(426);
actionTimer = 4;
SpecDamgNPC(32);
DDS2Damg = true;
DDStimer = 1;
resetAnimation();
teleportToX = absX;
... |
7b8868ae-8b4c-4d4b-899f-ad8debe9be40 | 0 | public void move(int x1, int y1, int x2, int y2) {
hlight = board[x1][y1].toggleMoves(hlight, board);
board[x2][y2] = board[x1][y1];
board[x1][y1] = null;
board[x2][y2].update(x2, y2);
} |
96ed988d-8bcd-47ac-bcd2-14f835c6e136 | 5 | public boolean isPalindrome(int x) {
if (x < 0)
return false;
if (x >= 0 && x <= 9)
return true;
int y = 0;
int o = x;
while (x > 0) {
y = 10 * y + (x % 10);
if (y < 0) return false;// probably y > MAX_VALUE
x /= 10;
}
return o == y;
} |
0afbf773-a9a8-4a6a-8cd4-25ed635b01d8 | 2 | public void setValueAt(Object newData, int row, int column) {
((Object[])data.get(row))[column] = newData;
if (row + 1 == getRowCount()) {
data.add(initializeRow(row + 1));
fireTableRowsInserted(row + 1, row + 1);
}
if (row >= getRowCount()) {
data.add(initializeRow(row));
f... |
c5691716-22ef-426c-9d2a-7c46b31458a4 | 5 | public CoinChange(int totalAmount, Integer denomination[])
{
this.totalAmount = totalAmount;
coin = new int[totalAmount + 1];
this.n = new int[totalAmount + 1];
// Base case
n[0] = 0;
for (int i = 1; i <= totalAmount; i++)
n[i] = Integer.MAX_VALUE;
// Optimal substructure
for (int amount = 1; amou... |
05f2f2bc-9255-4e72-b4e3-998136f5c63f | 0 | @XmlTransient
public Collection<Prueba> getPruebaCollection() {
return pruebaCollection;
} |
7483cc5a-9ba3-4b06-8fda-153a1efe6674 | 4 | private void initialize() {
frame = new JFrame();
ownPanel = new NicePanel();
frame.setTitle("Per Seconde Wijzer");
frame.setContentPane(ownPanel);
// frame.getContentPane().setBackground(Color.BLACK);
frame.setBounds(100, 100, 1280, 720);
frame.setLocationRelativeTo(null);
frame.setDefaultCloseOperati... |
83cd784e-f8f1-40fb-b9eb-c8c72dc54a4b | 6 | public boolean chargeForSettlement() {
if (! resForSettlement()) return false;
for (int i = 0; i < BRICK_SETTLEMENT; i++) _hand.remove(Resource.Brick);
for (int i = 0; i < ORE_SETTLEMENT; i++) _hand.remove(Resource.Ore);
for (int i = 0; i < SHEEP_SETTLEMENT; i++) _hand.remove(Resource.Sheep);
for (int i = 0; ... |
94bd44ec-a204-4693-9b72-d6ba33b7bea6 | 4 | @Override
public boolean verify()
{
boolean answerCorrect = true;
boolean[] hl = new boolean[6];
String[] ans = answerPanel.getText();
String[] sol;
if(getPhrase().core.reverse)
sol = getPhrase().phrase1.split("#");
else
sol = getPhrase().phrase2.split("#");
for(int i = 0; i < 6; i ++)
{
... |
0a5d6dfe-4908-44a3-95bb-836705f8b226 | 7 | private static void set(int idx, Operation o) {
switch (idx) {
case 0:
VIOLET.setOperation(o);
break;
case 1:
INDIGO.setOperation(o);
break;
case 2:
BLUE.setOperation(o);
break;
... |
49f1350a-f2cf-4dcb-a75c-5adc2480c961 | 4 | @SuppressWarnings("static-access")
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerDamage (EntityDamageByEntityEvent event) {
Random rand = new Random();
int i = rand.nextInt(200);
int j = rand.nextInt(200);
int k = rand.nextInt(200);
int l = rand.nextInt... |
62b73231-024b-4e9a-8142-a0b6ac48b587 | 5 | private void sortPlayersScores(Player[] players, int[] playerScores) {
int minScore, minScoreIndex, tempScore;
Player tempPlayer;
for (int i = 0; i < players.length - 1 && i < playerScores.length - 1; i++) {
minScore = playerScores[i];
minScoreIndex = i;
for... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.