method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
1c1b8fcf-dd92-4071-93a1-32212a64d50d | 2 | public void obtenirFormes() {
final String serverAddress[] = JOptionPane.showInputDialog("Quel est le nom d'h�te et le port du serveur de formes?").split(":");
final Socket srvCnx;
final PrintWriter srvOutput;
final BufferedReader srvInput;
final String hostName = serverAddress[0];
final int portNumber... |
3d61a78e-4915-49d5-87ef-76a1076f04ea | 4 | final public CycObject existExactForm(boolean requireEOF) throws ParseException, java.io.IOException, UnsupportedVocabularyException {
CycVariable var = null;
CycObject sent = null;
CycList val = new CycList();
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case THEREEXISTEXACTLY_CONSTANT:
jj_consume_token... |
64cfa774-1925-4ba6-9b69-83008a914c77 | 1 | public static StockStorage getInstance() {
if (theOne == null) {
theOne = new StockStorage();
}
return theOne;
} |
08a93eff-3645-4bd4-92a4-3e59bfbcff2c | 3 | private synchronized void checkGridletCompletion()
{
ResGridlet obj = null;
int i = 0;
// NOTE: This one should stay as it is since gridletFinish()
// will modify the content of this list if a Gridlet has finished.
// Can't use iterator since it will cause an exception
... |
d8fe2cf3-c064-48b4-9078-738f7964ec7d | 3 | public static void main(String[] args) throws SQLException {
ShowAllEmployeesOOP command = new ShowAllEmployeesOOP();
Collection<ShowAllEmployeesBasicInfo> allEmployeesBasicInformation = command
.getAllEmployeesBasicInformation();
if (allEmployeesBasicInformation == null
|| allEmployeesBasicInformation.is... |
89ee13ee-3953-4203-9224-b698d0179cb4 | 2 | public static String getFilenameExtension(String path) {
if (path == null) {
return null;
}
int sepIndex = path.lastIndexOf(EXTENSION_SEPARATOR);
return (sepIndex != -1 ? path.substring(sepIndex + 1) : null);
} |
4142391b-e473-40fc-9ff1-68b389643f12 | 5 | public SampleResult runTest(JavaSamplerContext context) {
SampleResult sampleResult = new SampleResult();
sampleResult.sampleStart();
String key = String.valueOf(String.valueOf(new Random().nextInt(keyNumLength)).hashCode());
try {
if (methedType.equals("put")) {
put = new Put(Bytes.toBytes(key));
... |
1a80045a-135f-4fde-9145-44a41a5d58f3 | 1 | public Sprite create(Owner owner, Resource res, Message sdt) {
GaussianPlant spr = new GaussianPlant(owner, res);
spr.addnegative();
Random rnd = owner.mkrandoom();
for(int i = 0; i < num; i++) {
Coord c = neg.bc.add(rnd.nextInt(neg.bs.x), rnd.nextInt(neg.bs.y));
Tex s = strands[rnd.nextInt(stra... |
f978b686-b94d-407c-aa17-5f5ff1c6f004 | 8 | public static void main(String[] args)
{
URL url = null; // create url Object
InputStream is = null;
HttpURLConnection connection = null;
try
{
url = new URL("http://www.bankisrael.gov.il/currency.xml");
is = url.openConnection().getInputStream(); ... |
87f4bbf4-b8c6-4a5a-ac04-b547ecf8113f | 6 | private static void call(GameException exception) {
HandlerList handlers = exception.getHandlers();
RegisteredListener[] listeners = handlers.getRegisteredListeners();
for (RegisteredListener registration : listeners) {
if (!registration.getPlugin().isEnabled()) {
c... |
48cafc47-78f2-4a24-9ac2-e6dbaf374b0a | 9 | public final GalaxyXPreprocessorParser.assignment_operator_return assignment_operator() throws RecognitionException {
GalaxyXPreprocessorParser.assignment_operator_return retval = new GalaxyXPreprocessorParser.assignment_operator_return();
retval.start = input.LT(1);
int assignment_operator_Star... |
4e4c7392-9a48-4e62-a7bb-37f783be8dff | 7 | public void move(int xa, int ya) {
System.out.println("Size: " + level.getProjectiles().size());
if (xa != 0 && ya !=0) {
move(xa, 0);
move(0, ya);
return;
}
//right
if (xa > 0) dir =1;
//left
if (xa < 0) dir =3;
//down
if (ya > 0) dir =2;
//up
if (ya < 0) dir =0;
if (!collision(xa... |
316422b8-9080-4782-b0fc-7c3f2eefad6a | 4 | public void run() {
while(true){
System.out.println("input q to quit, input d to download");
String c = input.next();
c = c.toLowerCase();
switch(c){
case "d": download();break;
case "q": gracefulExit();break;
case "t": System.out.println("I like Scarves");break;
}
}
... |
b38378a7-d472-4fc0-83bd-20a073612001 | 3 | @Override
public void run()
{
try
{
while (!isInterrupted() && run)
{
final String message = getNextMessageFromQueue();
sendMessageToClient(message + "\n");
Log.d("ClientSender", "run()" + message);
}
}
catch (final Exception e)
{
// erreur silencieuse...
}
clientInfo.getClientRe... |
944012bc-ef0c-47de-bc03-9cdf5969c4c8 | 2 | public String loadGames(String profileId, String parameters) throws Exception {
String url = "http://steamcommunity.com/";
if (containsOnlyDigits(profileId))
url += "profiles/";
else
url += "id/";
url += profileId + "/" + parameters;
WebPage page = WebPage... |
2e1a46c9-55b6-4ced-8001-d55193cc9ce2 | 2 | public void preOrder() {
// 1 Konten selber, 2 Linker Knoten , 3 Rechter Knoten
print();
if (left != null) {
left.preOrder();
}
if (right != null) {
right.preOrder();
}
} |
9d780dfb-80ec-4266-9a3e-c781c256c741 | 4 | private int convertToDirection(String s)
{
if(s.equals("w")) {return Location.NORTH;}
if(s.equals("a")) {return Location.WEST;}
if(s.equals("s")) {return Location.SOUTH;}
if(s.equals("d")) {return Location.EAST;}
return -1;
} |
cb6abcac-6a9b-4348-9f4a-ca2093122129 | 3 | @Override
public void actionPerformed(ActionEvent e) {
suljeEdellinenKortti();
if (e.getSource().equals(kertaus)){
ui.kertausmaatti();
}else if (e.getSource().equals(ajastus)){
ui.ajastinmaatti();
} else if (e.getSource().equals(tilastot)){
ui.tila... |
6c9a9ecb-64cb-468e-b63c-1dfb4e3389e8 | 8 | public String value() {
String result = "";
// If a number card.
if (value >= 2 && value <= 10) {
result = Integer.toString(value);
}
// If a face card.
else if (value >= 11 && value <= 14) {
if (value == 11) {
result = "J";
} else if (value == 12) {
result = "Q";
} else if (value ... |
cc7ac099-4473-4ebf-a9a0-6d7805c1995e | 8 | protected void cleanup(JComponent c, boolean remove) {
if (!cleaned && remove && indices != null) {
source = (JList) c;
DefaultListModel model = (DefaultListModel) source.getModel();
//If we are moving items around in the same list, we
//need to adjust the indices accordingly, since those
//after the i... |
f96ef6ea-9efb-4d60-986d-9b951278836e | 4 | public boolean conflicts(String name, int usageType) {
if (usageType == AMBIGUOUSNAME || usageType == LOCALNAME)
return findLocal(name) != null;
if (usageType == AMBIGUOUSNAME || usageType == CLASSNAME)
return findAnonClass(name) != null;
return false;
} |
d8445fc6-bc31-48b2-8394-78557fc23f68 | 1 | protected static Element createElement(Document document, String tagname,
Map attributes, String text) {
// Create the new element.
Element element = document.createElement(tagname);
// Add the text element.
if (text != null)
element.appendChild(document.createTextNode(text));
return element;
} |
de7704c9-55da-4d9b-ad8f-5e2a8f872daf | 7 | public NXNode<?> resolvePath(String s) {
String[] e = (s.startsWith("/") ? s.substring(1) : s).split(Pattern.quote("/"));
NXNode<?> r = _baseNode;
for (String f : e) {
if (f.equals(".")) continue;
else if (f.equals("..")) r = _baseNode._parent;
else r = r.getC... |
23785cd2-9636-4ef8-a03a-9d31dad62ddd | 4 | private void buildTree(JsonNode root, JsonNode parent){
if(root.isArray()){
for(JsonNode n : root){
buildTree(n, parent);
}
return;
}
if(root.isContainerNode()){
String name = getNodeName(root);
String parentName = getNodeName(parent);
JsonNode value = root.findValue(name);
treeIns... |
5c2125cf-26d4-472d-8ae3-aad906b6e72a | 0 | private Set<Card> foursFullWithTwoJacksAndTwoKings() {
return convertToCardSet("KD,4S,4C,KS,JD,4H,JH");
} |
f98eb448-10fb-49a9-9ba4-abe2b20c15a7 | 5 | public void CreateAANakedTorsoAlternativeTexturesFemalesOld() throws Exception {
NumberFormat formatter = new DecimalFormat("000");
for (int bodies = 1; bodies < RBS_Main.amountBodyTypes; bodies++) {
String s_bodies = formatter.format(bodies);
for (ARMA sourceAA : SkyProcStarter.... |
fad6c7f4-2113-4d79-8925-4c12adfe43d2 | 1 | private void jTextFieldCmdCliQte8FocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTextFieldCmdCliQte8FocusLost
mondecimal = new DecimalFormat("#######.00");
if (!(jTextFieldCmdCliQte8.getText().equals(""))) {
int qte = Integer.parseInt(jTextFieldCmdCliQte8.getText().trim... |
c70cc998-1d98-494b-aa0a-92049d0aad75 | 5 | int alphaBetaMin(int alpha, int beta, int depthleft) {
if (depthleft == 0) {
return -eval(mPieces, oPieces);
}
for (Piece a : oPieces) {
Move[] possible = a.getMoves(board);
System.out.println("min, white : " + a.white + ", # nodes " + possible.len... |
ca0b9faf-01f4-4634-b34d-7648996407d6 | 7 | public SegmentTreeMinCntSegAdd(int[] array){
int n = array.length, i;
for(d=1; d<n; d<<=1);
t = new int[d<<1];
add = new int[d<<1];
cntMin = new int[d<<1];
for(i=d; i<n+d; ++i){ t[i] = array[i-d]; cntMin[i] = 1; }
for(i=n+d; i<d+d; ++i)... |
ac8a40ad-a84d-4a3b-bb75-43f62a542c64 | 9 | private static Term eval(Term term, HashMap<String, Term> env) throws ParseException {
if (Util.getOperators().contains(term.getPred())) {
Integer a = Integer.parseInt(eval(term.getArgs().get(0), env).getPred());
Integer b = Integer.parseInt(eval(term.getArgs().get(1), env).getPred());
... |
7666ec57-c491-4117-b816-a48f15763922 | 3 | @Override
public Integer doInPreparedStatement(PreparedStatement ps) throws SQLException {
// 执行PreparedStatement
int rows = ps.executeUpdate();
// 根据是否存在KeyHolder判断是否需要从PreparedStatement中提取生成的主键
if (generatedKeyHolder != null) {
List<Map<String, Object>> generatedKeys = generatedKeyHolder.getKeyList();
... |
d1b0ff27-77e4-4be4-a1d9-25acba0a61c2 | 3 | protected synchronized boolean reduceMemoryWithDelegates(boolean aggressively) {
int reductionPolicy = aggressively ? MemoryManagerDelegate.REDUCE_AGGRESSIVELY
: MemoryManagerDelegate.REDUCE_SOMEWHAT;
boolean anyReduced = false;
for (MemoryManagerDelegate mmd : delegates) {
... |
0bc9475e-cb8c-41c0-894e-fd4c559a3660 | 6 | public void run() {
try {
//Generate the image for the Fractal
f.generateImage();
//If we should perform filtering make sure the Fractal is not sparse
if (PERFORM_FILTERING) {
//Counts how many times the current Fractal has... |
409bb1e7-cf15-497e-adf5-713748cf89f0 | 2 | public String[] getTerminalsOnRHS() {
ProductionChecker pc = new ProductionChecker();
ArrayList list = new ArrayList();
for (int i = 0; i < myRHS.length(); i++) {
char c = myRHS.charAt(i);
if (ProductionChecker.isTerminal(c))
list.add(myRHS.substring(i, i + 1));
}
return (String[]) list.toArray(new ... |
523ea70d-cf6f-40e7-9502-294b9843920a | 5 | public void LineSwap() {
if (caret.row == sel.row) {
if (caret.row == 0) {
return;
}
UndoPatch up = new UndoPatch(caret.row - 1, caret.row);
StringBuilder swb = code.getsb(caret.row - 1);
code.get(caret.row - 1).sbuild = code.get(caret.row).sbuild;
code.get(caret.row).sbu... |
aa25a82e-843b-43f4-9b22-0d16eb581291 | 6 | @Test
public void testAstarGraph() throws IOException{
HashMap<String,String[]> fromTo = new HashMap<String,String[]>();
fromTo.put("results_wolfeb_178816527_178816525_1_astar.txt", new String[]{"178816527", "178816525"});
fromTo.put("results_wolfeb_330767681_178817851_1_astar.txt", new String[]{"330767681", "1... |
cfc3989a-1895-4b2f-be2b-f207257bf573 | 8 | private void updateObject(Object changedObject){
String table = changedObject.getClass().getSimpleName();
switch(table){
case "User":
User user = (User) changedObject;
dataStorage.users().updateUser(user);
break;
case "Group":
... |
0d87aa70-15c2-4d27-9d56-50c968bc0a51 | 8 | private boolean r_postlude() {
int among_var;
int v_1;
// repeat, line 70
replab0: while (true) {
v_1 = cursor;
lab1: do {
// (, line 70
// [, line 72
bra = cursor;
// substring, line 72
among_var = find_among(a_1, 3);
if (among_var == 0) {
break lab1;
}
// ], line 72
... |
30866e9b-8b07-4a12-a5ee-2c951c144061 | 8 | @Test
public void persistenceTest() throws Exception
{
PartitionedHashMap map = (PartitionedHashMap) getMapInstance( 16 );
long totalSize = 0;
int amount = 0;
for ( long i = -456; i < 1029; i++ )
{
amount++;
totalSize += Long.toString( i ).length()... |
a5debedc-3527-40fd-b102-949351c4b624 | 6 | public void add(){
OptionView temp=null;
SavedEntityState selected=null;
temp=((GrandView)getSuperview()).getOptions();
for(int i=0;i<getScrollables().size();i++)
if(getScrollables().get(i).getSelected())
selected=((SelectableLabel)getScrollables().get(i)).get... |
b187b10a-bf4b-4388-8b2f-2c5bb5bd99aa | 5 | private static void annotateSuperRegions(BotState state) {
for (SuperRegion superRegion : state.getVisibleMap().getSuperRegions()) {
boolean canSuperRegionBeTaken = canSuperRegionBeTaken(state, superRegion);
boolean canSuperRegionBeTakenByOpponent = canSuperRegionBeTakenByOpponent(state, superRegion);
boolea... |
fb39d9ea-ad08-40e0-8dca-aa4954f817c5 | 2 | @Override
public void execute() {
final SceneObject cutRoot = SceneEntities.getNearest(Settings.CUT_CURL_FILTER);
if(cutRoot != null) {
doAction("Collect", cutRoot);
} else {
final SceneObject uncutRoot = SceneEntities.getNearest(Constants.CURLY_ROOT_ID);
if(uncutRoot != null) {
doAction("Chop", unc... |
286233ba-e017-4e7c-9515-7d12e9004d21 | 9 | public void checkAssignmentCorrect()
{
boolean checkAssign = true;
for(Integer m: this.Assignment.keySet())
{
Integer t = this.Assignment.get(m);
for(Integer cm: this.getConnectedMeetings(m))
{
if(t == this.Assignment.get(cm))
{
checkAssign = false;
break;
}
}
}
if(checkAssi... |
02d0af8f-1b8d-4db9-ae0a-c57269a4a0f7 | 7 | private void jComboBox1ItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jComboBox1ItemStateChanged
//getting values from jCombo box
//if the value dosn't change use the default values from the global variables
int selection = jComboBox1.getSelectedIndex();
swit... |
bad9e8ab-53b1-4cf6-b1da-230333c265cc | 4 | @EventHandler(priority = EventPriority.LOW)
public void onBlockPlace(BlockPlaceEvent E)
{
Block B = E.getBlockPlaced();
if (B == null)
return;
//Alert the player when they create a printing press.
//If a base block is placed, check for the piston -
else if (B.getType() == M.conf.PressBlock)
{
Pis... |
9416af1d-3e8f-4c70-bbf6-78da538e8129 | 5 | private static boolean[] primeBoolArray(int limit) {
boolean[] nums = new boolean[limit];
for (int i = 2; i < nums.length; i++)
nums[i] = true;
int nextPrime = 2;
while (nextPrime < nums.length / 2) {
int i = nextPrime;
for (; i < nums.length; i += nextPrime)
nums[i] = false;
nums[nextPrime] = t... |
8ca9cbda-0293-46f5-b05b-d22cc23550e2 | 6 | private boolean isBinaryOp(String string)
{
if(string.equals("add") || string.equals("sub") || string.equals("mult") || string.equals("div") || string.equals("and") || string.equals("or"))
return true;
else
return false;
} |
b25c4b45-9781-4c9b-b75a-d83ab59f8aee | 8 | @Override
public void actionPerformed(ActionEvent e) {
DocUtils.buttonDoClick(e);
String txt = wordProcessor.area1.getText().replaceAll("\r\n", "\n");
String find = wordProcessor.findFld.getText();
if (find == null || find.isEmpty()) {
wordProcessor.findMsg.setText("Enter a term to find");
return;
... |
6e05fb0b-9217-4f95-a919-e60e58399c53 | 0 | ParticipantItf deserializeFromJson(String json) {
AutoBean<ParticipantItf> bean = AutoBeanCodex.decode(factory, ParticipantItf.class, json);
return bean.as();
} |
bff85bc6-0f33-46e5-b814-29447a831a22 | 6 | public void getList(int rep,String searchText)
{
String tempQuery = "";
if(rep == 0) {
tempQuery = DEFAULT_QUERY;
}
else if(rep == 1) {
searchText = searchText.toUpperCase();
tempQuery = "select * from (Select compid,compname,contactperson,contactn... |
45b1812c-1986-4c43-bf12-4bc488933b2b | 5 | public static void main(String[] args){
if("SrcODS-Upload".matches("(?i)src-reset|srcOds|srcOds-upload")){
Log.Print("Ok");
}
try {
Class gsos=Class.forName("com.luxe.tools.util.MyReflection");
Class type=Class.forName("java.lang.String");
Const... |
ffafbbb5-12bc-44ca-81f6-0938577c4016 | 5 | private boolean checkNumber(int number, int[] numberCounter) {
if (number == 2 || number == 12 || number == 7) { // Si le nombre aux des est 2, 12 ou 7 (<=> les nombres presents qu'une fois sur la carte). Remarque : le 7 a deja ete place et son compteur deja incremente via la methode placeDesert(), il est necessaire ... |
b1557a11-1100-48df-acc4-b17490d39d6f | 4 | public ArrayList<Block> getPredecessors() {
ArrayList<Block> predecessor = new ArrayList<Block>();
if (normalPre != null) {
predecessor.add(normalPre);
}
if (thenPre != null) {
predecessor.add(thenPre);
}
if (elsePre != null) {
predecessor.add(elsePre);
}
if (loopBack != null) {
predecessor.... |
17002ae9-9043-4c64-887f-ec1488377b7a | 6 | public Predicate parsePredicate(String input) throws ParseException {
Matcher matcher = predicatePattern.matcher(input);
if (!matcher.matches()) {
throw new ParseException(
"The given input '" + input + "' is not a valid predicate.");
}
List<Term> arguments =... |
2e4d18f7-84ae-4747-9ef8-b854e2ffc099 | 1 | public JPanel getUsertilePWFieldMenu() {
if (!isInitialized()) {
IllegalStateException e = new IllegalStateException("Call init first!");
throw e;
}
return this.usermenuPWFieldMenu;
} |
f324d9df-cc2e-43b0-a60c-21f1b10a9010 | 7 | public static void readHash(String type_map, HashMap<String, String> typeMap) {
ArrayList<String> types = new ArrayList<String>();
ArrayList<String> tokens = new ArrayList<String>();
if (type_map != null) {
FileUtil.readLines(type_map, types);
for (int i = 0; i < types.size(); i++) {
if (!types.get(i)... |
12e93951-f3e2-4b68-bf8c-5fa29d1aab2c | 9 | private static Hand isPair(Card[] allCards) {
Hand h = new Hand();
int cardsALike = 0;
ArrayList<Card> pair = new ArrayList<>();
boolean found = false;
for (int j = 0; j < allCards.length; j++) {
Card firstCard = allCards[j];
if (!found) {
... |
9473eb62-ddef-4634-818c-15e4e9aa3607 | 8 | public void updateStat(){
int value = 0;
Iterator<Village> it = list.iterator();
List<Village> temp = new ArrayList<Village>();
Village v;
while(it.hasNext()){
v = it.next();
value += v.getPopulation();
v.updateHealth();
v.updateBaby();
if(v.getPopulation() == 0){
temp.add(v);
}
... |
20d2246e-8cb1-4c12-ae7b-5993853a3c37 | 3 | @Override
public void caseAEstrCaso(AEstrCaso node)
{
inAEstrCaso(node);
{
List<PComando> copy = new ArrayList<PComando>(node.getComando());
Collections.reverse(copy);
for(PComando e : copy)
{
e.apply(this);
}
}
... |
1c173b2e-cb98-429c-b5b9-d6e73c233f02 | 1 | public long getReminderAhead(long uid) throws SQLException {
Reminder reminder = Reminder.findByApptAndUser(this.getId(), uid);
return reminder == null ? 0 : reminder.reminderAhead;
} |
31d22ad0-e41b-4bb2-a6fb-0cfcf832b99f | 1 | @Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
int hScroll = mHSB.getValue();
if (mHeaderBounds.height > 0) {
Graphics2D gc = (Graphics2D) g.create();
try {
gc.clipRect(mHeaderBounds.x, mHeaderBounds.y, mHeaderBounds.width, mHeaderBounds.height);
gc.translate(mHeader... |
3949ed0f-adb7-42bc-b7fc-a26812db7ae2 | 6 | public static Schematic loadSchematic(File file) throws IOException {
FileInputStream stream = new FileInputStream(file);
@SuppressWarnings("resource")
NBTInputStream nbtStream = new NBTInputStream(stream);
CompoundTag schematicTag = (CompoundTag) nbtStream.readTag();
if (!schematicTag.getName().equals("Schem... |
86e5c703-fed8-441f-8559-5cc593d38096 | 6 | public void getCollidingBoundingBoxes(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, ArrayList par6ArrayList)
{
int var7 = par1World.getBlockMetadata(par2, par3, par4);
switch (getDirectionMeta(var7))
{
case 0:
this.setBlockBounds... |
b8ca883d-6161-4aef-b68a-9507773aeafa | 1 | public static String getAbstractSynCat(String synCat) throws Exception {
if (!abstractSynCat.containsKey(synCat))
throw new Exception("synCat " + synCat + " is unknown");
return abstractSynCat.get(synCat);
} |
ee81398e-b636-49ce-8708-701f6c4b4d6a | 0 | public void setUseDocumentSettings(boolean useDocumentSettings) {this.useDocumentSettings = useDocumentSettings;} |
f9eefc7d-f5c4-405b-9a6b-e3e7cc5171db | 5 | public String getContent(String urlString) throws MalformedURLException {
URL url = createURL(urlString);
URLConnection connection = createConnection(url);
if(connection == null) return "";
String content = "";
BufferedReader reader;
try {
reader = new Buf... |
56a3f8ce-d868-4567-a510-0d153c436eff | 3 | protected void openFiles(String indexDirectory_p) throws Exception{
// RandomAccessFile offsetFile=null;
// RandomAccessFile databaseFile=null;
//With persistent buffers
File offset_f=new File(indexDirectory+"/offsets.dat");
File database_f=new File(indexDirectory+"/database.dat");... |
30495f7b-a1bd-40f3-908c-fd71616d8503 | 7 | private void merge(int left, int middle1, int middle2, int right)
{
int leftIndex= left;
int rightIndex = middle2;
int combIndex= left;
int[] combArray= new int[array.length];
// output two subarrays before merging
// System.out.println( "merge: " + subarray( left, middle1 ) );
// System.out.... |
f95de4f6-e76b-4f5d-9fc9-0fdf32360ac8 | 4 | public static void main(String[] args) throws Exception
{
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String sNumber1 = reader.readLine();
String sNumber2 = reader.readLine();
String sNumber3 = reader.readLine();
int n1 = Integer.parseInt(... |
4dea53b3-f577-4aec-9eb3-42bd1cb1f300 | 5 | public AnimationTimer(int from, int to) {
loopCoef = 0;
toX = to;
fromX = from;
movex = 0 + MARGIN;
// 目的拡大率を算出
double xs = (getWidth() - 2.0d * MARGIN) / massRange;
tmpMassStart = massStart + ((toX - MARGIN) / xs);
tmpMassRange = 10 * (fromX / (10 * xs));
if (tmpMassRange < MASS_RAN... |
9a39d12f-812b-4594-a534-6bfaa7ba469c | 0 | public static void main(String[] args) {
// メッセージダイアログ表示
JOptionPane.showMessageDialog(null, "ハロー!");
} |
f00a2c2f-7c61-4dd3-b0de-094f146cf949 | 4 | @Override
public void replace(DocumentFilter.FilterBypass fb, int offset, int length, String text, AttributeSet attrs) throws BadLocationException {
Document doc = fb.getDocument();
Element root = doc.getDefaultRootElement();
int count = root.getElementCount();
int index = root.getElementIndex(offset);
El... |
b2927e2e-48f6-416d-a2ec-7e688362c76b | 3 | public static int getPlayerIDFromName(String inName) throws WrongNameException{
int n = 0;
boolean success = false;
for(int i = 0; i < NumPlayers; i++){
if(Players[i].equals(inName)){
n = i+1;
success = true;
break;
}
}
if(!success) throw new WrongNameException();
return (n);
} |
a75d0c1d-bd11-4b40-850a-82dd68988f31 | 4 | public boolean isOptOut() {
synchronized (optOutLock) {
try {
// Reload the metrics file
configuration.load(getConfigFile());
} catch (IOException ex) {
if (debug) {
Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.g... |
0b97e2c2-2f79-4dd9-8239-09373d0c2697 | 8 | private static String initialise(Token currentToken,
int[][] expectedTokenSequences,
String[] tokenImage) {
String eol = System.getProperty("line.separator", "\n");
StringBuffer expected = new StringBuffer();
int maxSize = 0;
for (int i = 0; i < expe... |
b52c3ff1-cdee-4c10-85eb-50a397e2b2cc | 1 | public static void println(String string, int l) {
if (check(l)) {
toTerminal(string + "\n", l);
}
} |
1830d196-9306-4d48-9f18-f7e5e8ada8c5 | 7 | public static void drawMap()
{
for (int x=0;x<Square.xAmt();++x)
{
for (int y=0;y<Square.yAmt();++y)
{
if (Square.get(x,y).isFree())
{
int r=120-map.value[x][y]/10;
int b=map.value[x][y]/25;
... |
9321c24b-5a6e-4b14-acd9-acb6e4711e3a | 9 | public void start() {
ObjectName serverName = null;
HtmlAdaptorServer adaptor = null;
try {
serverName = new ObjectName("Http:name=HttpAdaptor");
adaptor = new HtmlAdaptorServer();
domain.registerMBean(adaptor, serverName);
} catch (MalformedObjectName... |
3b034883-a2b7-4db5-947c-b88d7f89af0c | 0 | public void setLocation(double latitude, double longitude) {
putMergeVar("mc_location", new Location(latitude, longitude));
} |
6ecf3498-0bfb-43f3-bd1a-b00c1b6cf202 | 4 | public PrimitiveOperator combineLeftNLeft(PrimitiveOperator other) {
boolean[] newTruthTable = new boolean[4];
// the other gate is on the left side - on the LSB
newTruthTable[0] = truthTable[((other.truthTable[0]) ? 1 : 0) | 0]; //00
newTruthTable[1] = truthTable[((other.truthTable[1]) ? 1 : 0) | 0]; ... |
5edbd0cd-47f4-4f19-9563-90861ae8a3b2 | 1 | public PlayerStatsSummaryListDto getStatsBySummonerId(Region region, long summonerId, Season season) { //only one data set per queue type
String addon = (season == Settings.CURRENT_SEASON) ? "?api_key=" : ("?season=" + season.toString() + "&api_key=");
String requestURL = Settings.API_BASE_URL + region.toString().t... |
72a3e10b-52ae-4446-a724-be7c8cd88247 | 6 | @EventHandler
public void ZombieWeakness(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getZombieConfig().getDouble("Zombie.Weakne... |
fd8c2919-ed45-4619-b852-4d4c341813f9 | 1 | public void setAutomaton(Automaton newAuto) {
if (newAuto == null) {
//System.out.println("Setting automaton null");
return;
}
automaton = newAuto;
this.invalidate();
} |
e162def7-e90a-4c7d-b4fd-fc1e17016661 | 3 | public void setUsers(User[] users) {
usersModel.clear();
Runnable adder = new Runnable () {
@Override
public void run () {
usersModel.add( usersQueue.poll() );
}
};
try {
for (User user : users) {
usersQueu... |
927e7eab-2980-4aae-8a3e-fa2626b3306c | 8 | public static File isCommandPathViable(String path, File extraBinDir) {
if (path != null) {
File file = new File(path);
if (file.isFile()) {
return file;
}
if (path.indexOf(File.separatorChar) == -1) {
if (extraBinDir != null) {
file = new File(extraBinDir, path);
if (file.isFile()) {
... |
ec7c891a-1dbe-46a7-b44a-365b444c903d | 3 | public static Method getMethod(Class<?> cl, String method) {
for (Method m : cl.getMethods()) if (m.getName().equals(method)) return m;
return null;
} |
ac39e546-79cc-444d-bf2c-bfd22da4ddce | 4 | public ChannelMenu(String host, String pass, String nick, String user, String real) throws IOException {
super(host);
main = new IRCMain(host, new int[] {1024, 2048, 6667, 6669} , pass, nick, user, real);
main.addIRCEventListener(internalList);
//main.addIRCEventListener(new IRCLocalListener());
setBounds(100... |
25d09cbb-db3f-48ef-81de-ece6936362b9 | 6 | @EventHandler(priority = EventPriority.NORMAL)
public void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
if (event.isCancelled())
return;
if (event.getEntity().getType() == EntityType.PLAYER) {
Player player = (Player) event.getEntity();
if (plugin.playerProtections.containsKey(player.getNam... |
67e87932-cae3-4990-81c8-33848f21664e | 9 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Tuple3 tuple3 = (Tuple3) o;
if (item != null ? !item.equals(tuple3.item) : tuple3.item != null) return false;
if (item2 != null ? !item2.equals... |
410ca3af-aea8-4827-9ab3-3044a34ff529 | 2 | @Before
public void setUp() {
TestHelper.signon(this);
MongoHelper.setDB("fote");
MongoHelper.getCollection("suggestions").drop();
for(Suggestion suggestion : suggestions) {
if (!MongoHelper.save(suggestion, "suggestions")) {
TestHelper.failed("sa... |
0a018dcf-598b-4f1c-a6c1-1aa8835ce455 | 2 | public Bag getDiscsWithGlide(int glide) {
LOGGER.log(Level.INFO, "Getting discs with glide " + glide);
Bag discBag = new Bag();
for (int i = 0; i < discs.size(); i++) {
if (discs.get(i).getGlide() == glide) {
discBag.addDisc(discs.get(i));
}
}
... |
4f486006-59d4-46ed-81f5-3f3d7aac6ebc | 9 | public int motorUse(String[] prices, String[] purchases) {
int running = 0;
// Convert input prices
int cols = prices.length;
mInventory = new Inventory(prices.length);
for (int i=0; i<cols; i++) {
String temp[] = prices[i].split(" ");
int shelves = temp.length;
mInventory.columns[i] = new Colu... |
67b96516-324a-427e-a125-3e9062eb790a | 9 | private static void testColorValueRange(int r, int g, int b, int a) {
boolean rangeError = false;
String badComponentString = "";
if (a < 0 || a > 255) {
rangeError = true;
badComponentString = badComponentString + " Alpha";
}
if (r < 0 || r > 255) {
rangeError = true;
badComponentString = badCom... |
57f7ff87-82d4-4830-a7d0-2aed92b42478 | 6 | public final int fetchBinaryUInt(int size) throws EParseError {
if ((size == 0) || (pos + size > length))
throw new EParseError("Out of range"); // TODO: special exception
int r = 0;
int b;
b = src[pos++];
r = (b & 0xFF);
if (size == 1) return r;
b ... |
faeeaea8-d3b5-43a4-85da-da7ed6907dfb | 7 | public boolean clickedSign(Player player, Sign state) {
for (Animation a : animations) {
if (player.equals(a.CurrentEditor)
&& state.getLine(0).endsWith("SUPERFRAME")) {
if (a.WaitingToAddFrame) {
a.WaitingToAddFrame = false;
state.setLine(0, ChatColor.DARK_AQUA + "SUPERFRAME");
state.setLi... |
c8201479-bbaf-4d85-9d1a-c5cc8d4f4d89 | 9 | private void updateStateTellOrigin(List<Keyword> keywords, List<String> terms) {
//Check if new Recipe was also passed as a keyword
if (keywords != null && !keywords.isEmpty()) {
for (Keyword kw : keywords) {
if (kw.getKeywordData().getType() == KeywordType.RECIPE) {
currRecipe = new Recipe((RecipeData)kw.ge... |
6b478895-84a8-43bd-bf75-49510d24dda1 | 1 | public void clear() {
for (int i = 0; i < size; i++) {
data[i] = null;
}
size = 0;
} |
10f6b5fa-2d5f-4a85-8be5-f754636e50a6 | 5 | public SoundUtil() {
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
try {
for (int i = 0; i < fileNames.length; i++) {
String name = fileNames[i];
URL url = classLoader.getResource("resources/" + name);
File audioFile = new File(url.toURI());
AudioInputStream audioStrea... |
0030c927-f421-4cbe-9a07-c2da30f6b890 | 0 | public int getStudentId() {
return studentId;
} |
9840c921-7384-4411-812f-ab55e32dc29a | 2 | public void keyPressed(KeyEvent e) {
if (e.getKeyCode() > 0 && e.getKeyCode() < 256) {
keys[e.getKeyCode()] = true;
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.