method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
6a72935a-648f-46de-92ed-b3d62599717b | 4 | public void commit() {
normalize();
if (diff.get().size() == 0 && deleted.get().size() == 0) {
return;
}
for (Map.Entry<String, String> node : diff.get().entrySet()) {
old.put(node.getKey(), node.getValue());
}
for (String key : deleted.get()) {... |
90820005-4586-4d16-aa30-f63ba77a4445 | 3 | public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof Role)) {
return false;
}
final Role role = (Role) o;
return !(name != null ? !name.equals(role.name) : role.name != null);
} |
b2c9dff5-9e14-455d-9bde-50c5d5cbd457 | 0 | private void dispatcher(String uri, HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.getRequestDispatcher(uri).forward(request, response);
} |
1f3cdbcc-5fbc-461f-91e6-acf0f0a26357 | 5 | public boolean mouseup(Coord c, int button) {
Slot h = bhit(c);
if (button == 1) {
if (dragging != null) {
ui.dropthing(ui.root, ui.mc, dragging.getres());
dragging = pressed = null;
} else if (pressed != null) {
if (pressed == h)
... |
1d274828-16ba-4a84-b5eb-9c3e7eec66e3 | 8 | private boolean createResource(String workspace, StoreType dsType, String storeName,
GSResourceEncoder re) throws IllegalArgumentException {
if (workspace == null || dsType == null || storeName == null || re == null) {
throw new IllegalArgumentException("Null argument");
}
... |
9aaf0ef8-023a-4d48-9593-169c0e2046bb | 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... |
1c06d240-08df-4bd2-909d-786308bf3229 | 9 | public ResultSet query(String queryString)
throws SQLException
{
lastSQL=queryString;
ResultSet R=null;
if((inUse)&&(ready()))
{
try
{
sqlserver=true;
lastQueryTime=System.currentTimeMillis();
if(myStatement!=null)
R=myStatement.executeQuery(queryString);
else
lastError="DBCon... |
53dad750-f39c-4839-bba7-d2c0a9678a62 | 2 | public void cutSelection(boolean createUndo) {
CPRect sel = getSelection();
if (sel.isEmpty()) {
return;
}
clipboard = new CPClip(new CPColorBmp(curLayer, sel), sel.left, sel.top);
if (createUndo) {
addUndo(new CPUndoCut(clipboard.bmp, sel.left, sel.top, getActiveLayerNb(), sel));
}
curLayer.clea... |
e217e609-8642-4e3b-8003-a0b98a7a9615 | 0 | public void setURI(String value) {
this.uri = value;
} |
f32603bc-c1d8-4b3f-96fb-96a2c0f96192 | 7 | public void destroy(Integer id) throws IllegalOrphanException, NonexistentEntityException {
EntityManager em = null;
try {
em = getEntityManager();
em.getTransaction().begin();
PypAdmAgend pypAdmAgend;
try {
pypAdmAgend = em.getReference(Py... |
2aeefe03-d356-4fb1-95e9-0cec7c1b2ed7 | 7 | public static String doubleToString(double d) {
if (Double.isInfinite(d) || Double.isNaN(d)) {
return "null";
}
// Shave off trailing zeros and decimal point, if possible.
String string = Double.toString(d);
if (string.indexOf('.') > 0 && string.indexOf('e') < 0 &&
... |
cf61914f-3a63-4ff2-a143-c5347b870048 | 2 | private Class getAnnotationType() {
if (annotationType == null) {
String typeName = annotation.getTypeName();
try {
annotationType = classLoader.loadClass(typeName);
}
catch (ClassNotFoundException e) {
NoClassDefFoundError error = ... |
36c40afa-598a-4135-89f9-146616fbca84 | 1 | private static void loadWatchersFromConfigurationFile() throws IOException {
String[] foldersToBeWatched;
boolean watchSubtree;
foldersToBeWatched = validatorProperties.getProperties(PropertyKeys.FOLDERS_TO_BE_WATCHED.toString());
watchSubtree = validatorProperties.getBooleanProperty(PropertyKeys.WATCH_SUBTREE.... |
3432398e-9f0a-4567-ac39-a8b90c60bf94 | 7 | public Page(int width, int height) {
setLayout(null);
WIDTH = width;
HEIGHT = height;
title = new JLabel();
title.setHorizontalAlignment(0);
title.setBounds(0, 0, width, 50);
title.setFont(getFont().deriveFont(21.0F));
add(title);
reset = new JButton("Reset");
reset.addActionListener(new ActionList... |
4b0da7fe-180b-4291-aeff-6aacd487746b | 8 | public void goodMethod(int a[], int[] b) {
int i = 0;
int j = 0;
while (i < a.length && j < b.length) {
if (a[i] == b[j]) {
if (1 <= i && a[i] != a[i - 1]) {
System.out.println(a[i]);
} else if (0 == i) {
System.... |
337409da-0b45-4ecc-94ac-a602177ebc24 | 9 | public void confirmProcess() {
getCore().getNetwork().makeContact();
Pattern pWord = Pattern.compile("[a-zA-Z_0-9]*");
Pattern pEmail = Pattern.compile("^\\S+@\\S+$");
Matcher mPassword = pWord.matcher(String.valueOf(lPassword.getPassword()));
Matcher mEmail = pEmail.matcher(lEm... |
25d881c2-a6ef-4927-8a85-726a21b9787e | 3 | public String getGeocode(){
// Create the request
String request = "";
boolean res = false;
request+= this.getUrl();
if(this.getFormat()!=null){
request+= "format=" + this.getFormat();
res = true;
}
if(this.getQuery()!=null){
if(res){
request+= "&q=" + this.getQuery();
}else{
request+... |
1fb6a419-c01c-4a5b-ab98-332d719723b4 | 5 | public void render(Graphics g, Camera cam)
{
int tileX = (int) cam.x / Constants.TILE_SIZE;
int tileY = (int) cam.y / Constants.TILE_SIZE;
for (int x = tileX; x < tileX + 17; x++)
for (int y = tileY; y < tileY + 11; y++)
{
g.drawImage(hub.images.terrain[tiles[x][y].id], Math.round((x *... |
3c9db14a-d87e-4991-beef-688de5132831 | 9 | private PackageCoverageStatistics readStats(File file) throws IOException {
String fileName = file.getName();
String packageName = null;
int procedures = 0;
int covered = -1;
int total = -1;
FileInputStream fis = new FileInputStream(file);
InputStreamReader in = new InputStreamReader(fis, "UTF-8");
B... |
701b382d-3540-4e89-88f4-3b32b9cbd1df | 4 | public List findConstantsForNames(List constantNames)
throws UnknownHostException, IOException, CycApiException {
if ((constantNames == null) || (constantNames.size() <= 0)) {
return null;
}
StringBuffer command = new StringBuffer("(MAPCAR (QUOTE FIND-CONSTANT) (LIST");
for (Iterator ite... |
d0c602d0-9650-4eb5-ac53-770c7780792f | 1 | public AnnotationVisitor visitAnnotation(final String name,
final String desc) {
checkEnd();
checkName(name);
CheckMethodAdapter.checkDesc(desc, false);
return new CheckAnnotationAdapter(av == null ? null
: av.visitAnnotation(name, desc));
} |
17e4df7e-d3af-4a70-9816-12e3a1df3948 | 6 | @Override
public void run() {
if (Updater.this.url != null) {
// Obtain the results of the project's file feed
if (Updater.this.read()) {
if (Updater.this.versionCheck(Updater.this.versionName)) {
if ((Updater.this.versionLi... |
220bc604-b0b3-4939-b1d6-a763a76b068b | 3 | @Override
public void deserialize(Buffer buf) {
days = buf.readInt();
if (days < 0)
throw new RuntimeException("Forbidden value on days = " + days + ", it doesn't respect the following condition : days < 0");
hours = buf.readInt();
if (hours < 0)
throw new Run... |
b44e0621-50ed-4c88-8a23-7b146176e1ce | 2 | @Test
public void testCapacityValue() throws Exception
{
PersistenceManager pm = new PersistenceManager(driver,database,login,password);
//drop everything
pm.dropTable(Object.class);
ConnectionWrapper cw = pm.getConnectionWrapper();
assertEquals(0.0,pm.getUsedCapacity(cw),Math.ulp(0.0));
cw.discard();
... |
96da6c44-d27a-4464-ad9f-7f32249d90c0 | 6 | @Override
public Tipo validarSemantica() throws Exception {
Tipo izq,der;
izq=izquierdo.validarSemantica();
der=derecho.validarSemantica();
if (izq instanceof TipoInt){
if (der instanceof TipoInt || der instanceof TipoFloat ){
return izq;
}
... |
abf2c9b6-32eb-42b7-850a-bb48eec30e40 | 2 | public void wakeup()
{
if (closed) {
synchronized (this) {
if (closed) {
this.notifyAll();
}
}
}
} |
002d4c34-7bc7-4130-9563-ec4b1e2403cf | 8 | public static void experiment(PrintWriter pen, Comparable<?> val,
Comparable<?>[] values)
{
// Print original info
pen.println("--------------------------------------------------");
pen.println("old values: " + Arrays.toString(values));
pen.println("val: " + val.toString());
// Sort... |
37ff56d1-1af2-4ea3-b8b6-2b5d4e23ec87 | 1 | @Override
public int getHeight() {
int height = 0;
if (this.fontmetrics != null) {
height = this.fontmetrics.getHeight();
}
return height;
} |
b9ae1b4c-d0e2-4cc2-9920-df7120450a08 | 9 | public void setOptions(String [] options) throws Exception {
String lowerString = Utils.getOption('L', options);
if (lowerString.length() != 0) {
setRunLower(Integer.parseInt(lowerString));
} else {
setRunLower(1);
}
String upperString = Utils.getOption('U', options);
if (upperStrin... |
4dcd5ca6-11d3-46d7-9b2e-41d7c2fa3029 | 3 | public String reverseWords(String s) {
String[] ss = s.split(" ");
String ans = "";
for (String t : ss) {
if (!t.equals("")) {
ans = t + " " + ans;
}
}
return ans.length()==0?"":ans.substring(0,ans.length()-1);
} |
24528c93-99c5-4236-9531-581f54370640 | 2 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Word other = (Word) obj;
return this.value == other.value;
} |
e8e4c7d3-6efc-4338-83b3-4749aa015d6e | 2 | public static Production[] getProductionsOnVariable(String variable,
Grammar grammar) {
ArrayList list = new ArrayList();
ProductionChecker pc = new ProductionChecker();
Production[] productions = grammar.getProductions();
for (int k = 0; k < productions.length; k++) {
if (variable.equals(productions[k].g... |
25cf3d98-b241-4d0b-bc99-a58a369c4869 | 0 | public void setLigne( char[] tab){
ligne = tab;
} |
6cd95e08-3e57-4e0b-a554-c679f05662e2 | 1 | private String timeString(long time)
{
String mensaje= "";
long timeNow = System.currentTimeMillis();
long diferencia=timeNow-time;
long minutos = diferencia / 60000;
if(minutos == 0){
mensaje = "Hace " + (diferencia/1000) + " segundos";
}
else {
mensaje = "Hace " +... |
fbdd5bde-eb5f-4890-98a7-dfc8a5bdfa99 | 9 | private final void method675(int i) {
anInt5514++;
int i_577_ = 32767;
int i_578_ = 32767;
int i_579_ = 32767;
int i_580_ = -32768;
int i_581_ = -32768;
int i_582_ = -32768;
int i_583_ = 0;
int i_584_ = i;
for (int i_585_ = 0; (anInt5433 ^ 0xffffffff) < (i_585_ ^ 0xffffffff);
i_585_++) {
int i_586_... |
aca4c8e6-8d79-4cf2-80ee-8bd04451cf87 | 5 | public Point getPoint(int x, int y){
for(Point actPoint:bendPoints){
if (x >= actPoint.getX() - 5 && x<= actPoint.getX() + 5
&& y >= actPoint.getY() - 5 && y <= actPoint.getY() + 5) {
return actPoint;
}
}
return... |
3be21778-7dcf-4612-8fce-ddee87f56f79 | 0 | private Chunk load(Point p)
{
return generate(p);
} |
8b7b5f8a-e58c-42c4-8fe2-f40915a515dc | 3 | private final void mouseSegmentFinished(MouseEvent event) {
if (points[0].x == -1) return; // spurious event
if (points[0].x != event.x || points[0].y != event.y) {
// draw new segment
points[1].x = event.x;
points[1].y = event.y;
renderContinuousSegment();
}
} |
930a860e-cd4e-42cf-8e8c-97c31afe480c | 7 | protected void closeSocks(String finalMsg)
{
if(sock[0]!=null)
{
synchronized(sock)
{
if(sock[0]!=null)
{
try
{
Log.sysOut("Disconnect: "+finalMsg+getAddress()+" ("+CMLib.time().date2SmartEllapsedTime(getMillisOnline(),true)+")");
setStatus(SessionStatus.LOGOUT7);
sock[0].... |
bdaeb2b4-e433-4d11-9959-5a1d7707d9f5 | 3 | /* */ public LauncherFrame()
/* */ {
/* 24 */ super("CommunityCraft");
/* */
/* 26 */ setBackground(Color.BLACK);
/* 27 */ this.loginForm = new LoginForm(this);
/* 28 */ setLayout(new BorderLayout());
/* 29 */ add(this.loginForm, "Center");
/* */
/* 31 */ this.loginFo... |
881ced9b-b170-435d-b401-212be27d03a6 | 8 | @Override
public boolean setArmor(Wearable armor) throws NoSuchItemException, WrongItemTypeException {
if (armor != null) {
if (armor instanceof BodyArmor) {
if (armor.getLevelRequirement() > level || armor.getStrengthRequirement() > stats[0]
|| armor.getDexterityRequirement() > stats[1] || armor.getMag... |
58c2b72d-fd9e-4260-8555-02c7a86aa682 | 4 | private void registerName() {
while (registeredUsername == null && storageServices.isRunning()) {
String userName = storageServices.popUserName(); // blokierender Aufruf der auf den UserNamen wartet.
println(new_(userName)); // send to the server
System.out.println("Sen... |
1cc2a802-ba50-4db8-a77c-85bb4bd83d81 | 3 | public void setPidMode(int newMode){
m_pidMode = newMode;
if (newMode==ROTATE_TO_ANGLE_MODE){
getPIDController().setOutputRange(-12.0, 12.0);
getPIDController().setPID(0.125, 0, 0);
getPIDController().setAbsoluteTolerance(20);
}else if(newMode == DRIVE_TO_ANGL... |
c0118f50-91c1-4fb5-9f2e-04296752c2fd | 7 | final private static Object parseArrary(String val) {
String array = val.substring(1, val.length() - 1);
if (array.length() == 0) {
return new ArrayList<Value>();
}
String values[] = splitArray(array);
if (values.length == 1) {
if (array.contains(":")) {
values = array.split(":");
if (values.len... |
293f802a-0bf2-4f24-9c53-237b3e7848b3 | 3 | public int getMeetingInviteIndexByUsernameAndMeetingID(int meetingInviteID, String username){
for(MeetingInvite meetingInvite : meetingInvites){
if(meetingInviteID == meetingInvite.getMeetingID() && username.equals(meetingInvite.getUsername())) return meetingInvites.indexOf(meetingInvite);
}... |
275fc58e-abc1-4618-9870-a3c3b3bb2d8a | 3 | public static void toggle() {
try {
if (currentPlayback != null) {
if (currentPlayback.getStatus() == MediaPlayer.Status.PLAYING) {
pause();
} else {
play();
}
}
} catch (MediaException e) {
... |
80319354-a070-471b-8011-53a25bea0c62 | 3 | private void waitForThread() {
if ((this.thread != null) && this.thread.isAlive()) {
try {
this.thread.join();
} catch (final InterruptedException e) {
e.printStackTrace();
}
}
} |
4d64bc0a-8b61-43a6-8155-06aedc78f2e1 | 8 | public void refresh(boolean now) throws InterruptedException, InvocationTargetException {
Runnable runnable = new Runnable() {
public void run() {
try {
int selectedRow = SqlTable.this.getSelectedRow();
int selectedColumn = SqlTable.this.getSelectedColumn();
Statement statement = SybaseBuddyAppl... |
62082a6a-2dfd-46b9-88dd-307f48a66544 | 8 | public static double betacf( double a, double b, double x )
{
int MAXIT=100;
double EPS = getEpsilon();
double FPMIN = Double.MIN_VALUE / EPS;
int m, m2;
double aa, c, d, del, h, qab, qam, qap;
qab = a+b;
qap = a + 1.0;
qam = a - 1.0;
c=1.0;
d=1.0-qab*x/qap;
if ( Math.abs(d) < FPMIN )... |
96c747f6-e470-436c-ac79-14244c8e42ec | 8 | public void print(PrintProxy proxy) {
if (proxy != null) {
PrintService service = getPrintService();
if (service != null) {
if (useNativeDialogs()) {
mJob.setJobName(proxy.getPrintJobTitle());
if (mJob.printDialog()) {
try {
proxy.adjustToPageSetupChanges();
proxy.setPrinting(t... |
288cd844-bbab-46c3-a487-b989d18a92de | 4 | public static boolean open(IClientContext ctx, final GameObject door) {
if (openDoor(ctx, door)) return true;
if (door.valid()) {
if (ctx.camera.pitch() > 50) {
ctx.camera.pitch(Random.nextInt(0, 40));
} else {
ctx.camera.angle(Random.nextInt(0, 360));
}
if (openDoor(ctx, door)) return true;
... |
c1e4ed75-03c1-49e6-9b13-42b8c1a244f0 | 3 | public static boolean playsAll(Role role, String... r) {
if (role == null) {
return false;
}
for (String s : r) {
if (!role.value().contains(s)) {
return false;
}
}
return true;
} |
4ea8f87f-9ae5-48dd-823f-6985ad32efff | 5 | public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int count = 1;
while (true) {
String[] in = br.readLine().split(" ");
if (in.length <= 3)
break;
long max = 0;
long second_max = 0;
for (int i = 0; i < 4; i++) {... |
2eb8e0b7-5607-4640-9c73-38b825f5af23 | 0 | @Override
public WebDriver getDefaultWebDriver()
{
return new LocalFirefoxWebDriver().getWebDriver();
} |
802e7421-5964-4e8c-b761-36f17f9b5335 | 5 | public boolean saveTileInfo(){
try{
fc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
int returnVal = fc.showOpenDialog(this);
if(returnVal == JFileChooser.APPROVE_OPTION) {
File file = fc.getSelectedFile();
FileOutputStream x = new FileOutputStream(file.getAbsolutePath());... |
18a44fdc-2a70-4548-b0da-7920f03b0a16 | 8 | public String execute() throws CrashException {
try {
Registry registry = LocateRegistry.getRegistry(destPeer.IPaddr, destPeer.serverPortno);
ServerSideInterface stub = (ServerSideInterface) registry.lookup("ServerSide");
// Provo a contattare il peer
String result = stub.ElectionInit();
System.out... |
e8493b62-1175-4f5e-aa79-f273bd0b2a75 | 5 | void replaceAllocStmt(Unit u, Local cls){//Set<Unit> set){
String classname = null;
/* Iterator it = u.getDefBoxes().iterator();
while(it.hasNext()){
Value v = ((ValueBox)it.next()).getValue();
if(v instanceof Local){
Local l = (Local)v ;
classname = l.getType().toString();
}
}
*/
StringBui... |
b5e6b834-bff9-4a0e-b293-8f25fb6ec06e | 5 | public static ArrayList<Student> gradeChanger(ArrayList<Student> inList)
{
int whichStudent = 0;
int whichClass = 0;
String newGrade = null;
//which student are we doing something for?
printClassList(inList);
System.out.println("Enter the student number who's grade you want to change?");
Scanner ... |
f102052a-8c6a-499a-bbcc-4ae16991a005 | 6 | public int read(Size size, int bank, int addr) {
boolean fastrom = false;
// Determine speed by bank
if (bank >= 0x80) {
fastrom = true;
}
if ((bank == 0x00 || bank == 0x80) && addr >= 0x4000 && addr <= 0x41FF) {
Timing.cycle(12); // 12 master cycles to access these
return get(size,bank,addr);... |
8cef6a65-6394-4956-9a86-2e1cbf067d55 | 4 | private void flush() {
if (this.readyState != ReadyState.CLOSED && this.transport.writable &&
!this.upgrading && this.writeBuffer.size() != 0) {
logger.fine(String.format("flushing %d packets in socket", this.writeBuffer.size()));
this.prevBufferLen = this.writeBuffer.siz... |
ce7a09ec-8344-4bfc-b9f8-2f6ba6851ef4 | 5 | public boolean metodoCompare(Pessoa u ){
{
if (this.end.equals(u.getEnd()) && this.nome.equals(u.getNome())
&& this.login.equals(u.getLogin()) && this.senha.equals(u.getSenha())
&&this.instituicao.equals(getInstituicao())){
return true;
}
return false;
}
} |
3f8c36fb-8891-4826-9442-f62149a7e634 | 6 | public static void update()
{
WordFinder.kill();
WordFinder._ScrabbleGame.clearOldAnswer();
WordFinder._ScrabbleGame.setGameText(haventFoundWordsMessage, "Thinking");
boolean isNewGame = true;
for (int i = 0; i < 15 && isNewGame; i++)
{
... |
183ac5ce-39c5-4259-8375-36bef3546a90 | 2 | private DataInputStream requestFile(String name) throws IOException {
// if (!aBoolean872) {
// if (Signlink.mainapp != null) {
// return Signlink.openurl(name);
// } else {
// return new DataInputStream((new URL(getCodeBase(), name)).openStream());
// }
// }
... |
07f7d4d7-b6bd-403c-8dae-ed10e5ed2680 | 7 | final Class39_Sub2 method1066(int i) {
int j = 0;
Class39_Sub2 aclass39_sub2[] = new Class39_Sub2[5];
for (int k = 0; k < 5; k++) {
if (~anIntArray1871[k] != 0) {
aclass39_sub2[j++] = Class39_Sub2.method439(TraversalMap.aClass73_969, anIntArray1871[k], 0);
... |
77d59278-2677-4d25-962d-e7f004b24c81 | 3 | @Override
public Component getTreeCellRendererComponent(JTree tree, Object value,
boolean selected, boolean expanded, boolean leaf, int row,
boolean hasFocus) {
CourseFilter filter = getFilterOut(value);
if (filter != null)
return prepareCheckbox(filter.getName(), filter.isActive(),
selected);... |
d7bf6756-47fd-4849-ad9e-9a0bb91414a0 | 6 | private BufferedImage twistImage(BufferedImage tag) {
double dMultValue = random.nextInt(7) + 3;// 波形的幅度倍数,越大扭曲的程序越高,一般为3
double dPhase = random.nextInt(6);// 波形的起始相位,取值区间(0-2*PI)
BufferedImage destBi = new BufferedImage(tag.getWidth(),
tag.getHeight(), BufferedImage.TYPE_INT_... |
f58f5fa6-4198-44f1-8137-824b7cd00205 | 1 | public void restartGame() {
//Make a new thread to ensure we don't run it on the EDT
new Thread() {
public void run() {
if (panel != null) {
panel.removeComponentListener(panel);
panel.removeMouseMotionListener(panel);
... |
1a4b2a92-5748-42fe-8640-ce1131b5b76c | 2 | public void actionPerformed(ActionEvent e)
{
if(g.isGameOver())
{
countdownTimer.stop();
}
else if (--secondsRemaining > 0)
{
g.getForm().setTimerTime("Seconds left: " + String.valueOf(secondsRemaining));
}
... |
63d19875-8c54-4adb-893e-76c768644f26 | 4 | OptionSet( Map<String, AbstractOptionSpec<?>> recognizedSpecs ) {
detectedSpecs = new ArrayList<OptionSpec<?>>();
detectedOptions = new HashMap<String, AbstractOptionSpec<?>>();
optionsToArguments = new IdentityHashMap<AbstractOptionSpec<?>, List<String>>();
defaultValues = defaultValues... |
a7fc1e59-0f51-4a05-b878-a8b9115f8419 | 2 | private boolean handleCustomCommand(String name, String params) {
boolean handled = true;
Command customCommand = Settings.getInstance().getCommand(name);
if (customCommand != null) {
if (++recursionDepth > MAX_RECURSION_DEPTH) {
InputHandler.showRecursionTooDeepErr... |
0f9ebd95-a610-447e-acd0-671c66152677 | 5 | public void addConnection(int key1, int key2) {
Element element1 = elements.get(key1);
Element element2 = elements.get(key2);
if (element1 == null) {
throw new IllegalArgumentException(
"Unable to find element with key " + key1 + " in the model");
}
if (element2 == null) {
throw new IllegalArgume... |
06347525-008d-4881-a8f2-adf514bf4d2c | 9 | public boolean excludeClass(Class<?> clazz, boolean serialize) {
if (version != Excluder.IGNORE_VERSIONS
&& !isValidVersion(clazz.getAnnotation(Since.class), clazz.getAnnotation(Until.class))) {
return true;
}
if (!serializeInnerClasses && isInnerClass(clazz)) {
return true;
}
... |
4b81e540-c7b8-40c4-9a2b-3b58493efefe | 9 | public void saveImages(List<Cache> list, int folderid) {
// TODO Auto-generated method stub
Folder folder = this.folderDao.getFolder(folderid);
File basePath = new File(ServletActionContext.getServletContext().getRealPath("cache"));
if(!basePath.exists()){
basePath.mkdirs();
}
... |
804935e8-43fe-45f0-8116-9e767c118a86 | 0 | private static void showMessage(MessageShower ms) {
ms.show();
} |
6e78c26a-5c42-48e9-baac-b7915585aaeb | 5 | public String buscarProspectoPorDNI(String DNI){
//##########################CARGA_BASE DE DATOS#############
tablaDeProspectos();
//##########################INGRESO_VACIO###################
if(DNI.equals("")){
DNI = "No busque nada";
return resultBusque... |
b6027913-20d6-4c3e-9c91-df3733f1f65b | 4 | public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String line = "";
StringBuilder out = new StringBuilder();
d: do {
line = br.readLine();
if (line == null || line.length() == 0)
break d;
int[] nums = returnInts(lin... |
2dbd46f7-f3e5-4eac-97d4-36824e50d336 | 3 | private char[] hashPassword(char[] password)
throws CharacterCodingException {
byte[] bytes = null;
char[] result = null;
String charSet = getProperty(PARAM_CHARSET);
bytes = Utility.convertCharArrayToByteArray(password, charSet);
if (md != null) {
synchr... |
f8735813-9510-4a2b-9566-3052a279ebd0 | 0 | public boolean editTransition(Transition transition) {
return false;
} |
3f497814-c042-4dae-b71b-7f08a72e597c | 4 | public static boolean isCausallyReady(Op op) {
StateVector vec = op.getStateVec();
int s = vec.getId();
if (!(vec.get(s) == stateVector.get(s) + 1))
return false;
for (int i = 0; i < stateVector.size(); i++) {
if (i != s && vec.get(i) > stateVector.get(i))
... |
d540a4e5-5f09-4b87-8074-a25844837572 | 4 | public void InsertNames(Collection<CollectionAndArtist> names) {
String sql = "INSERT INTO dbo.Artists (lname,fname,collection,crawler,verified,url) VALUES ";
StringBuilder sb = new StringBuilder(sql);
int size = names.size();
int inserted = 0;
if (size == 0) {
Syste... |
3293f80c-1977-469c-a1f3-d74908f5f436 | 3 | @WebMethod(operationName = "ReadOrderIn")
public ArrayList<OrderIn> ReadOrderIn(@WebParam(name = "ord_in_id") String ord_in_id) {
OrderIn ord_in = new OrderIn();
ArrayList<OrderIn> ord_ins = new ArrayList<OrderIn>();
ArrayList<QueryCriteria> qc = new ArrayList<QueryCriteria>();
... |
41a1cbe2-4fbb-4011-ad3d-bd638a4fd214 | 7 | @EventHandler
public void OnPlayerSoup(PlayerInteractEvent event)
{
Player player = event.getPlayer();
if(plugin.getConfig().getBoolean("options.instant-soup"))
{
if (player.hasPermission("EasyPvpKits.Soup"))
{
if(player.getHealth() == 20){}
else
{
int soup = +7;
if((event.getAction().equa... |
9049877b-e5f5-4df6-9fcc-6fe345e3a255 | 3 | @Override
public String toString() {
// Create output
StringBuilder out = new StringBuilder();
out.append("enityId\tentityName");
for (int j = 0; j < results.size(); j++) {
String lab = Gpr.sanityzeName(labels.get(j));
out.append("\t" + lab);
}
out.append("\n");
for (int i = 0; i < size(); i++) {... |
2e9ce57d-55f6-4a19-87a7-e9dd9d736c5c | 3 | @Test
public void testGameController() {
GameController gc = new GameController(paddle1,paddle2,ball,view,padq1,ballq1);
assertEquals("Epic Pong.",gc.getTitle());
Component[] components = gc.getContentPane().getComponents();
boolean correct = false;
for(Component c: components){
if(c.equals(view)){
... |
c3c808a1-e6b9-4ba1-b5c0-39ee473d6290 | 0 | public boolean isValid(){
return cells != null;
} |
42672abe-82f1-4bf7-85ac-b0d23628c32a | 4 | @Test
public void testToStringServerMessageQueueEmptyCh() {
LOGGER.log(Level.INFO, "----- STARTING TEST testToStringServerMessageQueueEmptyCh -----");
try {
server1.setUseMessageQueues(true);
} catch (TimeoutException e) {
exception = true;
}
try {
... |
918f415e-15fc-4f28-87b4-f6d37cd1f1b8 | 2 | public static String fileToString(File f) throws Exception {
StringBuilder sb = new StringBuilder();
String line;
try {
BufferedReader in = new BufferedReader(new FileReader(f));
while ((line = in.readLine()) != null) sb.append(line + "\n");
} catch (Exception e) {
throw new Exception(... |
11327bf3-974a-46f4-8e2f-62749f647423 | 1 | public void visit_dsub(final Instruction inst) {
stackHeight -= 4;
if (stackHeight < minStackHeight) {
minStackHeight = stackHeight;
}
stackHeight += 2;
} |
ab5be396-9c38-42a7-b0cd-7dd1394e3264 | 8 | public void endHand(Vector<PlayerHand> winners){
String winnersMessage = "Winner!";
int cardIndex = -1;
for (OpponentPanel panel : panels.values()){
panel.showCards();
}
if (winners.size() > 1){
winnersMessage = "Split pot";
}
for (PlayerHand winningHand : winners) {
Player winner = winn... |
5dc361e9-3b36-448d-ae8d-94a35b483d0b | 2 | public List<String> getListString(String key, List<String> def) {
if(fconfig.contains(key)) {
return fconfig.getStringList(key);
}
else {
fconfig.set(key, def);
try { fconfig.save(path); } catch (IOException e) { e.printStackTrace(); }
return def;
}
} |
4958cab4-946c-42ae-ad89-1acecacc93b4 | 3 | public Object getValueAt(int rowIndex, int columnIndex)
{
Command row = lista.get(rowIndex);
if(0 == columnIndex) {
return row.getVrijeme();
}
else if(1 == columnIndex) {
return row.getUser();
}
else if(2 == columnIndex) {
return ro... |
47deff3d-054f-4dce-b252-462388287577 | 3 | private synchronized void addScene(Sprite sprite, int t){
if(t==-1){
totalTime=-1;
}
else
totalTime += t;
Sprite[] temp = new Sprite[list.length+1];
for(int i=0; i<list.length; i++)
temp[i] = list[i];
temp[list.length] = sprite;
list = temp;
int[] tempTime = new int[spriteTime.length+1];
... |
c5ad6c92-d3f9-4bf7-bd8f-ee8114e8a213 | 0 | public int size() {
return N;
} |
c7e35163-d6db-49f6-9903-94d13d3b8e63 | 5 | public void RemoveRecentFile(String filename) {
int i;
for(i=0;i<recentFiles.length-1;++i) {
if(recentFiles[i]==filename) {
break;
}
}
for(;i<recentFiles.length-1;++i) {
recentFiles[i]=recentFiles[i+1];
}
recentFiles[recentFiles.length-1]="";
// update prefs
for(i=0;i<recentFiles.length;++... |
5063c1c2-b317-42dd-804d-2e9fbb87f56e | 5 | private void launch() {
try {
BufferedImage inputImage = ImageIO.read(new File(inputFile));
widthInPieces = inputImage.getWidth() / pieceSize;
heightInPieces = inputImage.getHeight() / pieceSize;
if ((widthInPieces * pieceSize + 1) > inputImage.getWidth()) {
... |
00d5ae64-1711-4767-a1f2-fe2f5574d97c | 3 | public void draw(Graphics2D g2) {
this.calculateY();
if (this.sprite) {
ImageRendering.drawImage(g2, "Graphics/" + this.spritePath
+ "T.png", Main.FRAMEWIDTH / 2, this.y, this.angle);
this.count++;
if (this.count > 4) {
this.sprite = false;
this.count = 0;
}
} else {
ImageRendering.dra... |
67b1b38e-59fe-44f9-b991-cd48a9e92f63 | 3 | @Override
public void run() {
boolean stop = false;
while (!stop) {
System.out.println("My Thread is running......");
long time = System.currentTimeMillis();
while ((System.currentTimeMillis() - time) < 1000) {
}
if (Thread.currentThread()... |
41a71aca-1939-446e-b35a-14cca98a7414 | 8 | private Color computeField(int x, int y) {
Atom a;
double intensity = 0.0;
double xij, yij, rij;
synchronized (getSynchronizedLock()) {
for (Iterator it = iterator(); it.hasNext();) {
a = (Atom) it.next();
if (a.getCharge() > Particle.ZERO) {
xij = x - a.rx;
yij = y - a.ry;
rij = Math.... |
f493e303-dfba-4ceb-af0f-6620e74e754c | 1 | public int size() {
if (front <= rear)
return rear - front;
else
return (N - front + 1) + rear;
} |
0eb5bac4-de02-4f00-974e-c9981efda3d7 | 0 | public boolean isRegistered(String name) {
return this.listeners.containsKey(name);
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.