method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
b4ae69d3-eee1-4457-99e0-29d592769ffe | 7 | @Override
public RQ factor(DenseMatrix A) {
if (Q.numRows() != A.numRows())
throw new IllegalArgumentException("Q.numRows() != A.numRows()");
else if (Q.numColumns() != A.numColumns())
throw new IllegalArgumentException(
"Q.numColumns() != A.numColumns()"... |
87a001a1-9efa-4103-b34a-d2fb9ab1bd39 | 6 | public void dirSerach(){if(REC){AddToHistory(Path);}
((DefaultTreeModel)tree.getModel()).setRoot(null);
DefaultMutableTreeNode root=new DefaultMutableTreeNode("Root");
if(Path==""){File[] roots=File.listRoots();for(int i=0;i<roots.length;i++)
{DefaultMutableTreeNode temp=new DefaultMutableTreeNode(roots[i]);
temp.add(n... |
5069fa93-fd6c-42ba-b127-c325e737e6b4 | 3 | @Override
public void keyPressed(KeyEvent e) {
// Get the char typed
char typedChar = e.getKeyChar();
// If the typed char was between 1-9 (in terms of the char datatype)
if (typedChar > '0' && typedChar <= '9') {
// Calculate the integer value of the char, subtracting the char
// '1'. This will b... |
38bb59aa-bf5c-497f-8363-cb1a5e8f921e | 0 | public void setjTextFieldNom(JTextField jTextFieldNom) {
this.jTextFieldNom = jTextFieldNom;
} |
08853946-1ffe-4c02-9ae1-492fc87aac43 | 1 | private synchronized static void createInstance() {
if (instance == null) {
instance = new ActivityService();
}
} |
77a50496-b2db-41a2-8fcc-86b3fb5da905 | 4 | public int reverse(int x) {
int result = 0;
boolean flag = x < 0 ? true : false;
x = flag ? -x : x;
while(x != 0){
result = result*10 + x % 10;
x /=10;
}
return flag ? -result : result;
} |
48b1d1fb-0f3f-4176-b5df-b47d05784652 | 6 | @Override
public Component getListCellRendererComponent(JList<? extends SocketInformation> list, SocketInformation value, int index, boolean isSelected, boolean cellHasFocus) {
String status = (value.isClosed()) ? "fechada" : "aberta";
String text = value.getAddress() + "\n"
+ value.getPort() + "\n"
+ "Con... |
8cd42088-34b7-4f40-8c33-36d9481f8e52 | 5 | void resizeScrollBars() {
// Set the max and thumb for the image canvas scroll bars.
ScrollBar horizontal = imageCanvas.getHorizontalBar();
ScrollBar vertical = imageCanvas.getVerticalBar();
Rectangle canvasBounds = imageCanvas.getClientArea();
int width = Math.round(imageData.width * xscale);
if (width > c... |
508998ca-ce11-4cfe-9ce8-edf9e516ecc8 | 3 | private void insertScore(int week, User user, int score) {
PreparedStatement statement = null;
Connection connection = null;
try {
try {
connection = data.getConnection();
statement = connection.prepareStatement("INSERT INTO UserQuiz VALUES(?, ?, ?)");
... |
e2b13f5d-cb18-4385-acde-fc1e41202f2c | 3 | public static void main(String[] args) {
try {
Class.forName(driver);
con = DriverManager.getConnection(url, username, pwd);
String sql = "insert into pm_user(name,pwd,firstname,email) values('a','32','a','a@e.com')";
ps = con.prepareStatement(sql);
ps.exec... |
27eaca4e-8a6c-44f9-920b-d30881ab5ad3 | 9 | private String taskToStringWithoutSpecifiedLabels(Task task, ArrayList<String> unwantedLabels){
String labelsToString = "";
if (task.getLabels() != null) {
for (String s : task.getLabels()){
if (hasSameLabels(s ,unwantedLabels)){
continue;
}
labelsToString += " " + "#" + s;
}
}
String da... |
412f90d1-cd17-4664-8d76-73d9496414cf | 5 | protected void updateAsMobile() {
super.updateAsMobile() ;
if (pilot != null) updatePiloting() ;
else motion.updateTarget(motion.target()) ;
final Boardable step = motion.nextStep() ;
if (motion.checkPathingOkay() && step != null) {
float moveRate = baseMoveRate() ;
if (origin().pat... |
6485c65f-ac40-4c0f-84b1-4f006721a8fa | 9 | public boolean execute()
{
if (type == Type.AND && canExecute())
{
log.debug(this + " executes.");
// reset all conditions of the transition
for (TransitionCondition condition : conditions)
{
condition.reset(this);
}
... |
0e5a6a5f-acfe-413e-8c70-339cd1361aae | 4 | public static void main(String[] args){
SortedMap<String, Charset> charSets =
Charset.availableCharsets();
Iterator<String> it = charSets.keySet().iterator();
while(it.hasNext()){
String csName = it.next();
// print(csName);
Iterator aliases =
charSets.get(csName).aliases().iterator();
if(ali... |
63e09142-631c-4514-bc13-c9470d2a012e | 9 | public void setNodeHtml(NodeList nl,String html)
{
try
{
for(int i=0;i<nl.getLength();++i)
{
setNodeHtml(nl.item(i).getChildNodes(),html);
if(!(nl.item(i) instanceof org.w3c.dom.Element))
continue;
org.w3c.dom.Element el=(org.w3c.dom.Element)nl.item(i);
String elid=el.getAttribute("... |
f8fdff12-a976-49ef-b8c5-0b8d6aa08b0a | 1 | public void testConstructor_invalidObject_DateTimeZone() throws Throwable {
try {
new MutableDateTime(new Object(), PARIS);
fail();
} catch (IllegalArgumentException ex) {}
} |
baac869b-c13e-4ec5-9ab6-009176200e6c | 1 | public static int[] randArrayInt(int size, int a, int b)
{
int[] result = new int[size];
for(int i = 0; i < size; i++)
{
result[i] = randInt(a, b);
}
return result;
} |
899dca58-c2ad-4a3b-94bf-63a88d0c1c08 | 7 | @Override
public void executeMsg(Environmental affecting, CMMsg msg)
{
super.executeMsg(affecting,msg);
if((affecting instanceof MOB)&&(!canFreelyBehaveNormal(affecting)))
return;
if(disabled)
return;
if(((!(affecting instanceof MOB))||(!msg.amISource((MOB)affecting)))
&&(msg.sourceMinor()==CMMsg.TYP_... |
4593563b-49c3-4a35-9044-6fa484d63b06 | 0 | private void btnGuardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGuardarActionPerformed
Producto prodMod = new Producto(Integer.parseInt(idLabel.getText()),descripFt.getText(), refFt.getText(), Double.parseDouble(precioFt.getText()), Integer.parseInt(combFt.getText()));
Gesti... |
4e07687d-3415-454e-8166-a2081e82166b | 0 | @Override
protected int processSortInfo (byte[] sortInfo)
{
// TBD
//if (Outliner.DEBUG) { System.out.println("\tStan_Debug:\tPdbSPReaderWriter:processSortInfo"); }
return SUCCESS ;
} // end protected method processSortInfo; |
da91c80d-f619-411b-8573-d383ed622c3f | 8 | private void query(String query) {
Statement statement = null;
boolean done = false;
while(!done && open) {
if(!open) {
throw new ClosedException();
}
try {
statement = connection.createStatement();
... |
bb1e0e4f-d522-4f12-bb55-3f196951237a | 1 | protected LabelNode getLabelNode(final Label l) {
if (!(l.info instanceof LabelNode)) {
l.info = new LabelNode(l);
}
return (LabelNode) l.info;
} |
c091f3cc-4239-4504-9796-6a6bfa663627 | 9 | private void collectTypeHierarchy(Set<Class<?>> typeHierarchy, Class<?> type) {
if (type != null && !IGNORED_CLASSES.contains(type)) {
if (typeHierarchy.add(type)) {
Class<?> superclass = type.getSuperclass();
if (type.isArray()) {
superclass = primitiveTypeToWrapperMap.get(superclass);
}
... |
f8eace0e-67a7-4088-8896-07c8c358acd1 | 1 | protected void processKeybindEvent(KeybindEvent e) {
if(keybindListener != null) {
keybindListener.KeybindTouched(e);
}
} |
1d0dc6a0-9255-41e5-aaa5-7bb60772e229 | 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... |
891551d9-02fe-41f2-bc40-113ca796b90b | 4 | private void renderDeck(Graphics2D g) {
Stack<Card> deck = game.getDeck();
Card topCard = deck.size() == 0 ? null : deck.peek();
double x = X_BOARD_OFFSET;
double y = DECK_Y;
g.setColor(Color.white);
g.drawString(deck.size() + " cards in deck", (float) x, (float) y - 1)... |
fa41f55a-6034-400d-9e19-879982c04a26 | 3 | private boolean check()
{
boolean bool=true;
for(int i=0; i<this.copyPapan.length;i++)
{
for(int j =0; j< this.copyPapan.length; j++)
{
if(this.copyPapan[i][j].equals("C"))
{
bool=false;
}
... |
8c36a182-eb80-440f-a6e7-bd6ce08a7d3e | 3 | private static Long getMaxDiagonal1Product(int[][] data, int numbers) {
int max = Integer.MIN_VALUE;
for (int x = numbers - 1; x < DATA.length; x++) {
for (int y = 0; y + numbers <= DATA.length; y++) {
int sum = 1;
for (int offset = 0; offset < numbers; offset... |
9039c5da-85d2-4980-8471-412a7112f8bc | 0 | @Override
public String getDesc() {
return "Default";
} |
ce121504-11e1-490d-a6ff-896b5fcb7823 | 1 | public void testConstructor_RP_RP_PeriodType7() throws Throwable {
Partial dt1 = new Partial().with(DateTimeFieldType.year(), 2005).with(DateTimeFieldType.monthOfYear(), 12);
Partial dt2 = new Partial().with(DateTimeFieldType.year(), 2005).with(DateTimeFieldType.hourOfDay(), 14);
try {
... |
5b1f230e-26dc-4fbb-95fb-60c45f1e6c7e | 4 | public static ArrayList<Integer> preorderTraversalIterative(TreeNode root) {
ArrayList<Integer> preorder = new ArrayList<Integer>();
if(root == null) {
return preorder;
}
Stack<TreeNode> stack = new Stack<TreeNode>();
stack.push(root);
while(!stack.isEmpty()) {
TreeNode node = stack.pop();... |
74cb2866-561c-4db3-8754-7dbeb4d7857b | 4 | public static double[][] matrixMultiplication(double[][] m1, double[][] m2) {
int m1Rows = m1.length;
int m1Columns = m1[0].length;
int m2Rows = m2.length;
int m2Columns = m2[0].length;
double[][] res = new double[m1Rows][m2Columns];
if (m1Columns == m2Rows) {
for (int i = 0; i < m1Rows; i++) {
for (... |
b26655e6-7a36-47f1-a16d-3af8117d3b99 | 0 | @Test
public void test() {
String docs = "substring search application";
String pattern1 = "app";
String pattern2 = "apa";
RabinKarp rk1 = new RabinKarp(pattern1);
RabinKarp rk2 = new RabinKarp(pattern2);
assert(rk1.search(docs) == docs.indexOf(pattern1)); // success
assert(rk2.search(docs) == docs.l... |
dc9b1721-ab25-4b3f-9c6b-66ef684d44b0 | 9 | protected static BufferedImage toImage(Collection<Boolean> data) {
Iterator<Boolean> iterator = data.iterator();
int width = toInteger(getNextInteger(iterator));
int height = toInteger(getNextInteger(iterator));
if (width > 0 && height > 0) {
BufferedImage image;
... |
c73ba7d3-46a3-4ad5-b1d9-6193ac66897b | 8 | public boolean checkTree(Set<Node> featureList){
boolean check = true;
if (feature!= null && !featureList.contains(feature))
return false;
if (trueChild != null && trueChild.parent != this)
return false;
else if (trueChild != null)
check &= trueChild.c... |
eae2ec03-9943-49a3-bac2-63c7dc426f94 | 4 | public void saveVariable() {
var = nameField.getText() + ";";
if(rdbtnString.isSelected()) {
var += "S;" + textField_1.getText();
} else if(rdbtnInteger.isSelected()) {
var += "I;" + spinner.getValue();
} else if(rdbtnBoolean.isSelected()) {
var += "B;" + chckbxTrue.isSelected();
} else if(rdbtnFloat... |
f8803c31-ec70-4620-ad59-f102333aaacb | 7 | public void flatten(TreeNode root) {
TreeNode current = root;
while(current != null){
if(current.left != null){
TreeNode curLeft = current.left;
//find the last node for current left branch:
while(curLeft.right != null || curLeft.left != null){
if(curLeft.right == null && curLeft.left != null){
... |
0d415fec-d89d-4b7d-aafd-391c3322b8df | 4 | protected JComponent makeTextPanelEditCar(String text)
{
panelEdit = new JPanel(false);
panelEdit.setBackground(new Color(255, 255, 240));
panelEdit.setLayout(null);
{
JLabel lblMake = new JLabel("Make");
lblMake.setBounds(36, 30, 61, 16);
panelEdit.add(lblMake);
}
{
// createLblNickName(panelE... |
1b7749eb-8580-42cc-9a30-c37d8e3627e1 | 6 | public GamePanel(GUI gui, long period, int w, int h) {
this.gui = gui;
this.period = period;
pWidth = w;
pHeight = h;
setBackground(Color.white);
//TODO Investigate this weird hack "pWidth-2"
setPreferredSize(new Dimension(pWidth-2, pHeight));
setFocusable(true);
requestFocus(); // the JPanel now ha... |
cd8ac7f9-2926-48b5-979e-3de1174eab28 | 4 | public Move getMove(Board board) {
try {
color = GameManager.getInstance().getPlayerColor(this);
} catch (UnknownPlayerException e) {
throw new RuntimeException(e);
}
Integer columnForWin = getColumnForWin(board);
if (columnForWin != null)
{
... |
33ae7258-c5d3-4016-8ec1-2e86e7623b81 | 4 | Match[] getNextMatch( byte[] pattern )
{
Match[] matched = new Match[1];
// last pattern may have found nothing
if ( patternSame(pattern) && matches != null
&& matches.length > 0 )
{
if ( matchIndex == matches.length )
matchIndex = 0;
matched[0] = matches[matchIndex++];
return matched;
}
... |
65ad1533-2bf8-45fa-bb23-311738ed7da4 | 7 | public void save() {
try{
//saving new patient
if(this.getId() == null){
String query = "INSERT INTO patients (" +
"last_name," +
"middle_name," +
"first_name," +
"age," +
... |
553bd174-a1b2-4586-a7bb-5c802ca4153c | 0 | public Automaton getAutomaton() {
return automaton;
} |
c435af4b-9e03-41a8-8ec3-a87ca8d6551c | 1 | Simulation(WorldDescriptor descr, long stepDelay) {
generation = 0;
WDStack = new Vector<WorldDescriptor>();
logger.info("Creating new simulation");
WDStack.add(descr);
delay = stepDelay;
try {
logger.info("Creating game world");
world = new GameWorld(descr);
} catch (WeigthNumberNotMatchException e... |
fc1e4015-de69-4eef-87c3-e2777ed8e0b5 | 4 | public static DynamicArray<String> generateRandom(int size) {
DynamicArray<String> array = new DynamicArray();
for (int i = 0; i < size; i++) {
String line = "";
for (int j = 0; j < size; j++) {
if (j > i) {
int random = r.nextInt(100);
... |
7b5db5d9-a38f-4306-b771-c2a0507adbfd | 7 | public void setRezeptForm(String rId, String rName, String rSalesPrice, String rLwb, String rUpb, String rDesc, String rInst, String[] rezeptZutaten, String[] rezeptIngredientAmountNames, String[] rezeptIngredientAmounts){
//int rId = Integer.parseInt(rezeptId);
rezeptForm = "<input type=\"hidden\" name=\"rezept... |
0f6b8998-6dc5-429a-a3eb-af08cb750ffe | 6 | @Override
public void run(int interfaceId, int componentId) {
if (stage == -1) {
sendEntityDialogue(SEND_1_TEXT_CHAT,
new String[] { player.getDisplayName(), "Who are you!?" },
IS_PLAYER, player.getIndex(), 9827);
stage = 1;
} else if (stage == 1) {
sendEntityDialogue(
SEND_4_TEXT_CHAT,
... |
4f577012-1575-4e2d-b616-1f7dfe0767cd | 2 | @Override
public boolean execute() {
Boolean val = true;
try {
List<Font> fonts = new ArrayList<Font>();
for (int i = this.startFrom; i <= this.endAt; i++) {
Font previousFont = this.document.getChildren().get(i)
.getFont();
Font newFont = new Font(previousFont.getName(),
previousFont.get... |
5c837680-5e8a-4af5-9894-3e1ac016bdc6 | 7 | private String restPut(String restRequest, String[] pName, String[] pValue) {
String result = "";
String value = "";
if (pName != null && pValue != null && ! pName[0].isEmpty()) {
for (int i=0; i < pName.length; i++) {
value += "&" + pName[i] + "=" + pValue[i];
}
value = value.substring(1);
}
try... |
90a6b2c0-2e3d-465c-879b-b0009aada702 | 1 | public boolean isValid() {
return Utils.isInteger(id) && error == null;
} |
36b1042a-8167-4f01-9927-dfa0504cdbde | 1 | public int treeHeight(BTPosition<T> current)
throws InvalidPositionException {
if (current == null)
return 0;
return 1 + Math.max(treeHeight(current.getLeft()),
treeHeight(current.getRight()));
} |
41959230-47b0-4375-8e6d-6f7b9259b8a9 | 1 | private int scoreBowl(int[] bowl) {
int score = 0;
for (int i = 0; i < preferences.length; i++) {
score += bowl[i] * preferences[i];
}
return score;
} |
6a2c1649-1c8b-4e96-9b61-4bf35b8e9923 | 7 | @Override
public void process(List<Seed> seeds) {
this.seeds = seeds;
OrderedSeeds orderedSeeds = new OrderedSeeds();
List<Seed> neighbors = null;
for (Seed obj : seeds) {
if (obj.isProcessed()) {
continue;
}
neighbors = this.rangeQuery(obj);
obj.setProcessed(true);
Map<String, Double> objDi... |
7260cd35-9cf6-45c1-8dcd-b62b6e313a89 | 9 | private int getCharByCode(String inp, int off) throws NumberFormatException
{
int radix = 10;
String digStr = null;
if(inp.charAt(off) == LT_HEX)
{
try {
if(hexDigs.indexOf(inp.charAt(off+1)) < 0)
return -1;
}
catch(StringIndexOutOfBoundsException e) {
return -1;
}
radix = 16;
digStr = ... |
9f9cdf23-662c-4438-96d0-81c668a5154c | 4 | private static String[] removeOptionFromArgs(String[] args){
// debug
if(isDebug){
for(String arg: args){
System.out.println("[stdin] " + arg);
}
}
// exit when not having command line argument
if(args.length < 1){
System.out.p... |
833a94b8-873b-431b-8b74-4f8a15a506a2 | 3 | public String map(final String name) {
String s = (String) get(name);
if (s == null) {
int p = name.indexOf('.');
if (p == -1) {
s = name;
} else {
int q = name.indexOf('(');
if (q == -1) {
s = name.substring(p + 1);
} else {
s = name.substring(p + 1, q);
}
}
} else {
... |
f0171529-7dc8-4a45-964a-ae4ea917167c | 2 | public void crearArchivo(String nombre){
File arch = new File("./Data/" + nombre + ".o");
if(!arch.exists()){
try{
arch.createNewFile();
} catch(IOException ex){
System.out.println("\nDATA CORRUPTED!!!");
System.out.println(ex.getMe... |
947cccf1-8876-4c4f-9889-11a7c89df2b7 | 8 | private void btnSetasSupervisorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSetasSupervisorActionPerformed
int response;
if(!(this.txtSupervisor.getText().equals(""))){
response=JOptionPane.showConfirmDialog(null, "This project already has a supervisor. Are you sure ... |
408d7130-2f1d-4946-9278-de236c3cf26c | 2 | public <T> void put(CacheKey cacheKey, T cacheValue) {
if (cacheKey == null) {
throw new IllegalArgumentException("Parameter 'cacheKey' must be not null");
}
if (cacheValue == null) {
throw new IllegalArgumentException("Parameter 'cacheValue' must be not null");
}... |
9a354cc2-e562-4096-86be-f67d4b30db73 | 6 | public void render(){
screen.clear();
switch(state.getState()){
case 1:
menu.render(screen);
break;
case 2:
menu.render(screen);
break;
case 3:
dungeon.render(screen);
break;
case 4:
dungeon.render(screen);
break;
case 5:
//World map render
break;
defaul... |
66b1e807-40e5-4172-8224-e37b25085501 | 4 | @Override
public boolean isSameAs(DomainObject dob) {
boolean isSameAs = false;
if(dob instanceof Adress){
isSameAs = street.trim().equalsIgnoreCase(((Adress) dob).getStreet().trim());
isSameAs = isSameAs && city.trim().equalsIgnoreCase(((Adress) dob).getCity().trim());
isSameAs = isSameAs && state... |
15e72fcc-9ee5-470e-806e-dc19609a324a | 7 | public boolean sendEntityDialogue(short interId, String[] talkDefinitons,
byte type, int entityId, int animationId) {
int[] componentOptions = getIComponentsIds(interId);
if (componentOptions == null)
return false;
player.getInterfaceManager().sendChatBoxInterface(interId);
if (talkDefinitons.length != co... |
a151ca27-6159-4214-80ce-1b864b4633fe | 5 | public static String calculateLevelRatio(Deck deck) {
int zero = 0;
int one = 0;
int two = 0;
int three = 0;
for (Card c: deck) {
if (c.getLevel() == 0)
zero++;
if (c.getLevel() == 1)
one++;
if (c.getLevel() == 2)
two++;
if (c.getLevel() == 3)
three++;
}
String str = "Level S... |
a71017e0-d65d-4884-8186-d1dae88fc9dd | 2 | public static Object[][] slicesFromAllBoundaries(Object[] sequence, Boolean[] boundaries) {
List<Object[]> slices = new LinkedList<Object[]>();
int start = -1;
int end = -1;
// Go through all boundaries, slicing out each spot
for (int i = 0; i < boundaries.length; i++) {
if (boundaries[i]) {
start = e... |
59850c2a-4579-4c1d-83b4-95273a241717 | 1 | public String getContent() {
if (content == null) {
content = "";
}
return content;
} |
c717714c-33cf-4270-81af-2ac27ef3a8fa | 1 | @EventHandler
public void onPlayerLogin(PlayerLoginEvent event) {
if (!Spectacles.storedPlayerData.containsKey(event.getPlayer()
.getUniqueId().toString())) {
Spectacles.storedPlayerData.put(event.getPlayer().getUniqueId()
.toString(), new ArrayList<St... |
9a7cd228-95a3-4c61-9e69-97ebf56f62a4 | 7 | public boolean add(final Locatable locatable) {
if (!(locatable instanceof Unit)) {
throw new IllegalStateException("Not a unit: " + locatable);
}
Unit unit = (Unit) locatable;
if (super.add(unit)) {
if (this.canTeach()) {
Unit student = unit.getS... |
99b3ff02-47a8-4732-a47e-9b58c9155a9d | 5 | public boolean LoadConfigureInfo(){
boolean return_val = true;
try{
FileInputStream in = new FileInputStream(file_path);
try (BufferedReader bufffile = new BufferedReader(new InputStreamReader(in, "UTF8")))
{
String strLine;
strLine = ... |
328dc603-c96d-4d94-9c0e-900a44d8c5c0 | 2 | private String displayResults(String[] searchTextArr, NGramStore ngramMap) {
StringBuffer ngramBuffer = new StringBuffer();
for (String s : searchTextArr) {
ngramBuffer.append("NGram Results for Query: ");
ngramBuffer.append(s);
NGramNode node = (NGramNode) ngramMap.getNGram(s);
if (node == null) {
... |
831ab75c-0cd3-4433-b851-11585ab7520a | 1 | private boolean jj_3_5() {
if (jj_3R_23()) return true;
return false;
} |
e9fb1aeb-3404-4e1b-a262-8649d2113064 | 1 | public void setMinSpeed(double minSpeed) {
if(!_negated) {
_minSpeed = minSpeed;
} else {
_maxSpeed = minSpeed;
}
} |
9abf43cb-91a7-4d2a-8c9e-8597b18ae014 | 0 | protected boolean confirmContinue(int generated, Component component) {
int result = JOptionPane.showConfirmDialog(component, generated
+ " configurations have been generated. "
+ "Should we continue?");
return result == JOptionPane.YES_OPTION;
} |
928cd555-7b85-416a-8f43-742dead5b50e | 7 | @Override
public void toDot(String filename) {
monitor.println("Writing " + filename);
BufferedWriter w = null;
try {
FileWriter fstream = new FileWriter(filename);
w = new BufferedWriter(fstream);
w.write("digraph G {\n");
// nodes
for (ItemPair p : done) {
String id = Util.dotId(toStr... |
90d31786-5015-4dd2-9022-ff5a858a1bb5 | 7 | private void startServer(int port) {
client_thread = new ClientServerThread[max_client_count];
/* Creating server socket */
System.out.println("Creating server on port " + port + "...");
try {
server_socket = new ServerSocket(port);
} catch (IOException e) {
Sys... |
f02875c6-dbb9-41d2-97e6-0c09f2f6fb29 | 1 | protected void changedServerPassword(){
for(ModelChangeListener mcl : listeners){
mcl.changedServerPswd(psw_enable);
}
} |
7b295c16-576c-455b-86b7-a9df6c0c7c2c | 5 | @Override
protected boolean canRun(ClassNode node) {
if (!node.superName.endsWith(classNodes.get("Actor").name) || classNodes.containsKey("Npc"))
return false;
ListIterator<FieldNode> li = node.fields.listIterator();
if (classNodes.containsKey("NpcDefinition"))
while ... |
3fd3bb4b-9d3b-46bd-a7d2-464f59a716bd | 4 | public void process() {
BigDecimal sumaReda;
for (int i = 2; i <= N; i++) {
switch (checkNumber(i)) {
case 1:
// Broj je prim broj
sumaReda = getSumAll(i);
// System.out.println(i + ": " + sumaReda.toString());
sumaUkupno = sumaUkupno.add(sumaReda);
break;
case 2:
// broj ima parn... |
dfdb3295-f073-46ad-82ec-2ab908796285 | 9 | public static LinkedList<int[]> detectCircles(LinkedList<int[]> Borders) throws IOException{
//look at pixels around around supposed center of circle
BufferedImage frame;
frame = ImageIO.read(new File("saved.png"));
int[] radius = {27,28,29};
//run through all white areas of drawn image to look for circular... |
b721a1cb-5833-4413-a213-afd00667a53e | 9 | public void givePickaxeReward(Player p, int breaks) {
if (pickaxeGlobalRewards == null
|| !pickaxeGlobalRewards.containsKey(breaks)
|| pickaxeGlobalRewards.get(breaks) == null) {
return;
}
Reward r = globalRewards.get(breaks);
if (r == null) {
return;
}
if (r.getCommands() == nul... |
ac274a41-aaa9-4c4f-9b57-67c8674e1ae1 | 9 | public DbCommand parse (String query) {
query = query.trim().replaceAll(" +", " ").replaceAll(" +,", ",").replace(";", "").replaceAll("\n", "");
String firstWord = query.split(" ", 2)[0].toUpperCase();
if (firstWord.equals("CREATE")) {
String secondWord = query.split(" ", 3)[1].toUpp... |
f03ebf81-e8d2-4abe-83cd-321ed4f09707 | 3 | private List<Integer> processArrays(int low, int high) {
// checking input parameter for null
if (numbers == null || helper == null) {
return null;
}
// check if low is smaller then high, if not then the array is sorted
if (low < high) {
// Get the index... |
e7f517aa-374f-4aff-b77d-35df4484a61b | 1 | public Path generate(){
StringBuilder builder = new StringBuilder();
int lenght2 = random.nextInt(5)+1;
for(int i=0; i<lenght2; i++){
int lenght = random.nextInt(5)+1;
builder.append("/");
builder.append(generateString(letters, lenght));
}
return new Path(builder.toString());
} |
06e6e506-f0c5-41f0-8267-ffca9c11f057 | 1 | private void initJoystick(int i) {
if (joystickAxes[i] == null) {
updateJoystick(i);
}
} |
2e21a0e6-f8d8-48c5-8440-54eec34de852 | 5 | private boolean isPrimalFeasible(double[][] A, double[] b) {
double[] x = primal();
// check that x >= 0
for (int j = 0; j < x.length; j++) {
if (x[j] < 0.0) {
StdOut.println("x[" + j + "] = " + x[j] + " is negative");
return false;
}
... |
98624901-4259-4d38-856b-a2e2cd996458 | 9 | @Override
protected void Poll()
{
//if the robot re-oriented itself, cached sine and cosine values need to be re-calculated
double rotation = m_robot.GetTransformedData().GetRotation() + m_rotation;
if (Math.abs(rotation - m_cacheNetRotation) > PhysicsModel.EPSILON)
{
m_cacheNetRotation = rotation;
m_ca... |
27f6105e-bf25-4966-9a97-2fa1658dbdce | 2 | public static String getKeysFromValue(HashMap<Integer, String> hm,
String value) {
Set s = hm.entrySet();
// Move next key and value of HashMap by iterator
Iterator it = s.iterator();
while (it.hasNext()) {
// key=value separator this by Map.Entry to get key and value
Map.Entry m = (Map.Entry) it.next(... |
62babb82-a040-4716-9cfb-083b483f544b | 0 | public MyLiteralRule( IToken token ) {
super(new MyMemberDetector(), "#{", "}", token );
} |
0c8a9ed0-da81-43c1-9e0e-a1708a2b4c0c | 9 | private String getDashboardValues(Conn conn) {
// activen Player bekommen
Player player = players[handler.getConnections().indexOf(conn)];
// objekt für Geld
DashboardIcon cash = new DashboardIcon();
cash.setTitle("Cash");
cash.setColor("green");
cash.setIcon("usd");
try {
cash.setValue(Double.toStri... |
f574e635-0bfe-4655-89ba-28b050013b7d | 9 | void run(){
int N = 10000;
boolean[] p = new boolean[N+1];
Arrays.fill(p, true);
p[0]=p[1]=false;
int[] s = new int[1229];
int x = 0;
for(int i=2;i<=N;i++)if(p[i]){
s[x++] = i;
for(int j=i+i;j<=N;j+=i)p[j]=false;
}
Scanner sc = new Scanner(System.in);
for(;;){
int n = sc.nextInt();
if(n=... |
e73e77a3-6311-4af6-abf2-0735a032cb23 | 7 | public boolean loadROM(Component parentComponent){
if(isDirty()){
// prompt for save
}
File selectedFile = FileUtilities.selectFileForOpen( parentComponent );
if(selectedFile == null){
return false;
}
byte header[] = new byte[INES_ROM_INFO.INES... |
9d6207d6-0511-4fa2-8577-c249249a38bc | 0 | public static void main(String[] args) {
oldJavaWay();
newJavaWay();
} |
8d2ae782-8144-40f8-8907-3251e336734d | 6 | @Override
public void messageReceived(S source, final Message message)
{
if(message instanceof LoginFailedMessage)
{
ConnectController.getInstance().displayFailure(((LoginFailedMessage) message).getReason());
}
else if(message instanceof Lo... |
b858dd30-7955-4d33-9ca6-ca15b1c7e150 | 7 | public void parseChildMsg(int byteCounter){
int cnter = 0;
int[] tmp = new int[2];
int packetBotID = -1;
int packetParent = -1;
int packetTimeSlot = -1;
int packetSubTree = -1;
for (int i = 1; i < byteCounter; i++) {
if (i == 1) {
packetBotID = Integer.parseInt(new String(new byte[] {netText[i]})... |
62d9d15c-bd48-4580-a934-58c37b0ecc06 | 0 | public void setFormattedDatetime(String formattedDatetime) {
this.formattedDatetime = formattedDatetime;
} |
03e1a30f-6c91-4652-b6fe-1a796b5106b4 | 5 | @Override
public void deserialize(Buffer buf) {
jobId = buf.readByte();
if (jobId < 0)
throw new RuntimeException("Forbidden value on jobId = " + jobId + ", it doesn't respect the following condition : jobId < 0");
jobLevel = buf.readByte();
if (jobLevel < 0)
... |
179725dc-6732-4091-aa3d-8deb5e9a18c3 | 0 | @Override
public String getSector() {
return super.getSector();
} |
a432c757-7215-4a4f-8099-08e3f85f60d6 | 3 | public static void main(String[] args) throws ImageFormatException, IOException {
System.out.println("Please select a picture to encode or decode.");
String pictureLoc = FileChooser.pickAFile();
System.out.println("Do you want to Encode or Decode this image?");
@SuppressWarnings("resource")
Scanner in = new S... |
494e8a52-dd9b-4316-a482-101165083528 | 5 | @Override
public int hashCode() {
if (hashCode == 0) {
final int prime = 31;
int result = 1;
result = prime * result + ((high == null) ? 0 : high.hashCode());
result = prime * result + (isClosedOnHigh ? 1231 : 1237);
result = prime * result + ((low == null) ? 0 : low.hashCode());
... |
ef5b114a-5d3e-4a7d-9963-71aa6b2d7218 | 1 | private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton1MouseClicked
MessageFormat headerFormat = new MessageFormat("Time Management Tool - Page {0}");
MessageFormat footerFormat = new MessageFormat("- {0} -");
try {
jTable1.print(JTable.PrintMode.FI... |
4b0ad5d0-8f0a-4448-9f8e-7c6c30e961cc | 9 | @Override
public void run() {
try {
OutputStream os = connection.openOutputStream();
InputStream is = connection.openInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
PrintWriter writer = new PrintWriter(os);
while(true) {
String line = reader.readLine();
i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.