method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
979ed605-25ca-4835-bdc3-66c87cf41153 | 5 | @Override
public boolean containsValue(V value) {
if (value == null) {
return false;
}
for (Entry entry : this.array) {
if (entry != null && value.equals(entry.value) && !entry.isDeleted) {
return true;
}
}
return false;
... |
51e1b89b-9d2c-43fa-8c68-c60d26f870c2 | 9 | public GenericConverter find(Class<?> sourceType, Class<?> targetType) {
List<Class<?>> sourceCandidates = getTypeHierarchy(sourceType);
List<Class<?>> targetCandidates = getTypeHierarchy(targetType);
for (Class<?> sourceCandidate : sourceCandidates) {
for (Class<?> targetCandidate : targetCandidates) {
... |
bba4a844-c7a3-49e2-a161-13b83e139b5b | 4 | private void downHeapify(int p) {
for (int c = p * 2 + 1; c < values; p = c, c = p * 2 + 1) {
if (c + 1 < values && distance[c] < distance[c + 1]) {
c++;
}
if (distance[p] < distance[c]) {
// Swap the points
Object pData = data[p];
double pDist = distance[p];
data[p] = data[c];
... |
ae96d63d-146d-44e7-a67f-9c6e362572f6 | 2 | private int low() {
return (isInclusiveHostCount() ? network() :
broadcast() - network() > 1 ? network() + 1 : 0);
} |
82183bcc-32c8-4e2e-83b3-959abd9421ce | 0 | public SPKIDataType createSPKIDataType() {
return new SPKIDataType();
} |
12633867-1993-472f-9014-efceef787699 | 1 | private static synchronized UserEntry getEntry(long curUser) {
UserEntry entry = unfinished_map.remove((Long) curUser);
if (entry == null) {
MyArrayList list = new MyArrayList();
entry = new UserEntry(-1, list);
list.add(curUser);
}
return entry;
} |
a5fbbb51-3f65-476a-941b-e82f12478c7d | 7 | public void move (int xMove, int yMove) {
if (xMove != 0 && yMove != 0) {
move (xMove, 0);
move (0, yMove);
return;
}
if (xMove > 0) dir = 1;
if (xMove < 0) dir = 3;
if (yMove > 0) dir = 2;
if (yMove < 0) dir = 0;
if (!collision (xMove, yMove)) {
x += xMove;
y += yMove;
}
} |
9e71c971-47af-4374-bf0d-248a35f7b84a | 3 | public static String underscoreToCamelCase(String underscore) {
StringBuilder builder = new StringBuilder();
boolean prevIsUnderscore = false;
char[] chars = underscore.toCharArray();
for (char c : chars) {
if (c == '_') {
prevIsUnderscore = true;
} else if (prevIsUnderscore) {
prevIsUnderscore = ... |
6c2c13aa-1cbc-4575-a4c8-26356e33323a | 6 | public Type intersection(Type type) {
if (type == tError)
return type;
if (type == Type.tUnknown)
return this;
Type newBottom = getSpecializedType(type);
Type newTop = getGeneralizedType(type);
Type result;
if (newTop.equals(newBottom))
result = newTop;
else if (newTop instanceof ReferenceType
... |
bf925747-d1da-4e6e-85e9-67fec79f9d4b | 9 | public boolean camposobrigatoriospreenchidos() {
if (TfDescNotaCompra.getText().equals("")) {
msg.CampoObrigatorioNaoPreenchido(LbNotificacao, "Digite o código da nota do fornecedor!");
TfDescNotaCompra.grabFocus();
return false;
}
if (TfCodFuncionario.getText... |
ae9af0fb-4d38-4228-8814-60b4f1ccde20 | 1 | protected void clearCase(int i)
{
try
{
myLemma.clearCase(i);
myCases.remove(i);
myMessage.setText("Case #" + (i + 1) + " deleted.");
refresh();
}
catch(ArrayIndexOutOfBoundsException e)
{
/*
* This sho... |
697aa4d3-0f4f-41ae-9654-fb85dbb4c7a7 | 2 | public void inserir(long pesquisaId, ArrayList<Local> locais) throws Exception
{
String sql = "INSERT INTO pesquisalocal(id1,id2) VALUES (?, ?)";
try
{
PreparedStatement stmt = ConnectionFactory.getConnection().prepareStatement(sql);
for (Local local : locais)
{
... |
d97236a2-6747-4a48-be5f-dda0bcf3a2d5 | 4 | public boolean isViable(Field field)
{
// How many counts are non-zero.
int nonZero = 0;
if(!countsValid) {
generateCounts(field);
}
for(Class<?> key : counters.keySet()) {
Counter info = counters.get(key);
if(info.getCount() > 0) {
... |
dbdfc860-b910-46cb-979e-4b252be31c55 | 9 | public static void runInstrumentedManyTimes(
final MultithreadedTestCase test, int count, int[] failureCount)
throws Throwable {
int failures = 0;
Throwable t = null;
boolean failed = false;
System.out.println("Testing " + test.getClass());
for (int i = 0; i < count; i++) {
try {
runOnce(test);
... |
28d52eb4-565b-4035-a1c4-812856697a0d | 1 | private void atualizaCamposFormulario(){
lblValorTotal.setText(Float.toString(venda.getValor()));
modelo = new DefaultTableModel();
modelo.addColumn("Id");
modelo.addColumn("Produto");
modelo.addColumn("Quantidade");
modelo.addColumn("Valor Unitário");
fo... |
528eeb08-308d-4968-ac2d-bdd9629f5726 | 8 | public boolean tickUpdates(boolean var1) {
int var2 = this.scheduledTickTreeSet.size();
if (var2 != this.scheduledTickSet.size()) {
throw new IllegalStateException("TickNextTick list out of synch");
} else {
if (var2 > 1000) {
var2 = 1000;
}
... |
bf2d39e3-89c9-49ff-b7bc-6400758b09d4 | 4 | public double noise(double xin, double yin)
{
double n0, n1, n2; // Noise contributions from the three corners
// Skew the input space to determine which simplex cell we're in
final double F2 = 0.5 * (Math.sqrt(3.0) - 1.0);
double s = (xin + yin) * F2; // Hairy factor for 2D
int i = fastfloor(xin + s);
int... |
737e08af-c625-449a-ba6a-2f49deb91644 | 2 | public void lostPower(int type) {
switch(type) {
case PowerUp.FLY:
break;
case PowerUp.TALL:
width = DEFAULT_WIDTH;
height = DEFAULT_HEIGHT;
break;
}
} |
f19d2687-c1ad-4136-ab43-88d1c4f32b6a | 4 | @Override
public void mouseMoved(MouseEvent e)
{
if (graphComponent.isEnabled() && isEnabled())
{
Iterator<mxCellHandler> it = handlers.values().iterator();
while (it.hasNext() && !e.isConsumed())
{
it.next().mouseMoved(e);
}
}
} |
c9576467-6858-4b83-a88b-ce538947ee2f | 5 | public void listDirectory(String dir) {//list in System.out.println the nwt files of a folder
File file = new File(dir);
File[] files = file.listFiles(new FilenameFilter() {
public boolean accept(File file, String fileName) {
return fileName.endsWith(".nwt");
}
});
if (files != null)... |
86b2c6d9-17af-4a41-89fc-1b6042b5fcfc | 3 | public boolean belongsInLambdaSet(String variable, Grammar grammar,
Set lambdaSet) {
if (isVariableWithLambdaProduction(variable, grammar))
return true;
GrammarChecker gc = new GrammarChecker();
Production[] productions = GrammarChecker.getProductionsOnVariable(
variable, grammar);
for (int k = 0; k <... |
9e002c3b-9be1-4262-93e9-84f0695cc249 | 6 | @Override
public void deserialize(Buffer buf) {
super.deserialize(buf);
firstNameId = buf.readShort();
if (firstNameId < 0)
throw new RuntimeException("Forbidden value on firstNameId = " + firstNameId + ", it doesn't respect the following condition : firstNameId < 0");
la... |
1d70c6fb-c5d4-401e-82b2-c4323d3bde6f | 2 | private void checkHSExists(){
File f = new File(HIGHSCORES_PATH);
if(!f.exists()){
for(int i = 0; i < Board.NUM_SCORES; i++){
HighScore.write(new HighScore(), i, Board.HIGHSCORES_PATH);
}
}
} |
367bba84-bfe2-4563-9634-8535a696349f | 1 | public void stopHosting(String hostName){
if(matchNameExists(hostName)){
setStatusToIdle(hostName);
deletePlayerFromMarker(hostName);
setIsHostToZero(hostName);
resetMatchIDOfPlayers(hostName);
deletePlayerFromTeam(hostName);
deleteTeamsOfHost(hostName);
deleteHostFromTeams(hostName);
deleteHo... |
c6d5690c-8eb1-44ed-80de-a02f40122d65 | 4 | public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line = "";
int times = 1;
while ((line = in.readLine()) != null && line.length() != 0) {
if (line.trim().equals("-1"))
break;
totalDis = Double.parseDouble(line.... |
3937d839-2ab2-487b-ba00-62bc59b88ad3 | 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... |
12b78751-d70c-49ca-8749-5cdb7a7a87f6 | 3 | public void switch_out(Point p) {
if (!innerBorder.remove(p)) {
return;
}
addToOuterBorder(p);
for (Point n : n4(p)) {
if (tita.getValue(n) == -3) {
addToInnerBorder(n);
}
}
} |
64516d46-6a49-4b5a-ab89-c5517b76f6b7 | 6 | public static Client getClientInstance(ElasticClientType clientType) {
String HOSTNAME;
int PORT;
switch(clientType) {
case TEST:
System.out.println("Getting client");
if(node == null) {
System.out.println("Got New Node");
node = new NodeBuilder().settings(getTestSettings()).node();
}
return... |
65c41501-c6b7-4e28-8c2e-e21c2ce6d06f | 2 | private void calculateEnabledState(OutlinerDocument doc) {
if (doc == null) {
setEnabled(false);
return;
}
if (doc.hoistStack.isHoisted()) {
setEnabled(true);
} else {
setEnabled(false);
}
} |
e80d994e-3068-45ea-ad85-27a78ae95f1d | 1 | public void sleep(long duration) {
try {
Thread.sleep(duration);
} catch (InterruptedException e) {
print("Sleep Interrupted.");
}
} |
2c124f30-c7c8-4be3-b242-80ee1ab81387 | 8 | private double sIB_local_MI(Matrix m, double[] Pt) {
double Hy = 0.0, Ht = 0.0;
for (int i = 0; i < Pt.length; i++) {
Ht += Pt[i] * Math.log(Pt[i]);
}
Ht = -Ht;
for (int i = 0; i < m_numAttributes; i++) {
double Py = 0.0;
for (int j = 0; j < m_numCluster; j++) {
Py += m.get(i... |
002a21e2-edd7-46b6-9f8d-1d3ad541bf56 | 8 | private final void draw00(byte[] is, int[] is_49_, int i, int i_50_,
int i_51_, int i_52_, int i_53_, int i_54_,
int i_55_) {
int i_56_ = -(i_52_ >> 2);
i_52_ = -(i_52_ & 0x3);
for (int i_57_ = -i_53_; i_57_ < 0; i_57_++) {
for (int i_58_ = i_56_; i_58_ < 0; i_58_++) {
if (is[i_50_++] != 0)
... |
3f6f55f1-d373-4224-87eb-55bbf68684c3 | 0 | public void setSequence_Id(int sequenceId) {
sequence_Id = sequenceId;
} |
d38eab72-1793-41ac-a6d9-2fcdad05cd16 | 4 | private void initListeners() {
automaton.addTransitionListener(new AutomataTransitionListener() {
public void automataTransitionChange(AutomataTransitionEvent e) {
if (!e.isAdd()) {
return;
}
Transition transition = e.getTransition();
if (!tToP.containsKey(transition)
|| alreadyDone.cont... |
dd6bf88f-5848-4146-951f-acc5c0c6a11a | 4 | public Tile getTileAt(Position p) {
if ( p.getRow() == 0 && p.getColumn() == 0 ) {
return new StubTile(GameConstants.FOREST, 0, 0);
}
if ( p.getRow() == 1 && p.getColumn() == 0 ) {
return new StubTile(GameConstants.HILLS, 1, 0);
}
return new StubTile(GameConstants.PLAINS, 0, 1);
} |
f5a11df9-7eda-4606-9cfe-a02f8a034c52 | 5 | private Type mergeArray(Type type) {
Type typeRoot = getRootComponent(type);
Type thisRoot = getRootComponent(this);
int typeDims = type.getDimensions();
int thisDims = this.getDimensions();
// Array commponents can be merged when the dimensions are equal
if (typeDims ==... |
1b816f70-0361-476d-8613-4d57300a0862 | 7 | public void addEdge(Object u, Object v, int weight) {
try {
if(!isVertex(u) || !isVertex(v)) { // graph is unchanged if neither vertices are in the graph
return;
} else {
if (edgeHashTable == null) { // initialize the edgeHashTable when adding the first edge
edgeHashTable = new HashTableChained... |
b57fc2ab-3643-451e-8f99-2b632244d5d4 | 0 | @Test
public void runTestSourceCodeSpecific1() throws IOException {
InfoflowResults res = analyzeAPKFile("GeneralJava_SourceCodeSpecific1.apk");
Assert.assertEquals(1, res.size());
} |
57515261-cdf7-4a06-bde6-394858608212 | 9 | @Override
public boolean equals(Object obj){
if(!(obj instanceof FailureTransition))
return false;
if(obj == this)
return true;
FailureTransition ft = (FailureTransition)obj;
boolean sameState = true;
for(Tree<PhraseData> state : ft.getState()){
... |
18c1de4b-2783-46ea-bb2a-408bfbc27c2d | 6 | public String evaluateTemplate(String template, Map<String, String> variables) {
if (template == null) {
return template;
}
StringBuffer result = new StringBuffer();
int startIndex = template.indexOf(VAR_START);
int endIndex = -1;
while (startIndex >= 0 && ... |
0b3ca0df-bb05-4131-9895-97f60937b617 | 9 | public void connect() {
// Step 0 : Build URL
int step = 0;
long t0 = System.currentTimeMillis();
if (debug) Gpr.debug("Connect Step = " + step);
try {
URL url = buildUrl();
// Step 1: Open connection
step = 1;
if (debug) Gpr.debug("Connect Step = " + step);
URLConnection httpConnection = url.... |
9a68e40c-775a-462a-bd59-303e1d83336c | 3 | private static void loadPackSettings(JSONObject packConfig, List<String> installationQueue) {
//Set Minecraft version setting
Variables.setSetting("general.MinecraftVersion", (String) packConfig.get("minecraftversion"));
//Load pack settings
if (packConfig.get("settings... |
2fbabb8a-f6c4-4874-97ed-9ed6005630aa | 6 | public boolean getBoolean(int index) throws JSONException {
Object object = get(index);
if (object.equals(Boolean.FALSE) ||
(object instanceof String &&
((String)object).equalsIgnoreCase("false"))) {
return false;
} else if (object.equals(Boolean.TRUE)... |
0e182adf-389f-4470-acbb-59bbc324099e | 3 | private void initializeGraphicComponents() throws IOException
{
/* this method will initialize all the graphic components displayed
* on the screen and ensuring that no NullPointerException is generated
*/
searchField = new JIconTextField();
menuBar=new MenuBar();
menu=new Menu("Menu");
newMenuItem=new... |
db53845f-a4b7-4b89-a662-bc9eda603854 | 4 | @Override
public void mouseClicked(MouseEvent e) {
//System.out.println(e.isPopupTrigger()); // never works
if (e.getButton() == MouseEvent.BUTTON3 && tab.getSelectedValue() != null) {
JPopupMenu menu = new JPopupMenu();
for (int i = 0; i < tabs.size(); i++) {
final JList destination = tabs.get(i);
... |
eb1e5d99-2484-4381-b3bc-b8323b0e3e67 | 1 | @Override
public ArrayList<String> getColumnsNames() throws Exception {
ArrayList<String> alColumns = null;
try {
oMysql.conexion(enumTipoConexion);
alColumns = oMysql.getColumnsName("usuario", Conexion.getDatabaseName());
oMysql.desconexion();
} catch (E... |
2b050db6-5870-49d1-a7a0-68c4f4e93b76 | 8 | protected MoveResult checkGameOver() {
MoveResult result = MoveResult.OK;
boolean blueflysurrounded = false;
boolean redflysurrounded = false;
// check surrounded butterflys
if(bluefly != null) {
if(num_adjacent(bluefly) == 6) {
blueflysurrounded = true;
}
}
if(redfly != null) {
if(num_adj... |
4ed1dfa7-8c0d-4a24-b3fd-5ec5a9700c71 | 2 | private static boolean containsDuplicate(List<Character> chars, int start, int end) {
for (int i = start; i <= end-1; i++) {
if (chars.get(i)== chars.get(end)) {
return true;
}
}
return false;
} |
f6c55ac2-4e97-4d0e-ad14-2e0561d492cd | 4 | public static void deposit(int type, int amount) {
if(type == WOOD) {
wood += amount;
} else if(type == STONE) {
stone += amount;
} else if(type == GOLD) {
gold += amount;
} else if(type == FOOD) {
food += amount;
}
} |
bca35c20-a31c-46e5-b528-01733e1fa25f | 2 | private boolean jj_3R_63() {
Token xsp;
xsp = jj_scanpos;
if (jj_3_71()) {
jj_scanpos = xsp;
if (jj_3_72()) return true;
}
return false;
} |
939f6269-645a-477d-a587-cebf34a72468 | 2 | @Override
public boolean checkTable(String table) {
DatabaseMetaData dbm = null;
try {
dbm = this.open().getMetaData();
ResultSet tables = dbm.getTables(null, null, table, null);
if (tables.next()) {
tables.close();
return true;
} else {
tables.close();
return false;
}
} catch (SQL... |
0121a58e-8a8b-40da-920e-ad7b74c49074 | 9 | public void run() {
// Put a spiffy message in the console
try {
// Loop while we are active
while(active) {
MazewarPacket headQueuePacket;
headQueuePa... |
13b95c33-c2dd-441f-b720-900dd1956fb1 | 1 | public stringMutation(char[] cArray, int len) {
this.charCount = len;
this.charCountTail = len - 1;
this.charArray = new char[charCount];
this.charArrayNoTail = new char[charCount];
for(int i=0; i< charCount;i++){
this.charArray[i] = cArray[i];
this.charArrayNoTail[i] = cArray[i];
}
this.charArra... |
6dc8953c-85c4-4666-a984-e153ed8c293a | 8 | private double getInterval(double l)
{
double interval = 0.1;
if (l >= 1.0)
{
for (int i = 0; l / interval > 10; ++i)
{
if (i % 3 == 0) interval *= 2;
else if (i % 3 == 1) interval *= 2.5;
else interval *= 2;
... |
3c91ecc4-93c0-4252-8020-6c94ae2d9172 | 1 | @Override
public int getSlotSpacingX() {
return isNotPlayerInventory() ? 50 : 18;
} |
d9e357a8-6c5b-4320-9c8e-183791a8fbcd | 1 | public void remove(HiloBean oHiloBean) throws Exception {
try {
oMysql.conexion(enumTipoConexion);
oMysql.removeOne(oHiloBean.getId(), "hilo");
oMysql.desconexion();
} catch (Exception e) {
throw new Exception("HiloDao.removeHilo: Error: " + e.getMessage()... |
0045db59-9be2-4df9-9fd8-e7d57949d557 | 0 | public static boolean isApplicable(Serializable object) {
return object instanceof TuringMachine;
} |
7e5c837d-0ffa-42fc-92c9-656f7b814813 | 8 | public boolean epsilonEquals(Matrix3d m1, double epsilon) {
return Math.abs(m00 - m1.m00) <= epsilon
&& Math.abs(m01 - m1.m01) <= epsilon
&& Math.abs(m02 - m1.m02 ) <= epsilon
&& Math.abs(m10 - m1.m10) <= epsilon
&& Math.abs(m11 - m1.m11) <= epsilon
&& Math.abs(m12 - m1.m12) <= epsilon
&& Math.abs(m20... |
fb5fb3ae-eb84-4c2c-a0de-2ea9454dc268 | 9 | private void decodeHeader(BufferedReader in, Properties pre, Properties parms, Properties header)
throws InterruptedException
{
try {
// Read the request line
String inLine = in.readLine();
if (inLine == null) return;
StringTokenizer st = new StringTokenizer( inLine );
if ( !st.hasMoreToken... |
a02ea42c-25cb-4c47-9dc0-c0e882efb13c | 7 | static final void method1138(String string, boolean bool, String string_0_,
byte i) {
try {
anInt1908++;
Class64_Sub3.playerPassword = string;
Class186.playerUsername = string_0_;
Mob.aBoolean10238 = bool;
if (!Mob.aBoolean10238
&& (Class64_Sub3.playerPassword.equals("")
|| Class1... |
1587512a-f087-4897-aead-d3513c16a858 | 4 | public static String bytesToHexString(byte[] b) {
if (b == null || b.length < 0) {
return null;
}
StringBuilder stringBuilder = new StringBuilder();
String hv;
for (int i = 0; i < b.length; i++) {
hv = Integer.toHexString(b[i] & 0xFF);
if (hv.length() < 2) {
stringBuilder.append(0);
... |
d12126ab-ffc7-4d7c-a3cb-a3124212f261 | 2 | public static void main(String[] args) {
if(args.length == 2){
int a = Integer.parseInt(args[0]);
int b = Integer.parseInt(args[1]);
System.out.println((a>b)? a : b);
}
} |
92df7294-dac7-42f9-975e-d9a429e7c748 | 7 | private boolean jj_3R_58() {
Token xsp;
xsp = jj_scanpos;
if (jj_3R_63()) {
jj_scanpos = xsp;
if (jj_3R_64()) {
jj_scanpos = xsp;
if (jj_3R_65()) {
jj_scanpos = xsp;
if (jj_3R_66()) {
jj_scanpos = xsp;
if (jj_3R_67()) {
jj_scanpos = xsp;
if (jj_3R_68()) {
... |
96769ed8-4d33-4b5c-a1e0-059120bc28c9 | 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... |
bbb005fb-81b0-43f0-bb5a-62758f10472d | 6 | public boolean getBoolean(String key) throws JSONException {
Object object = this.get(key);
if (object.equals(Boolean.FALSE)
|| (object instanceof String && ((String) object)
.equalsIgnoreCase("false"))) {
return false;
} else if (object.equals... |
623fbab5-9f99-47b8-aa8e-299f763cf284 | 7 | @Override
public void executeMsg(Environmental host, CMMsg msg)
{
if((msg.target()==affected)
&&((msg.source()==invoker())||(msg.source().Name().equals(text())))
&&(msg.sourceMessage()!=null)
&&(msg.sourceMinor()==CMMsg.TYP_SPEAK)
&&(msg.sourceMessage().toUpperCase().indexOf("OPEN")>=0)
&&(affected instan... |
b5e28360-9d17-4fc1-9f2b-cd7d5b6af2ab | 0 | public <T2> Query<T2> cast(final Class<T2> t2)
{
return this.select(new Selector<T, T2>(){
@Override
public T2 select(T item) {
return t2.cast(item);
}});
} |
8f49a235-aecc-4d5a-9383-d65c681295b3 | 4 | public boolean containsDuplicate(int[] nums) {
if(nums==null || nums.length<=1){
return false;
}
boolean res =false;
HashMap s = new HashMap<>();
for(int i:nums){
if(s.get(i)==null){
s.put(i,i);
}else{
res = true;
break;
}
}
return res;
} |
9ef7e30b-502f-4da3-a4cd-bf5011d74b2c | 0 | public void setY(int y) {
this.y = y;
} |
d82cc35c-e8e1-4a9a-a097-8eaf3aab571e | 6 | public String Wert2String() {
if ((wert>=2)&&(wert<=10))
return ""+wert;
switch (wert) {
case 1:
return "A";
case 11:
return "B";
case 12:
return "D";
case 13:
return "K";
}
return "-1";
} |
583c4bcd-2e90-4492-a538-cb0062dedf8d | 7 | public static void fetchAd(final Context context) {
final Activity activity = (Activity) context;
// Only do this if we haven't already got an ad preloading or loading
if (adState != AdState.NONE){
return;
}
setAdStateToLoading();
activity.runOnUiThread(new Runnable(){
@Override
public void r... |
e77b19f3-10f1-4fd5-aad2-14d5f65cd244 | 2 | public static void runGame() {
// GL setup
try {
Display.setTitle("TankyTanks - DEV");
Display.setDisplayMode(new DisplayMode(800, 600));
Display.create();
} catch(Exception e) {
e.printStackTrace();
System.exit(-1);
}
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glEnable(GL11.GL_BLEND);
G... |
87a8ac2f-5345-4bc5-b219-2ee412c1f078 | 2 | public Location getLocation(World world) {
UUID uid = globalUID == null ? world.getUID() : globalUID;
Location loc = locations.get(uid);
return loc == null ? world.getSpawnLocation() : loc;
} |
f97a8949-d8dd-484b-ad9a-a115be32ae0d | 9 | public static boolean comienza(String baseDeDatos, String entrada) {
/* ENTRADA DE DATOS */
String[] cadena;
StringTokenizer tokenizerBD = new StringTokenizer(baseDeDatos, " ");
int cantTokensBD = tokenizerBD.countTokens();
StringTokenizer tokenizerEntrada = new StringTokenizer(entrada, " ");
int cantTokens... |
cefa4bfe-1e2d-4e25-957d-2332c13f55d4 | 2 | @Override
public boolean equals(Object obj) {
if (obj instanceof Teaches) {
Teaches t = (Teaches)obj;
return t.teacher == this.teacher && t.classTaught == this.classTaught;
}
return false;
} |
79b541d6-157d-42e7-be97-0b36358dc535 | 6 | public static void rect( double x, double y, double w, double h )
{
if ( filling )
{
pane.setColor( fillColor );
if ( rectMode == 0 )
pane.fillRect( (int) x, (int) y, (int) w, (int) h );
else if ( rectMode == 1 )
pane.fillRect( (int) ( x - w / 2 ), (int) ( y - h / 2 ), (int) w, (int) h );
}
if... |
266cff20-e0f8-4676-8735-631101879234 | 0 | @Test
public void gameStateTransitionTest2() {
City_Graph city_graph2 = new City_Graph();
city_graph2.loadMap("res/test2.mp");
Move move = new Move("R 2");
city_graph2 = city_graph2.gameStateTransition(move);
assertEquals(city_graph2.convertGameStateToString(),"CRRNNNRNNC");
} |
88f1478b-7dc4-43c4-8f31-4f4936697e43 | 7 | public void mouseClicked(MouseEvent me) {
int x, y;
Rectangle r = new Rectangle(0, 0, (int) (m_nPaddedNodeWidth * m_fScale), (int) (m_nNodeHeight * m_fScale));
x = me.getX();
y = me.getY();
for (int iNode = 0; iNode < m_BayesNet.getNrOfNodes(); iNode++) {
r.x = (int) (m_BayesNet.getPositionX(iNode)... |
0f800c73-1f8f-4843-a0ef-6f768296fa2c | 8 | public static void main(String[] args) {
String text = "Sample text";
File directory = new File("output/example");
directory.mkdirs();
// だめな例:ストリームをクローズしない
BufferedWriter output1 = null;
try {
output1 = new BufferedWriter(new FileWriter(
"output/example/output5.txt"));
output1.write(text);
... |
dea4980b-7977-4ea6-aa47-7fea955275e1 | 2 | private void closeConnection(Connection connection) {
if (connection == null) return;
try {
connection.close();
} catch (SQLException e) {}
} |
3d838a91-a648-4144-84c0-2a38de14874f | 4 | protected void init() {
Arrays.fill(m_diag, 0);
double lambda = 1.0/Math.sqrt(m_lambda);
for(int i=0; i<m_beta.length; i++)
m_beta[i] = Normal.staticNextDouble(0, lambda);
if (m_signs!=null) {//enforce sign over the initial setting of feature weights
for(int i=0; i<m_beta.length; i++) {
if (m_... |
523fc324-c136-4e5d-8c52-71f0e87d5af3 | 3 | public static String[][] getEvaluationResults() {
String [][] evaluationdata;
String read;
ArrayList<String> evaluationData = new ArrayList<String>();
try {
BufferedReader reader = new BufferedReader(new FileReader("evaluation.txt"));
while((read = reader.readLine()) != null) {
evaluationData.add(read... |
9cdefec0-409a-462e-8e34-13865070fc22 | 0 | public DCStation(String alias) {
this.alias = alias;
net = new Network();
kh = new KeyHandler(alias);
connectionSemaphore = new Semaphore(0);
Debugger.println(2, "[DCStation] Station " + alias + " started");
} |
b4121fff-158e-4ad1-bb3d-b4822643720f | 3 | public void move(Game game, boolean[] actionMask)
{
lastMovementType = Types.MOVEMENT.MOVE;
//Map from the action mask to a Vector2D action.
Direction action2D = Utils.processMovementActionKeys(actionMask, getPlayerID());
//Update the orientation for this cycle's movement,
... |
de2b1399-e003-4d04-8e5f-a96d0387235c | 7 | public String Impresion(String palabra) {
String temporal = "";
boolean finalizar = false;
int contador = 0;
while (!finalizar) {
if (contador == 0) {
temporal += palabra.charAt(contador);
contador = palabra.length() - 1;
} else if ... |
5f230e15-7617-4067-8518-b8d7aa8330b9 | 0 | public int getCurrRow(){
return currRow;
} |
27fb9c56-7408-483b-9512-0e19f3a25d96 | 3 | private static boolean occupySameSpace(Positioned a, Positioned b)
{
return a.leftBorder() == b.leftBorder() &&
a.rightBorder() == b.rightBorder() &&
a.topBorder() == b.topBorder() &&
a.bottomBorder() == b.bottomBorder();
} |
66f094ac-3b73-4cdb-9741-98f7404668df | 7 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Endereco other = (Endereco) obj;
if (this.codEndereco != other.codEndereco) {
return false;
... |
34a511ef-d63b-45aa-85e6-f1ca5211a4e3 | 0 | public TuringTestAction() {
//super("Test Turing Machines", null);
super("Test Turing Machines", KeyEvent.VK_T);
} |
9fae14ab-31e7-4b80-8a2a-5b9b4218178f | 7 | public static void main(String[] argv) throws IOException {
int i;
// parse options
for (i = 0; i < argv.length; i++) {
if (argv[i].charAt(0) != '-') break;
++i;
switch (argv[i - 1].charAt(1)) {
case 'b':
try {
... |
0027a51e-4ff7-4c78-894f-cd1986112b89 | 2 | private boolean isFalsePositive(String[] checks, String org) {
for (String check : checks) {
if (org.contains(check)) {
return true;
}
}
return false;
} |
cda3dbc1-0d26-49f0-8c5a-4aeb4b897aa7 | 1 | public String[][] toRowData() {
// return array
String[][] rowData = new String[BPO.size()][13];
// set values for all blueprints
for (int i = 0; i < BPO.size(); i++) {
rowData[i] = BPO.get(i).toStringArray();
}
return rowData;
} |
d7f13454-a6c3-4690-97fd-eff7d751380b | 9 | public static void main(String[] args) throws Exception
{
Configuration conf = new Configuration();
Job job = new Job(conf, "requestcounts");
job.setOutputKeyClass(Text.class);
job.setOutputValueClass(Text.class);
job.setMapperClass(MapRequest.class);
job.setReducerClass(ReduceRequest.class);
job.set... |
bd20f22d-4e62-4902-938e-67b56b939010 | 4 | void create(Map m, Tile t) {
m.rect(x, y, x + width, y + height, true, false, t);
m.rect(x, y, x + width, y + height, true, true, t);
switch (doorwall) {
case UR:
m.getTile(x + doorpos, y - 1).setWall(Tile.WALL_LL, false);
break;
case UL:
m.getTile(x - 1, y + doorpos).setWall(Tile.WALL_LR, fa... |
dc22d3fe-19ab-485a-b291-d21785e03ced | 4 | private void publishTopList() {
// calculate top list:
SortedMap<Long, String> top = new TreeMap<Long, String>();
for (Map.Entry<String, Long> entry : counter.entrySet()) {
long count = entry.getValue();
String word = entry.getKey();
top.put(count, word);
... |
3405f067-c388-4e4c-a24a-0e1a49938c56 | 2 | private boolean setupPermissions()
{
if( getServer().getPluginManager().getPlugin("Vault") != null ) {
RegisteredServiceProvider<Permission> permissionProvider = getServer().getServicesManager().getRegistration(net.milkbowl.vault.permission.Permission.class);
if (permissionProvider != null) {
vaultPerms = ... |
845bc53c-0eba-437b-a8cf-31192e7993f7 | 8 | private static MessageType decodeMessageType(byte messageType) {
switch(messageType) {
case Packet.MESSAGE_TYPE_APPLICATION:
return MessageType.APPLICATION;
case Packet.MESSAGE_TYPE_PING:
return MessageType.PING;
case Packet.MESSAGE_TYPE_PING_RESPONSE:
return MessageType.PING_RESPONSE;
case Pa... |
03db2aa5-11f5-453d-89f9-834cde6f2002 | 3 | @Test
public void testRunStartServerSpotGuest()throws Exception{
AccessControlServer server = new AccessControlServer(1933);
server.start();
SpotStub spot = new SpotStub("139",1933);
spot.start();
sleep(1000);
String ans = "";
int x = 0;
... |
9233fb57-4358-4eb8-819a-62c0d642f58b | 9 | public static Stack<Integer> sort(Stack<Integer> st1)
{
Stack<Integer> st2=null;
int max=0,counter=0,temp=0;
while(!st1.isEmpty())
{
if(max==0)
max=st1.peek();
else if(st1.peek()>max)
max=st1.peek();
if(st2==null)
{
st2=new Stack<Integer>();
st2.push(st1.pop());
}
else ... |
bc417b30-34fb-4c07-a19e-0a5a02fcdaf9 | 1 | public static Matrix identity(int N) {
Matrix I = new Matrix(N, N);
for (int i = 0; i < N; i++) {
I.data[i][i] = 1;
}
return I;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.