method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
407970a2-873c-426b-b6b3-c4c43fa53bf9 | 3 | private void moveOnX(Vector<Integer> ans, int xDis, int yDis){
if (xDis >= 0){
ans.add(1);
if (yDis >= 0){
ans.add(0);
ans.add(3);
ans.add(2);
}
else {
ans.add(2);
ans.add(3);
ans.add(0);
}
}
else {
ans.add(3);
if (yDis >= 0){
ans.add(0);
ans.add(1);
ans.ad... |
0071c030-bafb-4fa0-b71d-aab12ccc00f6 | 8 | public void getInput()
{
Scanner scanner=new Scanner(System.in);
int n, serial=1;
while(scanner.hasNextInt())
{
n=scanner.nextInt();
if(n<0)
break;
if(n==0||n==1)
{
System.out.println("Case "+serial+": 0");
}else if(n==2)
{
System.out.println("Case "+serial+": 1");
}else
... |
b2abb491-2816-4270-aa6e-02f35817d75f | 3 | private boolean _jspx_meth_c_import_0(PageContext _jspx_page_context)
throws Throwable {
PageContext pageContext = _jspx_page_context;
JspWriter out = _jspx_page_context.getOut();
// c:import
org.apache.taglibs.standard.tag.rt.core.ImportTag _jspx_th_c_import_0 = (org.apache.taglibs.standard.... |
5921206e-e101-4dd1-902f-a70c1bb68ac6 | 4 | public Double getTagWeight(Integer userID, Integer resourceID) {
if (! userResourceTagMaping.containsKey(userID) ||
! userResourceTagMaping.get(userID).containsKey(resourceID)) {
return 0.0;
}
//get user's tag for the provided resource
Map<Integer, List<Integer>> resourceTagMaping = userResourceTagMapin... |
f0205026-37dd-4cd3-b3a1-f19e0501f7dd | 8 | @Override
public Object getValueAt(int row, int col) {
Osoba osoba = data.get(row);
switch (col) {
case 0:
return row;
case 1:
return osoba.getNazwisko();
case 2:
return osoba.getImie();
case 3:
return osoba.getKodPocztowy();
case 4:
return osoba.getMiasto();
case 5:
return osoba.getU... |
e888f295-6689-4e88-ab11-c041bc1290f1 | 9 | public List getSearchArticles(int start, int end,String search, String val, int area) throws Exception{
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
List<BoardDataBean> articleList = null;
try{
conn = getConnection();
// val = new String(val.getBytes("iso_8859-1"),"utf-8");
Stri... |
976523d2-75e0-4f38-9ee0-e95bb30c405e | 0 | public static void main(String args[])
{
new Win();
} |
135713ce-535e-4cf5-9e09-c32253ef7a51 | 3 | public boolean ValidateTicker(String ticker){
if("".equals(ticker)){
return false;
}
this.inputStream = getClass().getResourceAsStream("/allTickerSymbols.txt");
this.fileScanner = new Scanner(this.inputStream);
while(this.fileScanner.hasNextLine()){
... |
e9018d5b-9765-4fb0-9c41-8abb9aa84c8b | 6 | @Override
public int loop() {
if (Game.getClientState() != Game.INDEX_MAP_LOADED) {
return 1000;
}
if (client != Bot.client()) {
WidgetCache.purge();
Bot.context().getEventManager().addListener(this);
client = Bot.client();
}
... |
189fc74e-3440-4e9c-9fea-14dccf2fef08 | 6 | @EventHandler
public void CreeperWaterBreathing(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.getCreeperConfig().getDouble("Creep... |
a7735f93-d7e4-4da5-88b1-8a76d526a483 | 5 | public void mousePressed(MouseEvent e) {
for(int i = 0;i < ui.getButtons().size();i++) {
b = ui.getButtons().get(i);
if(e.getX()>=b.getX() && e.getX()<=b.getX()+b.getWidth()) {
if(e.getY()>=b.getY() && e.getY()<=b.getY()+b.getHeight()) {
b.setBgColor(C... |
09e54b9f-7a82-43d3-a619-abba380373ab | 9 | protected int getPageAddressLarge(int va, boolean inst, boolean priv, boolean read, int entryL1, int entryL2) {
int dom = BitOp.getField32(entryL1, 5, 4);
int base = BitOp.getField32(entryL2, 16, 16);
//int ap3 = BitOp.getField32(entryL2, 10, 2);
//int ap2 = BitOp.getField32(entryL2, 8, ... |
b00261f9-7200-4b98-80bc-f7c387b66e9c | 4 | private String format(LogRecord e) {
StringBuilder sb = new StringBuilder();
Level lvl = e.getLevel();
if (lvl == Level.INFO) {
sb.append("[INFO] ");
} else if (lvl == Level.SEVERE) {
sb.append("[SEVERE] ");
}else if (lvl == Level.FINE) {
sb.append("[MSG] ");
} else {
sb.append("[OTHER] ");
}
... |
7a73039a-dd45-4dfa-8406-120120696cee | 5 | public String post(String name, Paste paste, ReportFormat format, ExpireDate expireDate) {
if(name == null)
name = "";
String report_url = "";
try {
URL urls = new URL(this.POST_URL);
HttpURLConnection conn = (HttpURLConnection) urls.openConnection();
... |
4351470d-0ffa-468f-bacd-8cd88d7aa85e | 4 | public void displayResult(boolean success) {
String text;
if (success) {
display.setForeground(Color.GREEN);
text = "Success!";
}
else {
display.setForeground(Color.RED);
text = "Failed";
}
display.setText(text);
display.setEchoChar((char) 0);
display.setEditable(false);
for(int i=0;i<butt... |
c7f57701-87f9-42c0-a76c-3ac7a99d4e22 | 0 | public void setTurnOffCommand(Command turnOffCommand) {
this.turnOffCommand = turnOffCommand;
} |
66f375ff-e84b-417b-82b5-f1e10732d4dc | 0 | Type(int type)
{
this.type = type;
} |
99a8a579-649c-4c36-966b-c0c00bfd723e | 7 | private void lsUpdateGroup (final int ISA, final int first, final int last) {
final int[] SA = this.SA;
int a, b;
int t;
for (a = first; a < last; ++a) {
if (0 <= SA[a]) {
b = a;
do {
SA[ISA + SA[a]] = a;
} while ((++a < last) && (0 <= SA[a]));
SA[b] = b - a;
if (last <= a) {
... |
7c6a91cf-e681-445f-82f8-f4e7811dc88a | 1 | @Override
public void mouseClicked(MouseEvent e) {
System.out.println("CLICK");
new Thread(new Runnable(){
public void run() {
synchronized(Main.lignes) {
MenuDroite.lblVitesse.setText(""+bus.getVitesse());// = new JLabel("OH YEAH "+bus.getId());
Utils.removeAllListeners(MenuDroite.btnAugmenterVit... |
8d92092f-e07e-420c-9874-f5ba93016fd6 | 6 | public void method346(int i, int j)
{
i += anInt1442;
j += anInt1443;
int l = i + j * DrawingArea.width;
int i1 = 0;
int j1 = myHeight;
int k1 = myWidth;
int l1 = DrawingArea.width - k1;
int i2 = 0;
if(j < DrawingArea.topY)
{
int j2 = DrawingArea.topY - j;
j1 -= j2;
j = DrawingArea.topY;
... |
576aa71a-d008-48f8-a72f-a48f9332f8fc | 5 | @Override
public boolean doTest(FuzzySet set, IDomain domain) {
boolean isSymmetric = new SymmetryTestCommand(
set.getName()).doTest(set, domain);
System.out.println(isSymmetric ? "YES" : "NO");
boolean isReflexive = new ReflexivityTestCommand(
set.getName()).doTest(set, domain);
System.out.pr... |
75d1df78-72e1-4feb-ac34-693979998627 | 8 | public void handleReceivedPacket(DatagramPacket packet){
byte [] data=packet.getData();
String temp_name=extractName(data);
if(temp_name.equals(name)){
return;//if packet with the name of the host arrived -> dont do anything
}
String message;
if(!members.contains(temp_name)){ // first time connected... |
d1d7b6e0-732a-420f-bac7-726408362d2d | 7 | public static void main(String[] args) throws DatumException {
SortedSet<Voertuig> voertuigen;
voertuigen = new TreeSet<>();
try {
voertuigen.add(new Personenwagen("opel", DATUM_1, 1000, 5, Color.YELLOW, BESTUURDER_A, INGEZETENE_A, INGEZETENE_B));
voertuigen.add(new Pers... |
5385f2b5-6121-4402-91c3-33d407f91f39 | 6 | @SuppressWarnings("unchecked")
public void addTag(String tag, String filePath){
Picture picture = findById(filePath);
if(picture != null){
List<TagI> tags = new ArrayList<TagI>();
try{
tags = (List<TagI>) picture.getTags();
}catch(Exception y){
Log.getLogger().log(Level.INFO, "Couldn't get any tag... |
6891dfe8-33fe-43c6-a61a-1967faef922b | 0 | public static boolean isNumeric(String str)
{
NumberFormat formatter = NumberFormat.getInstance();
ParsePosition pos = new ParsePosition(0);
formatter.parse(str, pos);
return str.length() == pos.getIndex();
} |
6f1e58fd-bb86-4ab9-8644-2b380e84b6dc | 0 | private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
// TODO add your handling code here:
final Thread serverThread = new Thread(){
public void run(){
basicslick.server.GameServer server = new basi... |
20e42afe-3e32-41be-a6e2-1508b26cab28 | 2 | private static int fac(int n){
if (n==0) return 1;
if (n==1) return 1;
return n*fac(n-1);
} |
86a2c6e3-7e23-4d1f-bd8c-90307c6002d9 | 6 | @EventHandler
public void SnowmanStrength(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.getsnowgolemConfig().getDouble("Snowman.S... |
b6511b31-c06c-42b7-a512-187f4da9228d | 7 | public void printToFile(String filePath) {
try {
StringBuilder sbOutput = new StringBuilder();
// Output each member of settings.
for (Field field : this.getClass().getDeclaredFields()) {
String typestr = field.getType().toString().toLowerCase();
if (typestr.endsWith("string") || typestr.endsWith("in... |
fb62e418-8efa-4a71-8f26-79a1bdc37b6c | 7 | private static String defineCord(HashMap<String, List<String>> pDictionary, String cordType) {
for (int i=0; i < pDictionary.get(allURIs.get(cordType)).size(); i++) {
if (cordType.equalsIgnoreCase("x")) {X.add(Double.parseDouble(pDictionary.get(allURIs.get(cordType)).get(i)));}
else if (cordType.equalsIgnoreCas... |
9ca400c8-06b4-433c-ac08-b9089d7cab8a | 3 | public synchronized void closeCon() throws Exception {
// 清空用户列表
sleep(300);
listModel.removeAllElements();
listmodel.removeAllElements();
onLineUsers.clear();
chatRooms.clear();
objChatRooms.clear();
btn_start.setEnabled... |
64d976e7-006a-41b4-9991-ac9c73a88e56 | 9 | private Object getFieldValue(final Field field, Object entity) {
try {
Class<?> clazz = field.getType();
if (clazz.equals(Integer.TYPE)) {
return field.getInt(entity);
}
if (clazz.equals(Long.TYPE)) {
return field.getLong(entity);
... |
cd81ea0d-17ba-4ff4-b8ae-d3e889ae7b65 | 9 | private void handleEntityEnd() {
if (currentArea == null || currentAttributes == null) {
log.warning("Can't handle this entity! Current Value: "
+ currentValue + ", Current Attributes: "
+ currentAttributes);
return;
}
if (currentArea.equals("accessible")) {
String entity = null;
for (int i ... |
6018591e-23a6-4b99-b87c-c36c17dc0747 | 8 | public static void main(String[] args)
{
openConfig(".jifirc");
//if we have arguments...don't use a gui
//Usage: jifi <device> <hex file>
if (args.length == 2 && true)
{
String dev = args[0];
String file = args[1];
IfiComm comm = new IfiComm(Jifi.lastPort);
try
{
comm.open();
... |
3e7e7e52-abaf-4959-a5e7-aafb500590b5 | 0 | @Override
protected void onTermination(Throwable exception) {
System.out.printf("MyWorkerThread %d:%d\n",getId(),taskCounter.get());
super.onTermination(exception);
} |
ee71ef9c-8ead-4d38-8194-da651be57e5c | 1 | private void startUpdate() {
if(periodicAddonUpdate == null)
setPeriodicUpdate(1000);
} |
9f10aa14-60c1-4671-9ed0-6090dbabd7bf | 8 | @Override
public boolean verifyInput() {
if (lineCommentsEnabledCB.isSelected()) {
String lineCommentStart = lineCommentStartField.getText().trim();
if (lineCommentStart.length()==0) {
app.validateError(lineCommentStartField, "Error.NoEolCommentStart");
return false;
}
}
if (mlcsEnabledCB.isSe... |
67ea32f2-88ef-40f4-bf05-ff05698daae3 | 1 | private void evalPutField(int opcode, int index, Frame frame) throws BadBytecode {
String desc = constPool.getFieldrefType(index);
Type type = zeroExtend(typeFromDesc(desc));
verifyAssignable(type, simplePop(frame));
if (opcode == PUTFIELD) {
Type objectType = resolveClassI... |
747014e0-aa20-4125-9da8-8b96ce5961e7 | 8 | public static DictItem find(List<DictItem> dictionary,
String groupId,
String artifactId,
String version) {
DictItem match=null;
for(DictItem item:dictionary) {
if(item.groupId.equals(groupId)&&
... |
348ef40d-64ee-4ded-a05f-5631628fdda0 | 7 | protected Map readStates(Node node, Automaton automaton, Set locatedStates,
Document document) {
Map i2s = new java.util.HashMap();
if(node == null) return i2s;
NodeList allNodes = node.getChildNodes();
ArrayList stateNodes = new ArrayList();
for (int k = 0; k < allNodes.getLength(); k++) {
if (al... |
77c995fd-ba04-4d70-a3d4-d509f06d7c9e | 0 | @Override
public Iterator<AbstractPlay> iterator() {
return bestPlays.iterator();
} |
722f1daf-2290-4dca-b050-0737367af748 | 8 | public static String NumberToText( int n)
{
if ( n < 0 )
return "Minus " + NumberToText(-n);
else if ( n == 0 )
return "";
else if ( n <= 19 )
return new String[] {"One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight",
"Nine", "Ten", "Eleven", "Twelve", "Thirteen"... |
63f3a145-be90-4279-9b9a-ac300ab62862 | 5 | @Override
public User createUser(User user) {
Connection cn = null;
PreparedStatement ps = null;
ResultSet rs = null;
try {
cn = ConnectionHelper.getConnection();
ps = cn.prepareStatement(QTPL_INSERT_USER, new String[] { "user_id" });
ps.setString... |
2266e948-6b4b-465c-be76-124bbd21fb57 | 8 | public void buildAssociations(Instances instances) throws Exception {
m_errorMessage = null;
m_targetSI.setUpper(instances.numAttributes() - 1);
m_target = m_targetSI.getIndex();
Instances inst = new Instances(instances);
inst.setClassIndex(m_target);
inst.deleteWithMissingClass();
// can ... |
02cb853c-04c9-47db-97e5-9836ad12819d | 9 | public static void initializeMappingFile (String sourceDir, String mappingFileName)
throws IOException {
GenUtil.validateString (sourceDir);
GenUtil.validateString(mappingFileName);
try {
CSVReader br = new CSVReader (new FileRea... |
59c650d6-7708-48eb-b0d4-821f0fcd29bc | 8 | public static void assertReferenceIsGCed(String text, Reference<?> ref) {
List<byte[]> alloc = new ArrayList<>();
int size = 100000;
for (int i = 0; i < 50; i++) {
if (ref.get() == null) {
return;
}
try {
System.gc();
... |
2dc13d5a-2419-4b73-a7e8-1f989572c536 | 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... |
36d81a7f-e2e8-4481-b4a0-98a298b04ae2 | 4 | public Vector<Vector<Object>> userTable() {
try {
String[] keys = {"username", "active"};
crs = qb.selectFrom(keys, "users").all().executeQuery();
data.clear();
while(crs.next()) {
Vector<Object> row = new Vector<Object>();
ResultSetMetaData metadata = crs.getMetaData();
int numberOfColumns... |
a5d13cf9-e596-4341-b134-bcdb05784d45 | 1 | @Test(expected = PersistencyException.class)
public void WhenLoadingFromFileWithInvalidPort_ExpectIllegalArgumentException() throws PersistencyException {
RoutingTable routingTable = new RoutingTable();
try {
persistenceDelegate_.load(INVALID_PORT_FILE, routingTable);
} catch (Fi... |
1dfe641f-55d6-4f3c-b48d-0ff0bed4d6b4 | 9 | public ArrayList<Integer> findSubstring(String S, String[] L) {
int n = S.length();
int m = L[0].length();
int l = L.length;
Map<String, Integer> needFind = new HashMap<String, Integer>();
Map<String, Integer> hasFound = new HashMap<String, Integer>();
for (int i = 0; i < l; i++) {
if (!ne... |
f4f1e119-7713-4eba-8c97-81b44327992d | 3 | static synchronized void remove(LinkedList list, String name) {
if (list == null)
return;
ListIterator iterator = list.listIterator();
while (iterator.hasNext()) {
AttributeInfo ai = (AttributeInfo)iterator.next();
if (ai.getName().equals(name))
... |
811805e7-ff20-4647-a79e-f7345be05724 | 7 | private static final FileOnDisk getPreferencesFileOnDisk(String string, int i,
String string_14_, int i_15_) {
String string_16_;
if (i_15_ == 33)
string_16_ = "jagex_" + string_14_ + "_preferences" + string + "_rc.dat";
else if (i_15_ != 34)
string_16_ = "jagex_" + string_14_ + "_preferences" + ... |
5b8fd0e5-6c40-448c-8f74-282c8a9c7a75 | 0 | public void makeActive() {
this.setBackground(this.BACKGROUND_ACTIVE);
} |
8dca0283-753a-4ad0-b662-b63385fd8ab0 | 8 | private void intelligenceMode() {
int count = 0;
gameMode = "Intelligence Mode";
System.out.println("----------- INTELLIGENCE MODE -----------");
System.out.println("Tip: Press \"Q\" for quit Game");
while (true) {
Coordinate scanPosition = this.inputPosition();
... |
f94a6c99-d95c-433f-93db-0860ec220d07 | 4 | public void parse() {
if (Compiler.verbose())
System.out.println("Scanning...");
lexer.scann(text);
if (Compiler.verbose()) {
while (lexer.hasNext())
System.out.println(lexer.nextToken().getToken() + ", ");
lexer.reset();
}
if (Compiler.verbose())
System.out.println("Parsing...");
/... |
634ba571-7478-4dc5-b7ac-a4b8ad43bf03 | 0 | public int getRank() {
return myRank;
} |
82a53dd9-62d1-4c0e-97ec-5f27e0fb2fd4 | 3 | private int readBytes(byte[] b, int offs, int len)
throws BitstreamException
{
int totalBytesRead = 0;
try
{
while (len > 0)
{
int bytesread = source.read(b, offs, len);
if (bytesread == -1)
{
break;
}
totalBytesRead += bytesread;
offs += bytesread;
len -= bytesread;
}... |
5cc8dfb5-f4f7-48f1-8f43-0698ffab41d6 | 9 | public int ladderLength1(String start, String end, HashSet<String> dict) {
HashSet<String> visited = new HashSet<String>();
LinkedList<String> queue = new LinkedList<String>();
HashSet<String> termi = new HashSet<String>();
for(String str : dict){
if(diffInOne(str, end)) term... |
e97cc513-d1c5-450f-a6b4-06301354666b | 5 | public static void main(String[] args) {
// TODO code application logic here
Scanner entrada = new Scanner(System.in);
String Cadena1="";
Cadena1=JOptionPane.showInputDialog("Ingrese Frase");
Cadena1=" "+ Cadena1 +" ";
int longitud = Cadena1.length();
ch... |
a2e71a20-8429-4fd0-9842-649bb069b9ec | 0 | public void mouseReleased(MouseEvent arg0) {} |
440b7808-8345-4baf-80a8-c7bd38c50b85 | 4 | public boolean triggerShimmyOut(){
if( ! hideTimer.isRunning()
&& isShimmyVisible()
&& !menu.isMenuItemOpen()
&& !menu.isLock()){
hideTimer.start();
mmMenuBar.reposition(0,0);
mmMenuBar.rescale(Gui.getContentPane().getWidth(), 10);
return true;
}
else return false;
} |
cabfa7ff-2953-4df2-b0a1-eee1be4758f5 | 4 | public WorldModelImpl(int width, int height, double bombPercentage, boolean isThorique, GameDifficulty gd) throws WidthException, HeightException, BombPercentageException {
if (bombPercentage < 100) {
this.bombPercentage = bombPercentage;
} else {
throw new BombPercentageExceptio... |
1042a471-a777-418c-90ef-8d25c3270a3b | 2 | public static AccessibilityEnumeration fromValue(String v) {
for (AccessibilityEnumeration c: AccessibilityEnumeration.values()) {
if (c.value.equals(v)) {
return c;
}
}
throw new IllegalArgumentException(v);
} |
2c3ccbcb-f9c0-4ef3-97a8-e2d819c53821 | 8 | public SearchCondition build_search_condition() {
SearchCondition cond = new SearchCondition();
if (this.m.get("city") != null) {
cond.setCity((String)m.get("city"));
}
if (this.m.get("country") != null) {
cond.setCountry((String)m.get("country"));
}
... |
50dd42fb-20c1-4203-b119-422bbd4cf527 | 4 | public static boolean isNumeric(String s){
if(s==null) return false;
if(s.contains("E")){
String mantissa = s.substring(0, s.indexOf("E"));
String power = s.substring(s.indexOf("E")+1);
return isNumeric(mantissa) && isNumeric(power);
}
if (s.matches("((-|\\+)?[0-9]+(\\.[0-9]+)?)+")) return true;
... |
407a1f27-ca07-43a0-bd2d-08aa2b4b7e37 | 7 | private void fillActionComboBox() {
actionComboBox.removeAllItems();
Object o = modelComboBox.getSelectedItem();
if (o instanceof BasicModel) {
BasicModel model = (BasicModel) o;
Map changeMap = model.getChanges();
if (changeMap != null) {
synchronized (changeMap) {
for (Object x : changeMap.val... |
d523dd54-1909-4e85-be9f-3e5662cc6617 | 6 | private boolean validateXML(Document dom) {
SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
Schema schema = null;
for (int i = 0; i < schemaLocations.length; i++) {
try {
schema = factory.newSchema(schemaLocations[i]);
} catch (Excep... |
2184318b-5df4-43b1-a528-8516628fa05b | 1 | public List<String[]> solveNQueens(int n) {
String []board= new String[n];
char[] init = new char[n];
Arrays.fill(init,'.');
for (int i =0; i < n ;i++ ) {
board[i]= new String(init,0,n);
}
nextQueens(board,0,n);
return list;
} |
102bc467-2eb2-44c7-948a-c7a33465323f | 8 | private TreeNode initTree() {
DefaultMutableTreeNode tmodel = new DefaultMutableTreeNode("Thème");
try {
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
} catch (ClassNotFoundException ex) {
JOptionPane.showMessageDialog(this, "Driver" + ex.getMessage(), nu... |
19fa8f41-4433-485d-8b11-dd29df7acb84 | 3 | PetiRound valueOf(RoundingMethod roundingMethod)
{
switch (roundingMethod)
{
case DOWN:
return PetiRound.DOWN;
case UP:
return PetiRound.UP;
case HALF_UP:
return PetiRound.HALF_UP;
default:
throw new IllegalArgumentException("Unexpected roundingMethod: " + roundingMethod);
}
} |
106a91f5-550b-4d40-967f-9b4475889521 | 4 | public boolean TableExists(Connection conn, String tname) {
DatabaseMetaData md;
ResultSet rs;
try {
md = conn.getMetaData();
} catch (SQLException e) {
// This shouldn't really happen
plugin.Warn("Unable to read DatabaseMetaData from DB connection!");
e.printStackTrace();
return false;
}
... |
531f52aa-866b-4215-97b3-344af8907133 | 0 | public void start(int interval, final boolean beep)
{
class TimePrinter implements ActionListener
{
public void actionPerformed(ActionEvent event)
{
Date now = new Date();
System.out.println("At the tone, the time is " + now);
if (beep) Toolkit.getDef... |
454f3516-d14b-47c6-86b6-af6bd564d678 | 7 | public static void OBRADI_odnosni_izraz(boolean staviNaStog){
String linija = mParser.ParsirajNovuLiniju();
int trenLabela = mBrojacLabela++;
if (linija.equals("<aditivni_izraz>")){
OBRADI_aditivni_izraz(staviNaStog);
return;
}
if (linija.equals("<odnosni_izraz>")){
OBRADI_odnosni_izraz(true);... |
c615a081-e0f2-407d-9a84-70a1a2969044 | 2 | private void sendIncorrectMessage(Player p, boolean hasPermission, boolean invalidArgs) {
if (!hasPermission)
plugin.tell(p, "You do not have permission to use this command.");
if (!invalidArgs)
plugin.tell(p, "Invalid arguments. Use &e/hunger help&r for a list of commands.");
} |
c21032aa-6a4d-4304-a023-e4a195e3f881 | 6 | private void dfs(TreeNode node, int level) {
if(node.left == null && node.right == null) {
minDepth = level < minDepth ? level : minDepth;
return;
}
if(level > minDepth) return;
if(null != node.left) {
dfs(node.left, level + 1);
}
if(null != node.right) ... |
82a07012-5128-4a67-9cf4-018011aff7fc | 9 | public static boolean validadePlaca(String placa) throws PlacaInvalidaException{
PlacaInvalidaException a = new PlacaInvalidaException();
//checar tamanho
if(placa.length()!=8){
throw a;
//checando se h� numeros onde deve haver n�meros
}else{
for(int i = 0; i <placa.length(); i++){
if(i>=4){
i... |
aef3c18f-85d1-4f3f-993b-e3796393fd6a | 6 | @Override
public void execute(Stack<Double> st, String userInput, Map<String, Double> def) {
String[] mas = userInput.split(" ");
try{
double pushValue = 0.0;
boolean flag = false;
// check the presence of parameter in def and, if found, define pushValue
... |
3fe94023-6121-4f16-b235-ad94f25cdfd6 | 5 | Class18(OpenGlToolkit var_ha_Sub2) {
anInt286 = 1;
aClass262_292 = new Deque();
aBoolean293 = true;
aClass258_Sub3Array295 = new Class258_Sub3[2];
aBoolean297 = true;
aBoolean294 = true;
aBoolean299 = true;
anInt302 = 0;
anInt301 = -1;
aBoolean303 = false;
aHa_Sub2_290 = var_ha_Sub2;
if (((OpenGlToolkit) aH... |
089e6618-19fe-4397-891f-39484f085deb | 9 | private boolean sendPacket()
{
boolean var1 = false;
try
{
Packet var2;
Object var3;
int var10001;
int[] var10000;
if (!this.dataPackets.isEmpty() && (this.chunkDataSendCounter == 0 || System.currentTimeMillis() - ((Packet)this.da... |
65ff8c06-838c-4a17-b022-771b5e01d419 | 6 | private Token jj_consume_token(int kind) throws ParseException {
Token oldToken;
if ((oldToken = token).next != null) token = token.next;
else token = token.next = token_source.getNextToken();
jj_ntk = -1;
if (token.kind == kind) {
jj_gen++;
if (++jj_gc > 100) {
jj_gc = 0;
... |
1ea94dd7-14e4-43b9-876c-4cef6fc48088 | 3 | @Override
public void validate() {
if (newrt == null) {
addActionError("Please Enter New Rate");
}
if (cfrt == null) {
addActionError("Please Enter Confirm New Rate");
} else if (!cfrt.equals(newrt)) {
addActionError("New Rate & Confirm New Rat... |
624f43ea-570b-4c1e-a30e-c1a182b3fdf8 | 0 | @After
public void tearDown() {
} |
8071203f-4c45-47ed-b3a9-55a03f70ab06 | 8 | public int lengthOfLongestSubstring(String s) {
int rstart = 0;
int rend = 0;
int mstart = 0;
int mend = 0;
if (s == null)
return 0;
if (s.length() == 0)
return 0;
if (s.length() == 1)
return 1;
for (int start = 0; start... |
d8b99c17-69f9-4c47-b9a9-e9918177a4b8 | 2 | public static void main(String[] args) {
/**
* Created 2 threads, and assign tasks (Processor(i).run) to the threads
*/
ExecutorService executor = Executors.newFixedThreadPool(2);//2 Threads
for (int i = 0; i < 2; i++) { // call the (Processor(i).run) 2 times with 2 threads
... |
7bacce45-ec09-45d9-8ab0-1092efbf9e0d | 1 | public void dispose() {
if (program != 0) {
disposeShaders();
GL20.glDeleteProgram(program);
program = 0;
}
} |
71625c24-df51-4f65-8127-9f0cb3624a36 | 7 | @EventHandler
public void SkeletonHarm(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("Skeleton.Harm.D... |
a381fbfe-6acd-4a67-8ff7-5109944e1016 | 2 | public ArrayList<SignatureFile> getSelectedFiles() {
ArrayList<SignatureFile> list = new ArrayList<SignatureFile>();
for (int i = 0; i < user.getFiles().size(); i++) {
if (this.isSelected(i)) {
list.add(user.getFiles().get(i));
}
}... |
bb9679b4-fec1-4ada-86a5-d1399bb88a32 | 9 | public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
int n = Integer.parseInt(st.nextToken());
Point[] horizontal = new Point[n];
Point[] vertic... |
f3e795a8-63d7-4411-8daa-e9963f678dcd | 5 | private boolean setPlus(int cardNumber, int playerNumber)
throws ContradictionException {
if (table[cardNumber][playerNumber] == Resolution.Minus) {
Card card = cardSet.cards.get(cardNumber);
String player = getCompartments().get(playerNumb... |
e65ba9ae-7177-4f93-bef3-b27d6701e943 | 7 | private String convertProduct(Product product)
{
StringBuffer result = new StringBuffer();
//First the uriref for the subject
String subjectURIREF = product.toString();
//rdf:type
result.append(createTriple(
subjectURIREF,
createURIref(RDF.type),
createURIref(BSBM.Product)));
//rdfs:... |
ce52e38f-6757-425c-9f28-151a835a16a5 | 0 | public void addCommand(Command command) {
commands.put(command.getName(), command);
} |
5411e67f-ed00-4b9c-aba3-382e517a49d3 | 7 | public void insert(Comparable c) {
if (list.isEmpty()) {
list.insertFront(c);
return;
}
try {
if (c.compareTo(list.front().item()) < 0) {
list.insertFront(c);
return;
}
if (c.compareTo(list.back().item()) > 0) {
list.insertBack(c);
return;
}
ListNode node = list.front();
wh... |
f9fe9244-b052-4221-9dea-671251b4e3e3 | 9 | public static void createFurnace(Player p){
createRecipesDirectory();
ItemStack in = null;
//9, 10, 11, 18, 19, 20, 27, 28, 29 .. 17
in = (p.getInventory().getItem(29) != null) ? p.getInventory().getItem(29) : null;
ItemStack out = (p.getInventory().getItem(17) != null) ? p.getInventory().getItem(17) : new... |
f60a7fdc-efb5-4976-b8fa-79f82f354204 | 1 | public Pass1(File source) {
this.temp = new File(source.getName() + ".tmp"); // Create the temporary file
this.tempLabel = new File(source.getName() + ".label.tmp");
lineNumber = 0; // Used to indicate what the line number of the file we are working on
recursionCounter = 0; ... |
b3aa265c-09ae-4ec7-bc4c-9039e8f7d13d | 7 | public omaArrayList<Aim> getShortestRoute(Tile endPoint) {
int distance = pathTable[endPoint.getRow()][endPoint.getCol()];
omaArrayList<Aim> path = new omaArrayList<Aim>();
Aim[] table = { Aim.NORTH, Aim.EAST, Aim.SOUTH, Aim.WEST };
Tile tile = endPoint;
Tile newTile;
while (distance > 0) {
for (int i = ... |
ad37cc0c-741d-4c30-aae3-7870109a1fd5 | 9 | public void stringToBlockMap(String key){//Make it a 2D array instead of a long list
int i = 0;
if(key != null){
for(int z=0; z<depth; z++){
for(int y=0; y<height; y++){
for(int x=0; x<width; x++){
if(key.length() > i){
s... |
4d685405-1d16-488b-898b-21f65ba875d9 | 9 | public static <F> DiscreteObjectChooser<F>
estimate(FeatureExtractor<F> featureExtractor,
List<List<F>> alternativeObjectss,
int[] choices,
int minFeatureCount,
RegressionPrior prior,
int priorBlockSize,
Annea... |
943e8fa7-a2b9-49bb-9be6-943082b92f64 | 4 | @Override
public Imagem aplica(Imagem imagem) {
Imagem novaImagem = new Imagem(imagem.getWidth(), imagem.getHeight());
int metadeTamanho = (int) Math.floor((float)getTamanho() / 2);
for(int x = metadeTamanho; x < imagem.getWidth() - metadeTamanho; x++) {
for(in... |
be9defd3-354b-40d9-9751-432c94ed8f5a | 5 | protected void printWordTopicDistribution(_Doc d,
File wordTopicDistributionFolder, int k) {
_ParentDoc4DCM pDoc = (_ParentDoc4DCM) d;
String wordTopicDistributionFile = pDoc.getName() + ".txt";
try {
PrintWriter pw = new PrintWriter(new File(
wordTopicDistributionFolder, wordTopicDistributionFile));
... |
565ee27f-24aa-4340-92f3-1e48298387ed | 1 | public void request() {
if (mState != null) {
mState.handle(this);
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.