method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
62532c0f-630d-4fef-8e63-7146d82af7b7 | 7 | private void preprocessDataOne(){
// Check row and column lengths
this.numberOfRows = this.values.length;
this.numberOfColumns = this.values[0].length;
for(int i=1; i<this.numberOfRows; i++){
if(this.values[i].length!=this.numberOfColumns)throw new IllegalArgumentExceptio... |
12afd75c-2e4a-4794-8e59-99d67e67d4f2 | 1 | public static boolean inRange(Range range, double val) {
return val >= range.min() && val <= range.max();
} |
e26f65dc-2982-4ef3-a171-a7f4fe9e88c4 | 3 | public static void f(int i) {
System.out.println("Initialization that requires cleanup");
try {
System.out.println("Point 1");
if (i == 1)
return;
System.out.println("Point 2");
if (i == 2)
return;
System.out.println("Point 3");
if (i == 3)
return;
System.out.println("End");
retu... |
e67b6ac5-8bb9-4c4b-ac35-bcb55d17d92d | 5 | @Override
public boolean equals(Object o) {
if (!(o instanceof Duration)) {
return false;
}
if (o == this) {
return true;
}
Duration d = (Duration) o;
if (d.getDurationValue() != this.getDurationValue()) {
return false;
}... |
f1743b5c-7c3e-456b-bf70-f2b80492d8cd | 1 | public void leaveAllChannels(User user){
try {
Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
String url = "jdbc:derby:" + DBName;
Connection connection = DriverManager.getConnection(url);
Statement statement = connection.createStatement();
String deleteStatement = "DELETE FROM userchatrela... |
05f19fe5-a6a7-4003-a628-00401ea26df7 | 2 | public static boolean isApplicable(Object object) {
if (object instanceof Grammar)
{
Grammar g=(Grammar) object;
if (g.isConverted())
{
// System.out.println("false");
return false;
}
// System.out.println("true");
return true;
}
return false;
} |
080a41d2-a593-48b3-9a4e-f599b4390140 | 2 | public static void writeBytesToFile(File theFile, byte[] bytes) throws IOException {
BufferedOutputStream bos = null;
try {
FileOutputStream fos = new FileOutputStream(theFile);
bos = new BufferedOutputStream(fos);
bos.write(bytes);
} finally {
if... |
458b80f2-bfcf-4364-8317-e5eb36adfab7 | 6 | @Override
public void doPlayCard(UIDataInterface data, List<CardInterface> cards, PacketFactoryInterface pf, Status status) {
for (CardInterface c : cards) {
try {
pf.sendPlayCardPacket(c.getNation(), c.getValue());
switch (status.waitForStatus()) {
... |
eea4e162-15cf-462e-9de2-e673affdb5f7 | 6 | public int trap(int[] height) {
//skip zeros
int cur = 0;
while (cur < height.length && height[cur] == 0)
++cur;
int volume = 0;
Stack<Integer> stack = new Stack<>();
while (cur < height.length) {
while (!stack.isEmpty() && height[cur] >= height[... |
d3fefb14-0411-4808-a26f-da6dbb96edde | 9 | @Override
public void buttonB(boolean pressed) {
if(enabled) {
if(ses2 != null) {
setFlagsFalse();
if(future != null) {
future.cancel(true);
}
}
if(pressed == true) {
bFlag = true;
dllProc.dll_keyPressed(container.xgetCurrentPreset().xgetBAssignedKeyCode());
if(... |
707f9d8a-bec8-4c44-85bf-990b6ee6eb53 | 7 | public double[] train(double[] scans){
double value;
getNext(scans);
for(int i = 0; i < _output.length; i++){
_outputDelta[i] = dTransfer(_output[i]) * (scans[i + _inputCount] - _output[i]);
}
for(int i = 0; i < _hiddenLayer.length; i++){
value = 0;
for(int j = 0; j < _output.length; j++)... |
925543f7-a055-43e7-8f19-3675f18e8399 | 3 | @Override
public boolean updateBook(Book book) {
if (doc == null)
return false;
Element currRoot = doc.getRootElement();
Element parentBooks = currRoot.getChild("books");
for (Element currBook : parentBooks.getChildren()) {
String isbn = currBook.getChild("isbn").getText();
if (book.getIsbn().equals(... |
69b62eaf-94fd-4d22-ab03-f6f64fbc22b6 | 5 | static Number toNumber(Object value,
Class targetClass) throws ConversionException {
if (value instanceof Number) {
return (Number)value;
} else {
String str = value.toString();
if (str.startsWith(HEX_PREFIX)) {
try {
... |
73931e63-1fd5-46f5-8f2c-4349ed83b56f | 5 | private static long readInteger(long min, long max) { // read long integer, limited to specified range
long x=0;
while (true) {
String s = readIntegerString();
if (s == null){
errorMessage("Integer value not found in input.",
"Integer in t... |
fe4128c0-5c58-4c83-93cd-94da70771676 | 0 | public Pizza getPizza() { return pizzaBuilder.getPizza(); } |
60ad1e44-2cd3-4d41-9f90-8bf661128fb6 | 7 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Result other = (Result) obj;
if (data == null) {
if (other.data != null)
return false;
} else if (!data.equals(other.data))
return fa... |
1544f815-05c5-4843-807b-1d42b7b37799 | 9 | static Method[] getMethodList(Class<?> clazz) {
Method[] methods = null;
try {
// getDeclaredMethods may be rejected by the security manager
// but getMethods is more expensive
if (!sawSecurityException)
methods = clazz.getDeclaredMethods();
} ... |
9b252f07-6cb5-4e24-83fd-bddf0662c945 | 4 | private boolean validacion(Punto p) {
return !(p.x < 0 || p.y < 0 || p.x > Tablero.columnas - 1 || p.y > Tablero.filas - 1 || esVibora(p));
} |
f4022ca1-5e51-4ebc-ab31-f542ff65c197 | 7 | public JMenuBar createMenuBar() {
// Create the menu bar
JMenuBar menuBar = new JMenuBar();
menuBar.putClientProperty("jgoodies.headerStyle", "Both");
// Menu for all beans to demo
JMenu componentsMenu = new JMenu("Components");
componentsMenu.setMnemonic('C');
... |
161872a3-d118-4609-9036-b36be40fbe2e | 4 | public String CalculateReversePolishExpression(String subStr) {
List<String> suffix = createReversePolishExpression(subStr);
Stack<Double> stack = new Stack<Double>();
for (int i = 0; i < suffix.size(); i++) {
if (!isOperatorType(suffix.get(i))) {
stack.push(Double.valueOf(suffix.get(i)));
} else if (is... |
6ae0c63f-0dcf-4607-b02a-9cc75e32232d | 7 | @Override
public int getMetricInternal() {
if(initialMove != 0)
Util.runToNextInputFrame();
Util.runToAddressNoLimit(0, initialMove, curGb.pokemon.afterDVGenerationAddress);
int bc = curGb.getRegister(Register.BC);
int atk = (bc >> 12) & 0xF;
int def = (bc >> 8) & 0xF;
int spd = (bc >> 4) & 0xF;
int s... |
2bdc3c43-998e-4074-94d0-2c16e7d005eb | 0 | public void setLayer(Layer layer) {
this.layer = layer;
} |
7a167679-5d67-48d5-a0fc-ea9af2b074f6 | 5 | public void showVertragsMenu() {
//Menüoptionen
final int NEW_LEASING_CONTRACT = 0;
final int NEW_SALE_CONTRACT = 1;
final int SHOW_CONTRACTS = 2;
final int BACK = 3;
//Vertragsverwaltung
Menu maklerMenu = new Menu("Vertrags-Verwaltung");
maklerMenu.addEntry("Neuer Mietvertrag", NEW_LEASING_CONTRACT)... |
415700af-e947-4619-82b0-73b001daf305 | 3 | public void jouerPartie() {
int x = this._parametre.getNbCaseX();
int y = this._parametre.getNbCaseY();
this.casesBateaux = new HashMap();
for (int i = 0; i < x; i++) {
for (int j = 0; j < y; j++) {
if (this._j1.getCases().get(i + j * x).getBateau() !... |
1f626120-0220-471c-bfa8-ac5565d518b7 | 6 | public void recursiveGetCategory(List<String> list, SecuredTaskBean pro) throws GranException {
SecuredUDFValueBean contentFAQ = pro.getUDFValues().get(PRODUCT_CATEGORY_UDFID);
if (contentFAQ != null) {
Object cFaq = contentFAQ.getValue();
if (cFaq != null) {
Stri... |
12f98c8a-3a9a-4014-b2c4-b3e2fb6d3917 | 2 | public double[] standardizedItemMeans(){
if(!this.dataPreprocessed)this.preprocessData();
if(!this.variancesCalculated)this.meansAndVariances();
return this.standardizedItemMeans;
} |
f268161b-5b19-4232-b557-d83f4a72c26a | 4 | public synchronized long getLongID( int whichID ) {
if( whichID < 0 && whichID > 3 )
return -1;
try {
ResultSet result = SQL_SEARCH[ whichID ].executeQuery();
if( result.first() ) {
return result.getLong( 1 );
} else {
return -1;
}
} catch ( Exception e ) {
e.printStackTrace();
return... |
45c68b0a-b2c7-4109-b93c-d0440828bbf9 | 4 | @Override
public void addEdge(N from, N to) {
if(containsNode(from) && containsNode(to) && !containsEdge(from, to)) {
nodes.get(from).add(new Edge<N>(from, to));
if(!isDirected) {
nodes.get(to).add(new Edge<N>(to, from));
}
}
} |
bd71d81a-8fce-44a8-851b-a019d3642218 | 2 | public void removeUser(User user) {
try {
GameManager.getInstance().removeUserFromGame(user);
users.remove(user);
authenticatedUsers.remove(user);
if(user.getUser_name() != null)
System.out.println("User " + user.getUser_name() + " disconnected");
else
System.out.println("User " + user.getPort(... |
9be49dd5-aaa3-4809-9bc6-ae6ef8d416e3 | 1 | public void dbInsert(String SDA, String DN) {
try {
//System.err.println("DBThread Runs");
Class.forName("com.mysql.jdbc.Driver");
connect = DriverManager.getConnection("jdbc:mysql://localhost/cdr_data?user=root&password=root");
preparedStatement = connect.prepare... |
12a3bf1e-f065-4b5b-97cc-47c1f13f549b | 2 | protected void incrementTime() {
currentTime = MathUtils.clamp(currentTime + Theater.getDeltaSpeed(0.025f), 0, duration);
if(currentTime >= duration) {
if(loop) {
processLoop();
return;
}
complete();
}
} |
803c4c16-188c-46da-a175-6a24bef12d28 | 5 | public boolean mentir(int probabilidad){
int probMentira = (int) (Math.random() * 100);
if(probabilidad == 20){
if(probMentira < 21){
return true;
}else{
return false;
}
}else if (probMentira == 50){
if(probMentira < 51){
return true;
}else{
return false;
}
}else{
if(probMen... |
f97dc3d0-aa52-4f0e-b01b-4273531809d3 | 9 | @Override public void run(){
try{
/*
while(cc.Alive()){
Thread.sleep(10000);
if(lastStoredMessage.equals(lastSentMessage)){
lastSentMessage = getPingMessage();
cc.getDataTransfer().sendMessage(lastSentMessage);
}else{
try{
cc.getDataTransfer().sendMessage("You Don't Have A Prope... |
d11d8058-9628-4a5c-b264-5d7c4079c56f | 4 | private void applyHTTPSettings( Environment<String,BasicType> httpConfig )
throws ConfigurationException,
IOException {
Environment<String,BasicType> httpSettings = httpConfig.getChild( Constants.KEY_HTTPCONFIG_SETTINGS );
if( httpSettings == null ) {
this.getLogger().log( Level.INFO,
getClass... |
5ffac8c3-abfb-4439-8cbb-b10ba72b83a3 | 7 | private void showCharacterAttributes(final AttributeSet a) {
String name = StyleConstants.getFontFamily(a);
int k = 0;
for (int i = 0; i < ModelerUtilities.FONT_FAMILY_NAMES.length; i++) {
if (name.equals(ModelerUtilities.FONT_FAMILY_NAMES[i])) {
k = i;
break;
}
}
fontNameComboBox.removeActionLi... |
9ad1c393-30fd-4aa2-84b1-9cc2ee04dd5b | 6 | protected synchronized int getPrimaryKeyId() {
if (primaryKeyId == -1) {
ResultSet rs = null;
Statement stat = null;
try {
stat = db.getConnection().createStatement();
rs = stat.executeQuery("SELECT MAX(" + getTableIdCol() + ") FROM " + getTableName());
primaryKeyId = rs.next() ? rs.getInt(1) : 0... |
f30bab9c-7d56-4b06-87f8-528cac830631 | 7 | @Override
public void executeMsg(Environmental host, CMMsg msg)
{
if((affected instanceof Armor)&&(msg.source()==((Armor)affected).owner()))
{
if((msg.targetMinor()==CMMsg.TYP_REMOVE)
||(msg.sourceMinor()==CMMsg.TYP_WEAR)
||(msg.sourceMinor()==CMMsg.TYP_WIELD)
||(msg.sourceMinor()==CMMsg.TYP_HOLD)
... |
57909b06-ba09-42f6-8509-94b4d65bdc3e | 3 | @Override
public int pulse() {
int digit = getDigitToTypeIndex();
if (digit != -1) {
Widget click = getEnterDigit(bankPin[digit]);
if (click.isValid()) {
click.click();
sleep(1000, 1500);
} else {
requestExit();
... |
545678e6-58ac-4288-825d-26f05f5657c0 | 6 | @EventHandler
public void BlazeBlindness(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.getBlazeConfig().getDouble("Blaze.Blindnes... |
54405264-0b75-4ceb-affe-55fad011ad2e | 6 | public void run()
{
try
{
URL var1 = new URL("http://s3.amazonaws.com/MinecraftResources/");
DocumentBuilderFactory var2 = DocumentBuilderFactory.newInstance();
DocumentBuilder var3 = var2.newDocumentBuilder();
Document var4 = var3.parse(var1.openStrea... |
2ff0ecaa-8174-4379-9bd3-4dd94db4f18e | 8 | public int jump(int[] A) {
if(A == null || A.length == 0 || A.length == 1) return 0;
int i = 0;// i keeps the index that can reach the max position
int res = 0;
while(i < A.length-1){
++res;
if(i + A[i] >= A.length - 1) return res;
int k = i;
... |
035d30b9-8637-4eb0-82c1-8ee14d58a43c | 1 | public long getElapsedTime() {
long elapsed;
if (running) {
elapsed = (System.currentTimeMillis() - startTime);
}
else {
elapsed = (stopTime - startTime);
}
return elapsed;
} |
1ffc1e3d-3374-46fa-9627-0ccbbec2c828 | 2 | public List<OrgaEinheit> getOrgaEinheiten(){
ResultSet resultSet;
List<OrgaEinheit> rueckgabe = new ArrayList<OrgaEinheit>();
try {
resultSet = db
.executeQueryStatement("SELECT * FROM OrgaEinheiten ORDER BY OrgaEinheitBez");
while(resultSet.next()){
rueckgabe.add(new OrgaEinheit(resultSet, db, this... |
4de9128f-350e-4fa2-b89e-bdf26b9ff48a | 1 | private void startOutput(String fileName){
leavesNodeFile = new File(fileName + ".leavesNode.txt");
try {
leavesNodeFileWriter = new FileWriter(leavesNodeFile);
leavesNodeFileWriter.write("開始時間: " + getRightNowTimeStr("/", ":", " ") + "\r\n");
} catch (IOException e1) {
// TODO Auto-generated catch block... |
b861b3d2-ced6-4236-98b6-698dd4021f98 | 8 | private void testClear() {
thePuzzle.reset();
boolean answer = true;
int row = 0;
int column = 0;
while (column != 9 && answer == true) {
while (row != 9 && answer == true) {
if (thePuzzle.getValueAtPosition(row, column) != 0) {
System.out.println("Clearing tests failed");
answer = fals... |
b3699308-cb11-4aa1-ad81-f3b2610a4fc2 | 5 | public static void appendStringToFile(File file, String string) {
FileWriter fw = null;
BufferedWriter bw = null;
PrintWriter pw = null;
try {
fw = new FileWriter(file, true);
bw = new BufferedWriter(fw);
pw = new PrintWriter(bw);
pw.printl... |
ff4df7c3-7b7d-4ee7-881f-03343f1fdd0f | 2 | public void updateImage()
{
//we will update animation when delay counter reaches delay, then reset delay counter
delayCounter++;
if(delayCounter>delay)
{
delayCounter=0;
frameNumber--;//updates frame to next frame
if(frameNumber < totalFrame-12)
{
frameNumber=11;// if surpass 12th frame, back ... |
6dbfbc43-96ed-46d8-bfcf-138dd7d53a60 | 1 | public double area() {
double area = 0;
for(int i=1; i<this.corners.length; i++)
area += this.corners[i-1].cross(this.corners[i]);
return area;
} |
b234cf46-e8f2-4cc7-a76c-202186035348 | 5 | public ArrayList<String> getPrimaryKeys(String tn, boolean caps){
ArrayList<String> pkList=new ArrayList<String>();
try {
Connection conn;
ResultSet pks;
Class.forName("oracle.jdbc.driver.OracleDriver");
conn = DriverManager.getConnection(dbUrl, un, pwd);
... |
8cfda8f7-82dd-407a-8089-6a78207918a7 | 9 | public static void printCurrentDirectMemory(StringBuilder store) {
long totalHeld = 0;
long heapMem = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();
boolean printStout = store == null;
if (store == null) {
store = new StringBuilder();
}
... |
2a6f9366-26e0-406a-b023-4632ea2c2f7b | 6 | public static HashMap<String, Integer> rareCounter(String countFile,
String dataFile) throws IOException {
HashMap<String, Integer> wordToCount = new HashMap<String, Integer>();
FileReader in = new FileReader(countFile);
BufferedReader br = new BufferedReader(in);
StringTokenizer stk;
String input;
St... |
0065df5c-c861-47a6-b638-808d5e617165 | 4 | public Object getValueAt(int rowIndex, int columnIndex) {
Proceso aux;
// Se obtiene la persona de la fila indicada
aux = (Proceso)(datos.get(rowIndex));
// Se obtiene el campo apropiado según el valor de columnIndex
switch (columnIndex)
{
ca... |
ac367156-ca85-41b0-9253-2e548b9c33a0 | 6 | private void rot13(CharBuffer cb) {
for (int pos = cb.position(); pos < cb.limit(); pos++) {
char c = cb.get(pos);
char a = '\u0000';
// Is it lowercase alpha?
if ((c >= 'a') && (c <= 'z')) {
a = 'a';
}
// Is it uppercase alpha?
if ((c >= 'A') && (c <= 'Z')) {
a = 'A';
}
// If eith... |
67987680-cd1c-4801-9c53-af505cc7683b | 3 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result
+ ((birthday == null) ? 0 : birthday.hashCode());
result = prime * result + ((email == null) ? 0 : email.hashCode());
result = prime * result
+ ((password == null) ? 0 : password.hashCode());
return resu... |
ca5ee267-7923-4525-abac-efe9913c8eea | 4 | protected String getJarName(URL url)
{
String fileName = url.getFile();
if (fileName.contains("?")) {
fileName = fileName.substring(0, fileName.indexOf("?"));
}
if (fileName.endsWith(".pack.lzma"))
fileName = fileName.replaceAll(".pack.lzma", "");
else if (fileName.e... |
9163acd1-cecb-4805-9d1f-2b1fae5ff56a | 1 | public void testUnmatchedClosedWithOtherValidParensParenthesis() throws Exception {
String openParenString = "(3) + 5)";
try {
new Expression(openParenString);
fail("Did not throw exception");
} catch (MalformedParenthesisException mpe) {}
} |
270eadeb-bcd5-45a3-88c8-fd82240de0a9 | 6 | static final void method2403(int i, int i_7_, int i_8_, int i_9_,
int i_10_, int i_11_, int i_12_) {
anInt9977++;
if (i_10_ != 19206)
method2402(-3, (byte) 46);
Class302[] class302s = Class348_Sub27.aClass302Array6897;
for (int i_13_ = 0;
(class302s.length ^ 0xffffffff) < (i_13_ ^ 0xffffffff); i_13_... |
ec2de0ca-4d80-4d98-ab9e-da4a4d425edd | 0 | @Override
public String toString() {
return super.toString().concat(" - Live States: " + liveStates);
} |
6bbc5ff8-3c63-4693-868a-2304e9408954 | 2 | private static void thirdStrategy()
{
Semaphore MReading = new Semaphore(1);
Semaphore MWriting = new Semaphore(1);
Semaphore MPrio = new Semaphore(1);
Random r = new Random();
while(true)
{
if(r.nextDouble() > 0.5)
new Lecteur2(MReading,MWriting,MPrio).run();
else
new Redacteur2(MWriting... |
fa425cfa-fe93-493a-ab3c-359d28933381 | 9 | private int[] goalPosition(int number)
{
switch(number) {
case 1: return new int[] {0, 0};
case 2: return new int[] {0, 1};
case 3: return new int[] {0, 2};
case 4: return new int[] {1, 0};
case 5: return new int[] {1, 1};
case 6: return new int[] {1, 2};
case 7: return new int[] {2, 0};
... |
9f750c4e-55e9-4bc7-8115-6b85ec751435 | 3 | public void setUpComboBoxes(Set<Card> cards) {
for (Card card : cards) {
String name = card.getName();
if (card.getType().equals(CardType.PERSON)) {
peoplePossibilities.addItem(name);
} else if (card.getType().equals(CardType.WEAPON)) {
weaponsPossibilities.addItem(name);
}
}
personGuess.ad... |
40f7b05f-8203-4ec2-b1ec-df496c21168d | 5 | public static void main(String[] args) {
// TODO code application logic here
// 3. Mira esta serie: 60, 30, 20, 15, 12 ... la semilla de esta serie fue el número 60.
//Cree una función que recibe dos enteros: x, y y. Si alguno de ellos es 0 o negativo, o si son mayores que 255, la función debe devolver -... |
bebbc396-5d25-4d44-840b-24f172d258c1 | 1 | public String Dump() {
if (rend != null) {
return rend.Dump();
}
return "";
} |
52c33a3a-daed-427e-a1b9-9c02633aa837 | 9 | public boolean equals(Object obj) {
if (obj == null)
return false;
if (!(obj instanceof PlaceUI))
return false;
PlaceUI p = (PlaceUI) obj;
if (p == this)
return true;
if ((this.getX() == p.getX()) && (this.getY() == p.getY())
&& (this.getTokens() == p.getTokens())
&& (this.getId() == p.get... |
40ea3fa3-1e92-48c2-b126-af335b885a9c | 4 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
DbObject dbObject = (DbObject) o;
if (!name.equals(dbObject.name)) return false;
return true;
} |
17032e61-e8bc-4622-8a92-2e08ead8fd9e | 2 | @SuppressWarnings("static-access")
private void showDocument(Document doc) {
StringBuffer content = new StringBuffer();
Node node = doc.getChildNodes().item(0);
newFirmNode firmNode = new newFirmNode(node);
content.append("Название фирмы \n");
List<officeNode> offices = firmNode.getOffices();
//инициализ... |
bc0edbba-872c-40e0-966c-e03a872a1895 | 4 | private StringBuffer Get10kContent(String urlStr) {
int chByte = 0;
URL url = null;
HttpURLConnection httpConn = null;
InputStream in = null;
StringBuffer sb = new StringBuffer("");
try {
// int len = 0;
url = new URL(urlStr);
httpConn = (HttpURLConnection) url.openConnection();
HttpURLConn... |
9041544c-9b3b-4f35-8d5c-0328fdabb303 | 7 | private void preencherCampos() {
ArrayList<String> telefones;
ArrayList<Premiacao> premiacoes;
jTextFieldAltura.setText(Double.toString(piloto.getAltura()));
jTextFieldBairro.setText(piloto.getEndereco().getBairro());
jTextFieldCategoriaPeso.setText(Double.toString(piloto.getPes... |
560596d1-3ee8-4f72-bf0a-5a332f9ac2a9 | 0 | @Override
public boolean runWithoutCheats() {
return true;
} |
d7547ed5-0ae9-4c27-8dd5-16e9539c536f | 2 | @Override
public void run()
{
while (this.running)
{
try
{
//listen
Socket socket = this.serverSocket.accept();
//handle
Transaction transaction = new Transaction(this, socket);
transaction.handle();
}
catch (IOException ioException)
{
}
}
} |
51b27f11-0dce-4b2a-b2f2-a86e169214dd | 3 | protected String getCanonicalName(String name) {
for (String[] aTYPE1_FONT_NAME : TYPE1_FONT_NAME) {
for (String anATYPE1_FONT_NAME : aTYPE1_FONT_NAME) {
if (name.startsWith(anATYPE1_FONT_NAME)) {
return aTYPE1_FONT_NAME[0];
}
}
... |
398bc330-30bd-4052-a0b3-af6615739ae3 | 7 | @Override
public int castingQuality(MOB mob, Physical target)
{
if(mob!=null)
{
final Room R=mob.location();
if(R!=null)
{
if((R.domainType()!=Room.DOMAIN_INDOORS_CAVE)
&&(R.domainType()!=Room.DOMAIN_OUTDOORS_CITY)
&&(R.domainType()!=Room.DOMAIN_OUTDOORS_MOUNTAINS)
&&(R.domainType()!=Room... |
8aa2548c-23e6-48ba-81bd-5779d316b430 | 4 | public List<DeliveryOption> getFeasible(Cart rx)
{
Set<DeliveryOption> ret = new HashSet<>(getAll());
log.info("Filtering total {} options", ret.size());
List<Set<DeliveryOption>> options = new ArrayList<>();
for(Class<? extends AbstractConstraint> clazz : constraintClasses)
try
{
AbstractConstraint ... |
613da63e-f1ee-4abc-9a34-74b78a46553b | 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... |
b99f02bb-33f4-497c-adb5-2eeb3b1445b8 | 3 | public static boolean doesPortalExist( String name ) {
for ( ArrayList<Portal> list : portals.values() ) {
for ( Portal p : list ) {
if ( p.getName().equalsIgnoreCase( name ) ) {
return true;
}
}
}
return false;
} |
2b0e5239-d1ff-4bb9-9ccb-7e93779eafa5 | 8 | public int[] getAvailable()
{
int[] unavailable = getUnavailableSpots();
int[] available = new int[maxSpots];
for(int i = 0; i < maxSpots; i++)
{
available[i] = i+1;
}
for(int i = 0; i < unavailable.length; i++)
{
for(... |
79860d3e-0e61-4c52-8e52-88326ca291b4 | 7 | public HashMap vectorMap (String query) throws SQLException
{
Connection connection = null;
Statement statement = null;
ResultSet result = null;
String key = "";
String val = "";
HashMap hashedList = new HashMap();
Vector value = new Vector();
try
{
Class.forName(driver);
connection = Drive... |
c4b0e031-b5fc-428f-843b-dbda06a451c2 | 9 | public static int shortLength(short n) {
return n < 0 ? n < -99 ? n < -9999 ? 6 : n < -999 ? 5 : 4 : n < -9 ? 3 : 2 : n < 100 ? n < 10 ? 1 : 2 : n < 1000 ? 3 : n < 10000 ? 4 : 5;
} |
c2911385-c661-4d09-984d-0f478281fc7f | 4 | private Node atom() {
// NUMBER
// | TRUE | FALSE
// | LPAREN^ sumExpr RPAREN!
// | variable
TokenType type = lookAhead(1);
if (type == TokenType.NUMBER) {
Token t = match(TokenType.NUMBER);
return new NumberNode(t.getPosition(), t.getText());
} else if (type == TokenType.TRUE) {
return new TrueN... |
9a9abd39-2500-4cc5-8862-6edeb48efcbc | 1 | protected void calcDIR_CrtTime() {
byte[] bTemp = new byte[2];
for (int i = 14;i < 16; i++) {
bTemp[i-14] = bytesOfFAT32Element[i];
}
Integer temp = byteArrayToInt(bTemp);
DIR_CrtTime = ((temp & 0b111110000000000) >> 10) + ":" + ((temp & 0b1111110000) >> 5) +... |
9eab54e9-95af-4920-9976-be1ac5b019da | 1 | public void prepar() {
while (notReadyToPlay()) {
score += somme();
deleteTheSame();
gravity();
fillGaps();
}
} |
bf735dc2-149c-4a1b-8eb4-f175c4684b87 | 1 | public void testToStandardMinutes() {
Days test = Days.days(2);
Minutes expected = Minutes.minutes(2 * 24 * 60);
assertEquals(expected, test.toStandardMinutes());
try {
Days.MAX_VALUE.toStandardMinutes();
fail();
} catch (ArithmeticException ex) {... |
865f9660-f2da-4213-be2a-eee031c39e9e | 0 | public int getSize() {
return size;
} |
d6848240-83ef-4254-876e-d58191995822 | 1 | private void visualizeBestAndWorstSystemsW() {
String reliability = isWReliable ? "" : "but some consumption parameters were missing";
String results = "BEST SYSTEMS:\nEVALUATING WATT CONSUMPTION:\n" + bestSoftwareSystemW.bestWToString() + "\nBEST OF BESTS: " + bestSoftwareSystemW.getSystemConsumptionW() + "KW " + ... |
21c95d01-0246-4a36-b3b3-1f14338c62fe | 0 | private Volume(int conversionFactor, String name) {
super(conversionFactor, name);
} |
60fbd716-ffcb-48e8-b21d-ec871cf2d239 | 5 | public void failout(String paramString1, String paramString2, Throwable paramThrowable)
{
System.err.println(paramString2);
if (paramThrowable != null) {
paramThrowable.printStackTrace();
}
Frame localFrame = null;
Object localObject = GameApplet.thisApplet;
while ((loca... |
6a27e2af-b82a-410f-b512-8c19d8b97a78 | 9 | @Override
public void process(Class<?> serviceClass) throws ESBBaseCheckedException {
if (ClassUtils.isAbstract(serviceClass)) {
return;
}
// 初始化临时服务池
if (this.tempServicePool == null || this.tempServiceContainerManager == null) {
synchronized (this) {
... |
8a1f9e1e-cabf-4b2a-bd71-0f402ec87d4c | 4 | public void setCellsFromLoad(String input) {
grid.reset();
if (player.getPlayer() != 1) {
player.changePlayer();
}
player.resetPlayer();
turn.resetTurn();
int tmp = gv.getRowSize()-1;
String inputWithoutWhitespaces = input.replaceAll("\\s+", "");
... |
db3d2a9a-9e8f-4791-8ffa-ed4422ab778f | 7 | public static void update() {
if (KeyHandler.getKey(Keys.F3) && !debugMode && count == 0) {
debugMode = true;
Util.enableWireframe();
System.out.println("Debug Mode enabled");
count++;
} else if (KeyHandler.getKey(Keys.F3) && debugMode && count == 0) {
... |
41b36d33-d6af-4236-b18e-d99de2985ac0 | 2 | public void showtab(Tab tab) {
Tab old = curtab;
if(old != null)
old.hide();
if((curtab = tab) != null)
curtab.show();
changed(old, tab);
} |
59f48563-9a40-47d6-b749-1aae9fa9989d | 1 | public void printAccounts() {
System.out.println("Bank: "+this.name);
for(Konto k:accountList) {
k.print();
}
} |
915d43a9-91af-4540-8d2c-b6aeee5c5525 | 1 | public Obstacle(Vector2 position, Vector2 scale, float boundingRadius) {
this.position = position;
this.scale = scale;
this.boundingRadius = boundingRadius;
try {
this.image = new Image("res/sprites/birdminigame/obstacle.png");
} catch (SlickException e) {
// TODO Auto-generated catch block
e.printSt... |
a149fd90-e022-40bb-a561-d0eb4a6d9080 | 3 | public void setProperPositions() {
for (LevelSegment seg : _layer1) {
seg.setX(seg.getSegmentColumn()*_defWidth);
seg.setY(1);
seg.setZ(seg.getSegmentRow()*_defThick-4);
}
for (LevelSegment seg : _layer0) {
seg.setX(seg.getSegmentColumn()*_defWidth);
seg.setY(0);
seg.setZ(seg.getSegmentRow()*_de... |
2d8407cc-6a1d-4c76-91a8-4c8a589182bb | 8 | private void remove(RemoveRequest req) {
StyledDocument doc = pane.getStyledDocument();
AbstractDocument aDoc = (AbstractDocument) doc;
int blob_ndx = Integer.MAX_VALUE;
try {
int difference = 0;
for (int ii = 0; ii < blobs.size(); ii++) {
if (ii... |
9062c882-ebdc-40b2-b94e-33bf6c8534ae | 1 | @Test
public void testRemove() throws IOException {
List<Class<?>> types = new ArrayList<>();
types.add(String.class);
types.add(Integer.class);
Table table = provider.createTable("simple", types);
Assert.assertNotNull(table);
Assert.assertNotNull(provider.getTable("... |
bc86aa76-fc49-483f-a37d-9de3c4ab0e73 | 2 | public Object opt(int index) {
return (index < 0 || index >= length()) ?
null : this.myArrayList.get(index);
} |
25e34bf7-96ce-44db-b576-1a8f575a54a7 | 7 | public static Polylinje returnShortestYellow(Polylinje[] polylinje) throws NoYellowPolylinjeException
{
// Hitta dem gula.
int antalGula = 0;
for(Polylinje p : polylinje)
{
if(p.getFarg().equals("gul"))
{
antalGula++;
}
}
Polylinje[] gulaPolylinjer = new Polylinje[antalGula];
System.out.pri... |
e828f5bb-95be-4557-9cc7-0e76b8ed78e3 | 5 | @Override
/**
* Currently just used to move a mob to a certain vector
*/
public void update() {
if (moveToVector != null) {
double dx = v.getX() - moveToVector.getX();
double dy = v.getY() - moveToVector.getY();
v.setX(dx < 0 ? v.getX() - Math.min(dx, speed)... |
0352cd1e-9903-429b-a00d-5b4db3c3c0ed | 7 | private void resetPosition(Tile current, int row, int col) {
if (current == null)
return;
int x = getTileX(col);
int y = getTileY(row);
int distX = current.getX() - x;
int distY = current.getY() - y;
if (Math.abs(distX) < Tile.SLIDE_SPEED) {
current.setX(current.getX() - distX);
}
if (Math.abs(dis... |
c5886dcf-ef87-4ad7-8de6-df04bd189caa | 3 | private static double intrinsicValue(String attribute,
ArrayList<HashMap<String, String>> examples,
HashMap<String, String[]> attributeValues) {
double out = 0;
for (String attrValue : attributeValues.get(attribute)) {
ArrayList<HashMap<String, String>> examplesWValue = new ArrayList<HashMap<String, String... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.