method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
ca6166b7-989b-4dc0-aa12-60596f57ca14 | 3 | public ArrayList<Integer> decoder(String chaine)
{
ArrayList<Integer> decoding = new ArrayList<Integer>();
String buffer = "";
for (int i = 0; i<chaine.length(); i++)
{
buffer += chaine.charAt(i);
for (ArrayList tab : this.tabBinary)
... |
cae2fdc3-ba6b-4bb2-9155-8dae579a8e71 | 4 | public ValidationResult validate(Object value) {
ValidationResult result = wrapped.validate(value);
if (result.ok && normalMessage != null) {
result = ValidationResult.ok(normalMessage);
}
if (!result.ok && warningMessage != null) {
result = ValidationResult.error... |
28fe645b-dabd-438f-a93d-26933069370a | 2 | public List leaves() {
Assert.isTrue(leaves != null);
final Iterator iter = leaves.iterator();
while (iter.hasNext()) {
final Expr e = (Expr) iter.next();
Assert.isTrue((e instanceof VarExpr)
|| (e instanceof ConstantExpr), "not a leaf: " + e);
}
return leaves;
} |
752ef0a3-87b3-43ab-92c4-8a4db773e0bc | 9 | public double cal() {
switch(op.tag) {
case '-':
return -(expr.cal());
case '+':
return expr.cal();
case Tag.SQR:
return Math.sqrt(expr.cal());
case Tag.TAN:
return Math.tan(expr.cal());
case Tag.SIN:
return Math... |
d7f091c4-1f9f-4bed-91cf-4dcc2f73bd97 | 4 | private PDFObject readDictionary(
ByteBuffer buf, int objNum, int objGen, PDFDecrypter decrypter) throws IOException {
HashMap<String,PDFObject> hm = new HashMap<String,PDFObject>();
// we've already read the <<. Now get /Name obj pairs until >>
PDFObject name;
while ((name= readOb... |
d2a37589-9767-4f1b-8b69-ddb940eb9d40 | 7 | public void readFileOaks() {
{
try
{
//File fw = new File();
//ArrayList<Oak> tmp = new ArrayList();
list1.removeAll(list1);
ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(new FileInputStream("fw.txt")));
list1 = (ArrayList<Oak>)in.readObject();
// list1.removeAll(list1);
... |
181e7230-bc09-4a5a-892b-ab265539eff0 | 6 | public static Cons yieldDefineStellaMethodObject(MethodSlot method, MethodSlot codemethod, MethodSlot wrappermethod) {
{ Stella_Object name = StringWrapper.wrapString(Native.stringify(method.slotName));
if (method.methodFunctionP) {
if (MethodSlot.defineFunctionObjectEagerlyP(method)) {
nam... |
96d5398a-a45d-4fca-913c-fc46c57eed7d | 0 | public void close() {
cleanUp();
super.close();
} |
b8b7a052-e2be-425f-a509-49495f822cbd | 9 | private void addToCounts(Instance instance) {
double [] countsPointer;
if(instance.classIsMissing())
return; // ignore instances with missing class
int classVal = (int)instance.classValue();
double weight = instance.weight();
m_ClassCounts[classVal] += weight;
m_SumInstances += w... |
0c1f8e44-741a-49dd-9699-bffd0a58467d | 0 | public void setMax(long value) {
this.max = value;
} |
a19a2177-fbeb-4d6f-bd3d-b6b5435b1d39 | 2 | protected int writeStream(HttpURLConnection conn, byte[] content) throws Exception {
OutputStream out = null;
try {
out = conn.getOutputStream();
out.write(content);
return conn.getResponseCode();
} finally {
if (out != null) {
try ... |
c5cc2e4d-141b-456e-b77b-541b79650db2 | 6 | public static void main(String argv[]) {
// JPL.setTraditional();
//
Query.hasSolution("use_module(library(jpl))"); // only because we call e.g. jpl_pl_syntax/1 below
Term swi = Query.oneSolution("current_prolog_flag(version_data,Swi)").get("Swi");
System.out.println("swipl.version = " + swi.arg(1) + "." + sw... |
04123aeb-116e-4d6f-bd88-bb9d1a56158a | 0 | protected final Object clone() {
return this;
} |
47da1f1e-4081-4a86-b04d-70c101989217 | 4 | public void shipInputReaction() {
if (getShip().isAccelerating()) {
accelerate(getShip());
}
if (getShip().isDecelerating()) {
decelerate(getShip());
}
if (getShip().isTurningAntiClockwise()) {
getShip().turnAntiClockwise();
}
i... |
7905b2bc-5c08-4788-81c0-0e1c3235daf0 | 0 | public void setCueCuentaConcatenada(String cueCuentaConcatenada) {
this.cueCuentaConcatenada = cueCuentaConcatenada;
} |
dede294c-c7a9-441d-bc4c-fd4d429cb4de | 6 | public void run() {
running = true;
while(running) {
int c = cServer.hasData();
if(c!=-1) {
//handle communication with connection c
Connection con = cServer.connections.get(c);
String line;
try {
line = con.getLine();
} catch (IOException e) {
continue; //this is weird.
}... |
f0905304-a836-48c4-810f-2e729ebebf3d | 3 | private int updateTel() {
int res = 0;
lblError.setVisible(false);
if (Validate.notOverSize(tfNyttTel)) {
if (Validate.isOkPhoneNumber(tfNyttTel.getText())) {
try {
DB.update("update anstalld set telefon = '" + tfNyttTel.getText() + "' where aid ="... |
14c2d39f-aa1f-4b94-8a23-7a2ff577490b | 0 | public boolean requiresPolygonIDs() {
// We really need them...
return true;
} |
3c5b091b-27a8-4523-b7b0-580bc8af2428 | 0 | public String getModifyAuther() {
return this.modifyAuther;
} |
68dbe321-1da0-4134-b438-c47081a83b3c | 4 | public void testSpasiZaposlenika() {
Osoba o=new Osoba();
Zaposlenik z=new Zaposlenik();
o.setImePrezime("Dzenana Mahmutspahic");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
try {
o.setDatumRodjenja(sdf.parse("1992-10-20"));
}
catch (j... |
21511e9b-e38d-4fd6-b62f-cbf967d56267 | 4 | private static String pluralize(String singular) {
return singular
+ ((singular.endsWith("s") || singular.endsWith("x")
|| singular.endsWith("sh") || singular.endsWith("ch")) ? "es"
: "s");
} |
9502c991-f199-45ea-8623-cb474b91c6ee | 1 | public Vector2f getSize()
{
if(transform.getRotation().getY() == 0)
return new Vector2f(1, 0.125f);
else
return new Vector2f(0.125f, 1);
} |
269ed7e1-7882-4336-ad59-74150751516a | 6 | public void draw(Graphics g)
{
Graphics2D g2d = (Graphics2D) g;
if(line != null)
{
g2d.setStroke(line);
}
g2d.drawRect((int) x, (int) y, (int) width, (int) height);
if (width < 0)
{
width = Math.abs(width);
x = x - width;
g2d.drawRect((int) x , (int) y, (int) width, (int) height);
... |
ab9c6ce9-830f-408d-9813-02c6b9145aaa | 3 | @Override
public boolean equals(Object obj) {
if (obj == this)
return true;
if (!(obj instanceof LatLng))
return false;
LatLng latlng = (LatLng) obj;
if (this.latitudeInternal != latlng.latitudeInternal) {
return false;
}
return this.longitudeInternal == latlng.longitudeInternal;
} |
8d814845-4b14-4b47-a0a4-2204c47ea53e | 4 | public boolean connect(String addr, String message) {
if (addr == null) {
System.out.println("No addresses: " + message);
}
if (!connected) {
System.out.println("Connecting network-client: " + addr);
try {
networkClient = Network.connectToS... |
15508d8e-a10f-4d8d-95ad-07d4f50ef6f0 | 4 | public void assertAction(SeleniumNode node) {
ElementAction annotation = node.getField().getAnnotation(ElementAction.class);
WebElement element = annotation.type().findElement(driver, node.getPath());
switch (annotation.assertType()) {
case EQUALS:
Assert.assertEquals(annotation.value(), element.getText());
... |
f9356adb-46e2-49d6-9c6e-3afe5a1007d8 | 3 | private OpCodes(Class<?> c)
{
System.out.println("Start " + c);
for (Field f : c.getFields())
try {
OpCode opCode = new OpCode(f.getName(), f.getInt(null));
this.codes.put(opCode.name.toUpperCase(), opCode);
ids.put(opCode.value, opCode);
} catch (Exception e) {
e.p... |
8518a0bd-71fb-4ef5-924f-82248dc5df9b | 0 | public static ArrayList<Excel> rotateX(int angle, ArrayList<Excel> toScale)
{
return Rotate.rotateX(angle, toScale);
} |
a139b51d-db3f-443d-b29e-c79fddfee65d | 1 | private boolean jj_3_72() {
if (jj_scan_token(VERTICALVERTICAL)) return true;
return false;
} |
f5e16eed-ed2c-4529-9b7a-cc9a288c4a6b | 9 | public void loadDataBase() {
if (dbLoadDialog == null) {
dbLoadDialog = new JDialog();
dbLoadDialog.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
dbLoadDialog.dispose();
}
});
... |
89317c42-e0ef-42d3-b13c-e20115139655 | 2 | public String update(String string, String string2) {
// TODO Auto-generated method stub
for (int i = 0; i < clientObj.length; i++) {
if((clientObj[i].getPassword()).equals(string)){
clientObj[i].setEmail(string2);
return clientObj[i].getEmail();
}
}
return null;
} |
08a6d0ae-b74e-4edf-b7db-d83eab63dcc0 | 0 | public void setSaleId(int saleId) {
this.saleId = saleId;
} |
a98a1d9f-7498-4ba4-89e7-999bcb676f25 | 9 | private static double[][] inv(double[][] arr) {
int N = arr.length;
double[][] M = new double[N][2 * N];
for (int i = 0; i < arr.length; i++) {
System.arraycopy(arr[i], 0, M[i], 0, N);
M[i][i + N] = 1;
}
for (int r = 0; r < N; r++) {
int k = r;
while (M[k][r] == 0) {
... |
6a539d34-598a-42bf-b8fe-7a1c414205f0 | 6 | public void setType(GameType type) {
gameType = type;
System.out.println("GameType " + gameType);
try {
//File excelFile = new File(cardValueFile);
if(gameType == GameType.FRACTIONS)
numberTypeFile = FRACTION_FILE;
else if(gameType == GameType.DECIMALS)
numberTypeFile = DECIMAL_FILE;
else if(... |
a57bd536-1d67-4124-9e32-18f2412a88fe | 0 | public static void main(String[] args) {
ApplicationContext context = new ClassPathXmlApplicationContext("classpath:beans.xml");
MainWindowView mainWindowView = (MainWindowView) context.getBean("mainWindowView");
mainWindowView.display();
} |
14ca077a-9614-47f1-b6df-1dc33891ef94 | 5 | private long getTimeFromType(String type) {
type = type.toLowerCase();
long remaining = task.getRemainingTime();
if(type.equals("d"))
return TimeUnit.MILLISECONDS.toDays(remaining) + 1;
else if(type.equals("h"))
return TimeUnit.MILLISECONDS.toHours(remaining) + 1;
else if(type.equals("m"))
return Tim... |
e0cacac9-b402-4259-9872-06083fbe44f8 | 9 | private static void exec(String[] args, HelloApp app) {
try {
if ("greet".equals(args[0]))
app.greet();
else if ("list".equals(args[0])) {
if (args.length > 1)
app.listPepleInCity(args[1]);
else
app.listPeple();
}
else if ("show".equals(args[0]))
app.showPersonByNameAndSurname(ar... |
11696160-a805-4845-ac7b-0f38c8b20ac2 | 4 | @Override
public void actionPerformed(ActionEvent ae) {
// ファイルオープンのダイアログを開く.
int returnVal = this.chooser.showOpenDialog(canvas);
if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = this.chooser.getSelectedFile();
DrawableReader reader = null;
try {
// readerを作成する.
... |
cc39ddf3-789c-49df-b8d8-f2212312f338 | 2 | public static QuizStatistic getQuizStatistic(int QuizId)
{
try
{
QuizStatistic qs = new QuizStatistic();
String statement = String.format("select distinct userid from quizresult where quizid = %d", QuizId);
ResultSet rs = getQueryResults(statement);
while (rs.next())
... |
46d3a5af-69b0-4e00-92f4-16775f74d4c5 | 3 | @Override
public Convenio listById(int codigo) {
Connection con = null;
PreparedStatement pstm = null;
ResultSet rs = null;
Convenio f = new Convenio();
try{
con = ConnectionFactory.getConnection();
pstm = con.prepareStatement(LISTBYID);
ps... |
08712106-4901-4959-a89e-cd9c18d8ee3f | 7 | private boolean addEditExpression(QueryTokens.DefaultExpression defaultToken, String title)
{
// Method Instances.
JPanel editExpressionPanel, northPanel;
JLabel aliasLabel;
JTextField aliasTextField;
JTextArea expressionTextArea;
JScrollPane scrollPane;
Border outerBorder;... |
d710924b-9ccc-42a5-a06f-2c24e9b00a8a | 0 | public MassAttractObject3D(Object3D obj, String name, SimpleVector velocity, double mass, int radius) {
super(obj, name, velocity, mass);
characteristicSize = new int[] {radius};
} |
4afb1fc7-542c-41a3-a01d-4b4f1a6e6e9d | 0 | public int [] getTopRight()
{
return topRight;
} |
4a9a48be-d8ff-4b74-b295-1c8d67bab5bd | 1 | public boolean isEnd() {
return isDoubled() && "X".equals(name);
} |
2f544613-6820-4afb-bd39-415345be885f | 2 | private boolean jj_3_44() {
if (jj_3R_63()) return true;
if (jj_3R_64()) return true;
return false;
} |
e0a9d08e-0227-4815-8c07-5c6caca94fd9 | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Birthday other = (Birthday) obj;
if (date == null) {
if (other.date != null)
return false;
} else if (!date.equals(other.date))
retur... |
c0c49de8-6aa7-4a7d-b493-87b28148e9a6 | 3 | private void copmare_and_code(myDataList temp1, myDataList temp2) {
for (int j = 0; j < temp2.size(); j++)
for (int i = 0; i < temp1.size(); i++) {
if ((((data) temp2.get(j)).getChar()).equals(((data) temp1.get(i)).getChar())) {
((data) temp2.get(j)).setBinary_Cod... |
3fa481c7-7568-4c88-a2d3-d4c2df3eff58 | 6 | private void connect() {
config = new ConnectConfig();
config.name = tfName.getText().trim();
if (config.name.isEmpty()) {
JOptionPane.showMessageDialog(this, "Empty name", "Error", JOptionPane.ERROR_MESSAGE);
return;
}
config.ip = tfIP.getText();
try {
} catch(NumberFormatException ex) {
... |
36758cb5-a2d6-4f20-8780-97b56b826b19 | 6 | public Main() {
// call the super constructor
super();
// Set up the frame
this.setResizable(false);
this.setTitle("Sudoku Solver");
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setBounds(framex, framey, framewidth, frameheight);
// Set the layout of the main panel
Panel.setLayout(n... |
467623e7-bc41-467f-b0a6-e62f9d819316 | 3 | private Music loadMusic(String path) throws SlickException {
if (path == null || path.length() == 0)
throw new SlickException("Sound resource has invalid path");
Music music = null;
try {
music = new Music(path);
} catch (SlickException e) {
throw new SlickException("Could not load sound", e);
... |
b74bb882-baeb-47da-b21a-1576751f5069 | 1 | public final void enqueue() {
if (nextOnQueue == null) {
this.nextOnQueue = notifyQueue.first;
notifyQueue.first = this;
}
} |
bf9952dd-ca07-46f6-b7a2-ec56d3bd55cc | 6 | public void CreatefromFile ( String DataFolder ) { //Ƀt@C̈ʒu𓊂ƃt@C烉CtTCN ɓn͉̂Ƃ̃Xg
try {
//t@C[_[
File file = new File ( DataFolder );
BufferedReader br = new BufferedReader ( new FileReader ( file ) );
//܂Ńt@C[_[
String str = "0" ; //ǂݎpString kɂƎ~܂iOj
int CountLine = 0; //sԍZϐiG[pj
... |
bbf7265e-25b0-411c-be75-9223a9f07b2b | 6 | private String getPropfileName(String domain, String subdomain, ArrayList<HashMap<String, String>> domainsMaps) {
boolean applyDefault = false;
for (int i = 0; i < domainsMaps.size(); i++) {
HashMap<String, String> domainsMap = domainsMaps.get(i);
if (domainsMap.get("domain").equalsIgnoreCase(domain) && domai... |
e0326929-d46a-4f1a-9c28-da951b2ca469 | 3 | public boolean requestCloudSicle(List<String> files, InetAddress server){
for(String filename : files){
this.files.put(filename.hashCode(), filename);
}
JobMetaData request = new JobMetaData();
request.setFiles(this.files);
request.setTotalFileSize(totalFileSize(files));
request.setStarttime(System... |
58d8df27-4c5e-466f-9fb9-6b66124680f7 | 5 | public static BigqueryFieldExporterSet instantiateExporterSet(String exporterSetClassStr) {
Class<?> exporterSetClass;
try {
exporterSetClass = Class.forName(exporterSetClassStr);
} catch (ClassNotFoundException e) {
throw new InvalidTaskParameterException("Got invalid BigqueryFieldExporterSet class name: "... |
0c5bd19e-bade-4bdf-855e-d4339ac42b46 | 6 | public SocketBase create_socket (int type_)
{
SocketBase s = null;
slot_sync.lock ();
try {
if (starting) {
starting = false;
// Initialise the array of mailboxes. Additional three slots are for
// zmq_term thread and reaper ... |
fad33c1a-578b-4aa1-a173-f9c13c8eb2b2 | 2 | public boolean isNaN() {
return Double.isNaN(x) || Double.isNaN(y) || Double.isNaN(z);
} |
17f457a1-49ea-40c7-9877-2d919f04b273 | 0 | @Override
public void update() {
} |
b07cba5e-dcc9-46ac-bcca-9820914f1871 | 5 | public boolean install() {
boolean result = false;
if(driver==Driver.Windows_x86 || driver==Driver.Windows_x64) {
result = installForWindows();
} else if(driver==Driver.Mac) {
result = installForMac();
} else if(driver==Driver.Linux_x86 || driver==Driver.Linux_x64... |
be994cc7-33f7-40c8-968c-9b4e5b459fca | 4 | public static void main(String[] args) {
try {
File f = null;
JFileChooser fChsr = new JFileChooser();
int ret = fChsr.showOpenDialog(null);
if (ret == JFileChooser.APPROVE_OPTION) {
f = fChsr.getSelectedFile();
}
Scanner sc... |
9adb0a80-0c28-4297-a778-aab0baedbb70 | 6 | private void initFakeField(Field[][] fields) {
for (int i = 0; i < sizeX; i++) {
for (int j = 0; j < sizeY; j++) {
if ((i % 2 == 0 && j % 2 == 0) || (i % 2 == 1 && j % 2 == 1)) {
fields[i][j] = new FakeField(fields[i][j]);
}
}
}... |
6c6482b6-9fc0-4691-89cb-68328cfbc54e | 4 | @Override
protected void drawJumpMarkers(WormSprite sprite) {
try {
double currentWormX = getFacade().getX(sprite.getWorm());
double currentWormY = getFacade().getY(sprite.getWorm());
double[] prevXY = new double[] { currentWormX, currentWormY };
double time = getFacade().getJumpTime(sprite.getWorm(),
... |
6dfdd44b-6156-457d-b9ce-8ba3bcd9569f | 2 | private boolean shouldSkip(Path path) {
return mSkipHidden && !mPath.equals(path) && path.getFileName().toString().startsWith("."); //$NON-NLS-1$
} |
14eecf83-9e90-4b24-a0ec-673e4154d8ab | 8 | @Override
public void setRiding(Rideable ride)
{
if((ride!=null)&&(riding()!=null)&&(riding()==ride)&&(riding().amRiding(this)))
return;
if((riding()!=null)&&(riding().amRiding(this)))
riding().delRider(this);
riding=ride;
if((riding()!=null)&&(!riding().amRiding(this)))
riding().addRider(this);
} |
645653fa-bfa1-4987-9b77-868cfb7e14fa | 2 | public boolean dominates(final Block block) {
Block p = block;
while (p != null) {
if (p == this) {
return true;
}
p = p.domParent();
}
return false;
} |
03ac7b5d-07dd-4caa-906b-aedf96afa5d1 | 4 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Id3PictureType other = (Id3PictureType) obj;
if (typeId != other.typeId)
return false;
return true;
} |
e7476fd1-5465-4fd6-8ba9-7eebdd45978e | 5 | public static void main(String[] args) throws IOException, JAXBException {
final ArrayOfTrackSection trackDatabase = TrackDatabase.load("D:/Program Files (x86)/Run 8 Studios/Run 8 Train Simulator/Content/Routes/BNSF_MojaveSub/trackDatabase.xml");
final String fileName = "D:/Program Files (x86)/Run 8 St... |
75d66e25-be25-477f-ac12-84e4983c2d7d | 4 | public java.util.ArrayList processar(String tipo, String arquivo){
java.util.ArrayList lista = new java.util.ArrayList();
try {
SAXParserFactory parserFactor = SAXParserFactory.newInstance();
javax.xml.parsers.SAXParser parser = parserFactor.newSAXParser();
SAXHandler handler = new SAXHandler(tipo);
/... |
7d3696b3-f027-4f9e-95f6-06202cd9dee3 | 9 | private byte[] getIntersectionWithSortAndMergeAlgorithm(byte[] a, byte[] b) {
// Take copies to not trample existing arrays.
a = a.clone();
b = b.clone();
Arrays.sort(a);
Arrays.sort(b);
int ixA = 0;
int ixB = 0;
List<Byte> out = new ArrayList<>();
... |
f52b2d94-d626-42c5-80b0-c4b3c0def835 | 8 | private static void attachListeners(final JTextField text,
final JList resultList) {
text.addKeyListener(new KeyListener() {
@Override
public void keyTyped(KeyEvent e) {
}
@Override
public void keyReleased(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
searchFormFrame.setVisibl... |
63e3af78-564b-4685-bd2e-ae3cfb2ca991 | 8 | public static void main(String[] args) throws IOException {
//列出一个文件系统的几个根路径,直接调用java7中的接口
Iterable<Path> rootDirectories = FileSystems.getDefault().getRootDirectories();
for (Path rootDirectory : rootDirectories) {
System.out.print(rootDirectory +" ");
}
//调用Java。ile... |
a8fc850e-a2d8-4c42-8cac-8d16c25aa44f | 1 | public void showWeaponHUD(boolean s) {
if (weaponHUD != null) {
weaponHUD.shouldRender = s;
}
} |
07263284-82b4-44be-bee3-c5fba0642288 | 4 | private void saveButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveButtonActionPerformed
if(checkInput())
{
if(!passwordField.getText().equals(confirmPasswordField.getText()))
{
Dialogs.ErrorDialog errorDialog = new ErrorDi... |
26f84aa7-dba7-47f2-8083-dc109f117f0c | 3 | public char nextClean() throws JSONException {
for (;;) {
char c = next();
if (c == 0 || c > ' ') {
return c;
}
}
} |
4d4637b8-5942-4eff-808e-6a64f526c3e5 | 3 | void removeDuplicates() {
Node current = this;
while(current != null) {
Node runner = current;
while(runner.next != null) {
if(runner.next.data == current.data) {
runner.next = runner.next.next;
}
else {
... |
90ba53e6-b726-48d0-9c6f-72cef29a5341 | 5 | private void addPlattform() {
lblError.setVisible(false);
Plattform selPlat = (Plattform) cbAvaliblePlattformar.getSelectedItem();
DefaultListModel<Plattform> dlm = (DefaultListModel<Plattform>) listPlattformarHolder.getModel();
boolean exists = false; // check if the plattform is alread... |
0c5ce211-3246-4759-91b5-a4ec5fee8b49 | 4 | @Override
public int estimateCostToGoal(SearchState state) {
short[] board = state.board.board;
for (int y = 0; y < maxLines - 1; y++) {
for (int x = 0; x < Board.WIDTH - (n-1); x++) {
int mask = (((1 << n) - 1) << x);
if ((board[y] & mask) == mask && (board[y+1] & mask) == 0)
... |
6c07722e-37a3-47e0-9954-e515f9381128 | 1 | public void paintComponent(Graphics g)
{
//System.out.println(String.format("Action painted x:%d, y:%d", centerX, centerY));
g.setColor(Color.black);
g.drawRect(centerX - width/2, centerY - height/2, width, height);
String text = null;
if (diskNum != -1) {
text ... |
8b21aff1-8cb8-455b-b558-c75e27fb0a79 | 6 | public void method482(int j, int k, int l, int i1, int j1, int k1)
{
int i = 0; //was a parameter
int l1 = Texture.textureInt1;
int i2 = Texture.textureInt2;
int j2 = modelIntArray1[i];
int k2 = modelIntArray2[i];
int l2 = modelIntArray1[j];
int i3 = modelIntArray2[j];
int j3 = modelIntArray1[k];
int... |
42b6b0d0-e86e-4c50-9abb-db1ff7f78df1 | 9 | public static void main(String[] args) throws IOException {
File f = new File("entrada");
if (f.exists()) {
in = new BufferedReader(new FileReader(f));
} else
in = new BufferedReader(new InputStreamReader(System.in));
int dates[] = readInts(nextLine());
int n = dates[0];
int m = dates[1];
if (m ==... |
873a41d2-2e6c-4ddc-81da-4745d5905c8b | 8 | public void beStoped() {
for (int h = 0; h < Engine.mb.BLOCKS[Layer - 1].length; h++) {
for (int w = 0; w < Engine.mb.BLOCKS[Layer - 1][h].length; w++) {
if (Engine.mb.BLOCKS[Layer - 1][h][w].isCollidable) {
if (Engine.mb.BLOCKS[Layer - 1][h][w] != null) {
if (up.intersects(Engine.mb.BLOCKS[Layer - ... |
4db8402e-9386-4c68-89aa-57426e6c9b94 | 7 | public void generateCrowdForOneDay()
{
int oneHour = 3600;
int requests;
//bufet -> dormi
int bufetRand = 5;
int bufetOff = 2;
requests = (int) (Math.random() * bufetRand) + bufetOff;
for (int i = 0; i < requests; i++)
{
generatePeopleGroupAgent(stationMap.get("bufet"), stationMap.get("dormi"), (in... |
f470dbb2-703d-4b02-81a1-bbf6f776e291 | 8 | public void performWrite(int address, int data, long cycles) {
System.out.println("TFE_CS8900: write " + Integer.toString(address, 16)
+ " = " + data);
address -= offset;
switch (address) {
case PPDATA:
break;
case PPDATA + 1:
break;
case PACKET_PP:
break;
case PAC... |
6d0f3d7c-a95a-4ab2-826f-af49afd1612b | 2 | public static Player NarrowMatchPlayer(Server server, String nick)
{
List<Player> list = server.matchPlayer(nick);
if(list.size() > 1 || list.isEmpty()) return null;
else return list.get(0);
} |
1c865229-ac1c-4754-a1c7-272cf201e769 | 0 | public static void main(String[] args) throws InterruptedException {
// 声明一个容量为10的缓存队列
BlockingQueue<String> queue = new LinkedBlockingQueue<String>(10);
Producer producer1 = new Producer(queue);
Producer producer2 = new Producer(queue);
Producer producer3 = new Producer(queue);... |
b5ed9b49-44c7-4a44-a036-ffd42e80f203 | 5 | public void LoadTextures(String location){
File folder = new File(location);
if(!folder.exists()){ Util.ERRORCODE1();}
else {
File[] files = folder.listFiles();
for(int i = 0; i < files.length; i++){
try {
if(files[i].getAbsolutePath().endsWith(".png")){
BufferedImage image;
String name = files[i].ge... |
3b32e9e4-ca8b-4c9a-ae12-10396fef47b9 | 5 | @Override
public void mouseClicked(MouseEvent e)
{
Component clicked = e.getComponent();
if (clicked.isEnabled())
{
if (clicked.equals(this.start))
{
if (loadInstrument())
{
this.railBoard.getController().setIsL... |
9047935f-893a-4044-be9d-d6cd1d6b021f | 3 | public <T> void copyAll(Collection<? extends T> collection,
Collection<? super T> out) {
for (T fruit : collection) {
out.add(fruit);
}
} |
5889d3aa-9a32-4d6c-9397-2e7f21caaad5 | 4 | private void info(int type) throws JSONException {
Control.sleep(3);
lastResult = getData(type);
lastChar = lastResult.getJSONObject("char");
// set cards
for (int i = 0; i < cards.length; i++) {
try {
cards[i] = lastChar.getInt("sk" + (i + 1));
} catch (JSONException e) {
try {
cards[i]... |
bc5509e4-fa7c-4d01-9d28-c83bbed20a15 | 2 | public static String eliminarComillas(String s){
String ret = "";
for (int x = 0; x < s.length(); x++)
if (s.charAt(x) != '"') ret += s.charAt(x);
return ret;
} |
ce3ffc64-613b-4724-b135-d529b4800eae | 7 | public void uimsg(String name, Object... args) {
if (name == "num") {
num = (Integer) args[0];
} else if (name == "chres") {
chres(ui.sess.getres((Integer) args[0]), (Integer) args[1]);
resettt();
} else if (name == "color") {
olcol = (Color) args[... |
dd81a49c-ae8d-4356-a215-324f7794d4f7 | 3 | public static void main(String[] args){
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int m = in.nextInt();
HashMap<Integer, HashMap<Integer, Integer>> g = new HashMap<Integer, HashMap<Integer, Integer>>();
int[] dist = new int[n+1];
for(int i=1;i<=n;i++){
dist[i]=Integer.MAX_VALUE;... |
881c5c7f-b9f9-4206-b0f1-78e084810f09 | 5 | public void move(short direction){
if(this.grid.canMove(this.position,direction)){
this.numMoves++;
grid.unmarkCell(position, MazeGrid.MARKER4);
switch(direction){
case MazeGrid.DIR_RIGHT:
position.col+=1;
break;
case MazeGrid.DIR_UP:
position.row-=1;
break;
case MazeGrid.DIR_LEFT... |
283eedb3-c81d-4107-bcc0-e755825f95ec | 8 | public void run() {
while (running) {
while (!dispatch.isEmpty()) {
DispatchEntity de = dispatch.get(0);
dispatch.remove(0);
int method = de.method;
Object args[] = de.params;
if (method == ON_DOWNLOAD_COMPLETE)
_bot.onDownloadComplete((User) getArg(args, 0), (DUEntity) getArg(args, 1), ... |
45b3f10f-666f-47fa-a42f-f86db25caf9d | 6 | public void loadSave(File loadPath) {
try{
Scanner loadScanner = new Scanner(loadPath);
while(loadScanner.hasNext()) {
Screen.killsToWin = loadScanner.nextInt();
Screen.wavesToWin = loadScanner.nextInt();
for(int y=0;y<Screen.room.block.length;y++) {
for(int x=0;x<Screen.room.block[0].length;x+... |
d5068af5-c96b-4b51-b350-3af7a89a140e | 2 | public void transferCardRange(Deck d, int start, int finish) //start to finish is inclusive
{
if(deck.isEmpty() == false)
{
for(int index = start; index <= finish; index++)
{
card tmp = deck.get(start);
deck.remove(start);
d.add... |
eecc6489-f977-4069-bc7b-691b0067c8a9 | 5 | public void setInputData(List<Double> in, List<Double> out) {
try {
if (in.size() != inNodes.size() || out.size() != outNodes.size()) {
throw new Exception("wrong node number (in or out)");
} else {
for (int i = 0; i < inNodes.size(); i++) {
... |
7f01b59a-4c83-4617-b383-68e4e205cdd6 | 4 | public ConverterFrame()
{
input = 0;
this.setLayout(new BorderLayout());
JPanel layoutPanel = new JPanel();
layoutPanel.setLayout(new GridLayout());
Launcher.unitList = MyUnitsMarshaller.unmarshal(Launcher.OBJECTS_LOC+Launcher.OBJECT_NAME);
firstUnit = new JComboBoxUnit();
secondUnit = new JComboBoxUni... |
83f22b24-034b-4d16-9aac-6993d19849ad | 2 | public static void main(String[] args) {
if (args.length > 0 && args[0].equals("-nogui")) {
Crypto_Sujet5.main(args);
} else {
Logger.getLogger(Loader.class.getName()).log(Level.FINE, "Graphical Interface");
MainWindow.main(args);
}
} |
bc85e0f5-7332-4014-936c-bbca3d9899b3 | 4 | public static void main(String[] args) throws Exception {
HamaConfiguration conf = new HamaConfiguration();
BSPJob bsp = new BSPJob(conf);
// Set the job name
bsp.setJobName("Strassen Multiply");
bsp.setBspClass(StrassenBSP.class);
bsp.setJar("strassenNoSync.jar");
if (args.length < 7 || args.length > 9)... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.