method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
d1dd3a97-3a7b-4d57-8ba8-635cf7b28166 | 8 | @Override
public ArrayList<Chromosome<T>> update()
{
if(chromoPool.size() % 4 != 0)
{
throw new RuntimeException("Gene pool size is not dividable by 4");
}
ArrayList<Chromosome<T>> newChromoList = new ArrayList<Chromosome<T>>();
double totalF... |
6c7f9772-10ac-4e8e-84f7-6e0a1d17a73b | 0 | @Override
public ArrayList<String> getGoToList() {
// TODO Auto-generated method stub
return null;
} |
8a7281b6-4227-4b9a-b7cb-3720c8fb4c9c | 8 | public static void main(String args[]) {
System.out.println("Enter the search term:");
// open up standard input
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
final Logger logger = Logger.getLogger(Executor.class.toString());
logger.info("In executor's main");
String tokenString... |
9bee67b8-69e5-4940-9201-51f0e5469f61 | 8 | public static void main(String[] args){
new Drawing();
ServerSocket listener = null;
try{
listener = new ServerSocket(9090);
Data.socket = true;
}catch(Exception e){
Data.socket = false;
}
System.out.println(listener);
try{
while(true){
Data.waiting = true;
Socket socket = n... |
b46f7239-763d-4594-afdf-da1994b11ec1 | 7 | public int realCheckContains(String string,
int offset,
String subString, String check)
{
int index=-1;
if ((string==null && subString==null)
|| (string!=null && (subString==null ||
(index=... |
f490fc62-e261-4360-84b8-b6615d81e4cf | 5 | public void transform() {
if ((Options.options & Options.OPTION_CONTRAFO) == 0
|| cons.length == 0)
return;
removeDefaultSuper();
removeInitializers();
checkJikesContinuation();
if (outerValues != null) {
/*
* Now tell all constructors the value of outerValues parameters and
* simplify the... |
315a8ad2-1072-4e71-919c-bff6bca15a73 | 7 | String table(String title, String cl, Class comp, List<Field> l) {
if (l.size() == 0) {
return "";
}
Collections.sort(l, new Comparator<Field>() {
@Override
public int compare(Field o1, Field o2) {
return o1.getNam... |
0ce3dabb-2a68-4ea5-8429-7f30a1551a85 | 8 | protected Map<String, String> getAndResponse(String urlString) {
Map<String, String> map = new HashMap<String, String>();
try {
URL url = new URL(urlString);
HttpURLConnection urlconn = (HttpURLConnection)url.openConnection();
urlconn.setRequestMethod("GET");
urlconn.setDoOutput(true);
urlconn.setIns... |
a2335cd4-8b46-41e5-a104-93e9fb7307de | 8 | @Override
public void initPanel() {
System.out.println("--- RateSongPopUpView.initPanel()");
final Dimension d = new Dimension(80, 20);
this.rateSongLabel.setSize(d);
this.validateButton.setSize(d);
this.validateButton.addActionListener(this.getController().new ValiderListe... |
952ce5e1-a41d-400b-a5c0-22c067aeac0e | 2 | private boolean writePlaneConstant(int src, byte[] tmp, int height) {
try {
for (int y = 0; y < height; y++)
{
tmp[y] = (byte)src;
}
dos.write(tmp);
return true;
}
catch (Exception e)
{
e.printStackTrace();
return false;
}
} |
32873317-947e-4468-a06f-eab28564a8c3 | 6 | public static void main(String args[]) {
for (UIManager.LookAndFeelInfo laf : UIManager
.getInstalledLookAndFeels()) {
if ("Nimbus".equals(laf.getName()))//option
try {
UIManager.setLookAndFeel(laf.getClassName());
} catch (ClassNot... |
649cc86a-6d1c-43da-9ff3-728ed9690cef | 1 | public MethodEditor editor() {
if(graphInUse) {
throw new IllegalStateException("Cannot use editor while a flow-graph is in use!");
}
editorInUse = true;
return editor;
} |
4b23ec2d-d6d2-4ac2-b3d2-6beb864afdc6 | 4 | @Override
public void actionPerformed(ActionEvent e) {
JButton buttonPressed = (JButton)(e.getSource());
if(buttonPressed == view.getButtonArray()[MAINMENU]){
//Main Menu
mainFrame.getLayeredPane().remove(view);
mainFrame.repaint();
launcher.reset();
}else if(buttonPressed == view.getButtonArray()... |
f9205f5e-5ec0-41d3-a25d-a5d3aa4ce5ec | 7 | public ArrayList< Move > playerTwoMove( Coordinate current )
{
ArrayList< Move > moves = new ArrayList< Move >( );
//gets player 2 normal moves
if( isPlayerTwo( current) )
{
//checks move to the top right of current checker
if( isEmpty( current.topRight( ) ) )
{
//adds the possible move to a lis... |
0e794304-4551-47a1-a103-a19b37809bf0 | 7 | public String stemString(String str) {
StringBuffer result = new StringBuffer();
int start = -1;
for (int j = 0; j < str.length(); j++) {
char c = str.charAt(j);
if (Character.isLetterOrDigit(c)) {
if (start == -1) {
start = j;
}
} else if (c == '\'') {
i... |
5d763ba6-fc77-4e45-ab52-8fc181bdfe37 | 3 | private static void addRandomWumpus(WorldMap w, Random r)
{
boolean valid = false;
while (!valid)
{
int x = rnd(r);
int y = rnd(r);
if (!(x == 1 && y == 1))
{
valid = true;
w.addWumpus(x, y);
}
... |
2cffc80b-265f-4014-ba3b-ec2297fa5904 | 0 | @Override
public void setGUITreeComponentID(String id) {this.id = id;} |
ed4506de-fd96-4043-96a5-f45c8443abcb | 1 | public ArrayList<Point> getBlocks(Point origin) {
ArrayList<Point> newPoints = new ArrayList<Point>();
for (Point p : points)
newPoints.add(new Point(p.x + origin.x, p.y + origin.y));
return newPoints;
} |
a44db22c-189e-4fce-b651-df714b5cd4b0 | 7 | public void notifyObserver(Object notificationData) {
if (notificationData instanceof ProcessorNotificationData) {
Object data = ((ProcessorNotificationData) notificationData).getData();
if (data instanceof IBitPattern) {
String instBits = ((IBitPattern) data).toBinaryStr... |
fbb8b8ff-881f-4137-b9a3-606884c7802e | 7 | public int operate(int reg1, int reg2, byte aluControl) {
int result;
/*The operation to run is decided.*/
switch(aluControl) {
case ALUCodes.ADD:
result = add(reg1, reg2);
break;
case ALUCodes.AND:
result = and(reg1, reg2)... |
b7b15f73-9911-47dc-a45f-903ddd8055f6 | 6 | private static Delivery bestOrigin(
Actor actor, Service goods[], Owner client,
Batch <Owner> origins, int sizeLimit, int tradeType
) {
Delivery picked = null ;
float bestRating = 0 ;
for (Owner origin : origins) {
Item order[] = Deliveries.configDelivery(
goods, origin, client, acto... |
6a6340c7-e272-401a-97a0-84328814b9dd | 6 | @Override
public boolean subscribeToDataOutputPort(String portName, LockPolicy lockPolicy, Observer observer, int periodMs) throws WrongPortTypeException{
final OrocosDataPort port = getPort(portName);
if(port.getPortType() == PortType.INPUT_PORT){
throw new WrongPortTypeException(port.getPortType());
}
if(... |
b76742e4-476f-4b92-8a6c-2390c2058ba4 | 1 | public void breakLine(SVGOMTextElement text) {
String textContent = text.getTextContent();
String[] contentParts = textContent.split("\\s+");
if (contentParts.length > 1) {
performBreaking(text, contentParts);
}
} |
b743b1ae-95a2-4f1c-b1b8-a4905885bfb9 | 4 | public static void main(String[] args) throws InterruptedException {
ExecutorService service = Executors.newFixedThreadPool(4);
List<WordLengthCallable> listThreads = new ArrayList<WordLengthCallable>(
Arrays.asList(
new WordLengthCallable(), new WordLengthCallabl... |
b3cc274b-fd26-4e51-8999-a530dd07c638 | 9 | @Override
public String format(LogRecord lr) {
char c;
switch(lr.getLevel().intValue()){
case 1000:
c = 'F'; // Indicates a fatal exception generally paired with
break; // actions to shut down the errored process.
case 900:
c = ... |
196aa7dc-6326-40d7-8f31-fc289df0bd25 | 9 | private float getFloat(byte[] b) {
float sample = 0.0f;
int ret = 0;
int length = b.length;
for (int i = 0; i < b.length; i++, length--) {
ret |= ((int) (b[i] & 0xFF) << ((((bigEndian) ? length : (i + 1)) * 8) - 8));
}
switch (bits) {
case 1:
... |
1a1f9c84-8b95-45d1-92b3-bdc0927081ce | 2 | private static double slowexp(final double x, final double result[]) {
final double xs[] = new double[2];
final double ys[] = new double[2];
final double facts[] = new double[2];
final double as[] = new double[2];
split(x, xs);
ys[0] = ys[1] = 0.0;
for (int i = 1... |
8484837c-5af1-40da-983f-b51dd1ef82e6 | 7 | protected Result create (int fid, String name, int perm, int mode, Credential cr) {
// get directory associated with fid.
Entry e = assoc.get (fid);
if (e == null || !(e instanceof Directory))
return new Result (Result.RC_NO_PARENT_DIRECTORY, e);
Directory dir = (Directory) e;
// allocate new entry
e =... |
5c69ff5c-b1e1-46c7-b252-26e9a425d922 | 1 | @Test
public void exceptionThrownIfCoreBudgetItemListIsNullWithinFormData() throws Exception {
when(budgetFormData.getCoreBudgetItemsList()).thenReturn(null);
try {
budget.buildBudget(budgetFormData);
fail("CoreBudgetItemList is null.");
} catch (Exception e) {
... |
48a84ee0-2a6b-4772-ae49-dba3de2c1847 | 1 | public void replyState(String content, long refresh) throws Exception
{
OutputStream out = connection.getOutputStream();
String head = "HTTP/1.0 200 OK\r\n";
if (refresh > 0) head += "Refresh: " + refresh + "; url=http://localhost:" + port + "/step\r\n";
head += "Content-Length: " + content.length() + "\... |
35998638-77e3-4e60-a0af-fcfbaef7f028 | 7 | @Override
public void run() {
script.status = "Sort tab";
// extra for tab0
// Categories then rest sorted alphabetically
for (int i = 0; i < mappingList.size(); i++) {
if (sorters == null) {
sorters = new ItemSorter[mappingList.size()];
}
final IBank.BankTab tab = BANK_TABS[i];
ItemSorter ... |
bbed00d2-2a86-461a-b4b8-ee1938fc8406 | 9 | private static final void addRestoreHitPointsTask() {
CoresManager.fastExecutor.schedule(new TimerTask() {
@Override
public void run() {
try {
for (Player player : getPlayers()) {
if (player == null || player.isDead()
|| !player.isRunning())
continue;
player.restoreHitPoints(... |
83cc3910-47f9-41ee-998c-5248f1a2f0f1 | 0 | public TableTransitionCreator(AutomatonPane parent) {
super(parent);
parent.addMouseListener(viewListener);
} |
c683dd08-07b4-4556-af1a-0408bbc95d77 | 7 | private final boolean isDisallowed(final OS os)
{
if(rules != null)
{
final String osName = os.getMinecraftName();
for(final DLRule rule : rules)
{
if(rule.os != null)
{
final String currentOs = rule.os.get("name");
if(rule.action.equals("disallow") && currentOs.equals(osName)... |
661be617-ad49-4957-a6f5-2298290b3dc0 | 9 | public void listerTaches(PrintWriter out, String [] choix){
try{
String ret = "";
Set cles = taches.keySet();
Iterator it = cles.iterator();
if(choix[1].equals("all")){
while (it.hasNext()){
Object cle = it.next();
Tache t = taches.get(cle);
ret+="Num: "+t.getNum()+" Description: "+t.ge... |
714f0e96-75ff-4c49-8965-d98edc85fccb | 5 | public boolean loadLMFeatures(String filename){
//If no lm features provided, we will use the same features as logistic model.
if (filename==null || filename.isEmpty()){
m_lmFeatureNameIndex = m_featureNameIndex;
m_lmFeatureNames = m_featureNames;
System.out.println("Language models share the same features... |
c4c6da4b-a23b-48e0-ad67-f49b398b2b1d | 7 | public void printRV(){
String kr = "";
for (int i=0; i<tPlateau.length ; i++){
switch (tPlateau[i]) {
case -1 : kr = ""; break;
case 0 : kr = "O"; break;
case 1 : kr = "R"; break;
case 2 : kr = "V"; break;
case 3 : kr = "N"; break;
}
if (i%9==0) System.out.println();
System.out.prin... |
14febbb1-2cdb-4b5d-ba49-1dc8aea213a5 | 9 | private void saveAndExit(){
ProfileFactory pf = ProfileFactory.getInstance();
if(editDirCheckBox.isSelected() &&
!dirTxt.getText().equals(profile.getSaveDir()))
{// Rename the profile's directory
// Sanatize the input
String dir = Utils.sanitizeD... |
bdbf1900-5e82-420c-8cad-5e7e505003f5 | 3 | private String findTagContent(String text, String startToken, String endToken,
int fromIndex) {
int startIndex = text.indexOf(startToken, fromIndex);
int endIndex = text.indexOf(endToken, startIndex);
if (startIndex>=0 && endIndex >0 && endIndex>startIndex)
return text.substring(star... |
e7664d1b-8cac-400d-8187-0477620863e2 | 2 | public void addEntity(Entity entity) {
if(this.entity.contains(entity)) {return;}
this.entity.add(entity);
frameIndex.add(0);
entity.setSprite(this);
entity.setImage(images[frameIndex.get(this.entity.size()-1)]);
//Start animation if this is the first entity
if(this.entity.size() == 1) {startAnimati... |
fc1be25a-0506-464b-9d97-6b1d406f16c9 | 4 | private static String toHex(byte[] data)
{
StringBuffer buf = new StringBuffer();
for (byte element: data)
{
int halfbyte = (element >>> 4) & 0x0F;
int two_halfs = 0;
do
{
if ((0 <= halfbyte) && (halfbyte <= 9))
{
buf.append((char) ('0' + halfbyte));
}
else
{
buf.append(... |
a6a19fc9-ebc6-4f38-8d4c-1f82e8a754ea | 4 | public static <E extends Comparable<E>> int positionOf(E[] array, E element) {
if (array == null)
return -1;
int leftIndex = 0;
int rightIndex = array.length - 1;
int pivot;
while (leftIndex <= rightIndex) {
pivot = (rightIndex + leftIndex) / 2;
if (element.compareTo(array[pivot]) > 0)
... |
a2d991a2-e447-4e7d-a92b-a1b6028bc675 | 2 | @Override
public ArrayList<Object> show(int id) {
conn = new SQLconnect().getConnection();
ArrayList<Object> tns = new ArrayList<Object>();
try {
String sql = "select * from worlds where display = 'true'";
Statement st = (Statement) conn.createStatement(); // 创建用于执行静态sql语句的Statement对象
ResultSet rs ... |
00ef8fa6-6370-4fbb-b223-2621e5172eae | 4 | private void readFile(File diffMapperFile) {
try {
BufferedReader reader = new BufferedReader(new FileReader(diffMapperFile));
String[] title = reader.readLine().split("\t");
String line;
while((line = reader.readLine()) != null) {
String[] value = line.split("\t");
for(int i = 0; i < title.le... |
cd894077-e5d9-467d-931c-400e5f5e0d88 | 0 | public void takeSeat() {
seat--;
} |
10e53731-2a4d-4ecd-a8ef-5c6d4feb8212 | 8 | public void generateWoodTexture(Texture tex) {
float noise;
float grainNoise;
float sample_x;
float sample_y;
float freq;
float amp;
float majorFrequency = 1.0f;
int majorOctaves = 1;
float majorPersistence = 0.5f;
float majorBands = 32.0f; // "Density" of major wood bands (i.e. frequency of disc... |
8e794f22-91b9-4011-bf97-c4678a167255 | 4 | public void getRandomList(){
this.pl.ChosenConfiguration = null;
int rnd = 0 + (int)(Math.random() * 101.0D);
List<String> lists = this.pl.getConfig().getStringList("activated-configurations");
boolean chosen = false;
for (String name : lists) {
String chance = this.pl.getConfig().getString("configurations... |
5f05655d-4277-4c7b-89f8-c70ee5458b89 | 4 | public BattleWindow(ArrayList<SimulatorRobot> r, String theme) {
setSize(1000, 628);
setLocationRelativeTo(null);
setLayout(new BorderLayout());
switch(theme){
case "Desert": ii = new ImageIcon(this.getClass().getResource("/resources/images/sc... |
bf6173a6-eaa8-4f26-bf9f-925bbc323468 | 7 | public Object nextContent() throws JSONException {
char c;
StringBuffer sb;
do {
c = next();
} while (Character.isWhitespace(c));
if (c == 0) {
return null;
}
if (c == '<') {
return XML.LT;
}
sb = new Str... |
acb7aa97-a825-4f46-a7ef-7b1ba0a243b7 | 9 | protected BufferedImage filterPixelsNN( BufferedImage dst, int width,
int height, int[] inPixels, Rectangle transformedSpace )
{
int srcWidth = width;
int srcHeight = height;
int outWidth = transformedSpace.width;
int outHeight = transformedSpace.height;
int outX... |
f948744b-8bc2-48a3-b098-2ef424c214a8 | 3 | @Override
public Logger getLogger(String name) {
if (name == null) {
throw new NullPointerException();
}
// the root logger is called "" in JUL
if (Logger.ROOT_LOGGER_NAME.equalsIgnoreCase(name)) {
name = "";
}
Logger logger = loggers.get(name);
if (logger == null) {
lo... |
62f49c63-b985-4464-b3f7-24bd49e30da8 | 6 | @Override
public Class<?> getColumnClass(int columnIndex) {
switch (columnIndex) {
case 0:
return Integer.class;
case 1:
return Integer.class;
case 2:
return Integer.class;
case 3:
return Integer... |
1ef71162-b148-47a6-8e60-4d36cea53912 | 2 | public static int shiftCounter(int original) {
int hold = original;
int shifts = 0;
for(shifts = 0 ; shifts < original ; shifts++ ) {
hold /= 2;
if(hold <= 1) {
shifts++;
return shifts;
}
}
return -1; //Error
} |
b58a4618-a7b4-47d3-b416-5ba4de280bde | 5 | public void rebind(){
try{
//Check if session0 is live, else reconnect
if(session0 == null){
session0 = clientBootstrap.bind(config0, sessionHandler);
}else if(!session0.isBound() && !session0.isBinding() && !session0.isOpen()){
session0 = clientBootstrap.bind(config0, s... |
7f4c4ebd-b3ab-46a5-9cf2-4920102d0eab | 6 | public ListNode addTwoNumbers(ListNode l1, ListNode l2) {
int overflow = 0;
ListNode cur = new ListNode(0);
ListNode head = cur;
while (l1 != null || l2 != null || overflow != 0) {
int sum = overflow;
if (l1 != null) {
sum += l1.val;
... |
450ed6d0-d65f-46f7-b142-78759acd34c0 | 0 | @Override
public void setCur(String value) {this.cur = parseColor(value);} |
4cc6cb17-dee3-48ad-8488-8cf48c424b84 | 7 | public boolean cast (Sorcerer sorcerer, Trigger trigger, Event event)
{
((PlayerInteractEvent) event).setCancelled(true);
boolean changedBlocks = false;
Location loc = sorcerer.getPlayer().getLocation();
int xMax = loc.getBlockX() + 2;
int zMax = loc.getBlockZ() + 2;
... |
54926963-6221-42ad-a877-5a19dc036ff0 | 3 | @Override
public void run() {
long diff;
while (monitor.isAlive()) {
while ((diff = waitTime - System.currentTimeMillis()) > 0) {
try {
Thread.sleep(diff);
} catch (InterruptedException e) {
throw new RTInterrupted(... |
0e0571ab-91d5-4c31-8cc5-ed439ad89c30 | 2 | public static Partie deserialiserPartie(String url)
{
Partie p = null;
try
{
ObjectInputStream ois = new ObjectInputStream(new FileInputStream(url));
p = (Partie)ois.readObject();
ois.close();
}
catch (IOException e)
{
System.out.println("Erreur lors de la lecture du fichier");
}
catch (... |
9cc35bd3-1240-4347-8d22-f511d64ff534 | 9 | public void scrollCellToView(JTable table, int rowIndex, int vColIndex) {
if (!(table.getParent() instanceof JViewport)) {
return;
}
JViewport viewport = (JViewport) table.getParent();
Rectangle rect = table.getCellRect(rowIndex, vColIndex, true);
Rectangle viewRect =... |
ba0ebfbf-2489-4874-b325-4564d739cfc3 | 3 | private void loadExampleDicts() {
File dir = new File(exdir);
optionsDicts.addItem("None");
for (File file : dir.listFiles()) {
if (!file.isDirectory()) {
String name = file.getName();
if (name.endsWith(".bnd")) {
optionsDicts.addItem(name.substring(0, name.length()));
... |
d079587b-44e8-494d-b69a-b6166c42c047 | 3 | @Override
public void actionPerformed(ActionEvent e) {
if (e.getSource() == paramBtn) {
ParameterManager pm = new ParameterManager(params);
pm.setVisible(true);
params = pm.getParams();
} else if (e.getSource() == cancelBtn) {
tools.setFormula(formula);
ok = false;
setVisible(false);
} else if ... |
f0305b32-1762-4ef8-a926-21bf6469b4c3 | 8 | public void showBookingDetails(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
try {
DbClasses.BookingDetails bd = (BookingDetails) request.get... |
37695aca-2a4f-4562-9c44-7cd7c93c3ca4 | 8 | private void downloadAndInstallResource(URL par1URL, String par2Str, long par3, int par5)
{
try
{
int var6 = par2Str.indexOf("/");
String var7 = par2Str.substring(0, var6);
if (!var7.equals("sound") && !var7.equals("newsound"))
{
if (p... |
fc08d6cb-d5cc-4937-bc72-89ba9ad8eded | 5 | @Override
public void recvLinkInfo(LinkInfo ls) {
if(ScienceTool._SCIENCE)
{
window = (int)ScienceTool.getParameter("window");
alpha = (int)ScienceTool.getParameter("alpha");
}
data.addLast(ls.power);
if(data.size() >= window... |
29cebd55-a507-42e5-9b54-35eb96a82521 | 0 | public void setjComboBoxChercher(JComboBox jComboBoxChercher) {
this.jComboBoxChercher = jComboBoxChercher;
} |
068763ac-cb5b-410c-a851-6bad2db98945 | 3 | public static void main(String[] args){
Server server = null;
String filePath = null;
int port;
if(args.length == 0){
System.err.println("No queue file specified");
usage();
System.exit(-1);
}
if(args.length == 1){
filePat... |
69438ae6-d160-426a-a9e9-e405b9fe892d | 1 | private int[][] history(int[] bowl, int bowlId, int round){
for (int i=0 ; i<bowl.length ; i++){
fruitHistory[round*n_players + bowlId][i] = bowl[i];
}
return fruitHistory;
} |
17743709-8cac-4591-bf5f-b83f640c894d | 3 | private void clickedChangeType()
{
if (cmbType.getSelectedItem().equals("simple"))
type = Phrase.Type.simple;
else if(cmbType.getSelectedItem().equals("conjugation"))
type = Phrase.Type.conjugation;
else if (cmbType.getSelectedItem().equals("number"))
type = Phrase.Type.number;
updateLayout();
} |
cb226b8e-3827-447f-9011-f60bc18fdee3 | 7 | public HashMap<String, HashMap<String, Double>> callTest(){
HashMap<String, HashMap<String, Double>> rt = new HashMap<String, HashMap<String, Double>>();
HypermodulesHeuristicAlgorithm ha = new HypermodulesHeuristicAlgorithm(this.stat, this.foregroundvariable, this.sampleValues, this.clinicalValues, this.network);
... |
0222e0fa-0d30-4999-9707-3e9643f1905c | 6 | public Vector getCloakingOffset(BlockFace facing)
{
Vector miningOffset = new Vector(0, 0, 0);
//Determines the Z or X offset
if (getProperties().getWidth() > 1)
{
if (facing.equals(BlockFace.NORTH))
{
miningOffset.setX(-(double)getProperties().getWidth() / 2);
}
else if (facing.equals(Bloc... |
f76dfdea-a65e-4cc0-8032-5b87e3a04fc5 | 4 | protected void onLoad(ConfigurationSection cs) throws Exception {
for (Field field : getClass().getDeclaredFields()) {
String path = field.getName().replaceAll("_", ".");
if (field.getAnnotation(Path.class) != null) {
path = field.getAnnotation(Path.class).value();
... |
a25d1dd3-dd55-4ca4-92cb-5e2e5036677a | 7 | public void bstTree(Node root,int k,int n){
int i;
if(d==0){
root.key=k;
d=1;
return;
}
Node x=root;
for(i=1; i<n; i++)
{
x=root;
for(int j=1; j<=i; j++)
{
if(k<x.key)
{
if(x.lc==null)
... |
72da1c6d-5cab-4d28-a918-f7c52c29889e | 8 | public static String readTimeInput() {
boolean tryAgain;
do {
tryAgain = false;
timeInput = scan.nextLine();
for(String time: timeInput.split(" ")) {
if(!time.contains(":")){
System.out.print("Input is in wrong format! Try again: ");
tryAgain = true;
break;
}
String[] t... |
3a69a075-314e-4277-a0ea-7f8d40a413c8 | 0 | @Override
public void addExtension(String ext, boolean isDefault) {
extensions.put(ext, new Boolean(isDefault));
} |
d0eed98a-384b-43b8-a81a-e582fa427547 | 4 | public void checkDisconnections(){
for (PlayerPawn v : playerPawns){
}
//Iterator used for removing players from the game when they're dead/disconnected.
//Using an interator because otherwise shifting indexes will cause issues
synchronized (playerPawns){
... |
71f9c9e7-dc15-43b1-92d2-088b833409d7 | 1 | public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
AnnotationVisitor av = fv.visitAnnotation(remapper.mapDesc(desc), visible);
return av == null ? null : new RemappingAnnotationAdapter(av, remapper);
} |
f8d6a9f8-2040-41d9-974f-339f5797db1f | 4 | public boolean autoCheckSibMessage(String xml,String id[],String ref[])
{ Hashtable hashtable = SibXMLMessageParser(xml,id);
if(hashtable==null)return false;
if(hashtable.size() < id.length) return false;
for(int i=0; i<hashtable.size();i++)
if(!ref[i].equals( (String)hashtable.get(id[i]) )) return false;
re... |
72fa0e6f-e8dc-4aa8-b322-c98a6e320107 | 5 | public boolean cinGood(String str) {
char []string = str.toCharArray();
if (str.length()==2) {
if (string[0] >= FIRST_TOP_COORD && string[0] <= FIRST_TOP_COORD+SIZE_OF_MATRIX/2-TOP_AND_LEFT_BORDER_SIZE) {
if (string[1] >= FIRST_LEFT_COORD && string[1] <= FIRST_LEFT_COORD+... |
83233238-fa0b-4288-8674-08d30b7bc4b8 | 4 | @Test
public void testHeightLimits() {
Metabolism m = new Metabolism();
try {
m.setHeight(0.);
fail("An IncoherentHeightException should have been thrown.");
} catch(IncoherentHeightException e) {}
try {
m.setHeight(-1.);
fail("An IncoherentHeightException should have been thrown.");
} catch(Inco... |
31acfb39-73b0-4a7c-8f8d-a105f189c3d9 | 5 | @Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
Item item = (Item) o;
return id == item.id && !(text != null ? !text.equals(item.text) : item.text ... |
aae449fc-e6f5-4fc7-8c40-d01cea9ed22c | 7 | private Node getNode(String key) {
// если корня нет - вставить в корень
if (root == null) {
return null;
} else {
Node currentNode = root;
while (true) {
int compare = key.compareTo(currentNode.getKey());
// если совпадает
if (compare == 0) {
return curre... |
2166f790-903d-45e4-813a-e7f56a3907a0 | 9 | private static void placeRock(Cell[][] cells, Position origin){
ArrayList<Position> rock = new ArrayList<>();
// Select rock shape at random
int rockType = (int)(7*Math.random());
if (rockType == 0){
rock.addAll(Arrays.asList(new Position(6, 4), new Position(7, 4),
new Position(8, 4), new Position(9, 4... |
9a315697-f539-451a-8a80-e413258d3f9c | 2 | public static void initStepWise(int x, int y, long seed)
{
GRID_WIDTH = x;
GRID_HEIGHT = y;
stack = new ArrayList<Cell>();
remainingCells = new ArrayList<Cell>();
visitedCells = new ArrayList<Cell>();
// Init array of cells
maze = new Cell[x][y];
// Reset maze and add cells to remainingcell list
f... |
767c63b1-bebe-4c99-baa4-9c9d3d71d812 | 4 | public FramerateDemo() {
MinuetoFont fontArial16; // Font used to write framerate.
MinuetoImage imageFramerate; // Text use to display framerate.
MinuetoColor color[] = new MinuetoColor[5]; // Array of color
MinuetoImage imageSquare[] = new MinuetoImage[20];
int aCoordX[] = new int[20];
int... |
1307200c-d505-49aa-973e-5a46185110b5 | 1 | public void setTotal(long total) {
this.total = total;
if (this.job != null) this.job.updateProgress();
} |
d514ba7a-4f4b-4e7a-a8f4-ead7a8abeabf | 7 | public void mouseExited(MouseEvent e) {
if (scrollableTabLayoutEnabled()) {
MouseListener[] ml = tabPane.getMouseListeners();
for (int i = 0; i < ml.length; i++) {
ml[i].mouseExited(e);
}
}
rolloverIndex = -1;
... |
833804b8-1494-478e-80ce-2aaaa621fed4 | 6 | public static List<List<Integer>> permute(int[] num) {
List<List<Integer>> res = new ArrayList<List<Integer>>();
if (0 == num.length) return res;
if (1 == num.length) {
List<Integer> t = new ArrayList<Integer>();
t.add(num[0]);
res.add(t);
return res;
... |
de6e2cb2-95dd-47ff-b61b-ffe9507e34c9 | 4 | public boolean equals(Object o) {
if (node == null || o == null || !(o instanceof Node))
return false;
Node n = (Node) o;
return node == n.getNode() || node.equals(n.getNode());
} |
cf471ac7-f293-4b28-b5ae-add7d3e9fcb5 | 9 | final public ModuleImport ModuleImport(Recovery next) throws ParseException {
NodeList symbol_list = new NodeList();
Identifier symbol;
Token comma_t;
Token from_t;
ModuleIdentifier module_id;
next.push(FROM_T);
next.push(COMMA_T);
try {
symbol = Symbol();
symbol_list... |
8fde258f-5242-4cba-84f9-8abd63b7012c | 0 | public int size()
{
return count;
} |
fa278565-1095-4b75-851b-da63dfbe6285 | 4 | public void addCarWaitTime(double time) {
if(time < 0) time = 0;
if(carStats.getSize() == 0) {
carWaitMin = time;
carWaitMax = time;
} else {
if(time < carWaitMin) carWaitMin = time;
if(time > carWaitMax) carWaitMax = time;
}
carStats.... |
64005db2-3360-488e-8c7a-c98883fe56de | 1 | public int getWidth(){
Window w = vc.getFullScreenWindow();
if(w != null){
return w.getWidth();
}else{
return 0;
}
} |
6fa95081-63df-4cca-9e38-dfa28b91b47b | 1 | public void addBlockInitializer(int index, StructuredBlock initializer) {
if (blockInitializers[index] == null)
blockInitializers[index] = initializer;
else
blockInitializers[index].appendBlock(initializer);
} |
aee1068d-739e-4ee5-b0e1-9cedb0ddf400 | 4 | public void recogniseCitation(Citation c) {
String type = c.getCitationType();
if (type.equals("Article")) {
makeArticleCitation((ArticleCitation) c);
} else if (type.equals("Book")) {
makeBookCitation((BookCitation) c);
} else if (type.equals("Inproceeding")) {
... |
813f8e44-1d5d-45fd-aba2-f0891fe2e44b | 3 | public Boolean lookupVerse(int sVerse, int eVerse) {
for (int i = sVerse; sVerse <= eVerse; i++) { //if any verse match return true
if (i >= startVerse && i <= endVerse) {
return true;
}
}
return false;
} |
694d9bde-e441-46b2-9c38-db712452efa3 | 2 | private void checkMinFreq() {
String minFreqInTFList= "";
int num = 0;
TreeMap<String, Integer> TFFreqTemp = new TreeMap<String, Integer>(TFFreq);
Iterator<Entry<String, Integer>> iter= TFFreqTemp.entrySet().iterator();
while(iter.hasNext()){
Entry<String, Integer> entry = iter.next();
String hash = e... |
b510709f-7d7a-405e-b513-da45ffb8c999 | 7 | public void testConstructor_int_int_int_Chronology() throws Throwable {
LocalDateTime test = new LocalDateTime(2005, 6, 9, 10, 20, 30, 40, GREGORIAN_PARIS);
assertEquals(GREGORIAN_UTC, test.getChronology());
assertEquals(2005, test.getYear());
assertEquals(6, test.getMonthOfYear());
... |
2a0ae63e-e01e-4878-8a34-19733eb01b39 | 1 | public void initializeBoardWithPlayers(){
// Associate AIs with players
for(AIConnection client: globalClients){
Tile spawn = world.getRandomSpawnpoint();
client.setSpawnpoint(spawn);
}
} |
e7444f1f-53d8-4b61-be98-2ba9970214b7 | 7 | @Override
public int getPlayerId(String player_name) {
PreparedStatement pst = null;
ResultSet rs = null;
try {
pst = conn.prepareStatement("SELECT player_id FROM ffa_leaderboards WHERE player_name=?");
pst.setString(1, player_name);
rs = pst.executeQuery();
while (rs.next()) {
if (rs.getInt("pla... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.