method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
a5252722-999b-42a7-832d-9c372f15e6ca | 0 | public String toString() {
return explain;
}; |
2dd3f794-fc3a-40e2-a7d3-7ced7e2c968f | 5 | public static final byte[] decode(String s){
int delta = s.endsWith( "==" ) ? 2 : s.endsWith( "=" ) ? 1 : 0;
byte[] buffer = new byte[s.length()*3/4 - delta];
int mask = 0xFF;
int index = 0;
for(int i=0; i< s.length(); i+=4){
int c0 = APLHAPETtoInt[s.charAt( i )];
... |
7cba4a06-79c9-4aa3-b0aa-71a3dcf8de70 | 7 | public static String UpKey(String key){
//Initialize Variables
int len;
String[] UKeyar;
String Ukey = "";
String TMPk;
boolean haserror = false;
int pos = 0;
//Determine Length
len = key.length() -1;
UKeyar = new String[len + 1];
//Convert To upper case
TMPk = key.toUpperCase();
//Mo... |
ebebba1a-26ff-4352-9e72-83d1b8c4b6ee | 9 | public void doStep() {
double vs[] = new double[3];
vs[0] = volts[0];
vs[1] = volts[1];
vs[2] = volts[2];
if (vs[1] > lastv1 + .5) {
vs[1] = lastv1 + .5;
}
if (vs[1] < lastv1 - .5) {
vs[1] = lastv1 - .5;
}
if (vs[2] > lastv2... |
6f3664d1-7ffc-41fe-b676-69e61f1d73c3 | 9 | private String currentCategory() {
if (places[currentPlayer] == 0) return "Pop";
if (places[currentPlayer] == 4) return "Pop";
if (places[currentPlayer] == 8) return "Pop";
if (places[currentPlayer] == 1) return "Science";
if (places[currentPlayer] == 5) return "Science";
if (places[currentPlayer] == 9) ret... |
991a400f-6e51-4fb6-8abc-fdc46da3d8b4 | 4 | public static String bytesToHexString(byte[] src)
{
StringBuilder stringBuilder = new StringBuilder("");
if ((src == null) || (src.length <= 0)) {
return null;
}
for (int i = 0; i < src.length; i++)
{
int v = src[i] & 0xFF;
String hv = Integer.toHexString(v);
if (hv.length() < 2) {
stringBuil... |
253f0acc-14e2-4e07-85d5-4d30dde42045 | 0 | public void makeTextbook() throws ParseException, IOException {
String note1 = "\nsource from:"
+ "\n http://a2z.fhl.net/CBOL.html"
+ "\n 本畫面由信望愛資訊中心之CBOL計畫產生,歡迎連結,無須申請。"
+ "\n CBOL計畫之資料版權宣告採用GNU Free Documentation License。"
+ "\n 願上帝的話能建造每一位使... |
910a937e-55f1-4248-b650-7d853f006059 | 6 | public void enablePlugins()
{
Snowstorm.logging().getLogger( "Core" ).info( "Enabling all plugins..." );
for( PluginContainer cont : plugins.values() )
{
if( !cont.getPlugin().enablePlugin() )
{
Snowstorm.logging().getLogger( "Core" ).warning( "Can't enable plugin " + cont.getName() );
continue;... |
67003feb-c0d8-48c5-8c83-fa7a65425254 | 4 | private void saveAsm() {
JFileChooser chooser = new JFileChooser();
chooser.setFileFilter(new FileFilter() {
@Override
public String getDescription() {
return lnf.getFileChooserHEXFilter();
}
@Override
public boolean accept(File f) {
return f.isDirectory() || f.toString().endsWith(".hex") || ... |
0e53991e-a3e5-4a1d-9c1a-4408099a8959 | 6 | public boolean buscar(char c){
//Instanciamos el arbol
BFSTree = new Arbol();
Queue<Nodo> pendientes = new LinkedList<>();
Set<Nodo> visitados = new HashSet<>();
Nodo V;
NodoArbol nAux; //Nodos del arbol
//Obtenemos el nodo raiz
V = G.getRoot();
... |
63e01e72-0f82-4428-a9a2-df82f6c978c8 | 7 | public byte[] write()
{
byte[] toret;
int cnt = 0;
int xcnt = 0;
if (rc == null)
{
toret = new byte[(int)2+bc.getNumControls()/8];
toret[0] = 0;
//Set the power down bit (2nd bit of first byte)
if (bc.getPowerDown())
toret[0] = (byte) (toret[0] | 2);
//Sets the control bits (bytes 2->x)... |
fb447b8b-a2b8-4436-afb1-250b19f00983 | 9 | private FieldDoc getFieldDoc(Configuration config, Tag tag, String name) {
if (name == null || name.length() == 0) {
//Base case: no label.
if (tag.holder() instanceof FieldDoc) {
return (FieldDoc) tag.holder();
} else {
//This should never eve... |
7ce4a939-c74e-4997-85f9-f3a0a10c283f | 3 | public List<Email> listarTodos(int idPessoa){
try{
PreparedStatement comando = banco.getConexao()
.prepareStatement("SELECT * FROM emails WHERE id_pessoa = ? AND "
+ " ativo = 1");
comando.setInt(1, idPessoa);
ResultSet consulta = coman... |
ed324145-6117-49e3-a7fb-029b1c18c1f5 | 3 | private static Packet getRegistrationPacket(String packet) {
Scanner sc = new Scanner(packet);
if(!sc.next().equals(Packet.PACKET_CODES.REGISTRATION_CMD)) return null;
Packet res = new Packet(Packet.PACKET_CODES.REGISTRATION_CMD);
HashMap<String, String> dat... |
53ba3356-016d-4855-9860-2848a0cba1b6 | 6 | public void quickSort(int a[],int low,int high)
{
int i = low;
int j = high;
int mid = low + (high - low)/2;
while(i <= j)
{
while(a[i] < a[mid])
{
i++;
}
while(a[j] > a[mid])
{
j--;
}
if(i <= j)
{
int temp = a[i];
a[i] = a[j];
a[j] = temp;
i++;
j--;... |
955989ae-9b34-4063-a843-ff43f4e6f806 | 9 | public void layout(IFigure parent) {
List children = parent.getChildren();
int numChildren = children.size();
Rectangle clientArea = transposer.t(parent.getClientArea());
int x = clientArea.x;
int y = clientArea.y;
int availableHeight = clientArea.height;
Dimension prefSizes[] = new Dimension[numChildren... |
7385e100-eea8-453f-8b80-c23fcabbb0ee | 0 | public static String buildShopUrl(String url) {
return url + "pas1ds9vepcatcpbnscac/";
// return url + "pas1ds10vepcatcpbnscac/";
} |
f97becdd-452f-44e5-88e5-e52dfae5ec37 | 3 | private int startY(Point[][] matrix) {
for (Point[] aMatrix : matrix) {
for (int col = 0; col < matrix[0].length; col++) {
if (aMatrix[col] != null) {
return aMatrix[col].y - col;
}
}
}
throw new RuntimeException();
... |
8c56870e-7171-4f94-9d99-a18455e6b6eb | 0 | public CmdListExecutor(SimpleQueues plugin) {
this.plugin = plugin;
} |
1910e576-d9ad-488c-90f5-a7b2b242df72 | 2 | private void jButton10ActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jButton10ActionPerformed
{//GEN-HEADEREND:event_jButton10ActionPerformed
//stuff i need to reset
initTable();
String win = winner;
winner = "Good Luck";
jLabel1.setText(winner);
rul... |
0ffa424b-4507-4dcb-98d3-d9b638fde51c | 1 | static void checkFieldSignature(final String signature) {
int pos = checkFieldTypeSignature(signature, 0);
if (pos != signature.length()) {
throw new IllegalArgumentException(signature + ": error at index "
+ pos);
}
} |
b8ad3bfa-bad0-4adf-b9d9-26e29966b6b8 | 6 | public static void unzip(String zipFile, String location) throws IOException {
try {
File f = new File(location);
if (!f.isDirectory()) f.mkdirs();
ZipInputStream zin = new ZipInputStream(new BufferedInputStream(new FileInputStream(zipFile)));
try {
ZipEntry ze = nu... |
a0808968-b5c7-4ac5-a3ff-3d7477a6ac1a | 9 | private int processedFailedNotifications() throws CommunicationException, KeystoreException {
if (useEnhancedNotificationFormat) {
logger.debug("Reading responses");
int responsesReceived = ResponsePacketReader.processResponses(this);
while (responsesReceived > 0) {
final PushedNotificatio... |
0ee54ea7-32b3-4ab0-a748-c9d7e53962ac | 3 | private String MessageAboutOnePrint(Date begin_date, Date end_date, int result_ , double sizeX , double sizeY , String user_name, String file_name, String rashod_ink)
{
SimpleDateFormat d_format = new SimpleDateFormat("yyyy.MM.dd HH:mm", Adapter_to_config.getInstance().GetLocale());
String annotat... |
4a16a171-ec50-4484-8e5b-49fc1148d955 | 7 | public void visitPage(WizardPage page) {
int idx = _path.indexOf(page);
WizardPage lastPage = currentPage();
if (null != lastPage) {
// update the settings before leaving
lastPage.updateSettings(getSettings());
}
// Buttons status of the new page.
boolean cancelEn... |
418fb95a-e9e8-42e4-ba5a-d60d0d8719f3 | 0 | Status(int requestStatus, String description) {
this.requestStatus = requestStatus;
this.description = description;
} |
26a14fba-3ef9-4620-815e-80c775f3dfb8 | 0 | protected void interrupted() {} |
a0aed128-9b1b-4053-84aa-3e32ace17546 | 1 | public PayTotalExcelReport1(File file) {
super(file);
// 命名以A开头
this.fileType = BaseReport.TYPE_A;
// 命名使用下划线分为3节
this.fileNameSectionsNumber = 3;
// 报表类型
this.reportName = "支付机构汇总报表";
// Sheet名称
this.sheetNames = new String[13];
for(int i = 0; i < 13; i++) {
sheetNames[i] = "1-" + (i+1);
}
... |
9ef35d44-a54b-40d4-94a4-c1f61ebc033b | 8 | private <T> T tryNewInstance(final Class<T> clazz, final Object ... args) throws NoDefaultConstructorException, TestException {
try{
Class<?>[] argTypes = null;
if(args != null){
argTypes = new Class<?>[args.length];
for(int i = 0; i < args.length; i++){... |
979a3a62-aed6-40a3-ae26-6ef70ab242e2 | 3 | public void act(List<Actor> newBears)
{
incrementAge();
incrementHunger();
if(isAlive()) {
giveBirth(newBears);
// Move towards a source of food if found.
Location newLocation = findFood();
if(newLocation == null) {
... |
dd85c1ef-a506-4c2c-a7e2-9404b7258441 | 0 | public Receiver() {
} |
f3a415fe-ec98-43f8-85b2-9ec5e0aa80c2 | 2 | public static void main(String[] args) {
display = Display.getDefault();
shell = new Shell();
shell.setMaximized(true);
shell.setText("数字图像处理作业(1130332054 - 谢晓华)");
shell.setLayout(new GridLayout(1,false));
createContents();
shell.open();
shell.layout();
while (!shell.isDisposed()) {
if (!... |
a76ec55a-ede9-49ed-9b42-e1e210002ed5 | 7 | public static void main(String[] args) {
int possible = 0;
for (int twoL = 200; twoL >= 0; twoL -= 200)
for (int oneL = twoL; oneL >= 0; oneL -= 100)
for (int fiftyP = oneL; fiftyP >= 0; fiftyP -= 50)
for (int twentyP = fiftyP; twentyP >= 0; twentyP -= 20)
for (int tenP = twentyP; tenP >= 0; tenP ... |
a89d8cb8-3926-466b-8b01-99f65a7e5f1a | 2 | private int getParentIndex(final int index) {
if (index == 0) {
return 0;
}
return (index % 2 == 0) ? (index - 2) / 2 : (index - 1) / 2;
} |
1b6eac85-6af2-4ecf-b420-5ab42e16c89a | 0 | public Item getItem() {
return item;
} |
5f06e9ee-ac3b-4c4c-aacf-0299520b4e32 | 2 | public ArrayList<Coordinate> getCoveredCoordinatesExcludingVehicle(Vehicle v) {
ArrayList<Coordinate> coveredCoordinates = new ArrayList<Coordinate>();
for (Character key : getVehicles().keySet()){
if(key!=v.identifier){
coveredCoordinates.addAll(getVehicles().get(key).getCoveredCoordinates());
}
}
cove... |
629543d4-5a28-4ab2-a4f6-e208be30f046 | 3 | private boolean checkScAvailable() {
int compteur = 0;
int timeValue = this.view.get(Main.siteNb).timer;
for (Line obj : this.view) {
if ((timeValue > obj.timer) && (Main.siteNb != compteur)) {
return false;
}
compteur++;
}
return true;
} |
6c2634aa-f097-45f9-87e1-7de4c9a292e3 | 8 | public static void main(String[] args) throws Exception {
Options options=new Options();
if(args.length==0) {
System.out.println("rrpm [-r repofile ...] [-s] [-a] [-l username] [-y yaml_path ...] manifest ...\n"+
" where \n"+
" ... |
3b208073-d064-4e89-9f37-353c62fb075f | 0 | public double getHealth() {
return health;
} |
3c01ae20-5bcc-430f-a41e-6aaf9586a175 | 8 | public synchronized void free(int clientID) {
//substituir por metodo que devolve o lugar reservado
int seat = -1;
int theaterID = -1;
for(int[] reservation : this.reservations)
if(reservation != null && reservation[0] == clientID){
seat = reservation[2];
theaterID = reservation[1];
this.reser... |
40f4f1a2-c900-4141-82a5-b6f178e6db1c | 7 | @Override
public boolean tick(Tickable ticking, int tickID)
{
if(!super.tick(ticking,tickID))
return false;
if((tickID==Tickable.TICKID_MOB)
&&(affected instanceof MOB)
&&(((MOB)affected).location()!=null)
&&((lastRoom==null)||(((MOB)affected).location()!=lastRoom)))
{
lastRoom=((MOB)affect... |
a924b4f2-5e8c-4ab4-9dd4-cf71981578c7 | 4 | public void run()
{
while (running)
{
Socket peerSocket;
try
{
peerSocket = server.accept();
String remoteAddress = peerSocket.getRemoteSocketAddress().toString();
int colonIndex = remoteAddress.indexOf(':');
String ip = remoteAddress.substring(1, colonIndex);
int port = peerSocket.ge... |
ea1ac9e9-32d6-41e2-9f73-796e128ecdaf | 8 | public boolean sendAuthentication() throws IOException{
String str = new String("login"+ "," + oldUsernameFld.getText()+ ","+ oldPasswordFld.getText());
System.out.println(str);
InetAddress serverAddr= null;
try {
serverAddr= InetAddress.getByName(GlobalV.serverIP);
} catch (UnknownHostExceptio... |
fc416b0c-5a9b-40d6-a890-7bf4064141b5 | 9 | static RefKind getRefkind(int tag) {
switch(tag) {
case 1:
return REF_getField;
case 2:
return REF_getStatic;
case 3:
return REF_putField;
case 4:
return REF_putSta... |
18eac8a6-735b-4e5f-9437-c12477959bea | 5 | public boolean studentPaidLicense(Activity activity, Student student) {
Calendar previousBillDate = Calendar.getInstance();
previousBillDate.add(Calendar.MONTH, -1);
Bill oldBill;
if(activity.getLicense().equals(new BigDecimal(0))){
return true;
}
try {
oldBill = findBillByDate(student.getHouseHold(),... |
71606e1a-7408-41db-8ff8-2785a0f33b71 | 5 | private synchronized void savePasswd() throws IOException {
if (passwdFile != null) {
final FileOutputStream fos = new FileOutputStream(passwdFile);
PrintWriter pw = null;
try {
pw = new PrintWriter(fos);
String key;
String[] fields;
Strin... |
7b2601fc-169f-4f1b-bb87-0eca3558197d | 0 | @Override
public void setSocialProfileType(final SocialProfileType socialProfileType) {
this.socialProfileType = socialProfileType;
} |
bbae6865-fac7-48a3-8e50-b1c9c1bd3b35 | 1 | private void setCurrPageList() {
currPageList = new ArrayList<>();
int first = (currPageNo - 1) * PAGE_STEP;
int last = first + PAGE_STEP;
if (last > list.size()) {
last = list.size();
}
currPageList = list.subList(first , last);
it = currPageList.iter... |
a0204a32-0a3b-4204-8fc5-83408455dbfe | 9 | public Business(Map<String, Object> raw) {
// TODO: Check that the data has the correct schema.
// NOTE: It's much safer to check the Map for fields than to catch a runtime exception.
try {
if (raw.containsKey("rating")) {
this.rating = Double.parseDouble(raw.get("rating").toS... |
b0cfb90f-5033-4c6b-a9e5-6103ac35af72 | 5 | static final void method3179(int i) {
Class3.method175((byte) -50);
anInt9508++;
int i_16_ = ((Class348_Sub51) BitmapTable.aClass348_Sub51_3959)
.aClass239_Sub3_7222.method1727(-32350);
do {
if (i_16_ != 2) {
if (i_16_ != 3)
break;
} else {
Class121.method1083(Class348_Sub8.currentToolkit, 10... |
7363b050-d8c8-458d-82d1-0527fd7a1cea | 3 | public void cargarTabla(){
//borra toda la tabla primero
for(int i=0;i<((DefaultTableModel)tablespaceT.getModel()).getRowCount();){
((DefaultTableModel)tablespaceT.getModel()).removeRow(i);
}
ServicioTablespace sc = new ServicioTablespace(estrategias.princip... |
e5267ed2-14b8-4758-8756-2d64e8ff4ff1 | 1 | public void send(byte[] b){
try {
os.write(b);
os.flush();
} catch (IOException e) {
e.printStackTrace();
}
System.out.println("sending "+new String(b));
} |
7e8acfdb-5319-4b1f-8be6-930267e91bdc | 9 | private void generateFile(Template temp, Map<String, Object> root)
throws TemplateException, IOException {
StringWriter out = new StringWriter();
temp.process(root, out);
String tempOutput = out.toString();
if (tempOutput.isEmpty()) {
System.out.println(
"No file generation becau... |
bc9b8faf-dc2d-4c0c-916c-9ebe27fd6557 | 2 | public static ArtistLogger getInstance()
throws LogException {
if(ArtistLogger.log == null) {
synchronized (ArtistLogger.class) {
if(ArtistLogger.log == null) {
ArtistLogger.instance= new ArtistLogger();
}
}
}
return ArtistLogger.instance;
} |
3be8a05c-11b6-49c3-8328-df7c00483df3 | 1 | public void testNormalizedStandard_periodType_yearMonth3() {
Period test = new Period(1, 15, 3, 4, 0, 0, 0, 0);
try {
test.normalizedStandard(PeriodType.dayTime());
fail();
} catch (UnsupportedOperationException ex) {}
} |
a82a25ea-80a8-42b3-a540-9947964e7f1f | 0 | public void init() {
screen = new ScreenManager();
DisplayMode displayMode =
screen.findFirstCompatibleMode(POSSIBLE_MODES);
screen.setFullScreen(displayMode);
Window window = screen.getFullScreenWindow();
window.setFont(new Font("Dialog", Font.PLAIN, FONT_SIZE));
... |
d66ee848-12e2-4540-96ed-a171b66597eb | 2 | public org.omg.CORBA.portable.OutputStream _invoke(String method, org.omg.CORBA.portable.InputStream _input, org.omg.CORBA.portable.ResponseHandler handler)
throws org.omg.CORBA.SystemException
{
org.omg.CORBA.portable.OutputStream _out = null;
// do something
// quick lookup of operation
java.lang.Integer o... |
95c6c4cd-1c7b-4af1-8315-d207633db029 | 9 | @Override
public void drawItem(Graphics2D g2,
CategoryItemRendererState state,
Rectangle2D dataArea,
CategoryPlot plot,
CategoryAxis domainAxis,
ValueAxis rangeAxis,
... |
97ffcab0-8cff-4f03-964c-14b1a1268cec | 4 | @Override
public void keyReleased(KeyEvent e) {
if(e.getKeyCode() == KeyEvent.VK_RIGHT) {
right = false;
}
else if(e.getKeyCode() == KeyEvent.VK_LEFT) {
left = false;
}
else if(e.getKeyCode() == KeyEvent.VK_UP) {
up = false;
}
else if(e.getKeyCode() == KeyEvent.VK_DOWN) {
down = false;
}
... |
852222af-7866-4aa9-8571-a2c470b81ca4 | 7 | public DataRSTap queryNow(String command) {
DataRSTap rsData = new DataRSTap(System.currentTimeMillis(),0,typeWorld,serialNumber);
/* rsData packets can only be 65535 bytes long ... might as well use that as an upper limit */
// byte[] raw = new byte[65535];
int[] raw = new int[65535];
int bytesRead=0;
... |
4151e84b-1e6c-466e-b0eb-73477594193b | 4 | public void output() {
StackElement[] headSaver = new StackElement[column.length];
for (int k = 0; k < column.length; k++) {
headSaver[k] = column[k].getHead();
}
for (int i = 0; i < column.length; i++) {
for (int j = 0; j < column.length; j++) {
... |
f37d65e8-4665-41b3-98f7-f4cec31d58cd | 8 | double parseImaginaryPart(SeekableStringReader sr)
{
//imaginary = ['+' | '-' ] ( float | int ) 'j' .
if(!sr.hasMore())
throw new ParseException("unexpected end of input string");
char sign_or_digit = sr.peek();
if(sign_or_digit=='+')
sr.read(); // skip the '+'
// now an int or float foll... |
742f47ef-6f12-4200-ae87-e9560cb85ca8 | 5 | private static void addGettersClass(Class cls) {
Map<String, Method> methods = new HashMap<String, Method>();
classToGetters.put(cls, methods);
while (cls != null) {
for (Method method : cls.getDeclaredMethods()) {
int modifiers = method.getModifiers();
... |
f9a4d16e-0804-4c54-af83-1081815699c9 | 2 | private boolean existe(Ejercicio ejercicio, Ejercicio[] ejercicios) {
for (int i = 0; i < ejercicios.length; i++)
if (ejercicio.getIdEjercicio() == ejercicios[i].getIdEjercicio())
return true;
return false;
} |
e34e91aa-5863-4dfa-b6fe-6f56cf8cb70a | 6 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
try {
int a = jList1.getSelectedIndex();
int b = jList1.getLastVisibleIndex();
int c = jList1.getFirstVisibleIndex();
btnRemove.setEnabled(true);
v1.add(jList1.get... |
ba4b0897-7402-4915-afa3-dad1a12bb89e | 2 | public String toString() {
try {
java.io.StringWriter strw = new java.io.StringWriter();
TabbedPrintWriter writer = new TabbedPrintWriter(strw);
dumpExpression(writer);
return strw.toString();
} catch (java.io.IOException ex) {
return "/*IOException*/" + super.toString();
} catch (RuntimeException ... |
19b46b7c-5531-4b64-86b2-097df33f2d45 | 9 | @SuppressWarnings("unchecked")
private <E extends Gen<?>> E instantiateGenerator(Class<E> genClass, Gen[] subGenerators)
{
Class[] subGenClasses = new Class[subGenerators == null ? 0 : subGenerators.length];
Arrays.fill(subGenClasses, Gen.class);
try {
if (subGenClas... |
f5b9dfb7-791c-4eea-a104-f3e02d47047e | 9 | public static Value from(int i) {
switch(i) {
case 1: return Value.ONE;
case 2: return Value.TWO;
case 3: return Value.THREE;
case 4: return Value.FOUR;
case 5: return Value.FIVE;
case 6: return Value.SIX;
case 7: return Value.SEVEN;
case 8: return Value.EIGHT;
case 9: return Value.NINE;
default :... |
820779cd-bb2f-4358-87f3-4e9d23cff5ca | 6 | public void run() {
DbConnection dbConn = new DbConnection();
Connection conn = dbConn.getConnection();
DataTile tile;
try {
while (true) {
tile = ThreadStorage.pollProcessedTile();
if (tile == null && ThreadStorage.isEndStatement()) {
break;
} else if (tile != null) {
Statement stmt;... |
62334733-7369-485f-95c0-3d896220a07a | 9 | @Override
public boolean equals( Object other ) {
if ( other == this ) {
return true;
}
if ( !( other instanceof TLongList ) ) return false;
if ( other instanceof TLongArrayList ) {
TLongArrayList that = ( TLongArrayList )other;
if ( that.size() !... |
e7ec6f37-ae19-421d-b87a-4e0b48e27dc6 | 3 | public void loadMap(int x0, int y0, int x1, int y1){
Sprite sprite = Sprites.level[x0][y0];
for(int y = 0; y < sprite.h; y++){
for(int x = 0; x < sprite.w; x++){
if(sprite.pixels[x + y * sprite.h] == -9276814){
tiles[x + x1 + (y + y1) * h] = Tile.rockTile.id;
}else{
tiles[x + x1 + (y + y1) *... |
4056867f-c7b3-47cf-a21d-9cb4d9b0ac51 | 6 | @Override
public void menu() {
out.println();
out.println("Digite o numero de uma das opcoes abaixo para continuar:");
out.println("[1] Agenda");
out.println("[2] Historico");
out.println("[3] Consultas");
out.println("[4] Pacientes");
out.println("[5] Medicamentos");
out.println("[0] Sair");
swit... |
ed4e50f3-6e6b-47e3-ac49-62dc81b3705c | 7 | public void printResults()
{
int minTurnaroundTime = Integer.MAX_VALUE;
double avgTurnaroundTime = 0;
int maxTurnaroundTime = 0;
int minInitialWaitTime = Integer.MAX_VALUE;
double avgInitialWaitTime = 0;
int maxInitialWaitTime = 0;
int minTotalWaitTi... |
7e22818d-6e39-44bf-8090-736ee4f741b2 | 5 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (!super.equals(obj))
return false;
if (!(obj instanceof SimpleTrain))
return false;
SimpleTrain other = (SimpleTrain) obj;
if (ID != other.ID)
return false;
if (number != other.number)
return false;
return true;... |
285c13f1-d398-47d2-a06f-a6409e1ab73f | 2 | private void jFlappyKeyReleased(java.awt.event.KeyEvent evt) {
if (empezar) {
if (evt.getExtendedKeyCode() == 32) {
this.mvnt_flappy.setVelocidad(aumentarVelocidad());
this.mvnt_flappy.setSaltar(true);
jFlappy.requestFocus(true);
Sonido... |
f58b6dff-8016-4f6b-91fa-767edad67edc | 2 | public void remove() {
Configuration[] configs = configurations.getSelected();
if (configs.length == 0) {
JOptionPane.showMessageDialog(configurations,
NO_CONFIGURATION_ERROR, NO_CONFIGURATION_ERROR_TITLE,
JOptionPane.ERROR_MESSAGE);
return;
}
for (int i = 0; i < configs.length; i++) {
config... |
91f8651c-adba-4011-94de-c318c7d57860 | 8 | @Override
public void endElement(String uri, String localName, String qName) throws SAXException {
super.endElement(uri, localName, qName);
tag = Tags.fromString(qName);
if (tag == null) {
return;
}
switch (tag) {
case FIRSTNAME:
user.setFirstName(valueTag);
break;
case LASTNAME:
user.setLas... |
400777b9-8354-46f3-9e32-90c366f931dd | 3 | public static boolean nodeListHasTag(NodeList nl, String tag)
{
boolean has = false;
if (nl != null)
{
int length = nl.getLength();
for (int i = 0; (i < length) && !has; i++)
{
has = (nl.item(i)).getNodeName().equals(tag);
}
}
return has;
} |
77802faf-4267-44ec-acbe-3d14d219a3c6 | 3 | public void run() {
syncDatabase();
} |
3e35edb2-26c3-45c8-98aa-112361d11f0b | 4 | @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH)
public void onPlayerMove(final PlayerMoveEvent event) {
AGPlayer agp = pH.getAGPlayer(event.getPlayer().getName());
if(agp == null)
return;
if(agp.isPraying() && ConfigHandler.disableMovement) {
if(!prayingMoveCooldown.contains(event.g... |
58b85c9a-4eab-48fd-b55e-3f23fd2b8042 | 4 | protected double[] checkWhetherRawItemsDichotomous(){
if(!this.dichotomousCheckDone){
this.dichotomous = new boolean[this.nItems];
this.dichotomousPercentage = new double[this.nItems];
int nDich = 0;
for(int k=0; k<this.nItems; k++){
this.dichotom... |
700a8397-1a70-4474-a007-ad2a5e2dedd5 | 1 | @Override
void quitter(Voiture v) {
// Verifier quelle est bien en droit de sortir (arriver au croisement)
if (croisement(v)) {
vehicules[vehicules.length - 1] = null;
voieDeSortie.sort(v);
}
} |
317781cc-ee1a-47d8-9725-8a82be5682e7 | 8 | public void update() {
if(GameManager.getGames().size()!= games)
getInventory();
for(ItemStack item: menu.getContents()) {
if(item!= null && item.getType()!= Material.MAGMA_CREAM) {
ItemMeta im = item.getItemMeta();
String name = ChatColor.stripColor(im.getDisplayName().split(" ")[0]);
Game game =... |
47eefc3f-9734-4a49-82ae-e07b76dd1943 | 0 | public ArrayList<String> getPostGradeTitles() {
return postGradeTitles;
} |
c4854538-b47e-4854-9aa5-d35c8596231e | 5 | public Dimension getPreferredSize() {
int height = 0;
int width = 0;
//
// Use the size set by the application
//
if (isPreferredSizeSet())
return super.getPreferredSize();
//
// Leave room for the component border
//
Border b... |
8e861f92-599f-42e5-a952-870a39bfc4dc | 5 | public void setLoggedIn(boolean e) {
loggedIn = e;
if (loggedIn) {
if (data != null) {
bukkitplayer.sendMessage(Configuration.prefix + ChatColor.GREEN + "You've successfully logged in! Enjoy!");
data.set("Lastlogin", System.currentTimeMillis());
saveData();
}
try {
// bukkitplayer.getIn... |
235caf9c-69d0-4aff-8517-c8e5c14376eb | 7 | public void input() {
//INPUT LOOP//
mouse_x = Mouse.getX();
mouse_y = Game.WINDOW_HEIGHT - Mouse.getY();
if(Keyboard.isKeyDown(Keyboard.KEY_ESCAPE))
Game.setRunning(false);
if(Keyboard.isKeyDown(Keyboard.KEY_GRAVE))
Game.getLogic().getScore().setScore(1000000);
if(Keyboard.isKeyDown(Key... |
1e4e7d73-19e3-4993-83d6-9137fe4bc34b | 5 | public byte getMenuChoiceNameOrId(Scanner a_scan)
{
byte selection = 0;
do
{
try
{
selection = a_scan.nextByte();
}
catch (InputMismatchException e)
{
System.out.println("Incorrect Entry, should be integer 1 or 2."+ " No letters, or characters allowed.");
a_scan.nextLine();// avoi... |
90d458a4-db64-40c9-be0e-f6686e7158ed | 8 | private boolean dumpRequest(Request request) {
// check if the resource request exists.
if (request.resource != null)
if (!this.resources.contains(request.resource)) {
System.out.println("error: Dump request resource ["
+ request.resource + "] does no... |
b121a8f7-82de-47ea-8f06-c3426cc0d5dd | 1 | @Override
public void render(Screen screen) {
if (this.background != null)
screen.render(0, 0, getHeight(), getWidth(), background);
super.render(screen);
} |
32fa7586-cc8e-4c5f-bbda-e15c98020f0b | 2 | private void printProgress(int current, int total,
List<Integer> printed) {
int percDone = (int) ((double) current / total * 100);
// Print progress every 10%
if (percDone % 10 == 0 && !printed.contains(percDone)) {
textArea.append(percDone + " % done\n");
printed.add(percDone);
}
} |
ee438b0f-b015-45c2-9fe5-62947de0148b | 8 | public void postalCodeCheck() {
for(MyNode n : mg.getNodeArray()) {
for(MyEdge e : n.getFromEdges()) {
if(e.getRoadName().equals(address[0]) && e.getPostalCode() == Integer.parseInt(address[4])) {
putEdge(e);
}
}
for(MyEdge e : n.getToEdges()) {
if(e.getRoadName().equals(address[0]) && e.get... |
b32c9da5-67cb-491c-aa68-b99820ff2015 | 8 | private void findCompletionsHelper(TrieNode root, LinkedList<String> completions, String prefix, String word) {
if (prefix.isEmpty()) {
String append = "";
if (root.getNodeValue() != null) {
append += root.getNodeValue();
}
if (root.getChildren().isEmpty()) {
completions.add(word + append);
} e... |
fb719024-7903-439f-bfca-a550783d11b7 | 8 | void translate() throws ScriptException {
if (statementLength < 3)
badArgumentCount();
if (statement[2].tok != Token.integer)
integerExpected();
int percent = statement[2].intValue;
if (percent > 100 || percent < -100)
numberOutOfRange(-100, 100);
if (statement[1].tok == Token.identifier) {
String... |
6574acaf-0654-4c5d-bcd3-6c6788b0420b | 6 | public void rollText() {
// New Timer object to generate dalays
Timer timer = new Timer();
// TimerTask is an object, and requires a written class
timer.schedule(new TimerTask() {
Array7 arr;
// A run() method is required
public void run() {
// shifting the content to LEFT in all positions in A... |
8d521e6b-ce4f-4152-98a8-e67430e98b2a | 1 | public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("Collected Statistics");
sb.append(System.lineSeparator());
sb.append("--------------------");
sb.append(System.lineSeparator());
sb.append(System.lineSeparator());
sb.append(String.format("Number of instances: %d", instances));
... |
e645b6ed-70a5-4c03-bea8-0f8b98936cbe | 8 | public boolean stem() {
int v_1;
int v_2;
int v_3;
int v_4;
// (, line 64
// do, line 66
v_1 = cursor;
lab0: do {
// call mark_regions, line 66
... |
3d2f83fe-aa94-4114-8fcf-a8d81a9afa39 | 6 | public List<List<Integer>> zigzagLevelOrder(TreeNode root) {
List<List<Integer>> result = new ArrayList<List<Integer>>();
List<TreeNode> list = new ArrayList<TreeNode>();
if(root == null)
return result;
list.add(root);
boolean flag = true;
while(list.size() !... |
5fc99a0a-00b1-47e5-a793-943629c28f3b | 3 | public String toString() {
if(isEmpty()) return null;
Node current = head;
String output = "";
while (current != null) {
output += current.getContent();
if (current.getNext() != null)
output += ", ";
current = current.getNext();
... |
71954e1a-c879-4d7c-bc41-9654f18a7177 | 2 | @Override
protected String processContents(File file, String contents) {
for (int i = 0; i < regexes.length; i++) {
String regex = regexes[i];
try {
System.out.println("\t\tREGEX: " + regex);
contents = util.substitute(regex, contents);
} catch (MalformedPerl5PatternException e) {
e.printStackTr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.