method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
65771a4f-4cbd-4560-b862-a5b55b0a15f9 | 1 | static public boolean playsRole(final CSProperties p, String key, String role) {
String r = p.getInfo(key).get("role");
if (r == null) {
return false;
}
return r.contains(role);
} |
d01ad103-a146-4f45-bc81-3caf366bcc12 | 2 | private int indexOf(float[] a, float x) {
for (int i = 0; i < a.length; i++) {
if (a[i] == x) {
return i;
}
}
return -1;
} |
3954b371-0502-41ae-841a-9ce572d610cf | 5 | private void instantiateType(){
isSensor= true;
switch(ID){
case "mutagenicHorror":
case "fireyField":
case "chillyWind":
duration = 3;
damageStrength = 1.5f;
break;
case "electricField":
duration = 3;
damageStrength = 1.8f;
break;
case "boulderFist":
//only lasts as long as the anima... |
ecb6e39b-b764-4220-8598-b675dbf26366 | 4 | @Override
public String decrypt(String cipherText) {
String text = processInput(cipherText);
int r = transpositionLevel;
int length = text.length();
int c=length/transpositionLevel;
char mat[][]=new char[r][c];
int k=0;
String plainText="";
for(int i=0;i< r;i++) {
for(int j=0;j<... |
2dfcc7c9-081b-42e6-957f-62704cf41dca | 3 | static void doTest(String desc, R btx, R xml) throws Throwable {
Timer t;
p("--------------------------");
p("Start test: " + desc);
for (int r = 0; r < 3; r++) {
t = new Timer();
for (int i = 0; i < 50; i++) {
btx.r();
t.mark();
}
t.report("btx");
t = new Timer();
for (int i... |
fe9eccae-acaf-4821-b7c5-c73169859554 | 9 | public void move() {
for (Organism org : Ecosystem.getOrange()) {
if (getDist(org) < sight) {
int x = posX - org.posX;
int y = posY - org.posY;
double d = Math.sqrt(x * x + y * y);
movX += 10 * (x / d);
movY += 10 * (y / d);
}
}
int dist = 1000;
for ... |
d91b7359-98f7-4965-a000-2f253ac61ba8 | 8 | private void extract(String name) {
File actual = new File(getDataFolder(), name);
if (!actual.exists()) {
InputStream input = getClass().getResourceAsStream("/" + name);
if (input != null) {
FileOutputStream output = null;
try
{
output = new FileOutputStream(actual... |
ec6a5d13-08c5-4142-9de2-478c5e607aeb | 6 | public static ListNode mergeKLists(ArrayList<ListNode> lists) {
if (lists == null || lists.size() == 0) {
return null;
}
Queue<ListNode> heap = new PriorityQueue<ListNode>(lists.size(), listNodeComparator);
// add element to heap
for (int i = 0; i < lists.size(); i++) {
if (lists.get(i) != null) {
/... |
8cc46870-42d1-4409-a65a-b1664a1c41ae | 2 | private void initializeVariables() {
variables = new TreeMap<Integer, Integer>();
variablesSnapshot = new TreeMap<Integer, Integer>();
// each site has copies of variables with even indexes
for(int i = 1; i<=10; i++) {
variables.put(2*i, 20*i);
variablesSnapshot.put(2*i, 20*i);
}
// if the sid of a si... |
5ec18dd3-8d15-41f0-8eb3-0ecd8fc84d3a | 8 | public void setEffectImage() throws SlickException{
Random rand = new Random();
int randomEffect = rand.nextInt(8); //Four pictures
switch (randomEffect){
case 0: effectImage = new Image("data/effects/powerup.png");
effectType = "Larger Paddle";
break;
case 1: effectImage = new Image("data/effects/powerd... |
58f20124-4684-46ab-aecf-345fb721ebfa | 2 | public void setUserlistPosition(Position position) {
if (position == null) {
this.userlist_Position = UIPositionInits.USERLIST.getPosition();
} else {
if (position.equals(Position.NONE)) {
IllegalArgumentException iae = new IllegalArgumentException("Position none... |
ab8a6672-f1f4-46fc-8f82-89ed06cf82eb | 7 | @Around("execution(* ProfileServiceImpl.shareProfile(..))")
public void aroundShare(ProceedingJoinPoint joinPoint) throws Throwable{
ProfileServiceImpl profileService = (ProfileServiceImpl)joinPoint.getTarget();
Object [] args = joinPoint.getArgs();
System.out.println(args[0] + " shares the profile of " + args... |
58b5777f-97ed-43f8-a40c-229342efb129 | 3 | public static boolean anoBissexto(int a) {
if ( a%4==0 && a%100!=0 || a%400==0 )
return true;
return false;
} |
7592ea61-126e-4646-829b-ec7eff2e7d33 | 7 | public void run() {
if(duration != -1) {
Robot.getInstance().getMotion().getPilot().forward();
Delay.msDelay(duration);
if(!getInterrupted()) {
Robot.getInstance().getMotion().getPilot().stop();
Robot.getInstance().getMotion().setRunnableRobot(null);
Robot.getInstance().warn(new Event(TypeEvent.G... |
6271c816-dacc-4422-acaf-8205ff2f2692 | 8 | public void Move(Location newloc)
{
Block array[] = null;
int a = 0,b = 0,c = 0 ;
int cux,cuy,cuz;
cux = flags.get("sx");
cuy = flags.get("sy");
cuz = flags.get("sz");
Server server = Bukkit.getServer();
//Location loc = new org.bukkit.Location(init.server.getWorld(getProp("world")), cux, cuy, cuz);
... |
b499affc-d417-4253-bae6-8bc6076f34c6 | 5 | @Override
public void runTask(InstallTasksQueue queue) throws IOException, InterruptedException {
String currentPath = relauncher.getRunningPath();
Utils.getLogger().log(Level.INFO, "Moving running package from " + currentPath + " to " + launcher.getAbsolutePath());
File source = new File(c... |
0e1187c2-505b-41bc-abce-dd3961eeb990 | 6 | private static int calcMinValueNeeded(int curActiveFrame,int minAValueNeeded,int minBValueNeeded, Map<PII, Integer> imActiveFrame, boolean optimizeA) {
int minValueNeeded = (optimizeA ? minAValueNeeded : minBValueNeeded);
for(Entry<PII, Integer> e : imActiveFrame.entrySet())
if(curActiveFrame > e.getValue() && (... |
b68164f2-8cd4-4c8c-9df2-1069de82d379 | 7 | @Override
public List<LayoutNode> generate(int num, int dir)
{
final Vector<LayoutNode> set = new Vector<LayoutNode>();
Vector<TreeStem> progress = new Vector<TreeStem>();
final long[] rootCoord = new long[]{0,0};
final LayoutSet lSet = new LayoutSet(set,num);
originalDirection=dir;
final TreeStem root =... |
60ae4e10-4665-428e-b0f0-a59fe704af17 | 1 | @Override
public V remove(Object key) {
int index = keys.indexOf(key);
if (index != - 1) {
V temp = values.get(index);
keys.remove(index);
values.remove(index);
return temp;
}
return null;
} |
c9ffda3e-fd92-44bf-80f6-5300378eba47 | 7 | protected void setCurrentStyle(String code) {
String oldStyle = currentStyle;
currentStyle = "";
String newStyle = "";
if (code.length() == 2) {
if (code.contains("0")) {
newStyle = defaultColor;
} else if (code.contains("-")) {
if ... |
4166f39a-ad02-4277-bbd9-b2c5833d0046 | 8 | public boolean fireballCollideCheck(Fireball fireball)
{
if (deadTime != 0) return false;
float xD = fireball.x - x;
float yD = fireball.y - y;
if (xD > -16 && xD < 16)
{
if (yD > -height && yD < fireball.height)
{
if (noFireballDeath... |
1ad8984a-0f70-4047-b526-28dfe08f5d89 | 6 | public Dialog saveDialog(int categoryId, Dialog dialog){
DialogCategory category = categories.get(categoryId);
if(category == null)
return dialog;
dialog.category = category;
while(containsDialogName(dialog.category, dialog)){
dialog.setTitle(dialog.getTitle() + "_");
}
if(dialog.id < 0){
lastUsed... |
c5899afa-e06c-46ce-9715-6cadf654280b | 5 | public boolean shouldActivate(Duel duel, Duelist duelist) {
if(!this.hasEffect()) return false;
try {
PluginVars.engine.eval(new FileReader(this.effectFile));
try {
Object ret = PluginVars.engineinv.invokeFunction("shouldActivate", duel, duelist);
if(Boolean.class.isInstance(ret)) {
Boolean retva... |
2d158971-37ac-4c94-8f44-21c2b241e45e | 2 | private static String bytetoString(byte[] digest) {
String str = "";
String tempStr = "";
for (int i = 0; i < digest.length; i++) {
tempStr = (Integer.toHexString(digest[i] & 0xff));
if (tempStr.length() == 1) {
str = str + "0" + tempStr;
... |
3747dbec-176e-4a49-b522-c24551854bce | 7 | private Tile(final char c, final boolean solid) {
this.solid = solid;
this.c = c;
switch (c) {
case '2':
img = ImageLoader.tile_glass_grey;
break;
case '3':
img = ImageLoader.tile_glass_black;
break;
case '4':
img = ImageLoader.tile_dirt;
break;
case '5':
img = ImageLoader.tile_grass... |
1d85426d-9955-4b17-aac2-b8c70faae7a7 | 7 | private void split(Hand hand) {
int card1Value = this.playerHand.getCard(0).getValue1();
int card2Value = this.playerHand.getCard(1).getValue2();
// money check
if ((2 * hand.getBet()) <= this.getBalance()) {
// make sure conditions met
if ((this.playerHand.countCards() == 2)
&& (card1Value == card... |
5a7f9ed8-dd6f-4703-8527-02925c300343 | 2 | public boolean equals(LigneMarqueur liMarq2){
for(int i=0; i < tabMarq.length; i++){
if(tabMarq[i] != liMarq2.getMarq(i)){
return false; // Si les 2 tables de marqueur ne sont pas égales
}
}
return true;
} |
6b82bc62-f466-4c01-b88a-8e1f95c2e4a3 | 3 | @Test
public void testReportDuplicate() throws Exception{
ParkedUsers garage = ParkedUsers.getInstance();
ParkingSpot spot = garage.searchBySpotNumber("312");
spot.setPrintWriter(new PrintWriter(System.out)); //2223432
String testedSpot = "312";
String userType = "student";
String tested... |
ceb530e0-c371-4d8e-b47c-1980e3921ace | 9 | @SuppressWarnings("unchecked")
public Object invoke(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
if (type == Type.FORWARD) {
request.getRequestDispatcher(target).forward(request, response);
} else if (type == Type.REDIRECT || type == Ty... |
deac20e5-106b-474d-bddd-0bab57f89e7f | 7 | public Resource gatherResources(World world, int x, int y, int amount) {
if(x >= world.width || x < 0 || y >= world.height || y < 0 || world.getTile(x, y).id != this.getID()) return null;
int available = getResources(world, x, y);
int newAmount = available - amount; if(newAmount < 0) newAmount = 0;
int gathe... |
7084eb13-18f6-452c-9138-ae73f6d852b0 | 4 | public void updateVersion() {
fileNumber = 0;
currentFile = 0;
try {
versions = OberienURL.getVersions();
status.append("Update finished\n\n");
status.append("Reinitialize verion label...\n");
serverVersion = versions[0];
status.append("Getting local version...\n");
try {
clientVersion =... |
1e5995f1-1914-4d3f-9095-92b2e61f9091 | 2 | public void popularCbEncarregado() {
ArrayList<String> Encarregado = new ArrayList<>();
UsuarioBO EncarregadoBO = new UsuarioBO();
try {
Encarregado = EncarregadoBO.ComboBoxEncarregadoPorDepartamento(this.usuarioLogado.getDepartamento().getCodigo());
} catch (SQLException ex... |
b6ed8951-1311-4081-9919-59edb263269e | 1 | @Override
public void update(UpdateSubject updater) {
for (SquareGraphic sq : squareGraphicList) {
sq.setState(Service.getWorstState(sq.getStock()));
}
} |
5bae462b-b61c-43ac-829a-24f352d265bb | 9 | public static void compareMomentumHL(String filename, int reps, int epochsPerRep, int printFrequency,
ANN ann, double[] mentums, int[] hlsizes, double[][] inputs, double[][] outputs) throws IOException {
File file = new File(filename);
FileWriter f = new FileWriter(file.getAbsolutePath());
int numDataPoints =... |
454ac5a5-cc2e-44c1-8c3a-96b06b9ef5c1 | 1 | public String toString() {
return this.mode == 'd' ? this.writer.toString() : null;
} |
1f43c46b-f0ee-4bea-9001-73b553b4b042 | 5 | public static boolean isAddress(String address) {
if (isNull(address)) {
return false;
}
String[] tokens = address.split(StringPool.AT);
if (tokens.length != 2) {
return false;
}
for (String token : tokens) {
for (char c : token.toCharArray()) {
if (Character.isWhitespace(c)) {
return f... |
26624a21-f10f-40c3-a422-cfefc2f6e993 | 0 | public void operation() {
System.out.println("concrete ImplementorA operation!");
} |
bdfdd9bc-2b6b-42d6-9566-8d4f649c5fca | 4 | public void collide(){ // CHECKS COLLISIONS
this.south = (Map.checkCollide(this.x, this.y + length + 1 ) || Map.checkCollide(this.x + length, this.y + length + 5));
this.north = (Map.checkCollide(this.x, this.y - 1) || Map.checkCollide(this.x + length, this.y - 1));
this.west = (Map.checkCollide(this.x - 1, th... |
bd2f7050-9666-4ee3-b29c-1eef9b0a25fd | 8 | @Override
public void onClick(Position position)
{
if (board == null)
{
return;
}
if (!board.isEmpty(position) && board.getPiece(position).getColor() == playerColor)
{
if (selectedPosition == position)
{
selectedPosition = null;
gui.clearReachablity();
return;
}
possibleMoves = M... |
e979fd5b-898c-4a0e-94ce-f063a2c9cd86 | 4 | private static void solve_one_class(svm_problem prob, svm_parameter param,
double[] alpha, Solver.SolutionInfo si)
{
int l = prob.l;
double[] zeros = new double[l];
byte[] ones = new byte[l];
int i;
int n = (int)(param.nu*prob.l); // # of alpha's at upper bound
for(i=0;i<n;i++)
alpha[i] = 1;
if... |
e6b35ed5-5be2-4641-aa02-13daa7b35037 | 6 | public static void createEvents(GameModel model) throws IOException {
URL url = Room.class.getResource(eventsDescriptorFilePath);
BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
assert reader != null;
String line = null;
while ((line = reade... |
32be44ac-bffa-4dec-b11c-52e76b65df13 | 2 | public void save() throws IOException {
File file = new File(System.getProperty("resources") + "/database/factions");
if(file.exists()) {
file.delete();
file.createNewFile();
} else {
file.createNewFile();
}
BufferedWriter writer = new BufferedWriter(new FileWriter(file));
for(int x = 0; x<li... |
b301dd60-594c-4345-905b-48fd6e612166 | 0 | public void addVertex(Object vertex, Point2D point) {
verticesToPoints.put(vertex, point.clone());
} |
8c89eaeb-124c-4152-8ecc-e47a895d8724 | 8 | public boolean stem() {
int v_1;
int v_2;
int v_3;
int v_4;
// (, line 157
// do, line 159
v_1 = cursor;
lab0: do {
// call prelude, line 159
if... |
1af8e732-a3ab-479c-918f-19e4498d1ac3 | 1 | private void closeOutput(){
try {
leavesNodeFileWriter.write("結束時間: " + getRightNowTimeStr("/", ":", " ") + "\r\n");
leavesContentFileWriter.write("結束時間: " + getRightNowTimeStr("/", ":", " ") + "\r\n");
leavesNodeFileWriter.close();
leavesContentFileWriter.close();
} catch (IOException e) {
// TODO A... |
6027555d-8d7e-4860-a708-041daf75bf24 | 1 | public String getLanguage() {
ConsoleFEData cd = (ConsoleFEData)extra.get(ConsoleFEData.signature);
if (cd == null) {
cd = new ConsoleFEData();
extra.put(ConsoleFEData.signature, cd);
}
return cd.getLanguage();
} |
022d405b-aa1d-4337-b948-c5cb65b23496 | 6 | public static void loadKeys() {
HashMap<String, String[]> oldKeys = loadKey();
if (oldKeys == null) {
ColorKeys.Log(Level.SEVERE, "Unable to load old Keys file.");
return;
}
for (String player : oldKeys.keySet()) {
for (String k : oldKeys.get(player)) {
String[] parts;
int uses = -1;
if... |
8da13841-22b0-4aa1-9f90-8bf4ce51f18e | 6 | public synchronized static void main(String[] args) {
SetupClient setupClient = new SetupClient();
try{
QuizServer quizAccess = (QuizServer)Naming.lookup("//127.0.0.1:1099/Quiz");
//quizList = quizAccess.getQuizList();
System.out.println("Quiz, Player and Result data are now availabe to setup ... |
9fed3fe8-66e3-478d-aa21-407ee44fc62a | 5 | public void runCommand(String command) {
for (Command x : commands) {
if (x.isMine(command)) {
String answer = x.execute();
if (answer != null) {
output.println(answer);
output.flush();
} else {
... |
c32dd52b-4065-4bd6-be7c-e82c9fc82447 | 3 | @Override
public List<SocialCommunity<?>> getCommunities(String query, Integer page) {
List<Group> groups = new ArrayList<Group>();// getGroups(query, page);
return Lists.transform(groups,
new Function<Group, SocialCommunity<?>>() {
@Override
public SocialCommunity<?> apply(Group object) {
re... |
ceb7d197-40e9-4716-96d4-3fca9e726b7f | 2 | public java.awt.Component prepareEditor(
javax.swing.table.TableCellEditor editor, int row, int col )
{
final java.awt.Component c = super.prepareEditor( editor, row, col );
if ( drawStripes && !isCellSelected( row, col ) )
c.setBackground( rowColors[row&1] );
return c;
... |
64059674-536f-4362-b77d-7349cadb2787 | 9 | public ArrayList<String> getTextureFilenames()
{
HashMap<String, Integer> tempMap = new HashMap<String, Integer>();
ArrayList<String> list = new ArrayList<String>();
list.add(this.tex);
if (this.tex_data != null)
{
for (String tex : this.tex_data.values())
{
if (!tempMap.containsKey(tex))
{
... |
8474f157-f155-45cf-9488-20949ae0d513 | 7 | private AttributeSet getTokenTextAttributes(TokenType token) {
if (token == null) {
return defaultAttributes;
}
switch (token) {
case ID:
return identifierAttributes;
case KEYWORD:
return keywordAttributes;
case KEYCHAR:
... |
133f1d7a-edf4-410d-9644-31fa741214c3 | 5 | static final void method2486(int i, int i_5_, int i_6_, int i_7_, int i_8_,
int i_9_) {
if (i_8_ >= Class369.anInt4960
&& (Class113.anInt1745 ^ 0xffffffff) <= (i_5_ ^ 0xffffffff)
&& (i_9_ ^ 0xffffffff) <= (Class132.anInt1910 ^ 0xffffffff)
&& Class38.anInt513 >= i_7_)
Class125.method1111(i_7_, ... |
726e7610-cd4d-4c03-896a-2185534c7129 | 8 | private boolean check() {
if (N == 0) {
if (first != null) return false;
}
else if (N == 1) {
if (first == null) return false;
if (first.next != null) return false;
}
else {
if (first.next == null) return false;
}
... |
67af1d25-4dad-4bfa-9706-c5fb4a2e2886 | 2 | public LocalVariableTable(int maxLocals, LocalVariableInfo[] lvt) {
locals = new LocalVariableRangeList[maxLocals];
for (int i = 0; i < maxLocals; i++)
locals[i] = new LocalVariableRangeList();
for (int i = 0; i < lvt.length; i++)
locals[lvt[i].slot].addLocal(lvt[i].start.getAddr(),
lvt[i].end.getAddr... |
bd2a0be4-a511-4203-a07c-dd7c1e8b3255 | 7 | public static LocationList getPermutation( final List<LocationList> variations, long variationi ) {
if (( null == variations ) || ( 0 == variations.size() )) return null;
if ( 0 > variationi ) return null;
long numVariations = getPermutationCount( variations );
if ( variationi >= numVariations ) return null;
... |
7268f9ac-126e-4d00-8426-34bc8cd23ed0 | 6 | private static void cleanCells() {
String fullFileName = "/Users/Johan/Documents/CellTowers/cells_exact_samples67-120_2036.json";
String newFileName = "/Users/Johan/Documents/CellTowers/cells_exact_samples67-120_cleaned.json";
JSONFile jsonFile = new JSONFile(newFileName);
jsonFile.iWannaStartAnArray("cells"... |
000db73b-e98b-4f88-996f-928b557086af | 2 | public void convert() {
try {
// File file = new File("E:\\Install\\levelssource.txt");
write(read());
} catch (JAXBException e) {
e.printStackTrace();
} catch (FileNotFoundException e) {
e.printStackTrace();
}
} |
fa4e8b14-5ac3-49c2-9ee7-6ef16c760f0f | 9 | public void parse(String input) throws ParseException {
String line;
String lastOpcodeLine = null;
List<String> lineBuffer = new ArrayList<String>();
Iterator<String> it = Splitter.on('\n').split(input).iterator();
while (it.hasNext()) {
line = it.next();
boolean isOpcode = (line.length() > 0 && l... |
dfa1f69d-a14c-4460-80b7-4e62531606a1 | 8 | public static String getPrintValue(AutomatonActions a) {
switch (a) {
case DRAGON:
return "D";
case SWORD:
return "S";
case ARC:
return "A";
case RIVER:
return "R";
case KEY:
... |
925674c4-547b-4c3d-9106-6f9ad0ca26a9 | 0 | public void setName(String name) {
this.name = name;
} |
8a153c77-4c1a-4be6-ad8d-3d51b30bfbaa | 3 | public int getMeetingAdminIndexByUsernameAndMeetingID(int meetingAdminID, String username){
for(MeetingAdmin meetingAdmin : meetingAdmins){
if(meetingAdminID == meetingAdmin.getMeetingID() && username.equals(meetingAdmin.getUsername())) return meetingAdmins.indexOf(meetingAdmin);
}
... |
f3c14be9-6a96-41a4-b371-531b0c832f0e | 2 | public String getPastUpdate() {
String past_update = (String) cache.get("past_update");
if (past_update != null)
return past_update;
Entity past_entity = null;
DatastoreService datastore = DatastoreServiceFactory
.getDatastoreService();
try {
past_entity = datastore.get(KeyFactory.createKey("past_st... |
4f7da4fb-bcc2-43bd-a1b9-3f5008e1e00f | 5 | public int minDepth(TreeNode root) {
if(root==null){
return 0;
}
if(root.left==null&&root.right==null){
return 1;
}
if(root.right==null){
return 1+minDepth(root.left);
}
if(root.left==null){
return 1+minDepth(root.ri... |
73985258-0f7a-4f5d-853c-1a27289e68c1 | 7 | public void outputTrainingData(String outputFile, List<Fortune> trainFortuneList){
Writer writer = null;
try {
writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outputFile), "utf-8"));
for(String word : this.vocabulary) {
writer.write(word + ... |
929e0d7d-56f7-4a6f-ba7f-407c57fe0a8c | 2 | public boolean editMessage(String title, String content){
if(title!=null)this.title =title;
if(content!=null)this.content = content;
save();
return true;
} |
baddbb33-674b-49c8-9567-fc7c9a2aba98 | 0 | @Id
@GenericGenerator(name = "generator", strategy = "increment")
@GeneratedValue(generator = "generator")
@Column(name = "consignment_id")
public int getConsignmentId() {
return consignmentId;
} |
9b295ef4-3565-4208-9a3c-3e05e9792d2f | 0 | public void setType(UpgradeType type) {
this.type = type;
} |
368bca0d-d6ca-4a2a-ad0c-c03d4dbc8d17 | 1 | public void cleanHeroes()
{
heroes = new ArrayList<core.Hero>();
while (heroesInner.count() > 0) {
heroesInner.takeAt(0).widget().dispose();
}
heroesSelected = -1;
} |
f508c97f-1de5-4f93-b0fe-2eecead4ec7c | 9 | private final Parameterization[] getParameterizations(
String serializedParameters, final IParameter[] parameters)
throws SerializationException {
if (serializedParameters == null
|| (serializedParameters.length() == 0)) {
return null;
}
if ((parameters == null) || (parameters.length == 0)) {
re... |
bdd901d5-c793-4d89-a028-fb2dd3006efb | 8 | public void writeMeanAndStdDevFiles(int[] placeIndicies) {
DecimalFormat form = new DecimalFormat("0.0");
StringBuilder meanBuffer = new StringBuilder("Totals\t");
StringBuilder standDevBuffer = new StringBuilder("Totals\t");
//begin by labeling the columns...
for (int i = 0; i < placeIndicies.length; i++)... |
a9d0f5fa-65db-4ebb-867b-aab4fcec5495 | 3 | public static Vector<Integer> alea(int k, int n) {
Vector<Boolean> val = new Vector<>(n, 0);
for (int i = 0; i < val.capacity(); i++) {
val.addElement(false);
}
Vector<Integer> tab = new Vector<>(k, 0);
int cpt = 0;
for (int i = 0; i < k; i++) {
int r = rand.nextInt(n);
tab.insertElementAt(r, i)... |
80506981-6882-4791-a8a0-b99ef1f1926f | 9 | public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
long n = 0, m = 0, a = 0, b = 0, x = 2;
int T = sc.nextInt();
for (int t = 0; t < T; t++) {
n = sc.nextLong();
if (n == 0) {
break;
}
... |
52a5e8c2-11be-47ba-adbc-b6f6881dab1f | 4 | public void writeInformation(Description d, int categoryID, HUD UI) {
if (categoryID >= 3) return ;
else super.writeInformation(d, categoryID, UI) ;
if (categoryID == 0) {
final String
uS = needMessage(upgradeLevel),
tS = needMessage(upgradeLevel + 1) ;
if (uS != null) {
... |
c1ab38f6-ef79-4402-bd12-af1b859c48a0 | 0 | public void testAddYear() {
Date date = DateUtils.addYear(testDate, 1);
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
assertEquals(2013, calendar.get(Calendar.YEAR));
} |
f6ee1056-46af-4801-9188-f441ac2e6193 | 4 | private boolean isRankConsistent() {
for (int i = 0; i < size(); i++)
if (i != rank(select(i))) return false;
for (Key key : keys())
if (key.compareTo(select(rank(key))) != 0) return false;
return true;
} |
81612636-af7a-478a-b10e-c91be6d140db | 8 | public static void psychic5_draw_sprites(osd_bitmap bitmap)
{
int offs,sx,sy,tile,palette,flipx,flipy;
int size32,tileofs0,tileofs1,tileofs2,tileofs3,temp1,temp2;
/* Draw the sprites */
for (offs = 11 ;offs < spriteram_size[0]; offs+=16)
{
if (!(spriteram.read(offs+4)==0 && spriteram.read(offs)==0xf0)... |
77322dc9-b8ee-4bc7-991d-7c357ac9b878 | 1 | public T pop() {
if(nodes.size() == 0)
return null;
T t = this.getLast();
nodes.remove(nodes.size() - 1);
return t;
} |
3fd7ca72-6f03-4add-aed1-1095dcf34ab3 | 0 | public boolean getFood() {
return this.hasFood;
} |
35b13031-c34d-4238-99b1-da343069514b | 9 | @Override
public void Configure(Context context) {
// TODO Auto-generated method stub
LOG.info("Config MultiLineParser");
buffer_size_ = context.getInteger("read_buffer_size",
FlumeConstants.READ_BUFFER_SIZE).intValue();
read_buffer_ = new byte[buffer_size_];
max_buffer_size_ = context.ge... |
345f2f55-bae4-4364-8803-b1726fa3d342 | 9 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final MOB target=(givenTarget instanceof MOB)?(MOB)givenTarget:mob;
if(target.fetchEffect(ID())!=null)
{
target.tell(L("You are no longer automatically marking traps."));
target.delEffect(mob... |
68f53017-363e-43b2-90c0-c555aaea25e3 | 1 | private void setLogger(ILogger logger) {
if (logger == null) {
System.err.println("[RemoteServerConnection WARN] Logger isn't assigned.");
this.logger = new FakeLogger();
}
else {
this.logger = logger;
}
} |
9da4ef61-6ff3-4b3c-acd8-0f0afdf51690 | 2 | public Login() {
initComponents();
ImageIcon iconLogo = new ImageIcon(IMG.getImage("menu_soldados.png"));
ImageIcon iconLogo2 = new ImageIcon(IMG.getImage("Label_nombre.png"));
//obtener usuario
Lusuario.setIcon(iconLogo);
JTextField TextUsuario = new ja... |
b03b5e7e-8fea-4ca7-99ec-d81ff9793573 | 6 | public void run()
{
while(running)
{
if(connected)
{
if(debugMode) TEMPReadFromSocket();
else ReadFromSocket();
}
/*else
{
//if not connected, wait a bit before rechecking
try ... |
2a05f7cf-af76-436f-ba58-4030c22d6ef2 | 7 | public static Tile getUnexplored(
IntelMap intelMap, Target target
) {
//
// TODO: Restrict this to within a given Box2D area if possible.
final Vec3D pos = target.position(null) ;
final MipMap map = intelMap.fogMap() ;
int high = map.high() + 1, x = 0, y = 0, kX, kY ;
final Co... |
6b1730a9-95eb-427a-9cb3-558572f6391c | 5 | public static byte[] decodeLines(String s) {
char[] buf = new char[s.length()];
int p = 0;
for (int ip = 0; ip < s.length(); ip++) {
char c = s.charAt(ip);
if (c != ' ' && c != '\r' && c != '\n' && c != '\t') {
buf[p++] = c;
}
}
... |
4d88f6f3-0883-476a-94e0-b10599e93dfd | 5 | public boolean isDocDateExistsInTable(String docTableName) throws SQLException {
ArrayList<String> columnNames = new ArrayList<String>();
Connection conn = DriverManager.getConnection(ConnectionController.getConnParams);
String query = "select COLUMN_NAME from INFORMATION_SCHEMA.COLUMNS where TA... |
b775e9d3-b9fc-4ece-9987-5d95351411a6 | 8 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result
+ ((buyNowPrice == null) ? 0 : buyNowPrice.hashCode());
result = prime * result
+ ((description == null) ? 0 : description.hashCode());
result = prime * result + ((endTime == null) ? 0 : endTime.hashCode()... |
8fa727b3-0e44-473d-9f14-ababf181347e | 3 | @Override
public void render(GameContainer arg0, StateBasedGame arg1, Graphics graphics)
throws SlickException {
//Draw debug information
if (debug) {
//Draw mouse position
graphics.drawString("Mouse X: " + (mouseX < 0 ? "??" : mouseX) +
", Y: " + (mouseY < 0 ? "??" : mouseY), 10, 30);
}
} |
c40e5704-13ff-4536-8e1f-d4f084920298 | 6 | public void setTypeName(int titleID) {
switch (titleID) {
case 0: typeName = "The Ditzy ";
break;
case 1: typeName = "Cryptic";
break;
case 2: typeName = "The Seer of Fates";
break;
case 3: typeName = "Flirtatous";
break;
case 4: typeName = "King of the Mountain";
break;
case 5: typeNa... |
27e9ce5b-791e-44d2-9be9-91cdadf5515a | 3 | StringTokenizer(String value, char delim) {
string = value;
// Loop on the characters counting the separators and remembering
// their positions
StringCharacterIterator sci = new StringCharacterIterator(string);
char c = sci.first();
while (c != CharacterIterator.DONE) {
if (c == delim) {
// ... |
fc0efd85-aefe-438f-9c5a-c9bca47fea71 | 3 | private void jbtnSend_ActionPerformed()
{
if
(
this.contacts != null && this.contacts.size() > 0
&& this.etaMsg.getText().length() > 0
)
{
EzimMsgSender jmsTmp = new EzimMsgSender(this);
EzimThreadPool.getInstance().execute(jmsTmp);
}
} |
b632e8ce-81fb-4bf3-95dd-71f4acc343b3 | 0 | public TargetPIDTilt(Target target, double timeout, boolean continuous){
super(target,Target.Axis.Y,timeout,continuous,
0.7, 0.15, 1, // P, I, D
0.7,1, // tolerance, maxOutput
1.5/10); // period - high to allow for network latency.
requires(Robot.til... |
4f11c57c-8574-4ad9-ae8a-4f573996fd6f | 3 | public static synchronized void endProfiling(final String reportPath) throws IOException {
if (reportPath == null)
throw new NullPointerException("reportPath must not be null");
if (reportPath.length() == 0)
throw new IllegalArgumentException("reportPath must not be an empty string");
subLC... |
2f1e0979-95cc-4baa-9e41-6255ddd04725 | 7 | @POST
@Path("/Add")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response Add (UserResponse data)
{
if (data == null
|| data.password == null
|| data.username == null)
return Response
.status(400) // Bad... |
5f62b187-aef4-435a-a776-7dc4cd535d7c | 6 | void createSubs()
{
int toDo = subs.size();
while (done<toDo)
{
for (int i=done;i<toDo;i++)
{
Expr expr = subs.elementAt(i);
procName = expr.name;
out.box(procName + " = " + Convert.toComment(expr.asString()));
out.line("private boolean " + ... |
65455144-816a-40c6-83e0-57814528b085 | 7 | public List<EloStatistik> getEloStatistik(String teamId, String datePattern, String dateStart) {
Team team = eloPersistence
.createQuery("select distinct t from Team t join fetch t.punktzahlHistorie h where t.id = :teamId", Team.class)
.setParameter("teamId", teamId).getSingleResult();
TreeMap<String, EloPu... |
71cf4b88-408d-4f4b-ad24-df0a0bf3fbc5 | 9 | 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://downlo... |
26bc7fa1-6c6e-4c9f-962c-43f320b9370c | 9 | public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
StringBuilder out = new StringBuilder();
String line;
while ((line = in.readLine()) != null) {
int n = Integer.parseInt(line.trim());
if (n == 0)
break;
while (true)... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.