method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
d3f5f8ad-10df-4b83-beb8-7a28c2c210d4 | 5 | public static void main(String[] args) {
System.out.println("Loading configuration file");
loadComputeNodeConfig();
System.out.println("Connecting to master");
try {
cServer = new CommunicationServer(Integer.parseInt(node_config.get("port")));
cServerThread = new Thread(cServer);
cServerThread.start();... |
ebb13cbf-f9fa-41d7-b21f-e68efbc30b84 | 8 | private double[] test(List<List<String>> tokenizedTestTweets) {
int[] classCounts = { 0, 0, 0, 0 };
double fullCount = 0.0;
double[] decision = new double[4];
int idx = 0;
for (List<String> tweet : tokenizedTestTweets) {
/** tweetenként nézzük **/
for (int i = 0; i < 4; i++) {
decision[i] = Math.l... |
4a25fcf4-bf60-4023-ae07-c9df47f44b48 | 1 | public void redo(){
if (this.canRedo()){
current++;
this.commands.get(current).execute();
}
} |
24f8e7c7-3220-4421-af30-bc378faba47d | 0 | public String getLabel(TreeNode node) {
return (String) labels.get(node);
} |
a85ab2f9-a393-4b74-a1d4-b14c0bf2b446 | 9 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
MOB target=mob;
if((auto)&&(givenTarget!=null)&&(givenTarget instanceof MOB))
target=(MOB)givenTarget;
if(target.fetchEffect(this.ID())!=null)
{
mob.tell(target,null,null,L("<S-NAME> <S-IS-... |
cbd5d461-14c9-4964-9e12-f81e461f9874 | 4 | public static Animation loadAnimationFile(String animationFilename) {
try {
Scanner reader = new Scanner(new FileReader("Resources/Animations/" + animationFilename));
String spritesPath = reader.next().substring(1);
int width = reader.nextInt();
int height = reader.nextInt();
int nbOfSupportedStates = ... |
56fd5da9-d81e-4dc7-841d-5db998164fc2 | 0 | @Override public void finishPopulate()
{
} |
9f1bc6ee-fc4c-4dc3-a16c-86b372dcd8eb | 5 | public int[][] getStatesOfTrans(String transcription) {
String phonems = FilesLoader.getPhonemsOfTrans(transcription);
int states[][];
int indexFirst = 0;
System.out.println("Phonem sequence : "+phonems);
String phonemsArray[]= phonems.split(" ");
int noOfTriPhones = phonemsArray.lengt... |
20c6512d-0d7d-4b1b-8b6f-5b8e2a747f88 | 0 | public static void main(String[] args) {
Map<String, Pet> petMap = new HashMap<String, Pet>();
petMap.put("My Cat", new Cat("Molly"));
petMap.put("My Dog", new Dog("Ginger"));
petMap.put("My Hamster", new Hamster("Bosco"));
System.out.println(petMap);
Pet dog = petMap.get("My Dog");
System.out.println(dog... |
8b4a8ae6-61ea-4d07-aa89-4c212578b0df | 7 | @Test
public void multiThreadedTest() throws InterruptedException {
final AtomicBoolean failed = new AtomicBoolean(false);
final LastAccessTimeCounter c = new LastAccessTimeCounter();
final AtomicLong index = new AtomicLong(0);
ArrayList<Thread> threads = new ArrayList<Thread>();
for (int i = 0; i < 10; ... |
eedece0d-37bb-4b4f-9e5f-d31b3c194240 | 7 | private double checkDistribution_nextBoolean(RandomGenerator randGen) {
int[] count = new int[2] ;
int total = FAST_TEST ? 1000000 : 10000000 ;
double totalD = total ;
for (int i = 0; i < total; i++) {
int n = randGen.nextBoolean() ? 0 : 1 ;
count[n]++ ;
}
double distribution = totalD / co... |
99ab62cb-5f43-4e86-838c-141d8a96f8fd | 2 | protected Class getClass(final Type t) {
try {
if (t.getSort() == Type.ARRAY) {
return Class.forName(t.getDescriptor().replace('/', '.'),
false, loader);
}
return Class.forName(t.getClassName(), false, loader);
} catch (ClassNotFoundException e) {
throw new RuntimeException(e.toString());
}
... |
59a98ee6-88c1-4036-a78b-0cfe2574a7a4 | 0 | public BookTicketsServlet() {
super();
// TODO Auto-generated constructor stub
} |
b518b040-d7cc-4b77-9e51-15ed98429494 | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Group other = (Group) obj;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return fals... |
7609b667-e980-4a98-a881-a12d96e79d10 | 1 | protected void updateRange(double delta, AABB range) {
Set<Entity> entities = structure.queryRange(new HashSet<Entity>(),
range);
Iterator<Entity> it = entities.iterator();
while (it.hasNext()) {
Entity current = (Entity) it.next();
current.update(delta);
}
} |
c395a009-83c7-47a9-a0c6-3dfea687c596 | 3 | public void binaryFilter(float cutOff, float value) {
for(int i=0; i < data.length; i++) {
float[] block = data[i];
for(int j=0; j < block.length; j++) {
block[j] = (block[j] >= cutOff ? 1.0f : 0.0f) * value;
}
}
} |
d2214f96-e3e5-4669-935e-78a18e0d7532 | 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() && (... |
3f2a0097-9ae3-4362-ba9b-0db1dbd07709 | 6 | private void drawCurve(double[] intervalT) {
if ( intervalT == null)
return;
double s = ( maxY + minY)/ canvasHeight;
double m = Math.max( Math.max( Math.abs(derivativeY(intervalT[0])), Math.abs(derivativeY(intervalT[1]))),
Math.max( Math.abs(derivative... |
2f6f7e1a-f91b-49c7-a447-bfa1015b2b5f | 0 | @XmlElementDecl(namespace = "http://www.w3.org/2001/04/xmlenc#", name = "CipherReference")
public JAXBElement<CipherReferenceType> createCipherReference(CipherReferenceType value) {
return new JAXBElement<CipherReferenceType>(_CipherReference_QNAME, CipherReferenceType.class, null, value);
} |
99a7321f-0072-40c7-9b22-5b6e79a44646 | 2 | public void schemeEditorAddContact() {
if(ce_circuit2.getSelectionIndex() == -1 || ce_drain.getSelectionIndex() == -1) return;
String circuitName = ce_circuit2.getText();
String contactName = ce_drain.getText();
scheme.getCircuits().get(circuitName).getContacts().add(new Contact... |
9bb1e993-9f53-4766-a800-30594cc70ade | 1 | public WheresMyBusServer( int numThreads, int queueSize, String query ) {
bq = new ArrayBlockingQueue<>( queueSize );
twitter = TwitterFactory.getSingleton();
tweetProcWorkers = new ArrayList<>( numThreads );
for ( int i = 0; i < numThreads; i++ ) {
tweetProcWorkers.add(
... |
95c10ae4-7729-4456-857c-a413adc57e3c | 3 | private void close() {
try {
if (statement != null) {
statement.close();
}
if (conn != null) {
conn.close();
}
} catch (SQLException e) {
throw new RuntimeException("Erro ao fechar conexão!");
}
} |
fb85dd47-d1f7-4dd6-abc7-1a12638d81b7 | 8 | public void run() {
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
// This thread simulate the network. It allows the program to send or
// receive messages from another site.
System.out.println("-- Starting Network's thread --- \n ");
System.out.println(" ... |
c263d95e-de67-4fe4-b819-b4c521620b93 | 4 | private boolean readZipFile(String flName) throws IOException {
boolean success = false;
ZipFile zipFile = null;
try {
BufferedReader reader = null;
// ZipFile offers an Enumeration of all the files in the file
zipFile = new ZipFile(flName);
Enume... |
1f17c0e6-5b99-4e07-afe2-1fa853818d1c | 3 | @Override
public Weapon calculateWeapon() {
Weapon calculatedWeapon;
weapons = CPUThrower.getWeapons();
if (round <= 4) {
calculatedWeapon = NCalculateWeapon(2);
} else if (round <= 6) {
calculatedWeapon = NCalculateWeapon(3);
} else if (round <= 8) {
... |
19a76bc3-7a23-4a81-8ee8-10578cf64be9 | 9 | public void zero_old(int[][] matrix) {
if(matrix == null)
return;
int m = matrix.length;
if(m == 0)
return;
int n = matrix[0].length;
boolean[] row_zero = new boolean[m];
boolean[] col_zero = new boolean[n];
for(int i = 0; i < m; i++)
for(int j = 0; j < n; j++)
{
if(matrix[i][j] == 0)
... |
bac7e1e0-0edf-42a1-b9ce-1a6971763555 | 3 | public boolean checkOptimization(int[] rightCuts, int index){
final int opt=index+1;
if(opt==1){//no opt
return true;
} else if(opt==2){//2-opt check
//d(t 1 ,t 2 ) > d(t 2 ,t 3 )
int t1=rightCuts[0];
int t2=Help.circleIncrement(rightCuts[0], tour.length());
// int t3=rightCuts[1];
int t3=Help.ci... |
71e72d53-8de4-4192-91d8-848bf29f20af | 1 | public void addPatient(Patient newPatient) {
if (nextPatient == null) {
nextPatient = newPatient;
nextPatient.previousPatient = this;
} else {
nextPatient.addPatient(newPatient);
}
} |
536c8d1c-0d50-42d9-96d5-53e7e90b0555 | 9 | private void selectImage(){
// Identify computer
String computerName = null;
try{
InetAddress localaddress = InetAddress.getLocalHost();
computerName = localaddress.getHostName();
}
catch(UnknownHostException e){
System.err.println("Cannot det... |
d20090cb-f641-4318-aba2-ff081bd2e5c6 | 4 | public static void assertElementWithTextPosition(MyElement myElement, String elementText, int expectedPosition, WebDriver driver) {
log.info("enter to function assertElementWithTextPosition with element '" + myElement.getName() + "'");
options.setDriver(driver);
options.setMyElement(myElement);
options.setTe... |
42139a05-1da4-4c54-839c-e9e8e699f11d | 5 | public void saveBoard(Board b){
FileWriter fichero = null;
PrintWriter pw = null;
try{
fichero = new FileWriter("savedBoard.txt");
pw = new PrintWriter(fichero);
for (int i = 0; i < 8; i++){
for (int j = 0; j < 8; j++){
... |
93768db9-0ec4-4242-ab90-cbdf4cb16d13 | 9 | public Updater(Plugin plugin, int id, File file, UpdateType type, boolean announce) {
this.plugin = plugin;
this.type = type;
this.announce = announce;
this.file = file;
this.id = id;
this.updateFolder = plugin.getServer().getUpdateFolder();
final File pluginFile... |
710df47e-4e6a-4fa1-9e48-b080a74b3f6d | 0 | @Override
public void loadConsole() throws DataLoadFailedException {
ConfigurationSection sec = getData(specialYamlConfiguration, "console");
YamlPermissionBase permBase = new YamlPermissionConsole(sec);
load(PermissionType.CONSOLE, permBase);
} |
fa3833ec-d2f2-4a79-b8b6-6a75a4ed768f | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Atividade)) {
return false;
}
Atividade other = (Atividade) object;
if ((this.id == null && other.id != null) |... |
5e6afa45-9ca5-44d5-8147-185bd2c011f8 | 7 | private String eFormatString(double x,char eChar) {
boolean noDigits=false;
char[] ca4,ca5;
if (Double.isInfinite(x)) {
if (x==Double.POSITIVE_INFINITY) {
if (leadingSign) ca4 = "+Inf".toCharArray();
else if (leadingSpace)
ca4 = " Inf".toCharArray();
e... |
7b65a1a7-2ae0-4a66-865f-64a53dd2ee7d | 4 | private static Double[][] initializeWeight(mxAnalysisGraph aGraph, Object[] nodes, Object[] edges, Map<Object, Integer> indexMap)
{
Double[][] weight = new Double[nodes.length][nodes.length];
for (int i = 0; i < nodes.length; i++)
{
Arrays.fill(weight[i], Double.MAX_VALUE);
}
boolean isDirected = mxGrap... |
8e922d6f-13b0-4c98-b82d-0c96772c6211 | 4 | private DefaultTableModel resultSetToTableModel(DefaultTableModel model, CachedRowSetImpl rowSet) throws SQLException {
ResultSetMetaData rsMetaData = rowSet.getMetaData();
if(model == null){
model = new DefaultTableModel();
}
String columnLabels[] = new String[rsMetaData.getColumnCount() + 1];
columnLabel... |
9e035858-8a90-4de7-99b3-f5a002df437b | 5 | public static final int gcd(int x1,int x2) {
if(x1<0 || x2<0) {
throw new IllegalArgumentException("Cannot compute the GCD "+
"if one integer is negative.");
}
int a,b,g,z;
if(x1>x2) {
a = x1;
b = x2;
} else {
a = x2;
b = x1;
}
if(b==0) return 0;
g = b;
while (g!=0) {... |
87a264da-0602-4965-afca-ddf3b7960619 | 4 | public int getPixel(int x, int y) {
if (x < 0 || x >= width || y < 0 || y >= height)
return -1;
return pixels[x + y * width];
} |
0f4e479b-8cb9-4a6b-8a4f-2444210c052a | 0 | @Test
public void minDoesNotRemoveValuesWhenCalled() {
h.insert(v);
h.min();
assertFalse(h.isEmpty());
} |
bceba6d8-5eac-44f1-a7f7-39f4ad073c37 | 5 | private static void editarCliente()
{
boolean salir;
String nombre, dni;
Integer idCliente;
Cliente cliente;
do
{
try
{
System.out.print( "Introduce el Id del Cliente: ");
idCliente = Integer.parseInt( scanner.nextLine());
if ((cliente = Cliente.buscar( idCliente)) == null)
{... |
aa043911-3f51-4938-a46d-fa319c73e97a | 2 | private String getEdges(Vertex<Text, Text, NullWritable> vertex) {
StringBuilder sb = new StringBuilder();
for (Edge<Text, NullWritable> edge : vertex.getEdges()) {
sb.append(sb.length() > 0 ? ", " : "");
sb.append(edge.getTargetVertexId());
}
return sb.toString()... |
1cc64e68-0329-452b-b0a1-b7805cba669d | 7 | public boolean func_73085_a(EntityPlayer par1EntityPlayer, World par2World, ItemStack par3ItemStack)
{
int i = par3ItemStack.stackSize;
int j = par3ItemStack.getItemDamage();
ItemStack itemstack = par3ItemStack.useItemRightClick(par2World, par1EntityPlayer);
if (itemstack != par3Ite... |
b45039dc-9434-4e04-9889-f13c65439681 | 7 | private int getChunkSize()
throws IOException
{
if (_chunkSize<0)
return -1;
_trailer=null;
_chunkSize=-1;
// Get next non blank line
org.openqa.jetty.util.LineInput.LineBuffer line_buffer
=_in.readLineBuffer();
while(... |
eabcf9aa-b2c2-44b8-a765-d44b519b39df | 8 | public Iterator<T> iterator() {
return new Iterator<T>() {
private int pos, knownMod = modCount;
{
iteratorCount++;
}
public boolean hasNext() {
boolean hn = false;
for(int a = pos; a < size(); a++) {
if(get(a) != null) {
hn = true;
break;
}
}
if... |
8b24131a-6360-477d-adf6-1ceac8f6ee10 | 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... |
03e2ddb3-150f-4812-817f-39c49c8cae28 | 4 | public static String replace(String inString, String oldPattern, String newPattern) {
if (!hasLength(inString) || !hasLength(oldPattern) || newPattern == null) {
return inString;
}
StringBuilder sb = new StringBuilder();
int pos = 0; // our position in the old string
int index = inString.indexOf(oldPattern... |
bc14600e-2213-4d8e-9bc8-ccdfd5c0408d | 0 | public static void main(String[] args) {
PairManager pman1 = new PairManager1(), pman2 = new PairManager2();
testApproaches(pman1, pman2);
} |
51fc830c-46d4-4df7-9505-070fdac298d8 | 3 | public TreeRow getFirstSelectedRow() {
if (!mSelectedRows.isEmpty()) {
for (TreeRow row : new TreeRowViewIterator(this, mRoot.getChildren())) {
if (mSelectedRows.contains(row)) {
return row;
}
}
}
return null;
} |
97ef6595-2732-4f3a-bbf5-96d4e5f514a3 | 4 | private double getCost(int nextLevelCalls, int[][] newBoard) {
double cost = Double.NEGATIVE_INFINITY;
if (nextLevelCalls == 0) {
cost = evaluator.evaluate(newBoard);
} else {
for (int i = 0; i < newBoard.length; i++) {
for (int j = 0; j < newBoard[i].leng... |
9112f726-8ec9-4db7-8a4f-604dc74e8b9b | 9 | public void handlePut(HttpServletRequest request, HttpServletResponse response, String pathInContext, Resource resource) throws ServletException, IOException
{
boolean exists = resource != null && resource.exists();
if (exists && !passConditionalHeaders(request, response, resource))
retu... |
eb8565a6-0537-43bf-86f4-cca05a1c7c71 | 2 | void checkClose () {
if ( this.closedInputStream && this.closedOutputStream ) {
// close();
}
} |
6086af19-efe4-4ac2-9e96-8db3af3f5163 | 7 | public void renderSheet(int xp, int yp, SpriteSheet sheet, boolean fixed) {
if (fixed) {
xp -= xOffset;
yp -= yOffset;
}
for (int y = 0; y < sheet.HEIGHT; y++) {
int ya = y + yp;
for (int x = 0; x < sheet.WIDTH; x++) {
int xa = x + xp;
if (xa < 0 || xa >= width || ya < 0 || ya >= height) conti... |
cd60863c-b8a2-437f-ba05-f773c692b38e | 6 | public static int dehexchar(char c) {
if (c >= '0' && c <= '9') {
return c - '0';
}
if (c >= 'A' && c <= 'F') {
return c - ('A' - 10);
}
if (c >= 'a' && c <= 'f') {
return c - ('a' - 10);
}
return -1;
} |
f5c2ddaa-652d-40dc-b638-827cb045217d | 7 | @Override
public void render(float interpolation) {
if(!isEnabled)
return;
int xPos = x+width/2-titledim[0]/2;
int yPos = y+height/2-titledim[1]/2;
if(isSelected)
Renderer.drawRect(new Vector2(x,y), new Vector2(width,height), 1, 0.6f, 0.6f, 1);
Fonts.get("Arial").drawString(title, xPos, yPos, 20... |
aabae5d8-5736-4c06-9efe-64d9925f7df5 | 1 | public boolean checksums()
{
if (h_protection_bit == 0) return true;
else return false;
} |
7a725f66-2f2a-4f70-9814-d44538ea7b68 | 0 | public AntiAliasingLine(Excel ex1, Excel ex2) {
begin = ex1;
end = ex2;
setColoredExes();
} |
80309b83-f842-4dfd-8c36-9efa57137559 | 2 | private <T extends GMResponseBase> T _GET(URL url, GMRequestBase request, Class<T> responseType)
throws GongmingConnectionException {
RestTemplate restTemplate = new RestTemplate();
ResponseEntity<T> responseEntity;
T response = null;
try {
responseEntity = restTemplate.getForEntity(
... |
45cc4517-fba3-4778-af73-a44793fdd4f2 | 4 | @Override
public void mousePressed(MouseEvent e) {
int x = e.getX();
int y = e.getY();
if (x >= this.x && y >= this.y && x <= this.x + this.width && y <= this.y + this.height)
setState(ButtonState.ACTIVE);
} |
8f66b41c-f406-466e-b741-8fbda48c3366 | 9 | public void loadFromFile(String file) throws IOException{
File f= new File(file);
FileReader fr= new FileReader(f);
BufferedReader bf= new BufferedReader(fr);
String line= bf.readLine();
double K=0;
int vars=Integer.parseInt(line);
line= bf.readLine();
double[] W= new double[vars];
double[] P=new doub... |
e0dbbbfd-e226-4623-b5ee-642cdc28af53 | 5 | public void setPriorMap(HashMap<String, Double> priorMap) throws LangDetectException {
this.priorMap = new double[langlist.size()];
double sump = 0;
for (int i=0;i<this.priorMap.length;++i) {
String lang = langlist.get(i);
if (priorMap.containsKey(lang)) {
... |
d66f68cc-22a0-4f70-9502-d1020f51011e | 7 | public void moveRow(int start, int end, int to)
{
if (start < 0)
{
String message = "Start index must be positive: " + start;
throw new IllegalArgumentException( message );
}
if (end > getRowCount() - 1)
{
String message = "End index must be less than total rows: " + end;
throw new IllegalArgume... |
c525cead-d3e0-4fe0-ac58-03e439ced577 | 5 | private static String encode_base64(byte d[], int len)
throws IllegalArgumentException {
int off = 0;
StringBuffer rs = new StringBuffer();
int c1, c2;
if (len <= 0 || len > d.length)
throw new IllegalArgumentException ("Invalid len");
while (off < len) {
c1 = d[off++] & 0xff;
rs.append(base64_co... |
60eb1f4f-d07c-4bfe-a78a-b1b17ec850d9 | 9 | private static boolean checkIsPrime(long n) {
if (n == 1) {
return false;
} else if (n < 1) {
return false;
} else if (n < 4) {
return true;
} else if (n % 2 == 0) {
return false;
} else if (n < 9) {
return true;
} else if (n % 3 == 0) {
return false;
}
long maxLoop = (long) (Math.sqrt... |
1db37c68-7b6d-4926-8398-7bdd430855df | 7 | public Object readForthNode( File f, LoadContext<?> parentContext ) throws ScriptError, IOException {
final HashMapLoadContext<Object> ctx = new HashMapLoadContext<Object>(parentContext);
Interpreter interp = new Interpreter();
SafeProcedures.register(interp.wordDefinitions);
interp.wordDefinitions.put("incl... |
d2b04e85-7ed9-4453-a26a-c8527e82e1ab | 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 (!r_prelude()) {
break lab0;
}
} while (fal... |
1cad6789-141e-4aba-ae9b-2616752e9367 | 9 | protected static HostConfiguration getHostConfiguration(URL serviceURL) {
HostConfiguration hostConfig = new HostConfiguration();
// apply proxy settings:
String host = System.getProperty("http.proxyHost");
String port = System.getProperty("http.proxyPort");
String nonPr... |
39558a5e-c7cb-4410-9bad-b736c4c0cbcf | 9 | static String describeWar(int warLength) {
switch (warLength) {
case 0:
return "warless battles";
case 1:
return "wars";
case 2:
return "double wars";
case 3:
return "triple wars";
case 4:... |
b00fe183-7250-4c14-a53e-c466ad0db273 | 7 | public void handleRequest(Session Session, EventRequest Message) throws Exception
{
if (Message.GetHeader() == 4000)
{
String SWFBUILD = Message.GetBodyString().replace("{0}", "");
if (!SWFBUILD.contains(Grizzly.HabboBuild) && !SWFBUILD.contains("Cracked"))
{
Grizzly.WriteOut("Build Mismatch; May ... |
f958a35a-7399-40b9-8738-3f03c2c89813 | 4 | @Override
public ByteBuffer encode(Message message) {
switch (getSession().getState()) {
case CONNECTED:
case LOGGING_IN:
return loginEncoder.encode(message);
case UPDATING:
// TODO: Update encoder.
break;
case LOGGED_IN:
// TODO: Game stream encoding.
break;
}
return null;
} |
f4bcce68-d345-4e7c-b132-9e505e229a96 | 8 | private static void writePrimitiveSetBestIdentifierValueForSelect(final CodeVisitor mw,
final Class returnType,
final int psIdx,
... |
9ddb0656-3ae6-4f5a-823f-e6af5eb0977b | 2 | void txtTable() {
System.out.println(String.format("%-60s\t%-60s\t%-10s\t%s", "Genome", "Organism", "Status", "Database download link"));
System.out.println(String.format("%-60s\t%-60s\t%-10s\t%s", "------", "--------", "------", "----------------------"));
for (String genomeVer : genVerSorted) {
String name ... |
23f52083-9a8e-4db5-9a0a-95587cc02044 | 9 | public void getExits() {
if (getNExit() == null && getSExit() == null && getEExit() == null && getWExit() == null) {
System.out.println("There are no exits!");
}
else {
String sExits = "";//the string of exits
if (oneExit() == true) {
System.ou... |
364f19d4-f187-4d43-97b2-a0057d08b63c | 9 | @Override
@SuppressWarnings("unchecked")
public MaterialPattern read(Object value) {
if (value == null) {
logger.warning("Unknown material (null value)");
return null;
} else if (value instanceof Map) {
Map<Object, Object> structure = (Map<Object, Object>) va... |
b70a7b0d-2ba5-4cda-bdb7-b32d04384dd0 | 0 | public ArrayList<String> getSoundPaths() {
return SoundPaths;
} |
60ab0320-3626-4000-bc10-608c2614ca15 | 4 | public void showFirmwareReadme() {
try {
// seems odd that there isn't a cross platform way to do this!
if (os == OS.WINDOWS)
Runtime.getRuntime().exec("cmd.exe /c start firmware/readme.txt");
if (os == OS.MAC)
Runtime.getRuntime().exec("open firmware/readme.txt");
// this seems cheezy, but I don... |
423a174a-7700-4635-b82a-f9cd2854a432 | 1 | private void initializeProfile() {
System.out.println("Initializing the file");
File file = new File("../src/saveData/saveFile.json");
try {
writer = new PrintWriter(file);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
writer.flush();
writer.clos... |
6386a7a3-4722-4a60-a48f-f281a7b25944 | 2 | private static void createDisplay() {
try {
Display.setDisplayModeAndFullscreen(new DisplayMode(1600, 900));
Display.setFullscreen(false);
Display.setVSyncEnabled(true);
Display.setResizable(false);
Game.WIDTH = Display.getDisplayMode().getWidth();
Game.HEIGHT = Display.getDisplayMode().getHeight()... |
73b1f580-6af4-4816-95c5-762cb284efdc | 5 | private int getAmicableNumberSumUnder(int limit) {
Map<Integer, Integer> map = new LinkedHashMap<>(limit - 1);
for (int i = 1; i < limit; i++) {
map.put(i, getSumOfFactors(i));
}
int total = 0;
for (Map.Entry<Integer, Integer> entry : map.entrySet()) {
int... |
6056cc35-1e7b-4889-ae64-b439ecf13069 | 5 | public void iterativeInOrder(TreeNode root) {
if (root == null) {
return;
}
Stack<TreeNode> stack = new Stack<TreeNode>();
TreeNode currentNode = root;
while (currentNode != null) {
if (currentNode.getLeft() != null) {
stack.push(currentNode);
currentNode = currentNode.getLeft();
} else {
... |
ad213648-d6da-4008-965f-0ed95ea1131a | 5 | public void start(MapleCharacter c, int npc) {
if ((autoStart || checkNPCOnMap(c, npc)) && canStart(c, npc)) {
for (MapleQuestAction a : startActs) {
a.runStart(c, null);
}
if (!customend) {
final MapleQuestStatus oldStatus = c.getQuest(this);
final MapleQuestStatus newStatus = new MapleQuestStatu... |
f822f19b-ffd8-4791-9601-ed0469ea8173 | 1 | synchronized public static org.omg.CORBA.TypeCode type ()
{
if (__typeCode == null)
{
__typeCode = org.omg.CORBA.ORB.init ().create_interface_tc (BankHelper.id (), "Bank");
}
return __typeCode;
} |
8d8e4379-2699-48dc-ad7e-575198647ec0 | 7 | public static void main(String[] args)
throws UnspecifiedErrorException, IOException, InvalidHeaderException {
// Attach the shutdown hook to do any necessary cleanup
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
in.close();
}
});
// Setup the logger
C... |
a2e46442-d1e8-4e94-9b5a-93c46e463613 | 0 | @Override
public void setName(String name) {
super.setName(name);
} |
46218cff-c7cf-4013-ac5f-12adb54f402f | 4 | Module removeSubModule(Module module) {
if (null == this.subModules || null == module) {
return this;
}
if (this.subModules.remove(module) && this.subModules.isEmpty()) {
this.subModules = null;
}
return this;
} |
160ef57e-8bf3-40ef-91e8-4f20a80b2dc4 | 3 | @Test
public void testForAssignments() {
for(int i = 6; i <= 10; i++) {
for(int j = 1; j <= 7; j++ ) {
try {
assertNotNull("Assesment Getter returns assignment: " + i + " " + j, AssesmentGetter.getAssignment(i, j));
} catch (ClassNotFoundException e) {
fail("Assignment " + i + " " + j + " does ... |
c440659d-5255-44ff-9b5f-693688814853 | 3 | private void btnExcluirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExcluirActionPerformed
if (estaModoEdicao() && exclusaoConfirmada()) {
try {
excluir();
} catch (ValidacaoException ex) {
_unitOfWork.rollback();
J... |
2fb4df04-9754-495f-9576-fd7f2dc9069c | 8 | public static ServiceTime getServiceTime(Address srcAddr, Address dstAddr) {
ServiceTime serviceTime = new ServiceTime();
serviceTime.setSrcAddr(srcAddr);
serviceTime.setDstAddr(dstAddr);
String url = "http://www.sf-express.com/dwr/call/plaincall/ServiceTimeManager.getServiceTime_omp.dwr";
List<NameValuePair>... |
79f0b442-a1a9-43ce-b27a-d7d36b4be4b0 | 9 | public double getAttackMultiplier() {
if (onPrayersCount == 0)
return 1.0;
double value = 1.0;
// normal
if (usingPrayer(0, 2))
value += 0.05;
else if (usingPrayer(0, 7))
value += 0.10;
else if (usingPrayer(0, 15))
value += 0.15;
else if (usingPrayer(0, 25))
value += 0.15;
else if (using... |
bafcb4f2-117f-46ed-8349-8181d83e4507 | 2 | public int access_x_coordinate(int x) {
if (x < 0) {
return 0;
} else if (x >= height) {
return height - 1;
} else {
return x;
}
} |
5b426dd1-9cbd-45dd-a088-b381233d295f | 4 | public JLabel getPlayer2Piece() {
boolean test = false;
if (test || m_test) {
System.out.println("Drawing :: getPlayer2Piece() BEGIN");
}
if (test || m_test)
System.out.println("Drawing:: getPlayer2Piece() - END");
return m_player2Piece;
} |
abf70911-ccaf-401a-a83e-3b15781ffb6a | 4 | public void draw(Graphics2D g) {
g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
bg.draw(g);
g.drawImage(title, 105, 25, null);
g.drawImage(up, 290, 188, null);
g.drawImage(down, 310, 188, null);
g.drawImage(enter, 80, 188, null);
if (currentChoice == 0)... |
933a8378-fecb-47b8-838c-a3c0f7db91c9 | 9 | private static void addQueryResults(List<ConstraintViolation> results, QueryOrTemplateCall qot, Resource resource, boolean matchValue, List<SPINStatistics> stats, SPINModuleRegistry registry) {
QuerySolutionMap arqBindings = new QuerySolutionMap();
String queryString = ARQFactory.get().createCommandString(qot... |
3ce05952-cbbd-458c-a6ff-360afaa81a35 | 7 | public FineGUI(){
screenSize = Toolkit.getDefaultToolkit().getScreenSize();
screenMax = Toolkit.getDefaultToolkit().getScreenInsets(fineDialog.getGraphicsConfiguration());
taskbarSize = screenMax.bottom;
screenWidth = (int)screenSize.getWidth();
screenHeight = (int)screenSize.getHeight() - taskbarSize;
/... |
4da4fade-8da0-4ded-bb87-41215bf1e747 | 0 | @Override
public void startSetup(Attributes atts) {
super.startSetup(atts);
addActionListener(this);
} |
faf8a1e4-e98f-4618-81ee-23ebc02920c1 | 7 | static void testValidity(Object o) throws JSONException {
if (o != null) {
if (o instanceof Double) {
if (((Double)o).isInfinite() || ((Double)o).isNaN()) {
throw new JSONException(
"JSON does not allow non-finite numbers.");
... |
22ce477e-f7fd-4d18-8061-7bf72d46b851 | 8 | public static void printArgumentConstraint(OutputStream sql, Stella_Object argument, RelationColumnInfo column) {
{ NamedDescription columntype = column.columnType;
Surrogate argname = Logic.objectSurrogate(argument);
Module argmodule = ((argname != null) ? ((Module)(argname.homeContext)) : ((Module)(nu... |
317c5d5a-0a9c-4f4b-99ef-46940b91e825 | 9 | private double calculateScore(ArrayList<seed> seedlist) {
double total = 0.0;
for (int i = 0; i < seedlist.size(); i++) {
double score = 0.0;
double chance = 0.0;
double totaldis = 0.0;
double difdis = 0.0;
for (int j = 0; j < seedlist.size(); j++) {
if (j != i) {
totaldis = totaldis
... |
828349cc-1d58-4d16-96ea-ea68a23ad9b4 | 6 | public String toString() {
if (x!=0 && y>0) {
return x+" + "+y+"i";
}
if (x!=0 && y<0) {
return x+" - "+(-y)+"i";
}
if (y==0) {
return String.valueOf(x);
}
if (x==0) {
return y+"i";
}
// shouldn't get... |
fe2f18be-dc6d-4bc1-a80d-6d5a168aadaa | 4 | @Override
public boolean activate() {
return Game.isLoggedIn() && Players.getLocal() != null && Players.getLocal().isOnScreen()
&& !Widgets.get(1252, 1).visible() && !Widgets.get(1234, 10).visible();
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.