method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
29d195b1-6146-4792-84f0-07672f0c7f8a | 0 | @Override
public YamlPermissionOp getOP() throws DataLoadFailedException {
checkCache(PermissionType.OP, "op");
return (YamlPermissionOp) cache.get(PermissionType.OP).get(null);
} |
d9ee5ca1-a811-479c-99f0-b0e4ecbdb099 | 0 | @Override
public String toString() {
return "Value " + probability;
} |
f8d0d505-32d6-4674-afcf-c87ae8e82ff4 | 6 | public long getLong(int bits) throws IOException {
if(bits>64) {
throw new IllegalArgumentException("Argument \"bits\" must be <= 64");
}
long res=0;
if(endian==LITTLE_ENDIAN) {
for(int i=0; i<bits; i++) {
if(getBit()) {
res|=(1L<<i);
}
... |
5f8ec731-9b46-4693-bbe0-1b54704d8509 | 2 | public void select(int index)
{
for(int i=0;i<markers;i++)
{
if(i==index)
{
marker[i].select();
}
else
{
marker[i].unSelect();
}
}
} |
e3c415e4-2379-41ae-b891-24f249df69b4 | 1 | private static List<IArticle> getArticleMocks(int size) throws IOException {
List<IArticle> articles = new ArrayList<>();
for (int i = 0; i < size; i++) {
IArticle article = mock(IArticle.class);
when(article.getName()).thenReturn("Article" + articleNameUniqueIndex++);
... |
21460e62-e925-4d29-9919-87dfeaaf14cb | 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... |
8ef46f98-2026-40b2-9200-a6454351ec65 | 3 | public void setComingAsTinyInt(String coming){
if(coming == null){
this.coming = null;
return;
}
switch (coming){
case "0":
setComing(false);
break;
case "1":
setComing(true);
break;
... |
69e4eb68-4671-4f77-bc9a-eefb03d1696e | 3 | private boolean saveToFile(String fileName) {
if(cardStackFrom == null) return true; // nothing saved
CardStack setToWrite = new CardStack(cardStackFrom);
// setToWrite.addCardStack(cardStackHard);
setToWrite.addCardStack(cardStackTo);
if(card != null) setToWrite.addCard(card);
if(!setToWrite.writeToFile(f... |
e4414afe-495d-4b67-9ec0-81b433f78665 | 7 | public boolean isAnagram(String s, String t) {
boolean res = false;
if(s==null||t==null|| s.length()!=t.length() ){
return res;
}
int len = s.length();
char[] sc = s.toCharArray();
char[] tc = t.toCharArray();
int tsum = 0;
int ssum = 0;
byte sxor = 0x0;
byte txor = 0x0;
for(int i=0;i<len;i++){... |
4f13260b-6392-41ab-baa5-7ad92c4ac8a1 | 6 | static boolean timetableByStation(ObjectOutputStream toServer, ObjectInputStream fromServer, Scanner scanner) throws IOException, ClassNotFoundException {
log.debug("Start \"timetableByStation\" method");
List<String> listAllStation = listStations(toServer, fromServer);
DateFormat dateFormat = n... |
cd44dfd2-11f0-4e4e-af86-a181dbeb92be | 2 | public static Set<Integer> findDivisors(int a) {
Set<Integer> factors = new HashSet<Integer>();
factors.add(1);
for (int x = 2; x < a; x++) {
if (a % x == 0) {
factors.add(x);
}
}
return factors;
} |
e56cf056-e161-4492-a5d8-ec8cf72ffa7b | 2 | @Test
public void testCSV() {
try {
InputStreamReader c = new InputStreamReader(getClass().getResourceAsStream("/format.xml"));
BufferedReader r = new BufferedReader(c);
StringBuffer b = new StringBuffer();
String line = r.readLine();
while (line!=null) {
b.append(line);
line = r... |
f1565d7e-4cd4-4c8d-a789-fafbd39fdc0a | 1 | @Override
public void userLeft(String nickname) {
boolean isMe = getServerTab().getConnection().getNick().equals(nickname);
if (isMe) {
getServerTab().removeChannelTab(this);
} else {
appendInfo(nickname + " odešel z místnosti." );
usersModel.detachUser(ni... |
5e7f91b7-9b2b-487d-97e4-aee7ead152f7 | 8 | private static double rndGamma1(double s){
double a = 0,p = 0,uf = 0,ss=10.0,d = 0,r,x=0,small= 1e-37,w;
if (s!=ss){
a = 1.0-s;
p = a/(a+s*Math.exp(-a));
uf = p*Math.pow(small/a, s);
d = a*Math.log(a);
ss = s;
}
for(;;){
r = generator.nextDouble();
if (r>p){
x = a-Math.log((1.0-r)/(1... |
090edd20-8e5e-4e3e-8c1c-90c28597c4ef | 1 | public void disableComponent(String comp) {
Iterator<GameActor> it = actors.values().iterator();
while(it.hasNext()) {
GameActor actor = it.next();
actor.disableComponent(comp);
}
actorManager.disableComponent(comp);
} |
b49c95f4-3b44-47e7-9c63-9aa1b16319fb | 2 | @Test
public void testGetTrackingByNumber()throws Exception{
Tracking trackingGet1 = new Tracking("RC328021065CN");
trackingGet1.setSlug("canada-post");
Tracking tracking = connection.getTrackingByNumber(trackingGet1);
Assert.assertEquals("Should be equals TrackingNumber", "RC328021... |
96323feb-f428-41dc-857c-5170e31ae8f2 | 4 | public synchronized void stop() {
debug("Route.stop() Route-" + hashCode());
if (stopped) {
warn("Route.stop() called but already stopped");
}
stopped = true;
synchronized(processors) {
for (ConnectionProcessor proc : processors) {
proc.disconnect();
}
}
if (serverSocket != null) {
try
... |
30de6fac-a7d1-4ab7-acf4-5edce73478cc | 3 | public static Annotation buildAnnotation(Library library,
int type,
Rectangle rect,
AnnotationState annotationState) {
// state manager
StateManager stateManager = libr... |
df923e39-f183-4196-aac3-52eb74ab7960 | 5 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// Opérations pré-traitement.
preTraitement(request, response);
// ================================
// Gestion de la ressource demandée
// ================================
// Accueil
... |
4d3e34d4-9ee5-4402-9f9d-9a657b2446f0 | 2 | public void testToStandardDuration_years() {
Period test = Period.years(1);
try {
test.toStandardDuration();
fail();
} catch (UnsupportedOperationException ex) {}
test = Period.years(-1);
try {
test.toStandardDuration();
fa... |
48f3098f-32ff-4e6f-9972-ca45f1dd0a0f | 4 | @Override
public void draw(int x, int y) {
glColor4f(1f, 1f, 1f, 1f);
//TODO fix this, it's due to a quirk in the drawing code that offsets the draw by one
x = x - Standards.TILE_SIZE;
y = y - Standards.TILE_SIZE;
Boot.getTexHandler().bindTexture("player");
float rotation = this.getOrientation() * 90;
... |
9436bd06-ce7a-4163-8bc0-dbfb0d706c23 | 3 | public static boolean isPrime(int totest){
if (totest ==2)
return true;
for (int n =3;n<totest;n+=2){
if (totest%n==0)
return false;
}
return true;
} |
03413794-e76f-47c9-bd68-0daae2698e3e | 3 | public void createTray() {
// Check the SystemTray is supported
if (!SystemTray.isSupported()) {
System.out.println("SystemTray is not supported");
return;
}
Image image = Toolkit.getDefaultToolkit().getImage("Tray_logo.jpg");
final PopupMenu popup = new PopupMenu();
final TrayIcon trayIcon = new Tray... |
736b5765-69a2-4254-8cb4-cb922e99f769 | 3 | private void changeDialogTo(final String id) {
if (!id.equals(currentMenuButtonId)) {
int currentIndex = buttonIdList.indexOf(currentMenuButtonId);
int nextIndex = buttonIdList.indexOf(id);
Element nextElement = screen.findElementByName(buttonToDialogMap.get(id));
modifyMoveEffect(EffectEve... |
9f231119-6718-4428-ab14-cee03a1e5550 | 8 | public ListNode detectCycle(ListNode head) {
ListNode oneStep = head;
ListNode twoStep = head;
while(oneStep != null && twoStep != null && twoStep.next != null){
oneStep = oneStep.next;
twoStep = twoStep.next.next;
if(oneStep ==twoStep)
break... |
125cd452-3be9-4813-b344-eefc497bcf23 | 1 | public boolean mouseReleased(int x, int y) {
beingClicked = false;
if (bounds.contains(x, y)) {
onMouseRelease(x, y);
return true;
}
return false;
} |
5d47126e-141d-4062-b351-69b2cbbdcb2d | 7 | @Override
public String execute(HttpServletRequest request, HttpServletResponse response) throws Exception {
String data;
try {
ArrayList<FilterBean> alFilter = new ArrayList<>();
if (request.getParameter("filter") != null) {
if (request.getParameter("filterop... |
bcc2157e-b563-464f-a531-7f4775516216 | 6 | @Override
public void actionPerformed(ActionEvent event) {
if(event.getActionCommand().equals("Add")){
String userkey = username.getText().toString();
String passkey = password.getText().toString();
String mess = user_dao.regisUser(userkey, passkey);
if(!userkey.equals("")) {
message.setText... |
dc22b0de-8426-4690-8f2a-46383184cf72 | 8 | private static Point round(Point prev, Point curr, Point next){
double x = curr.x().doubleValue();
double y = curr.y().doubleValue();
for(int hop=0; ;hop++){//BUG: too long time when two segments are nearly parallel
//System.out.println(hop);
for(int row=-hop; row<=hop; row++){
for(int col=-hop; col<=ho... |
26c1b4e0-3a04-4f62-98ee-cdc260e65027 | 2 | protected void unbrew(int[] buf) {
assert buf.length % 2 == 1;
int i, v0, v1, sum, n;
i = 1;
while (i < buf.length) {
n = CUPS;
v0 = buf[i];
v1 = buf[i + 1];
sum = UNSUGAR;
while (n-- > 0) {
v1 -= ((v0 << 4) + S[... |
7d2d2be3-50ff-41cb-a3f4-9b0d0354b902 | 1 | private int sumNumbers(String[] numbers) {
int sum = 0;
for(String number : numbers){
sum += toInt(number);
}
return sum;
} |
f4f0584e-0f8d-45fe-9258-340997819997 | 5 | public void splitChildOfNode(BTreeNode parent, int splitIndex) {
BTreeNode rightPart = new BTreeNode(order);
BTreeNode leftPart = parent.getChildAt(splitIndex);
rightPart.setAmIaLeaf(leftPart.isLeaf());
rightPart.setNoOfKeys( order - 1 );
for(int j=0 ; j < order-1 ; j++) {
rightPart.setKeyAt(j, leftPart.ge... |
eebae71b-f1d3-40f6-840e-2d261eb8ad03 | 9 | public boolean attaquer(Region regionDefensive, int nbforceAttaque,
int nbforceDefense)
{
if (attaquePossible(regionDefensive))
{
Integer[] resultatDeAttaque = null;
resultatDeAttaque = new Integer[3];
Integer[] resultatDeDefense = null;
resultatDeDefense = new Integer[2];
resultatDeAttaque[0]... |
2d5294b5-418b-4ba2-833f-a10d851866a8 | 5 | @Override
public int removexattr(String path, String name) throws FuseException {
try {
fileSystem.removeExtendedAttribute(path, name);
} catch (PathNotFoundException e) {
return Errno.ENOENT;
} catch (AccessDeniedException e) {
return Errno.EACCES;
} catch (UnsupportedFeatureException e) {
if (Env... |
f04d59c8-384f-4437-a93b-514056bcb060 | 6 | private void generaAzione(){
String t="ospiti";//team che conduce l'azione
double cSS=(double)match.getCasa().compareTo(match.getOspiti())/15;//Coefficiente di Sbilanciamento Squadre
if(Math.random()<0.53+cSS){//comprende il fattore casa
t="casa";
}
if(Math.random()<percTipo){
CalcioPiazzato a=new Ca... |
f6de1ac1-d411-4d15-8409-0dfb7eb02c88 | 1 | public boolean doTransformations() {
StructuredBlock last = flowBlock.lastModified;
return CreateCheckNull.transformJikes(this, last)
|| CreateClassField.transform(this, last);
} |
35e432e2-e0a4-4217-95ce-65a923d96426 | 7 | @Override
public void run() {
try {
try {
input = new ObjectInputStream(connection.getSocket().getInputStream());
} catch (IOException ioe) {
connection.sendMessage(new SocketDisconnec... |
5a58eaa0-3a7b-45b6-9f81-1393047281da | 7 | @Override
public List<String> generate(final String aValue) {
if (aValue == null || aValue.isEmpty()) {
return Collections.emptyList();
}
final List<String> result = new ArrayList<String>();
int index;
boolean isStackValid = true;
initFields(aValue);
... |
a120cb81-179e-4693-89bc-5c3d66582bfe | 6 | @Override
public void onMessage(final IRCChannel channel, final String sender,
final String message) {
if (message.startsWith(Variables.commandPrefix)) {
instance.getCommandManager().onIRCCommand(sender, message, channel);
} else if (!Variables.passOnName
&& !... |
21306cd8-ef33-4a59-9953-f13fba20e33c | 9 | private void paintState(Graphics2D g, float hairline) {
g.setColor(Color.GRAY);
// Draw cells.
g.setStroke(new BasicStroke(hairline));
for (int x = 0; x < board.getWidth(); x++) {
for (int y = 0; y < board.getHeight(); y++) {
g.draw(new Rectangle2D.Double(x + WALL_THICKNESS / 2, y
+ WALL_THICKNESS... |
9dc7456a-0bf1-43f8-a835-f0dab60105fc | 5 | public void init() {
eCount = 0;
sCount = 0;
dCount = 0;
ac = getAudioClip(getDocumentBase(), "sounds/mystery.wav");
acFall = getAudioClip(getDocumentBase(), "sounds/end.wav");
acShot = getAudioClip(getDocumentBase(), "sounds/laser.wav");
score = 0;
// add keyboard listener
addKeyListener(this);
... |
b9c93b01-7e12-4412-bf1f-fee54b289662 | 4 | public void visit(String site) throws IOException, MalformedHtmlException{
request(site, null, GET).setType(RAW);
HttpRequest in = sendWait();
switch(in.getType()){
case ERROR:
sleep(50);
((Exception) in.getData()).printStackTrace();
sleep(50);
break;
case NULL:
System.out.print(... |
7b39147e-a033-42ae-a7f3-90b33a35892d | 8 | private void loadState() {
try {
Class.forName("org.sqlite.JDBC");
Connection conn = DriverManager.getConnection("jdbc:sqlite:"+MineJMX.Persistance );
Statement stat = conn.createStatement();
prepTables(stat) ;
ResultSet rs = stat.executeQuery("SELECT key , type , data FROM metrics ;") ;
while (rs.... |
f931043d-0c68-4ef6-9f77-a42da1e48c20 | 7 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final Item target=getTarget(mob,mob.location(),givenTarget,commands,Wearable.FILTER_ANY);
if(target==null)
return false;
if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
return false... |
65c4d8f4-1306-4ba7-ac38-5663c34e365a | 7 | public void bucketFill(int x, int y) {
BufferedImage image = canvas.getImage();
int replaceColor = canvas.getColor().getRGB();
int targetColor = image.getRGB(x, y);
if (targetColor != replaceColor) {
Stack<Point> stack = new Stack<Point>();
stack.push(new Point(x, y));
Point point;
while (!stack.isE... |
76618c83-c40d-4aff-a8ba-5d8c4ee87a08 | 3 | public int pieces(char c, Square[][] theBoard)/**
* @returns the number of pieces of a given
* character left.
*/
{
int count = 0;
for (int x = 0; x < 8; x++)
{
for (int y = 0; y < 8; y++)
{
if (theBoard[x][y].getPiece() == c)
... |
4c01c063-0c5d-4229-a702-9544db917e3c | 4 | public void undo() {
if (prevSpeed == CeilingFan.HIGH) {
ceilingFan.high();
}
if (prevSpeed == CeilingFan.MEDIUM) {
ceilingFan.medium();
}
if (prevSpeed == CeilingFan.LOW) {
ceilingFan.low();
}
if (prevSpeed == CeilingFan.OFF) {... |
bdffd750-c0e5-421d-92de-019a52a88b2a | 2 | public boolean alterar(){
EntityManager em = conecta();
try {
Medico medico = em.find(Medico.class, idMedico);
medico.setNome(nome);
medico.setCrm(crm);
em.getTransaction().begin();
em.persist(medico);
em.getTransaction... |
da10bb63-3a40-4708-a400-f0b515d9085e | 7 | private void cacheAllClasses(String name) throws ClassNotFoundException {
JarFile jarFile = null;
String stripClassName = "";
try {
jarFile = new JarFile(FILE_PATH_NAME);
} catch (IOException e) {
LOG.error("Jar file " + FILE_PATH_NAME + " not found" + e.getMessag... |
37918f99-0480-4210-96f0-e39ce22ffc7b | 9 | public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while(true){
int n = sc.nextInt();
if(n==0)break;
List<P> l = new ArrayList<P>();
P[] s = new P[4001];
int id = 1;
while(n--!=0){
int d = sc.nextInt();
if(s[d]==null){
s[d] = new P();
s[d].x = d;
s... |
c5b43ec8-666a-40a3-81e6-bbe9c6e87463 | 6 | public void processClass() throws IllegalArgumentException, IllegalAccessException{
for(Field f:obj.getClass().getDeclaredFields()){
f.setAccessible(true);
if(f.isAnnotationPresent(CommandAnnotation.class) && f.get(obj) instanceof CommandListener){
CommandAnnotation ann = f.getAnnotation(CommandAnnotation.c... |
90ee87e9-74d5-48fb-9b36-338140c85050 | 8 | @Override
public void mouseReleased(MouseEvent e) {
// TODO Auto-generated method stub
if (back.getState () == 1) {
back.setState(0);
main.setScreen(SelectionScreen);
}
if (help.getState() == 1){
help.setState(0);
main.setScreen(HelpScreen);
}
if (addEgg.getState() == 1) {
addEgg.setState(0)... |
06722928-a101-47f1-87c4-ab112ddb553d | 2 | public Production[] getNonLambdaProductions(Grammar grammar) {
ProductionChecker pc = new ProductionChecker();
ArrayList list = new ArrayList();
Production[] productions = grammar.getProductions();
for (int k = 0; k < productions.length; k++) {
if (!ProductionChecker.isLambdaProduction(productions[k]))
l... |
7052477b-6ecf-467b-b971-6cd829941289 | 3 | public static String loadShader(String fileName){
StringBuilder shaderSource = new StringBuilder();
BufferedReader shaderReader = null;
try{
try {
shaderReader = new BufferedReader(new FileReader("./res/shaders/" + fileName));
} catch (Exception e) {
e.printStackTrace();
System.exit(1);
}
... |
511ab98d-a9a3-46c1-bb6e-7dd34ec8f6f6 | 3 | public void deleteBookByTitle(final String title) {
Book bookToDelete = null;
for (Book book : bookList.getBookList()) {
if (title.equals(book.getTitle())) {
bookToDelete = book;
}
}
if (bookToDelete != null) {
bookList.getBookList().r... |
dc077351-c4f7-4227-9d74-49e31a534505 | 8 | protected LinkedList<Book> getBooks() {
if (LOGGER.isLoggable(Level.FINE)) {
LOGGER.fine("The call of Model.getBooks()");
}
long startTime = System.currentTimeMillis();
LinkedList<Book> books = new LinkedList<Book>();
String SQL = "SELECT * FROM books";
try {
... |
09ee49d3-fda4-43a2-9dc1-852171575d1c | 3 | public Search_BookNameID1() throws SQLException {
try {
initComponents();
lblBookName.setText(" ");
jLabel3.setText(" ");
jLabel6.setText(" ");
jLabel8.setText(" ");
jLabel10.setText(" ");
jLabel12.setText(" ");
jLab... |
dc4f245a-bfde-4e5d-b19e-c0eeeda7eaae | 5 | private static void inline(final BloatContext context) {
final Set liveMethods = new TreeSet(new MemberRefComparator());
final CallGraph cg = context.getCallGraph();
liveMethods.addAll(cg.liveMethods());
BloatBenchmark.tr("Inlining " + liveMethods.size() + " live methods");
if (BloatBenchmark.CALLEE_SIZE !... |
d17a1184-815a-44cb-8654-6db9354c71e4 | 8 | private MultipleChoiceAnswer getChosenMultipleChoiceAnswer() {
String correctAnswer = ((MultipleChoiceAnswer) question.getCorrectAnswer()).getAnswer();
String result = null;
String answer1 = GuiUtils.stripHtmlWrappedString(this.jRadioButton1.getText());
String answer2 = GuiUtils.stripHt... |
78c2a87b-3019-4e1a-b983-0e7476177d15 | 9 | @Override
public Query rewrite(IndexReader reader) throws IOException {
if (minNrShouldMatch == 0 && clauses.size() == 1) { // optimize 1-clause queries
BooleanClause c = clauses.get(0);
if (!c.isProhibited()) { // just return clause
Query query = c.getQuery().rewrite(r... |
e8d9c851-3304-467d-8d91-210441051f6c | 4 | public void run() {
try {
InputStream input = clientSocket.getInputStream();
OutputStream output = clientSocket.getOutputStream();
while (true){
byte[] receivedBytes = new byte[BUFFER_SIZE];
//System.out.println("Waiting read\n");
... |
54cc4338-2a3a-4057-8946-4a5c55cedddc | 8 | void repairCutValues(Edge edge) {
spanningTree.remove(edge);
Node n = getTreeTail(edge);
int cutvalue = 0;
int multiplier = (edge.target == n) ? 1 : -1;
EdgeList list;
list = n.outgoing;
Edge e;
for (int i = 0; i < list.size(); i++) {
e = list.getEdge(i);
if (e.tree && e != edge)
cutvalue += ... |
002b1f7b-0cd7-4fa0-ab81-a3dcccc3a6c7 | 5 | private String getJoinMessage(String groupName, String playerName) {
if(groupName.equalsIgnoreCase("New")){
return null;
}else if(groupName.equalsIgnoreCase("Member")){
return ChatColor.GRAY + playerName + " joined!";
}else if(groupName.equalsIgnoreCase("VIP")){
return ChatColor.DARK_AQUA + playerName + ... |
a281bd79-47f1-4ff8-aa56-6c6c0c007a07 | 0 | public Environment getEnvironment() {
return environment;
} |
96229d34-8888-4da5-bead-7803022490fe | 1 | public void display(Integer level) {
String space = "";
for (int i = 0; i < level; i++) {
space += "-";
}
System.out.println(space + name);
} |
fd3d7496-7d7a-40d5-b007-0bd7ec69fe38 | 4 | public static Venue nearestAdminFor(Actor actor, boolean welfare) {
final World world = actor.world() ;
final Upgrade WS = AuditOffice.RELIEF_AUDIT ;
for (Object o : world.presences.sampleFromKey(
actor, world, 5, null, SERVICE_ADMIN
)) {
final Venue v = (Venue) o ;
if (v.base() !... |
01d15a55-dca3-48da-9cb7-dc5b1b3cd9ac | 4 | @Override
public String toString() {
switch(this) {
case TILE_TREASURE:
return "$";
case TILE_HARDBLOCK:
return "#";
case TILE_SOFTBLOCK:
return "?";
case TILE_FLOOR:
default:
return "... |
15a4c9b0-7d65-4ba1-988a-835c5aa911af | 0 | public final void drawIcon(Graphics g, Icon icon) {
icon.paintIcon(this, g, (getWidth() - icon.getIconWidth()) >> 1, 0);
g.translate(0, icon.getIconHeight());
} |
ded06f84-3df4-4ee1-b2b8-7df9201c51e4 | 0 | public AntLabMain () {
ant11 = new AntLab11();
ant12 = new AntLab12();
ant21 = new AntLab21();
ant22 = new AntLab22();
ant31 = new AntLab31();
} |
41556332-af40-4fd3-be99-e8f5fb46aacd | 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... |
6d2c8941-7a3b-4d50-bc3d-76990faa9911 | 7 | public ArrayList<Renderable> getRenderables(int x, int y, int w, int h) {
ArrayList<Renderable> ret = new ArrayList<Renderable>();
//Fix values. TODO more fixing.
if(x < 0)
x = 0;
if(w >= mapGrid.length)
w = mapGrid.length;
if(x + w >= mapGrid.length)
w = mapGrid.length - x;
for(int i = x; i < w... |
19cebe7b-6f1b-4ee5-9422-d5969bac2b22 | 5 | @SuppressWarnings("unchecked")
@RequestMapping(value = "/loginAuthentication", method = RequestMethod.POST)
public ModelAndView loginAuthentication(HttpServletRequest req,ModelAndView model) throws IOException {
// Create the Object for EmployeeBeanClass
//EmployeeBeanClass employee = EmployeeBeanClass.getInstanc... |
3519f454-a8b9-4f0d-9f12-86ea7f522694 | 2 | public void gotPower(int type) {
switch(type) {
case PowerUp.FLY:
break;
case PowerUp.TALL:
width = 2 * DEFAULT_WIDTH;
height = 2 * DEFAULT_HEIGHT;
break;
}
} |
00249ee3-61fc-4cc0-a2aa-d82c83484d75 | 5 | public JsonElement next() throws JsonParseException {
if (!hasNext()) {
throw new NoSuchElementException();
}
try {
return Streams.parse(parser);
} catch (StackOverflowError e) {
throw new JsonParseException("Failed parsing JSON source to Json", e);
} catch (OutOfMemoryError e... |
3d7b525f-aa97-4e58-b977-6c0a4672cd87 | 7 | public Command getCommand(char currentOperator) {
Command command;
switch (currentOperator) {
case BrainFuckConstants.SHIFT_RIGHT:
command = new ShiftRight();
break;
case BrainFuckConstants.SHIFT_LEFT:
command = new ShiftLeft();
... |
38e2ce33-3fdd-4fd1-9a48-bd0267a09862 | 2 | public static void main(String[] args) {
ScheduledExecutorService executorService = Executors.newScheduledThreadPool(1000);
for (int i = 0; i < 10000; i++) {
final int no = i;
Runnable runnable = new Runnable() {
@Override
public void run() {
... |
839a67da-4d14-4404-a7be-f628ca2a9843 | 2 | @Override
public String getPrettyRepresentation(Object value) {
if (value instanceof Boolean) {
return (Boolean) value ? "Yes" : "No";
} else {
return super.getPrettyRepresentation(value);
}
} |
ffdd28e3-c233-4d0c-bc63-7202927865b7 | 1 | public static void main(String args[]){
Client client=new Client("loggg", "pwwwd");
client.setNom("ad");
client.setPrenom("euhlol");
client.setTelephone(158);
ClientDAO clientdao =new ClientDAO();
// //test ajout réussi
clientdao.AjouterClient(client);
// // test update ... |
2dbc873a-a2a9-4d57-b374-dbe0a6485199 | 5 | public void decrease(T node, int key){
if(this.location.get(node)==-1 || this.location.get(node)==0){
return;
}
int i = this.location.get(node);
if(key<this.heap[i].getKey()){
this.heap[i].setKey(key);
while(i>1 && this.heap[parent(i)].getKey()>this.he... |
62dbf34f-9f88-45c0-a4fc-b683e237ca4a | 6 | public void sample(int[] S, int sampleSize) {
k = new int[sampleSize];
if (k.length > S.length)
return;
if (S == null || S.length == 0)
return;
int i=0;
for (i=0; i<k.length; i++)
k[i] = S[i];
for (int j=i; j<S.length; j++) {
... |
47f820d8-47cb-4c42-92ab-390cfb084291 | 7 | public SymbolSet first(List<Symbol> l, int start) {
SymbolSet result = newSymbolSet();
Symbol s = null;
SymbolSet fs = null;
for (int i = start; i < l.size(); i++) {
s = l.get(i);
if (s instanceof NonTerminal) {
if (AmbiDexterConfig.nonTerminalLookahead) {
result.add(s); // add nonterminals to... |
d5cb3927-dd8b-4ac1-878d-73f71583eed0 | 2 | public BoardModel waitForBoardInfo() throws IOException {
while (true) {
String[] tokens = this.inStream.readLine().split(" ");
if (tokens[0].equals("BOARD")) {
int width = Integer.parseInt(tokens[1]);
int height = Integer.parseInt(tokens[2]);
... |
606aa1a3-8316-428a-8905-5abf293e7d3b | 5 | public boolean equals(Object obj)
{
if(obj instanceof Ship)
{
Ship objShip = (Ship)obj;
if(objShip.x == this.x && objShip.y == this.y && objShip.xSize == this.xSize && objShip.ySize == this.ySize)
return true;
}
return false;
} |
6a0587fd-3ca6-4dff-9019-be2c957d0fcd | 3 | @Before
public void setUp(){
FileWriter FW;
FW = new FileWriter();
FW.add("TestText", "Test");
FW.add(58, "Achtundfünfzig");
FW.add(true,"bool");
FW.add(false,"bool2");
TestClass[] tests = new TestClass[testArray.length];
for(int i = 0;i<tests.length;i++){
tests[i] = new TestClass(testArray[i]);
}... |
51f2e493-8c37-4a70-b300-942ff67e30aa | 1 | private static String getStringFromDocument(Document doc) {
try {
DOMSource domSource = new DOMSource(doc);
StringWriter writer = new StringWriter();
StreamResult result = new StreamResult(writer);
TransformerFactory tf = TransformerFactory.newInstance();
... |
32ee31ec-00ad-4f2e-bc4d-d969b69467ef | 0 | public void setAffiliatId(String consumerKey) {
this.affiliateId = consumerKey;
} |
64fdd734-756d-4059-9498-1c9cb0e44167 | 9 | public static void zipDir(File zipRootDir, File targetDir, ZipOutputStream out) {
File[] files = targetDir.listFiles();
byte[] tmpBuf = new byte[1024];
String relative = zipRootDir.toURI()
.relativize(targetDir.toURI()).getPath();
// Manage folders, excluding the root case
if(!zipRootDir.equals(... |
0ea941a9-25d6-469f-920c-042f02972d53 | 3 | public void dispose(GLAutoDrawable gLDrawable) {
try {
if (animator.isAnimating())
animator.stop();
Thread ani = animator.getThread();
if (ani != null)
ani.join();
} catch (InterruptedException e) {
// TODO Aut... |
5418113e-4da4-41d0-88fb-512480652fc8 | 4 | public void keyReleased(KeyEvent e) {
key = e.getKeyCode();
if (key == KeyEvent.VK_A) {
move_x = 0;
}
if (key == KeyEvent.VK_LEFT) {
move_x= 0;
}
if (key == KeyEvent.VK_D) {
move_x = 0;
}
if (key == KeyEvent.VK_RIGHT) {
move_x= 0;
}
} |
90a4646b-1a09-4324-8fea-1e381997ac39 | 4 | @Command("proxy")
public static Object proxy(final Scope scope, List<?> klassNames, Statement statement)
throws Exception, PoslException {
Scope child = scope.createChildScope();
Interpreter.process(child, statement);
Class<?>[] klasses = new Class[klassNames.size()];
int index = 0;
for (Object object : k... |
401fdcc3-9ecf-4368-b878-48644154ce81 | 4 | public static String[] mergeStringArrays(String[] array1, String[] array2) {
if (ObjectUtils.isEmpty(array1)) {
return array2;
}
if (ObjectUtils.isEmpty(array2)) {
return array1;
}
List<String> result = new ArrayList<String>();
result.addAll(Arrays.asList(array1));
... |
b2bb0083-468b-413f-b534-3ecc1e19f6e2 | 1 | private static DecimalImpl safegetInstance(final long base, final int factor)
{
if (DPU.isTooBigBase(base))
{
return getInstance(base / 10, factor - 1);
}
else
{
return getInstance(base, factor);
}
} |
5466a5df-11a9-4ea8-8a5b-bcbd41b30ac0 | 9 | public void jsFunction_useNativeCursor(Object o) {
Cursor c = Cursor.getDefaultCursor();
if (Boolean.FALSE.equals(Context.toBoolean(o))) {
c = createEmptyCursor();
}
if (o != null) {
String cursorStr = Context.toString(o).toLowerCase();
if ("default"... |
d543e18a-96f2-40d3-b638-e89f3f2c448e | 4 | public static void setZIndex(int index) {
if (getSelectedIndex() == index) {
return;
}
if (Main.selectedId != -1 && !Main.getSelected().locked) {
RSInterface rsi = Main.getInterface();
if (rsi.children != null) {
int selected = getSelectedIndex();
int id = rsi.children.get(selected);
int x = ... |
d7a33ee6-b400-40ac-82b2-fb29c9cda307 | 0 | public void setjLabel5(JLabel jLabel5) {
this.jLabel5 = jLabel5;
} |
2f51123a-f553-419d-820c-5b9f03a5b3c8 | 8 | void updateOrder(OMMMapEntry entry)
{
OMMData data = entry.getData();
if (data.getType() != OMMTypes.FIELD_LIST)
{
myCallback.notifyStatus("UpdateOrder: Invalid data type; expecting FieldList!!!");
return;
}
OMMData key = entry.getKey();
if (k... |
c0b7a4de-b432-4ebe-a155-e260424c39ea | 1 | public PreferenceBoolean getApplyFontStyleForMoveability() {
if (useDocumentSettings()) {
return this.applyFontStyleForMoveability;
} else {
return Preferences.getPreferenceBoolean(Preferences.APPLY_FONT_STYLE_FOR_MOVEABILITY);
}
} |
8de8a209-7e85-468d-a98f-7b6af8507abe | 6 | private final void method504(int i) {
if (i != 1999)
aByteArray995 = null;
anInt982++;
for (Class348_Sub23 class348_sub23
= (Class348_Sub23) aClass356_1011.method3484(0);
class348_sub23 != null;
class348_sub23 = (Class348_Sub23) aClass356_1011.method3482(0)) {
if (class348_sub23 instanceof C... |
b0d7c538-b4fa-43f7-b9e8-bfb55ac33ef8 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Coordinates other = (... |
d6ebc060-00ad-4f5b-bd20-7995053c33b4 | 7 | @Override
public void keyReleased(KeyEvent e) {
if (!view.getNameJTextField().getText().equals("")){
boolean unique=true;
for (int i=0; i<view.getModel().objectsListSize();i++){
if (view.getIndex()!=i
&& view.getModel().getObjectUmlAtIndex(i).getName().equals(view.getNameJTextField().getText())){
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.