method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
a71f949b-a0d7-4d9d-8689-2725d8cbc60e | 2 | private static TIntIntHashMap getWidthMap(Font font) {
TIntIntHashMap map = WIDTH_MAP.get(font);
if (map == null) {
map = new TIntIntHashMap();
WIDTH_MAP.put(font, map);
FontMetrics fm = Fonts.getFontMetrics(font);
for (int i = 32; i < 127; i++) {
map.put(i, fm.charWidth((char) i));
}
}
retur... |
683a3b8d-0926-40ac-9c4b-26813ad77705 | 2 | public List<FormasPagamento> ListarTodos(){
try{
PreparedStatement comando = banco.getConexao()
.prepareStatement("SELECT * FROM tipos_pagamento WHERE ativo "
+ "= 1");
ResultSet rs = comando.executeQuery();
List<FormasPagamen... |
b86a7700-15a3-4aa9-9f6c-4728b07467f4 | 8 | @Override
public int getAlignMedianFacValue(Faction.Align eq)
{
int bottom=Integer.MAX_VALUE;
int top=Integer.MIN_VALUE;
final Enumeration<FRange> e = getRanges(AlignID());
if(e==null)
return 0;
for(;e.hasMoreElements();)
{
final Faction.FRange R=e.nextElement();
if(R.alignEquiv()==eq)
{
i... |
3305b208-b16b-4a69-a304-dc332400bf6a | 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... |
c1d263fe-1ace-41ba-8a0d-77f0057baf70 | 1 | public double[] getLocalGrid(long density) {
int numberOfDots = (int) (density * getWidth());
double gridStep = 1 / (double) density;
double[] grid = new double[numberOfDots];
for (int i = 0; i < numberOfDots; i++) {
grid[i] = ((double) i + 0.5) * gridStep;
}
... |
e0d4fd7a-b318-4b00-abd7-4ddcc21c3b14 | 6 | public void readFromNBT(NBTTagList par1NBTTagList)
{
this.mainInventory = new ItemStack[36];
this.armorInventory = new ItemStack[4];
for (int var2 = 0; var2 < par1NBTTagList.tagCount(); ++var2)
{
NBTTagCompound var3 = (NBTTagCompound)par1NBTTagList.tagAt(var2);
... |
51efc2b1-6511-4ed3-881c-d5006a23d552 | 7 | public boolean method195(int j) {
int k = maleEquip1;
int l = maleEquip2;
int i1 = anInt185;
if (j == 1) {
k = femaleEquip1;
l = femaleEquip2;
i1 = anInt162;
}
if (k == -1)
return true;
boolean flag = true;
if (!Model.method463(k))
flag = false;
if (l != -1 && !Model.method463(l))
fl... |
f11b485a-f107-4439-9553-9b368e2828ee | 8 | protected void parse(PDFObject obj) throws IOException {
// read the size array (required)
PDFObject sizeObj = obj.getDictRef("Size");
if (sizeObj == null) {
throw new PDFParseException("Size required for function type 0!");
}
PDFObject[] sizeAry = sizeObj.getArray();... |
510b9011-6462-49cf-b64e-242ee8de5d14 | 7 | private static void addFile(File source, JarOutputStream target) throws IOException
{
BufferedInputStream in = null;
try{
if (source.isDirectory())
{
String name = source.getPath().replace("\\", "/");
if (!name.isEmpty())
{
if (!name.endsWith("/"))
name += "/";
JarEntry entry = ne... |
94082bc6-54a6-44f1-95fe-40196342fd23 | 9 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ColorBean colorBean = (ColorBean) o;
if (b != null ? !b.equals(colorBean.b) : colorBean.b != null) return false;
if (g != null ? !g.equals(colo... |
3b253c68-f363-4015-89c8-58d6e0a8f831 | 2 | public boolean isSelected()
{
for(int i=0;i<markers;i++)
{
if(marker[i].isSelected())
{
return true;
}
}
return false;
} |
a0f0da23-8240-4e45-966d-fd9e6f8147b2 | 9 | public void updateTropes() {
// Clear the trope lists
narrativeTropes.clear();
genreTropes.clear();
topicTropes.clear();
ArrayList<NarrativeType> _narrative =
new ArrayList<NarrativeType>(Arrays.asList(NarrativeType.values()));
ArrayList<GenreType> _genre =
new ArrayList<GenreType>(Arrays.asList(G... |
6418f521-3a6b-44b2-a9d3-376d2c885114 | 2 | public void printAnalysisResults() {
String string = "";
for (int i = 0; i < bestSequenceAlternativesEnergyPoint.size(); i++)
string += i + ": " + bestSequenceAlternativesEnergyPoint.get(i) + "CONSUMPTION:" + consumptionEnergyPoints[i] + "EP\n";
for (int i = 0; i < bestSequenceAlternativesWatt.size(); i++)
... |
1f4636e4-de63-4b12-9d29-701a01c5bd96 | 8 | private void init ( ) {
updateLogDate = "";
tempSensors = new NumberWithLabel[MAX_TEMP_SENSORS];
int i;
for ( i = 0; i < MAX_TEMP_SENSORS; i++ ) {
tempSensors[i] = new NumberWithLabel( (byte) 1 );
}
pH = new NumberWithLabel( (byte) 2 );
pHExp = new NumberWithLabel( (byte) 2 );
atoLow = false;
atoHi... |
5a7586d1-533f-4d13-bfcf-f591360424a9 | 7 | @EventHandler(priority = EventPriority.NORMAL)
public void onProjectileLaunch (ProjectileLaunchEvent event)
{
Projectile projectile = event.getEntity();
if (projectile.getType() != EntityType.THROWN_EXP_BOTTLE
|| ! (projectile.getShooter() instanceof Player))
return;
... |
d0edcc37-bcbe-4213-9a81-0c673a018ff8 | 2 | public JSONObject append(String key, Object value) throws JSONException {
testValidity(value);
Object object = opt(key);
if (object == null) {
put(key, new JSONArray().put(value));
} else if (object instanceof JSONArray) {
put(key, ((JSONArray) object).put(value))... |
186827ff-3a10-480c-b0ed-e40dd4f9e81e | 6 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof PointData)) return false;
PointData pointData = (PointData) o;
if (!category.equals(pointData.category)) return false;
if (!id.equals(pointData.id)) return false;
if (!Arrays.... |
fd967962-2db7-4f04-9b33-4e899482358e | 5 | @Override
public List<Account> findAccountByRoleId(int roleId) {
List<Account> list = new ArrayList<Account>();
Connection cn = null;
PreparedStatement ps = null;
ResultSet rs = null;
try {
cn = ConnectionHelper.getConnection();
ps = cn.prepareStatem... |
190640e5-76a3-4805-a34b-354824c0078a | 6 | private static Image getImage(String filename) {
// to read from file
ImageIcon icon = new ImageIcon(filename);
// try to read from URL
if ((icon == null) || (icon.getImageLoadStatus() != MediaTracker.COMPLETE)) {
try {
URL url = new URL(filename);
... |
39381a13-092c-4c2b-a51e-ddbda31b9e9e | 5 | public void visitVarExpr(final VarExpr expr) {
if(!(expr.isDef() || (expr.def() != null)
|| (expr.parent() instanceof PhiStmt))) {
System.out.println(expr.getClass());
}
Assert.isTrue(expr.isDef() || (expr.def() != null)
|| (expr.parent() instanceof PhiStmt), "Null def for variable "
+ expr);
v... |
96e59b85-e971-4be8-a7c6-debecee1728b | 0 | private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException {
stream.defaultReadObject();
b = (String)stream.readObject();
} |
53769643-6946-4a19-8cd3-a9f1595c320a | 3 | public boolean addShow(Show show){
if (show instanceof Movie){
if (showExists(show)){
return false;
}else {
Movie tmp = new Movie((Movie) show);
shows.add(tmp);
}
}else{
if (showExists(show)){
... |
8cd0dc30-b6ca-48a8-b400-6369f264a87e | 3 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final TOutlet other = (TOutlet) obj;
if (!Objects.equals(this.scyOutCode, other.scyOutCode)) {
retu... |
98f7c3f3-bc31-44d1-994b-e1b15f5ea532 | 0 | public void setSymbols(final Hashtable<K, String> symbols) {
this.symbols = symbols;
} |
8d800c78-461c-41c7-b664-90e4938cc5e2 | 2 | public static void main(String[] args) {
final Count count = new Count();
for (int i = 0; i < 2; i++) {
new Thread() {
public void run() {
count.get();
}
}.start();
}
for (int i = 0; i < 2; i++) {
n... |
9fd1e272-b41b-45ae-b58a-ed253d3acda9 | 3 | public ArrayList<MealData> mealsForCategory(MealCategoryData category) {
ArrayList<MealData> meals = new ArrayList<MealData>();
for (LineData canteenLine : canteenData.getLines()) {
for (MealData meal : canteenLine.getTodayMeals()) {
if (meal.getMealCategory().equals(category)) {
meals.add(meal);
}
}
}... |
04ee996f-1367-4de9-ba38-d6237a5a9d5b | 5 | public String execute() {
String returnVal = SUCCESS;
if (getSubmit() != null && SUBMIT.equals(getSubmit())) {
LibraryManagementFacade facade = new LibraryManagementFacade();
try {
Calendar calendar = Calendar.getInstance();
if ("issue".equals(getAction())) {
Date issueDate = calendar.getTime();... |
79952a4a-8fb2-480c-8fa1-a0f7ff41f601 | 3 | @SuppressWarnings("unchecked")
@Override
public final boolean equals(Object o)
{
if (o == this) return true;
if (o == null) return false;
/* Here we assume final classes, and comparisons only
* between leaf (final) classes
*/
if (o.getClass() != getClass()) ... |
2b4530dc-9132-4905-925c-b5e9b0e5d90a | 7 | public void movement() {
if (body == null)
return;
Vector3D oldPosition = getLocation();
body.updateBodyEuler(0.1);
if (body.getX() > getArenaWidth() - getWidth() ||
body.getY() > getArenaHeight() - getHeight() ||
body.getX() < 0 ||
body.getY() < 0 ||
getArena().isBlockedByTe... |
4387d564-d4c4-4aa9-9dd1-b943c0b4176f | 9 | double isApproxEqual(MembershipFunction mf, InnerOperatorset op) {
if(mf instanceof FuzzySingleton)
{ return op.moreorless(isEqual( ((FuzzySingleton) mf).getValue())); }
if((mf instanceof OutputMembershipFunction) &&
((OutputMembershipFunction) mf).isDiscrete() ) {
double[][] val = ((OutputMembershi... |
559910cb-8db9-458e-bd15-e604c9243b1d | 5 | public void propertyChange(PropertyChangeEvent evt) {
if (calendar != null) {
Calendar c = (Calendar) calendar.clone();
if (evt.getPropertyName().equals("day")) {
c.set(Calendar.DAY_OF_MONTH,
((Integer) evt.getNewValue()).intValue());
... |
2712f595-1d56-41cb-ab43-a6e0e960bb03 | 5 | public ArrayList<Integer> getRow(int rowIndex) {
ArrayList<Integer> res = new ArrayList<Integer>();
if(rowIndex < 0) return res;
res.add(1);
if(rowIndex == 0) return res;
res.add(1);
if(rowIndex == 1) return res;
for(int i = 1; i <= rowIndex-1; ++i){
... |
eb02a11e-6462-45a3-98b1-c0e36f5384ef | 8 | private static int partition(int[] array, int start, int end) {
int center = (start + end) / 2;
//mediaan van 3
if (array[center] < array[start]) {
swap(array, center, start);
}
if (array[end] < array[start]) {
swap(array, start, end);
}
if... |
a95f7538-6226-4d43-a1f1-c893faece17c | 2 | public ReceptKompDTO getReceptKomp(int receptId, int raavareId) throws DALException {
ResultSet rs = Connector.doQuery("SELECT * FROM receptkomponent WHERE recept_id = " + receptId + " AND raavare_id = " + raavareId);
try {
if (!rs.first()) throw new DALException("Receptkomponenten " + receptId + ", " + raavareI... |
a5e6706d-83fb-48bd-930a-446897b5a863 | 0 | public Window(GraphCanvas canvas) {
this.canvas = canvas;
} |
c78429fb-5e4f-47a3-b359-0e02fc39f7b3 | 8 | protected Pair<Item,String> makeItemContainer(String data)
{
int x=data.indexOf(';');
if(x<0)
return null;
Item I=null;
if(data.substring(0,x).equals("COINS"))
I=CMClass.getItem("StdCoins");
else
I=CMClass.getItem(data.substring(0,x));
if(I!=null)
{
String container="";
String xml = data.... |
1358a46d-9f2d-4e70-935f-0379306146d7 | 6 | * @return String
*/
public static String getShortName(Stella_Object obj) {
{ Surrogate testValue000 = Stella_Object.safePrimaryType(obj);
if (Surrogate.subtypeOfP(testValue000, Logic.SGT_LOGIC_SKOLEM)) {
{ Skolem obj000 = ((Skolem)(obj));
return (null);
}
}
else if... |
7584c8c8-31f4-4233-bd5d-945edd7bcbe5 | 0 | public void showDialog()
{
org.i4qwee.chgk.trainer.new_brain.actionlisteners.MouseListener.setHandle(false);
super.showDialog();
org.i4qwee.chgk.trainer.new_brain.actionlisteners.MouseListener.setHandle(true);
} |
1c9fcb47-7a9f-464f-94f9-15375895b1ff | 4 | public static ComboBoxModel getAllParameters() {
if(parameterModel==null)
{
checkParameterList();
parameterModel = new DefaultComboBoxModel();
for(String v:parameters.keySet())
{
if(v.equals("Neighbore")|| v.equals("Datapoint"))
... |
1603ab37-55ad-4d48-bb81-be7d5af6af4a | 9 | private String getAbbreviatedName(String name) {
if (!isTooLarge(name)) {
return name;
}
String[] partNames = name.split(" ");
// Abbreviate middle names:
for (int i = 1; i < partNames.length - 1 && isTooLarge(Utils.join(" ", partNames)); i++... |
0cbf2694-0940-4881-9497-2a95e2ab8568 | 2 | @Test
public void testNoAgregarTodasEntidades() {
Object[][] entidades = new Object[4][4];
entidades[0][0] = new Long(2000);
entidades[0][1] = "Tuercas";
entidades[0][2] = new Double(250);
try {
entidades[1][0] = new Long(100);
entidades[1][1] = "Lla... |
7fdfae78-469d-45f6-ae6c-1146351c39f5 | 8 | public static UndirectedGraphNode cloneGraph(UndirectedGraphNode node) {
List<UndirectedGraphNode> nodes = new ArrayList<UndirectedGraphNode>();
UndirectedGraphNode headnode = null;
int index = 0;
if (null == node) return null;
nodes.add(node);
while (index != nodes.size()) {
Undirec... |
261d786f-841c-4a2a-8cca-6cd4f8e1cb68 | 5 | private void searchRentacars() {
if (dateFieldReturnDate.getDate() < dateFieldPickUp.getDate()) {
Dialog.alert("Return date should be greater or equals to Pick up date");
return;
}
if (rentalcarSearchParameters.getFromAirportId() == null || rentalcarSearchParameters.getToAirportId() == null) {
Dialog.ale... |
d422bd2f-29e9-4945-aa80-9e72061497e1 | 0 | public static void main(String[] args) {
// ConcreteClassの実装次第で独自ロジックを切り替える。共通処理は親クラスで実装。
AbstractClass c1 = new ConcreteClass();
c1.templateMethod();
System.out.println("--------------------");
// 無名クラスを使ってみたり。
AbstractClass c2 = new AbstractClass() {
@Override
void method() {
System.out.pr... |
74377664-1165-4e41-862c-b6e034c33391 | 8 | public void renderShipMorphBehaviors(int glMode, RenderStyle renderStyle, Ship ship, boolean preMorphRendering) {
for (Morph morph : ship.getMorphsByIds().values()) {
if (glMode == GL11.GL_RENDER) {
for (Behavior<?> behavior : morph.getAlwaysActiveBehaviorList()) {
renderBehavior(glMode, renderStyle, beha... |
a4345e31-eaa0-44db-82df-d7ea0f2290bd | 2 | protected int getKnownAttributeCount() {
int count = 0;
if (lvt != null)
count++;
if (lnt != null)
count++;
return count;
} |
eecfcbdd-a66b-4973-be13-a39ca0ea3021 | 9 | @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
// Entering a sub-command without parameters is assumed to be a request
// for information. So display some detailed help.
if (args.length == 0) {
sender.sendMessage(plugin.t... |
4aa60aec-7d69-4d65-9556-8f51e50bd56e | 5 | @Override
public void run() {
if (!mNoFurtherWrites) {
try {
// Wait for any pending writes to finish, but not forever
long maxWait = System.currentTimeMillis() + TimeUnit.MILLISECONDS.convert(1, TimeUnit.MINUTES);
while (mServer.hasPendingWrite(mChannel) && System.currentTimeMillis() < maxWait) {
... |
4ff1dd3b-0c36-4a81-a420-ea119f7d4d0f | 7 | private V active(){
//we know at the start, we clearly aren't done
//and we also know the params are also set
rec.get().req.done = false;
while(true){
boolean locked = true;
if(!lock.lock()){ //NOT the combiner
while(!rec.get().req.done &&
rec.get().active &&
(locked = lock.isLocked()));
... |
86ba5262-7be2-4b7c-b319-cb1d31c6c1a7 | 4 | @Test
public void SpeakerToTopicWriterTest() {
String theSpeaker = "Cameron Thomas";
String topic = "CS 246";
String base = "CS 246";
String content = "This is the content";
//HashMap<String, List<Session>> topicMap = new HashMap<>();
ArrayList<Spea... |
3865df12-dbf7-4e00-8613-f046cfebbd3f | 9 | public static void main(String[] args) {
String filename = args[0];
String separator = args[1];
In in = new In(filename);
ST<String, Queue<String>> st = new ST<String, Queue<String>>();
ST<String, Queue<String>> ts = new ST<String, Queue<String>>();
while (in.hasNextLin... |
408a6271-6cd1-4b9f-9cbd-5f94670597ab | 4 | public static Configuration loadConfiguration( InputStream input ) throws Exception
{
Configuration config = new Configuration();
config.delays = Tries.forInsensitiveStrings( 0 );
config.inclusion = Tries.forInsensitiveStrings( Boolean.FALSE );
config.mode = AgentMode.CSV;
Element root... |
9c31a9f8-5221-4f29-93fb-71238c5c3dff | 4 | @Override
public void start(Character player) {
System.out.println("Starting Treasure Event...");
int randomizedEvent = generator.nextInt(100) + 1;
if(randomizedEvent > 75){
//Drop gold
randomGold = generator.nextInt(10) + 1;
System.out.println("You opened the chest and found " + this.getGold() + " G... |
5e3ef1f9-0065-4ba0-b730-fb6d4433ae62 | 9 | @Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
double amount;
boolean isLent = false;
String description;
String dateString;
Date date = null;
SimpleDateFormat dateFormate = new SimpleDateFormat("yyyy-MM-dd");
if(e.getSource() instanceof JButton){
if(... |
d92553a2-fdf8-4e3c-a947-a1d28b6bf757 | 6 | public void setLeafIcons(String menuName, ImageIcon normal, ImageIcon selected) {
for (AccordionRootItem menu : getMenus()) {
if (menu.getName().equals(menuName)) {
if (normal != null) {
for (AccordionLeafItem leaf : getLeafsOf(menuName)) {
... |
f25dc78e-8430-435c-a937-352d599ea79b | 8 | public static void initScore() {
int[][] moviercount = new int[DataInfo.numItems][DataInfo.softmax];
Function.zero(moviercount, DataInfo.numItems, DataInfo.softmax);
for(int user = 0; user < DataInfo.numUsers; user++) {
int num = DataInfo.TrainSet[user].length;
for(int j = 0; j < num; j++) {
i... |
60dbb135-2fc5-4e9a-9577-8a04a1302df5 | 9 | public long getTimestamp()
{
System.out.println("getTimestamp():");
if (timestamp==null) return 0;
long ts=0;
if ( timestamp == null ) timestamp = "";
else
{
// timestamp=timestamp.trim();
if ( timestamp.length()>0 )
{
try
{
ts = new Lo... |
97cca745-20b0-4169-a8d4-6b8eeb66fe4e | 7 | void launchThreads(final int numIter) {
for(int i=0;i<NUM_THREADS;i++) {
threads[i] = new Thread() {
@Override
public void run() {
try {
final Directory[] dirs = new Directory[NUM_COPY];
for(int k=0;k<NUM_COPY;k++)
d... |
e57af8f1-cd20-4ba1-b5b8-f3374851c252 | 1 | public void UpdateLayout()
{
for(GuiField button :displayedFields)
{
button.UpdateLayout();
}
} |
7825c9ab-6468-4b67-894d-0bdc3eb42c7b | 7 | public void fuseTimeAndStylo(List info) {
List tempInfo = new ArrayList();
tempInfo.addAll(info);
// System.out.println("List: ");
// for (Object a : info) {
// System.out.println(a);
// }
List sortedStyloList = new ArrayList();
List sortedTimeList = new A... |
54410bee-3b14-479d-867f-b196f1d5be70 | 8 | public Parser build(Grammar grammar, boolean useHeadSet) {
NontermTable nontermTable = new NontermTable();
// Construct automation.
State.StateGenerator stateGenerator = new State.StateGenerator();
State startState = stateGenerator.generate();
for (Grammar.Production production:... |
7e8bb448-bc34-4b4b-bb92-5c88074e6494 | 1 | public boolean addElement(T element) throws InterruptedException {
lock.lock();
try {
while (isFull()) {
emptyCondition.await();
}
boolean result = tasksQueue.add(element);
fullCondition.signalAll();
return result;
} fi... |
14dfabb0-9f04-4ce5-9417-91e65f485a8a | 2 | public void close(){
try {
ps.close();
} catch (SQLException e){
if( debug ) System.out.println("Error in DBComm.close(): "+e.getMessage());
}
} |
7e25d352-751e-46d6-a09f-9c5ccea8a76c | 1 | public Integer pop() throws EmptyException {
counter -= 1;
if (counter < 0) {
counter = 0;
throw new EmptyException();
}
return table[counter];
} |
7d7e41e8-65f0-4062-af77-2bef14f218d9 | 4 | public static TheoraPacket create(OggPacket packet) {
byte type = packet.getData()[0];
// Special header types detection
if(isTheoraSpecial(packet)) {
switch(type) {
case (byte)TYPE_IDENTIFICATION:
return new TheoraInfo(packet);
case (byte)TYP... |
e9b1d049-d3cc-421f-a19b-636c2fd4cac6 | 9 | private boolean r_mark_suffix_with_optional_s_consonant() {
int v_1;
int v_2;
int v_3;
int v_4;
int v_5;
int v_6;
int v_7;
// (, line 143
// or, line 145
lab0: do {
... |
451d4dd4-811f-4539-89c7-e7bec5987608 | 6 | private List<Trade> auctionOrderList() {
List<Trade> tra = new ArrayList<Trade>();
while ( buyOrderQueue.size() != 0 && sellOrderQueue.size() != 0 && buyOrderQueue.get(0).getPrice() >= sellOrderQueue.get(0).getPrice() )
{
Order buyOrder = buyOrderQueue.get(0);
Order sellOrder = sellOrderQueue.get(0);
Tr... |
61a972c5-3c1d-4b59-afa9-1fe36c60d76d | 6 | private Expr factor() throws IOException {
Expr e;
switch (token) {
case '(':
token = tokenizer.nextToken();
e = expr();
if (token != ')')
throw new XLException("expecting \")\", found: " + token);
token = tokenizer.nextToken();
... |
f597e747-6627-465d-9d25-cc6bb1a63d04 | 6 | public static DenseMatrix64F handleV(DenseMatrix64F V, boolean transpose, boolean compact,
int m , int n , int min ) {
int w = n > m ? min + 1 : min;
if( compact ) {
if( transpose ) {
if( V == null ) {
V = new DenseMatri... |
42af0ff3-6095-4e53-be2f-2e9a85bef4c8 | 6 | public void tick()
{
if(dmgLen > 0)
{
dmgTick++;
if(dmgTick > 120) //120 = 2 seconds
{
dmgLen = dmgTick = 0;
}
}
if(moving)
{
walkTick++;
if(count >= walkList.size())
... |
deab9f4f-c42d-4b96-8c2b-d6d64d60d7ea | 4 | RGBImage magnify(int n) {
RGBImage m = new RGBImage(n * width, n * height);
for (int row = 0; row < height; row++) {
for (int col = 0; col < width; col++) {
int c = image.getRGB(col, row);
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
m.image.setRGB(n * col + j, n * row + i, c);... |
41760976-aa96-422a-8a60-8f1edbc6beaa | 7 | public void print(Byte[] jeu){
for (int i=0; i < 37; i++){
if (i==4 || i==9 || i==15 || i==22 || i==28 || i==33)
System.out.println();
System.out.print(jeu[i]);
}
System.out.println();
} |
2fb6b8ee-8354-41be-828d-0f7b97461bbd | 8 | public String XAuth(String username, String password)
{
URL url;
try {
url = new URL("http://fanfou.com/oauth/access_token");
} catch (MalformedURLException e)
{
setLog(e.getMessage());
return null;
}
long timestamp = System.currentTimeMillis() / 1000;
long nonce = System.nanoTime();
String p... |
98274041-64f1-4f55-8ce1-c045aa7654ac | 4 | private String CheckIfUpdate(String modFolder, String mod) {
boolean foundit=false;
File oldMod = new File(modFolder+"/"+mod);
if(oldMod.isDirectory()){
con.log("Log","IS DIRECTORY");
foundit=true;
}
else con.log("Log","NOT DIRECTORY ... " + oldMod);
if(foundit){
if(McLauncher.tglbtnDelete... |
2c09a762-11ba-4543-890b-13204fa44ad9 | 1 | public static boolean isAPageTag(String str, boolean state) {
if (state == true) {
StringUtility.pattern = OPEN_PAGE_TAG;
} else {
StringUtility.pattern = CLOSE_PAGE_TAG;
}
StringUtility.matcher = pattern.matcher(str);
return StringUtility.matcher.matches... |
c96fc665-b4b0-4636-8414-96367f2b64b3 | 1 | private void miLoadCourseMousePressed(java.awt.event.MouseEvent evt) {
Object[] courseNames = Manager.getInstance().getCourseNames().toArray();
String selectedCourse = (String) JOptionPane.showInputDialog(this,
"Select a course.",
"Course Select",
JOptionPane.QUESTION_M... |
ed4389ab-96cf-45b2-a847-12d19ca56063 | 3 | public void histogrammeBruit() {
Iterator<Float> itr = valeursBruit.iterator();
float vb;
Integer val;
while (itr.hasNext()) {
vb = itr.next();
// regard de l'occurence d'un élément
vb = (float) (Math.round((vb * 100.0)) / 100.0);
val = mapHisto.get(vb);
if (val != null) {
mapHisto.put(vb, va... |
07cd2ba6-0a8e-4b71-9e39-fb0596e74f2b | 1 | public Ingredient getIngredient() {
if (ingredient == null) {
ingredient = new Ingredient();
}
return ingredient;
} |
6a61bc06-3bea-4f9a-a989-f52d654c7bc5 | 5 | public void waitForConnection() {
if (!server.isConnecting() && !server.isConnected()) {
if (server.isConnectedToNetwork()) {
new Thread(new Runnable() {
@Override
public void run() {
updateStatus(WAITING);
while (!server.waitForConnection()) {
if (server.isAbortRequestSent())
... |
b00cfb25-1899-4975-a3e0-6348a5903ca3 | 7 | @Override
public boolean execute(MOB mob, List<String> commands, int metaFlags)
throws java.io.IOException
{
final PlayerStats pstats=mob.playerStats();
if(pstats==null)
return false;
final StringBuffer buf=new StringBuffer(L("Available channels: \n\r"));
int col=0;
final String[] names=CMLib.channels(... |
1e920b24-8d70-45ba-b370-6dda5199eaee | 3 | public static void writeArxFile(HashMap<String, String> map, File dest) {
try {
if (!dest.exists()) {
dest.mkdirs();
dest.createNewFile();
}
String output = "";
Set<String> keySet = map.keySet();
String[] keys = keySet... |
c7f0f990-0dbc-4aa8-be75-dd07ebcc1f78 | 5 | private Raum[] getNachbarn(String[] richtungen, Raum raum)
{
Raum nordNachbar = null;
Raum ostNachbar = null;
Raum suedNachbar = null;
Raum westNachbar = null;
for(String s : richtungen)
{
if(s.equals(TextVerwalter.RICHTUNG_NORDEN))
{
nordNachbar = raum.getAusgang(s);
}
else if(s.equals(Te... |
6195f409-8cb4-4455-a249-4b22afd96e81 | 9 | private void load() throws FileNotFoundException {
Scanner in = new Scanner(new File(FILE_NAME));
while (in.hasNextLine()) {
String line = in.nextLine();
if (!line.startsWith("#")) {
String[] bisect = line.split("=");
// If the field was defined;
if (bisect.length > 1) {
if (line.startsWith(... |
511b32c0-3a7f-4084-95e0-4656b8f7d771 | 3 | private void acao123() throws SemanticError {
if (tipoLimiteInferior != tipoConstante)
throw new SemanticError(
"Constantes de intervalo de tipos diferentes");
int valorLimiteSuperior = tipoConstante == Tipo.INTEIRO ? Integer
.parseInt(valorConstante) : valorConstante.charAt(0);
if (valorLimiteSuper... |
1c07bc85-c4cd-4632-b609-d8104c54be61 | 5 | @Override
public void run(){
try{
if(!window.IsFull()){
socket.setName(recvStringMsg());
window.socket.getLast().setName(socket.getName());
window.sendStringMsg(socket.getName()+" entrou na sala...", window);
while(socket.getSocket(... |
a1bb048d-caff-40a3-bb13-8edc6ce1e6e9 | 2 | public void borrarRegistros(String nombreTabla, int id)
{
try {
this.bd.open();
this.table = this.bd.getTable(nombreTabla);
this.bd.beginTransaction(SqlJetTransactionMode.WRITE);
// Esta función busca por calve primaria aquel id que concuerde con el pasado po... |
57422657-fb6a-46bc-9434-6ef3d15b086f | 9 | public void runGameTimedSpeedOptimised(Controller<MOVE> pacManController,Controller<EnumMap<GHOST,MOVE>> ghostController,boolean fixedTime,boolean visual)
{
Game game=new Game(0);
GameView gv=null;
if(visual)
gv=new GameView(game).showGame();
if(pacManController instanceof HumanController)... |
8185f430-79ed-452c-a7aa-ac9cc20986c9 | 4 | public synchronized int hashCode() {
if (__hashCodeCalc) {
return 0;
}
__hashCodeCalc = true;
int _hashCode = 1;
if (getName() != null) {
_hashCode += getName().hashCode();
}
if (getCurrency() != null) {
_hashCode += getCurrency... |
b914a30e-ca35-4401-94b2-1a3a556c3e77 | 0 | public DateFormat getTimeFormat() {
return timeFormat;
} |
8cb05b8d-e573-4982-8959-c0aca9b19611 | 3 | public static boolean checkForClick(int button){
while(Mouse.next()){
if(Mouse.getEventButtonState()){
if(Mouse.getEventButton() == button) return true;
}
}
return false;
} |
0dedf698-bdd0-4499-ae8c-2df8209faa33 | 9 | public static List readWatchableObjects(DataInputStream par0DataInputStream) throws IOException
{
ArrayList arraylist = null;
for (byte byte0 = par0DataInputStream.readByte(); byte0 != 127; byte0 = par0DataInputStream.readByte())
{
if (arraylist == null)
{
... |
cb80a9c3-446a-46aa-a71d-de6e18c62aa0 | 4 | public void falling() {
if(!isBlocked(x, y + velY + 1f)){
timer += delta;
if(velY < 16){
if(timer > 100){
velY = velY += 1f;
timer = 0;
}
}
mapY += velY;
isOnGround = false;
}else if(velY < 16){
velY = 0;
isOnGround = true;
}else{
velY = 0;
isOnGround = true;
i... |
d732034f-a59a-4779-8049-de696df419de | 1 | @Override
public boolean addGroup(String group) {
if (groups.contains(group)) {
return false;
}
return groups.add(group);
} |
84dba5c9-62ad-4462-9d06-33ccb4005fd1 | 3 | public static int sqrt(int x) {
if (0 == x) return 0;
long bit = 1l << 16;
long res = 0;
while (bit != 0) {
res = res | bit;
if (res * res > x) res = res ^ bit;
bit = bit >> 1;
}
return (int) res;
} |
c6c020d7-1abf-4b55-a4a1-900959496175 | 1 | public void Run() {
// Рестарт при повторном вызове. Зарпет на две копии одного скрипта при
// одновременном выполнии
if (isScriptRunning()) {
Stop();
}
Update();
scrThread = new JSThread(this) {
@Override
public void OnStart() {
super.OnStart();
AddStopMenuElement();
}
@Override
... |
9da4eaa5-43a8-473e-a6f2-f92e44a42d72 | 9 | public void mouseDown(org.eclipse.swt.events.MouseEvent e) {
// TODO Auto-generated method stub
if (e.getSource() == buttonOk) {
String host = comboHost.getText();
String user = comboUser.getText();
String password = textPassword.getText();
// String protocol = comboProtocol.getText();
... |
4eaff419-8685-4c7a-8824-6563c6d44ed1 | 1 | @BeforeClass
public static void setUp() {
bmTestManager = BmTestManager.getInstance();
plan = new Plan("HV40KOD", 40000, 40, true, 1000, 0);
users = new Users("1689", "dzmitrykashlach", "dzmitry.kashlach@blazemeter.com",
"1394008114", "1392730300", "1324748306", true, plan, n... |
d8f7fc98-3989-43e2-8cca-42eca0f295c6 | 8 | @Override
protected void controlUpdate(float tpf) {
if(GameStarted.gameStart){
if(!init){
if(comboNumber == 1){
// currentComboNo = animationToInt(((Node)spatial.getParent().getChild("Model")).getChild("Player1").getControl(ComboSetupControl.class).getCombo1_1(... |
b6122ffb-8d00-4c5a-929a-467abf612cd8 | 7 | static int checkAck(InputStream in) throws IOException
{
int b = in.read();
// b may be 0 for success,
// 1 for error,
// 2 for fatal error,
// -1
if (b == 0)
return b;
if (b == -1)
return b;
if (b == 1 || b == 2)
{
... |
c909fdb3-e68f-44d8-9774-3910fc252eb3 | 2 | public void init() {
if (CollectionUtils.isEmpty(messageConverters)) {
StringHttpMessageConverter stringHttpMessageConverter = new StringHttpMessageConverter();
stringHttpMessageConverter.setWriteAcceptCharset(false); // See SPR-7316
this.messageConverters = new ArrayList<Htt... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.