method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
7e00c98d-8e9a-41eb-997f-57fdc45125b4 | 7 | static public String doubleToString(double d) {
if (Double.isInfinite(d) || Double.isNaN(d)) {
return "null";
}
// Shave off trailing zeros and decimal point, if possible.
String s = Double.toString(d);
if (s.indexOf('.') > 0 && s.indexOf('e') < 0 && s.indexOf('E') < 0) {
... |
0a8ca3c0-65f5-4172-b003-93702801da46 | 7 | public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws IOException, ServletException {
resp.setContentType("text/html");
resp.setCharacterEncoding("utf-8");
setSearchResult();
extendedLinkedHashMap<String, String> elhm = this.searchResult
.getRootMap();
resp.getWriter()
.printl... |
17cb972a-7db1-46c9-8636-1ed5c9c07eed | 8 | public static boolean writeUserSelectedFile() {
if (fileDialog == null)
fileDialog = new JFileChooser();
fileDialog.setDialogTitle("Select File for Output");
File selectedFile;
while (true) {
int option = fileDialog.showSaveDialog(null);
if (option != ... |
5f5408a3-ff08-4a6a-b180-bb64ba46bc73 | 0 | protected void execute() {} |
d492dd47-4cda-428b-8702-5cec45419260 | 5 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//Vastaanotetaan käyttäjätunnus jsp-sivulta
String username = request.getParameter("username");
System.out.println("Käyttäjätunnus:" + username);
//Vastaanotetaan salasana jsp-sivulta
String ... |
2b13b287-cbfc-4c7b-9b3a-3062285653c1 | 0 | public int GetY()
{
return this.y;
} |
96aad5c4-6f30-454e-8fb1-a60d765627d8 | 2 | public void easeOpacity(float opacity) {
if (opacity <= 0) {
opacity = 0;
return;
} else if (opacity > 1) {
opacity = 1;
}
AWTUtilities.setWindowOpacity(loginDialog, opacity);
} |
7604f611-dcbe-4ca9-b118-4e50946a904d | 4 | private int PNToAscii(String recieved)
{
// split the recieved code into 2 parts
String[] recieveds = new String[] {
recieved.substring(0, 8),
recieved.substring(8, 16)
};
// decode each part and join them to get the result byte
StringBuffer decoded = new StringBuffer();
for (String recievedi : ... |
9e08f45e-4018-4a3b-9ab4-d0e7b0d2eeec | 7 | private void loadComponentsFromXML() {
//First Child should be a Desktop Tag
if(desktopElement == null) {
logger.info("No Desktop in XML");
return;
}
Element _containerElement = null;
//Walk through All Children and Load Them up
NodeList _list = deskto... |
331bb665-bf8f-4094-99ab-d961a6bf4885 | 8 | public int characterAt(int at) throws JSONException {
int c = get(at);
if ((c & 0x80) == 0) {
return c;
}
int character;
int c1 = get(at + 1);
if ((c1 & 0x80) == 0) {
character = ((c & 0x7F) << 7) | c1;
if (character > 0x7F) {
... |
3e7a6b1c-2b3d-44f5-98ca-ee90ad4d0498 | 8 | public boolean stem() {
int v_1;
int v_2;
int v_3;
int v_4;
// (, line 72
// do, line 74
v_1 = cursor;
lab0: do {
// call mark_regions, line 74
... |
348118cb-0a83-47ce-981e-fd720405c771 | 8 | public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox)
{
if (averageGroundLevel < 0)
{
averageGroundLevel = getAverageGroundLevel(par1World, par3StructureBoundingBox);
if (averageGroundLevel < 0)
{
... |
af78086f-0db7-4c7b-8e19-ca669ca777cc | 4 | @Override
public ArrayList<TCliente> listarClientes() throws Exception {
Statement query = null;
Connection connection = null;
TCliente temp = new TCliente();
ArrayList<TCliente> ret = new ArrayList<TCliente>();
//baja lógica de cliente (solo en la tabla de los genéri... |
863dff95-477d-4054-9d28-d65ca69b1660 | 5 | public boolean collide(GameSphere gs){
int newX = (int)(gs.getPosition()[0] + gs.getVelocity()[0]);
int newY = (int)(gs.getPosition()[1] + gs.getVelocity()[1]);
if(newX < 0 || newX > screen.width || newY < 0 || newY > screen.height) return false;
if(levelLayout[newX + newY * screen.width... |
0097a07b-e670-4487-9241-5e72a4b297d9 | 4 | public static boolean walkToAndClick(String action, int... id) {
SceneObject o = SceneEntities.getNearest(id);
if (Calculations.distanceTo(o) > 5 && !Players.getLocal().isMoving())
Walking.walk(o);
else {
if (o != null && o.isOnScreen()) {
Mouse.move(o.getCentralPoint(), 30, 50);
return (o.interact(... |
ca976822-b5a3-4816-9f9f-4da26770675a | 9 | public static void modificaIntervento(String id, String idPaziente, String idInfermiere, String citta, String civico, String cap, String data, String ora, DefaultTableModel tipiIntervento)
{
//VERIFICA VALIDITA' E CORREZIONE DEI DATI
String errLog = "";
errLog += Paziente.verificaCoerenzaID(idPaziente);
... |
c1746ed1-76c2-429e-af96-210bc72f3617 | 8 | protected void updateCapabilitiesFilter(Capabilities filter) {
Instances tempInst;
Capabilities filterClass;
if (filter == null) {
m_ClassifierEditor.setCapabilitiesFilter(new Capabilities(null));
return;
}
if (!ExplorerDefaults.getInitGenericObjectEditorFilter())
tempInst... |
1abe4269-a2c0-4614-a0e2-780d28bb32e1 | 4 | @Override
public void onDraw(Graphics G, int viewX, int viewY) {
if (X>viewX&&X<viewX+300&&Y>viewY&&Y<viewY+300)
{
Graphics2D g2d = (Graphics2D)G;
G.setColor(Color.white);
G.fillArc((int)X-viewX-1,(int)Y-viewY-1,2,2,0,360);
}
} |
49b17d3d-aefe-4803-988c-dae59ddc1cad | 1 | public JSettingsPane(final boolean mutable) {
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
for (final Parameter p : Parameter.values()) {
add(new JParameterPane(p, mutable));
}
} |
e1a3a2aa-b1fc-4119-9a8c-ce43c6720b8d | 3 | public boolean compareTwoStrings(String aString, String anotherString) {
int aStringSize = aString.length(); int anotherStringSize = anotherString.length();
if(aStringSize != anotherStringSize) return false;
for(int index = 0; index < aStringSize; index++)
if(aString.charAt(index) != anotherString.charAt(inde... |
dcd6b183-6140-45f9-aa04-1b1b65aaabdf | 6 | private void addStamp(CHRMultiTilePanelDecorator decorator){
_stamps.add(decorator);
_stampPanel.add(decorator);
if(! decorator.isAdded()) {
CHRMultiTilePanel stamp = decorator.getTilePanel();
CHRTile tiles[] = stamp.getTiles();
for(int i=0;i<tiles.length;i++)... |
519059a3-0285-4652-933d-ead223e21b59 | 1 | public void removeAllListeners() {
//// Preconditions
assert listeners != null : "listeners must not be null";
if (cycAccess.getCycConnection() instanceof CycConnection) {
assert cycAccess.getCycLeaseManager().isAlive() : "the CycLeaseManager thread has died because a lease timed-out, errored or was d... |
235686b1-2b9e-4c4d-9dca-5f5cefaa10e7 | 2 | public synchronized void increase()
{
// if(0 != number) //只能在两个线程的时候使用if作为判断,当多个线程(2个以上的时候)会出现异常,例如:
// 同时有两个进入等待,来了一个通知,唤醒的线程不知道在等待的过程中发生了什么,却继续了后续的操作,唤醒后应该立即检查判断条件。
while(0 != number) //
{
//如果number不是0的时候就会进入等待的状态,等待notify
try {
wait();
} catch (InterruptedException e) {
e.printStackTr... |
55d0976b-34ff-48d0-a350-e418b4ff615c | 1 | @Override
public void onMessageNotDelivered(int messageId, int resendMessageId, String message) {
System.out.println("Message not delivered: \"" + message + "\" Resending...");
try {
conn.resend(resendMessageId, message);
} catch (CouldNotSendPacketException e) {
System.out.println("Message could not be re... |
8170eb49-7583-4478-b9c7-2e5285d4a4eb | 3 | public boolean collision(int xa, int ya, List<Block> blocks) {
collision.position.x = x + xa + width / 2;
collision.position.y = y + ya + height / 2;
for (int i = 0; i < blocks.size(); i++) {
Block b = blocks.get(i);
if (b == this) continue;
if (Box.collides(collision, b.collision)) return true;
}
re... |
030b53a6-cd7a-4a5c-a257-ac4752fbe737 | 5 | @Override
public FullNameData build(String[] params) {
if (params.length != 6) {
throw new IllegalArgumentException("You should pass exactly 6 parameters");
}
FullNameData data = new FullNameData();
data.setInput(params[0]);
data.setExpectedFirstName(params[1].equ... |
bf098754-3cf6-443e-b8bb-f6b709a9f473 | 4 | public void start(){
Form form = new Form(/*person*/);
while(true){
System.out.println("What do you wana do? \n<1> Fill out Form. \n<2> Search for person. \n<3> Quit.");
myChoice = input.nextInt();
if(myChoice == 1){
form.StoreForm();
System.out.println("--------------------------... |
6183439a-2db5-4efc-aae9-1d2ba13fbc74 | 1 | public double getTotalBalance()
{
bankLock.lock();
try
{
double sum = 0;
for (double a : accounts)
sum += a;
return sum;
}
finally
{
bankLock.unlock();
}
} |
ac1e1371-e89b-43d9-a4b4-63d493c31cbf | 0 | public KeyDataType getData() {
return data;
} |
4a8e2e46-17a2-4211-9d18-887ab925e2f1 | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Schema other = (Schema) obj;
if (name == null) {
if (other.name != null)
... |
bd5481c9-15d4-4ddd-9abb-6e9bd86fa71f | 4 | private void sendProcessingError(Throwable t, ServletResponse response) {
String stackTrace = getStackTrace(t);
if (stackTrace != null && !stackTrace.equals("")) {
try {
response.setContentType("text/html");
PrintStream ps = new PrintStream(response.getOutput... |
888e64bf-e8ad-45f3-821e-804e44c07b1b | 7 | public static String singleOccurance(String s) {
char c[] = s.toCharArray();
int count = 0;
for (int i = 0; i < c.length; i++) {
if (c[i] != ' ') {
for (int j = i + 1; j < c.length; j++) {
if (c[i] == c[j]) {
count++;
} else {
i = j - 1;
break;
}
}
}
}
System.out... |
b4706420-e0f5-485b-998f-c282e25200e4 | 9 | public static int[] rotationArray() {
int n = cad.length;
Integer[] order = new Integer[n];
for (int i = 0; i < n; i++)
order[i] = i;
Arrays.sort(order, comp);
int[] sa = new int[n];
int[] classes = new int[n];
for (int i = 0; i < n; i++) {
sa[i] = order[i];
classes[i] = cad[i];
}
for (int le... |
94b48d40-002e-4282-9554-46ce80be735c | 5 | public void sendPaquets() throws IOException, InterruptedException {
long start_time;
boolean dropped;
System.out.println("[Host] Ready to send paquets.");
NATBox.eth_frame pqt;
while (Host.RUNNING) {
/* Wait until there are paquets to send */
while(Host.pqts.isEmpty()) { }
/* Send paqu... |
f2252201-360a-4e1b-bfd7-5c22183fdbc4 | 6 | @Override
public void run()
/* The frames of the animation are drawn inside the while loop. */
{
long beforeTime, afterTime, timeDiff, sleepTime;
long overSleepTime = 0L;
int noDelays = 0;
long excess = 0L;
gameStartTime = System.currentTimeMillis();
beforeTime = gameStartTime;
running = true;
whi... |
6642cb3b-939a-4e73-bbc4-6d93f3d75dc1 | 1 | public void MostarToken() {
for (Token token : this.listaToken) {
System.out.println(token.getLexema() + " => " + token.getValor_token());
}
} |
22e90d5a-f37b-46f3-97c3-e3abef8bca83 | 9 | public static void addCommissions(
Actor actor, Venue makes, Choice choice
) {
final boolean hasCommission = actor.mind.hasToDo(Commission.class) ;
if (hasCommission) return ;
// Check to see if this venue makes the actor's device type, and if an
// upgrade/repair to said device is needed.
... |
adf0f3bc-de44-46d0-931d-ccad42354d51 | 9 | private Expression renameJikesSuper(Expression expr,
MethodAnalyzer methodAna, int firstOuterSlot, int firstParamSlot) {
if (expr instanceof LocalLoadOperator) {
LocalLoadOperator llop = (LocalLoadOperator) expr;
int slot = llop.getLocalInfo().getSlot();
if (slot >= firstOuterSlot && slot < firstParamSlot... |
dfbec86d-9958-4183-aa41-7d23b53e8dad | 3 | public void writeAllMSISDNData(boolean writeAlsoInHex) {
for (int i = 1; i <= DatabaseOfEF.EF_MSISDN.getNumberOfEntries(); i++) {
if (!getters.getMSISDNString(i, false).isEmpty()) {
if (writeAlsoInHex) {
System.out.println("MSISDN n." + i + " in hex: " + getters.g... |
66c695ea-7121-4783-9fd2-eb391a6dd4f6 | 6 | protected void setPermissionUDF(SessionContext sc, String newUDFId, String clientUdfId)
throws GranException {
// скопировать права с поля Клиент
String incidentsRoot = KernelManager.getTask().findByNumber("50");
Set<SecuredPrstatusBean> prstatusSet = new TreeSet<SecuredPrstatusBean>... |
cf1bddda-e8a2-4833-9263-16841fa0381f | 9 | public static void TypeStatistics(String directoryPath) {
File directory = new File(directoryPath);
File[] files = directory.listFiles();
long[] typeCounts = new long[32];
for (int i = 0; i < typeCounts.length; i++) {
typeCounts[i] = 0;
}
System.out.println("R... |
821a32c1-4c24-42e7-8446-1f97dd302632 | 1 | private Constant newString(final String value) {
key2.set('S', value, null, null);
Constant result = get(key2);
if (result == null) {
newUTF8(value);
result = new Constant(key2);
put(result);
}
return result;
} |
4e297d40-b407-4f77-89a1-18b54ca529ff | 7 | @Override
public Object getValueAt(int rowIndex, int columnIndex) {
Object return_object = null;
switch(columnIndex){
case 0:
return_object = members.get(rowIndex).getName();
break;
case 1:
return_object = members.get(rowIndex).getSurname();
break;
case 2:
return_object = me... |
bfeb2a7f-1430-4f0e-b83d-1a4a7096ff74 | 5 | public void addEdge(Vertex<T> source, Vertex<T> destination, Integer weight) {
if (!vertexes.containsKey(source)) {
throw new RuntimeException("There is no vertex in graph " + source);
}
if (!vertexes.containsKey(destination)) {
throw new RuntimeException("There is no ... |
35c3fcf9-aa96-455b-8c8c-651efee653d3 | 0 | public boolean getOnline(){ return IsOnline; } |
6b01ae80-68e2-4be9-8972-887849746161 | 8 | public void actionPerformed(ActionEvent arg0) {
Object[] inputDetails = new Object[16];
int counter = 0;
for(int i = 0; i < comps.length; i++){
if(comps[i].getClass() == JTextField.class){
JTextField compTemp = (JTextField) comps[i];
inputDetails[counter] = compTemp.getText();
counter++;
}
i... |
407f19f2-37c0-4b6e-b799-b94173a83763 | 1 | private void addCampo(Attributes attr) {
try {
ArrayList<Tabela> tbl = bd.get(bd.size() - 1).getTabela();
tbl.get(tbl.size() - 1).addCampo(attr);
} catch (Exception e) {
System.out.println("Erro ler tag \'campo\': " + e.getMessage());
}
} |
18389955-2d6a-4b06-8e96-02130f5ecd19 | 4 | public double getPropagationEnergy(int index, double energy_min, double energy_max) {
System.out.println("ENTERING BISECTION...");
double energy = (energy_min + energy_max) / 2;
// double dprop = getPropagationValueLogDerivative(index, energy);
double dprop = getPropagationValueDerivativ... |
7bed5676-ba3c-482d-be94-caf20f8115af | 6 | private static String getNextInputToken (boolean skip)
{
final String delimiters = " \t\n\r\f";
String token = null;
try
{
if (reader == null)
reader = new StringTokenizer
(in.readLine(), delimiters, true);
while (token == null ||
... |
cfa4179b-a1f8-40cb-afbd-10e09bf9e409 | 1 | public void testJulianYearZero() {
DateTime dt = new DateTime(JulianChronology.getInstanceUTC());
try {
dt.year().setCopy(0);
fail();
} catch (IllegalFieldValueException e) {
assertEquals(DateTimeFieldType.year(), e.getDateTimeFieldType());
assertE... |
43166dfb-a793-4525-8e78-bdc9d3516090 | 1 | public static void updateCommandeFounisseur(int idcommandefournisseur,int idutilisateur, String referencefournisseur, Date datecommandefournisseur, Float remisefournisseur ) throws SQLException {
String query = "";
try {
query = " UPDATE COMMANDE_FOURNISSEUR SET ID_UTILISATEUR=?,COMFOUREF=... |
66ba8c99-b33f-4178-a596-364242103b72 | 9 | public void handleResponse(JSONObject jo) {
try {
String op = jo.getString(Field.OPERATION_TYPE);
if (op.equals(OperationTypes.COMM_RESP)) {
boolean succeed = jo.getBoolean(Field.SUCCEED);
String msg = jo.getString(Field.MESSAGE);
if (succeed) {
out.println("Succeed!");
} else {
out.pr... |
fdc4f0f2-9eaf-4168-9bbf-48ab0bfe3f14 | 2 | public static int som(int k) {
if(k == 0)
return 0;
int ksom = 1;
while(k > 1) {
ksom = ksom + k;
k = k - 1;
}
return ksom;
} |
56577c7f-76bf-4783-a1c2-fa895902d366 | 7 | public void paint(Graphics paramGraphics)
{
if (isShowing())
{
int i = getComponentCount();
Component[] arrayOfComponent = getComponents();
Rectangle localRectangle1 = paramGraphics.getClipBounds();
for (int j = i - 1; j >= 0; j--)
{
Component localComponent = arrayOfComp... |
2899e0e9-673d-409c-a345-a605193c53d5 | 3 | public static void showRecognizeDialog(Component c) throws HeadlessException {
HashMap<String, ArrayList<String>> shapeCoords = App.ge.getShapeCoordString();
StringBuilder sb = new StringBuilder("Recognized:\n");
if (shapeCoords.get(Shapes.POLY) != null) {
sb.append(" ").append(sha... |
b93f7e13-5cba-4244-9483-265b723dcaaf | 5 | protected void SendQueuedCommand() {
if(!portOpened || waitingForCue) return;
if(commandQueue.size()==0) {
notifyListeners();
return;
}
String command;
try {
command=commandQueue.remove(0)+";";
Log(command+NL);
serialPort.writeBytes(command.getBytes());
waitingForCue=true;
... |
5939b68c-46c6-497a-bc3d-78948ec4a008 | 2 | @Override
public Iterable<Key> keys()
{
LinkedList<Key> keys = new LinkedList<Key>();
for (int i = 0; i < M; i++)
keys.addAll((Collection<? extends Key>) st[i].keys());
return keys;
} |
d7d2c7ad-94dc-4561-aa1e-ba3d71f203a9 | 7 | public void cleanMinRowPedinaTab(){
int max=0;
//Recupero la riga dei pezzi più avanzati
for(int i=0;i<desmosse.length;i++)
if(desmosse[i]!=null && desmosse[i].getMossa().getStartPos().getRow()>max)
max = desmosse[i].getMossa().getStartPos().getRow();
System.out.println("Il massimo valore della rig... |
8568cf26-d13f-43f0-aa2c-ca29b0b4bd75 | 4 | private void generateElements(PrintStream out) {
for (State state : repository.states()) {
if(state.isStart()) {
generateStartState(out, state);
}
else if(state.isEnd()) {
generateEndState(out, state);
}
else {
... |
35a0b0bc-13fc-4b9a-ac2b-159eb4ce4214 | 4 | double makeTotalPredict(Match match) {
double predict = 0;
Team homeTeam = match.homeTeam;
Team awayTeam = match.awayTeam;
double homeAttack = getAttack(match, homeTeam);
double homeDefence = getDefence(match, homeTeam);
double awayAttack = getAttack(match, awayTeam);
... |
bf427999-394c-4ba7-a1e2-bb9774081ad9 | 8 | public byte getSREG() {
int value = 0;
if (I) value |= LegacyState.SREG_I_MASK;
if (T) value |= LegacyState.SREG_T_MASK;
if (H) value |= LegacyState.SREG_H_MASK;
if (S) value |= LegacyState.SREG_S_MASK;
if (V) value |= LegacyState.SREG_V_MASK;
... |
c16ce148-d7fb-40be-a86e-0fd1e7de342e | 0 | public Render(int height, int width){
MAP_HEIGHT = Base.level.height;
MAP_WIDTH = Base.level.width;
xOffset = ((Base.level.width * 32) / 2) - (width / 2);
yOffset = ((Base.level.height * 32) / 2) - (height / 2);
this.height = height;
this.width = width;
pixels = new int[height * width];
} |
7fb5c85a-3dc8-4e95-84a6-092040d5174e | 9 | public void jogada(Peca peca, int pos, int num, int id) { //0 - dir, 1 - esq
if (turno == 0) {
pontaDir = pontaEsq = peca.getDir();
pos = 2;
} else {
if (pos == 0) {
if (peca.getDir() == pontaDir) {
pontaDir = peca.getEsq();
... |
3222110b-cd70-4c90-b430-050543498282 | 7 | private Corner getCornerBasedOnDirection()
{
int bleh = random1.nextInt(100);
if(direction == Direction.NORTH)
{
if (bleh < 50)
return Corner.NE;
else
return Corner.NW;
}
else if(direction == Direction.SOUTH)
{
if(bleh < 50)
return Corner.SE;
else
return Corner.SW;
}
else if... |
568990ac-acd1-4088-bd6a-0b9627bcb1a0 | 8 | public List<UUID> findPostUUIDsByTimeRange( DateTime start, DateTime end ) {
// this method assumes the number of keys for the range is "not too big" so as to blow
// out thrift's frame buffer or cause cassandra to take too long and "time out"
DateTime firstRow = calculatePostTimeGranularity(sta... |
89939919-bb4b-4dc7-a0b9-8435d347fddf | 1 | public void testGetInstantConverterBadMultipleMatches() {
InstantConverter c = new InstantConverter() {
public long getInstantMillis(Object object, Chronology chrono) {return 0;}
public Chronology getChronology(Object object, DateTimeZone zone) {return null;}
public Chronolog... |
64c72efa-011b-469f-a58d-b30b10851525 | 3 | public void drawTime(Graphics g){
int time_sec, time_min, time_hour;
//System.out.println("current time: " + (new SimpleDateFormat("HH:mm:ss")).format(calender.getTime()));
time_sec = Integer.parseInt((new SimpleDateFormat("ss")).format(calender.getTime()));
time_min = Integer.parseInt((new SimpleDateFormat("mm... |
8018356b-74b5-4a07-90fa-00d41843c759 | 3 | public ArrayList<Item> alSort(ArrayList<Item> al) {
for (int i=0;i<al.size();i++) {
for (int e=0;e<al.size()-i-1;e++) {
if (al.get(e).data2>al.get(e+1).data2) {
swap(al,e,e+1);
}
}
}
return al;
} |
5430e036-10a4-44a3-9fbb-43c3a655b6ba | 4 | private void loadLevel(String level){
Scanner input = null;
File f = new File(level);
try{
input = new Scanner(f);
}catch(FileNotFoundException e){
e.printStackTrace();
}
width = Integer.parseInt(input.next());
height = Integer.parseInt(input.next());
String[] s = new String[height * width];
... |
a08bcb60-6691-4ade-afac-c9f8eff69764 | 7 | public void onPickupFromSlot(ItemStack par1ItemStack)
{
func_75208_c(par1ItemStack);
MerchantRecipe merchantrecipe = field_75233_a.func_70468_h();
if (merchantrecipe != null)
{
ItemStack itemstack = field_75233_a.getStackInSlot(0);
ItemStack itemstack1 = fiel... |
7221edf9-d630-4b1a-92b6-2cde3b0167dc | 2 | public void fetchFile(String fileName) throws IOException {
if(Arrays.asList(rootFolder.list()).contains(fileName)) {
throw new FileAlreadyExistsException(fileName);
}
DatagramSocket clientSocket = new DatagramSocket();
Sender sender = new Sender(clientSocket, GlobalConfig.TFTP_CONTROL_PORT, serverAddr... |
adc43da6-f6e4-48ec-a06e-15672cc369ed | 9 | public static int findGCD(int x, int y) {
if(x == 0) {
return y;
} else if(y == 0) {
return x;
} else if(((x & 1) == 0) && ((y & 1) == 0)) { // both x and y are even
return (findGCD(x >> 1, y >> 1) << 1);
} else if(((x & 1) == 0) && ((y & 1) != 0)) { /... |
fa1971a9-e8d7-490b-acf4-75e3d123b4d2 | 9 | public Behaviour getNextStep() {
if (onPoint == null) return null ;
final World world = actor.world() ;
Target stop = onPoint ;
if (verbose) I.sayAbout(actor, "Goes: "+onPoint+", post time: "+postTime) ;
//
// TODO: You need to add an intercept/attack behaviour for enemies near
// th... |
d22da914-2ea3-418f-ac7f-4ae3a226613d | 6 | public void onButtonsEvent(WiimoteButtonsEvent wbe) {
if(wbe.isButtonLeftPressed()) {
isLeft = true;
owner.getMainController().getZeppelinController().engineAstate(MotorA.LEFT);
} else {
isLeft = false;
owner.getMainController().getZeppelinController().eng... |
d44fb0e0-32cd-4b05-9b33-1352a5c57d0a | 2 | public String encode(String password) {
try {
MessageDigest md = MessageDigest.getInstance("SHA-256");
byte[] hashed = md.digest(password.getBytes());
StringBuilder sb = new StringBuilder();
for(int i=0; i< hashed.length ;i++)
{
sb.append(Integer.toString((hashed[i] & 0xff) + 0... |
5bc711a4-54d7-43e4-bdaf-748ce47ef991 | 9 | private Object readValue() throws JSONException {
switch (read(2)) {
case 0:
return new Integer(read(!bit() ? 4 : !bit() ? 7 : 14));
case 1:
byte[] bytes = new byte[256];
int length = 0;
while (true) {
int c = read(4);
... |
f92f6035-bb91-4c70-b498-7ef9804b6662 | 6 | * @return Cons
*/
public Cons difference(Cons otherlist) {
{ Cons self = this;
if ((otherlist == null) ||
(otherlist == Stella.NIL)) {
return (Cons.copyConsList(self));
}
{ Cons diff = Stella.NIL;
{ Stella_Object i = null;
Cons iter000 = self;
C... |
9123d3b1-6921-466d-a19f-5eaec4b2089a | 1 | public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
try {
MainView window = new MainView();
window.frmProgrammingContestSystem.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
} |
6f8735d5-494e-4554-9e9f-ebb263ec4b46 | 3 | @Override
public void repaint(TextGraphics graphics)
{
if(hasFocus())
graphics.applyTheme(graphics.getTheme().getDefinition(Theme.Category.BUTTON_ACTIVE));
else
graphics.applyTheme(graphics.getTheme().getDefinition(Theme.Category.BUTTON_INACTIVE));
Termin... |
34084af0-900a-4b83-a8fe-d6a06c259852 | 9 | public V put(int key, V value)
{
if (entrycnt == threshold) {
capacity <<= 1; // double the capacity
allocateBuckets();
}
final int bktid = getBucket(key);
int[] bucket = keytbl[bktid];
final int lmt = (bucket == null ? 1 : bucket[0] + 1);
int slot = 1;
if (bucket == null) {
// this bucket doe... |
39e338d9-9018-4165-af83-6c8e7d3de1c8 | 7 | public Grammar(BufferedReader in) throws IOException {
Pattern linePattern = Pattern.compile("^\\s*(\\S+)\\s*-*>\\s*(.*\\S+)\\s*$");
while (in.ready()) {
String line = in.readLine();
Matcher matcher = linePattern.matcher(line);
if (!matcher.matches()) throw new RuntimeException("Bad ... |
63d1ea67-8d96-44a0-83cb-a61da83ad609 | 3 | public ArrayList<Vector2> getOpaqueTiles(){
ArrayList<Vector2> result = new ArrayList<Vector2>();
for(int y = 0; y < worldHeight; y++){
for(int x = 0; x < worldWidth; x++){
Tile tile = Tile.getTileById(mapData.get((y * worldHeight) + x));
if(tile.isOpaque){
result.add(new Vector2(x * tileSiz... |
75187eba-7091-41f8-8096-1f5ae1a7f1b7 | 4 | @Override
public void setParametersOn(PreparedStatement statement) throws SQLException {
logger.info("Setting INSERT parameters on prepared statement ...");
int index = 0;
Object[] valueSet = null;
for(Entry<Integer, Object[]> entry : getParameters()) {
index = entry.getKey();
valueSet = entry.getValue()... |
85c2e1af-bc6d-4616-b74a-3710d61669e9 | 3 | public static OperatingSystem getCurrentPlatform() {
String osName = System.getProperty("os.name").toLowerCase();
for (OperatingSystem os : values()) {
for (String alias : os.getAliases()) {
if (osName.contains(alias)) return os;
}
}
return UNKNOWN;
} |
fdf2e54b-40e1-4a10-bcc8-9c9184526460 | 3 | public ItemPanel(final Item i) {
super();
ImagePanel picture = new ImagePanel(i.getImage(), 120, 120);
JLabel title = new JLabel("<html><h3>" + i.getTitle() + "</h3></html>");
JLabel bid = new JLabel(i.getHighestBid().formattedWithName());
JLabel history = new JLabel("<html><font color=\"#000099\"><u>View ... |
c50b46d7-e418-4f46-a132-1230680921c5 | 2 | public void keydown(KeyEvent ev) {
setmods(ev);
if (keygrab == null) {
if (!root.keydown(ev))
root.globtype((char) 0, ev);
} else {
keygrab.keydown(ev);
}
} |
b38d49bb-2080-4eb8-a0b5-512ffb4781a3 | 0 | public static HttpServletRequest getHttpServletRequest() {
return ((ServletRequestAttributes) RequestContextHolder
.getRequestAttributes()).getRequest();
} |
dd7e8f8a-c0b3-42a4-8e1a-464ae07ddcbd | 4 | public boolean deleteRoom(String name){
for (Cine movieTheatre : movieTheatres) {
if(movieTheatre.getName().equals(name)){
movieTheatres.remove(movieTheatre);
return true;
}
}
for (Theatre theatre : theatres) {
if(theatre.getNam... |
25cdd288-b548-4a92-a9ef-669b8d517aa8 | 5 | public void compareJvmCost() {
String rMapperFile = "realMapper.txt";
String rReducerFile = "realReducer.txt";
String realJvmCostDir = baseDir + jobName + "/RealJvmCost/";
String estiJvmCostDir = baseDir + jobName + "/estimatedJvmCost/";
String compJvmCostDir = baseDir + jobName + "/compJvmCost/";
List<... |
173f41ac-1c13-4e34-a82d-ee8bcbe3ad0b | 1 | @Test
public void block() {
Question q = mock(Question.class);
// 1ый раз - не дубликат, 2ой раз и больше - дубликат
assertFalse(blocker.isDuplicate(q));
for (int i = 0; i < limit; i++) {
assertTrue(blocker.isDuplicate(q));
}
Question q2 = mock(Question.... |
7962c036-7a36-4ce5-b020-add81f8e8ff2 | 2 | public Worker(int workerPriority,BlockingQueue<Worker> idleWorkers){
Integer bufferSize = Config.getInt(READ_BUFFER);
if(bufferSize == null){
bufferSize = 10;
}
this.charBuffer = ByteBuffer.allocateDirect(1024 * bufferSize);// 创建读取缓冲区
this.idleWorkers = idleWorkers;
handoffBox = new ArrayBlockingQueue... |
2692cfcc-82e8-4274-a44a-572e48675cca | 0 | public int getDealCounter(){
return dealCounter;
} |
7abb7532-45b1-41f8-b441-234df851fbe1 | 5 | private Map<QueueType, Team.QueueStat> convertStats(JsonObject statSummaryObject)
{
JsonArray statsArray = statSummaryObject.getArray("teamStatDetails");
//Might not exist in the response if no games have been played (not sure)
if(statsArray == null)
return new TreeMap<>();
Map<QueueType, Team.QueueSt... |
a6686545-ec69-4f26-8c75-f4b7db4e7938 | 3 | public void largestPrimeFinder(long num) {
System.out.println("Starting...");
//goal number is 600851475143
long largestPrime = 0;
for (long i = num - 1; i > 1l; i--) {
if (num % i == 0) { //First find a factor of the number
if (isPrime(i)) { //Then determine if it is prime; if so, you've found t... |
848bb5b2-7cfc-45a4-9dce-71f0b91a637c | 1 | private int getTokenID(String name) {
if (!tokens.contains(name))
tokens.add(name);
return tokens.indexOf(name);
} |
f11389bf-cc9f-4f9a-a4e0-89def1066b97 | 3 | public Expression negate() {
if ((getType() != Type.tFloat && getType() != Type.tDouble)
|| getOperatorIndex() <= NOTEQUALS_OP) {
setOperatorIndex(getOperatorIndex() ^ 1);
return this;
}
return super.negate();
} |
5413cd4c-9f97-45a7-9edc-d25ec140aed0 | 1 | public ShellLink setWorkingDir(String s) {
if (s == null)
header.getLinkFlags().clearHasWorkingDir();
else {
header.getLinkFlags().setHasWorkingDir();
s = Paths.get(s).toAbsolutePath().normalize().toString();
}
workingDir = s;
return this;
} |
79dd894a-c9a0-4c38-9419-150880b7a250 | 1 | @RequestMapping(value = "/room-event-object/{id}", method = RequestMethod.GET)
@ResponseBody
public RoomEventObjectResponse roomEventObject(
@PathVariable(value = "id") final String idStr
) {
Boolean success = true;
String errorMessage = null;
RoomEvent roomEvent = null;
... |
7a08b8a8-9c93-41d9-824b-27bc4d14cb4a | 4 | public void filledRectangle(double x, double y, double halfWidth, double halfHeight) {
if (halfWidth < 0) throw new RuntimeException("half width can't be negative");
if (halfHeight < 0) throw new RuntimeException("half height can't be negative");
double xs = scaleX(x);
double ys = scale... |
94b16de6-87e8-412c-a133-ea62e6f6d217 | 4 | public void addFiles(File[] files) {
clearList();
for (File file : files) {
if (file.isDirectory() || file.getName().endsWith(".class")) {
if (!file.isHidden()) {
addFile(file);
}
}
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.