method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
53ab6a15-2eef-425f-9707-9b632063c9dc | 9 | public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line = "";
StringBuilder out = new StringBuilder();
functionDFS();
while ((line = in.readLine()) != null && line.length() != 0) {
String cube = line.trim();
int[] ... |
f7b7d708-afa6-49e2-aac9-7b82e6bb2f8e | 6 | public static void makeGrid(Container parent,
int rows, int cols,
int initialX, int initialY,
int xPad, int yPad) {
SpringLayout layout;
try {
layout = (SpringLayout)parent.getLayout();
} ... |
3ae0d377-26e8-4216-8dd0-f52a2fc2fee4 | 4 | public Boolean isEmptyTable(JTable table) {
dataTable = new Object[table.getRowCount()][table.getColumnCount() - 1];
for (int i = 0; i < table.getRowCount(); i++) {
for (int j = 1; j < table.getColumnCount(); j++) {
if (table.getValueAt(i, j) == null || table.getValueAt(i, j)... |
8f3b6759-f3f4-481a-a9e0-1e32d76f1834 | 1 | public boolean canHaveAsBalance(BigInteger balance) {
return (balance != null) && (balance.compareTo(this.getCreditLimit()) >= 0);
} |
e93a1f73-fd3e-4e04-b53a-60fd45f8b73a | 8 | public void setFrequency (CommandSender sender, String inputString) throws IOException{
if (new File("plugins/CakesMinerApocalypse/").mkdirs())
System.out.println("Frequencies file created");
File myFile = new File("plugins/CakesMinerApocalypse/frequencies.txt");
if (myFile.exists()){
Scanner i... |
ad547c53-1ed7-42e2-9e09-77202d1b84ef | 2 | public String toString() {
StringBuilder sb = new StringBuilder();
for( int i=0; i<32; i++ ) {
sb.append(this.prefix.get(i) == true ? "1" : "0");
}
return sb.toString();
} |
d1039edd-92cb-4532-a341-7807d6bd65c4 | 9 | @Override
public void run() {
try {
if ("I'm here !".equals(in_socket.readLine())) {
boolean test_server = false;
int randNumber = (int) (Math.random() * 5);
System.out.println("I've chosen number " + randNumber);
... |
d4e9aab6-d5f4-4c66-b1d4-b9101b60ac1b | 2 | public static void main(String[] args) {
logger.info("Starting");
SubLAPIHelper thisObj = null;
try {
CycConstant admin = new CycConstant("Administrator", new Guid("bd58aedc-9c29-11b1-9dad-c379636f7270"));
thisObj = new SubLAPIHelper("localhost", 3660, admin);
setLoggingLevel(Level.FINE);
... |
2f11e6dd-fcb3-429f-981f-06e602070e77 | 6 | public boolean allMosquitoesCaptured(int[][] board) {
boolean captured = true;
for ( int i = 0; i < 100; i++ ) {
for ( int j = 0; j < 100; j++ ) {
if ( board[i][j] > 0 ) {
boolean capturedByLight = false;
for ( Light light : lights ) {
double x = Math.pow(i-light.getX(),2);
double y = ... |
996781d8-a172-48e5-8e8e-b89fbd8b6330 | 6 | protected static PPJCProduction determineProduction(Node node) {
// Logger.log("TRAŽIM PRODUKCIJU ZA NEZAVRŠNI: " +
// node.getSymbol());
List<Node> children = node.getChildren();
List<orderedProduction> prods = productions.get(node.getSymbol().toString());
if (prods == null)
throw new SemanticsExceptio... |
38013d9b-bf8a-456f-9179-49177749d6e1 | 3 | public int returnLowestBin () {
try {
int a,lowBin=-1;
int lowVal=Integer.MAX_VALUE;
for (a=0;a<circBufferCounter;a++) {
if (circDataBuffer[a]<lowVal) {
lowVal=circDataBuffer[a];
lowBin=a;
}
}
return lowBin;
}
catch (Exception e) {
JOptionPane.showMessageDialog(null,"Error in r... |
81c9e7e9-68e2-41dd-8d08-d442b1088d21 | 8 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Subsection other = (Subsection) obj;
if (this.id != other.id && (this.id == null || !this.id.equals(other... |
45ab47e2-1850-44da-9b34-670602f01aa7 | 0 | public HeroClass gethclass(String s) {
return plugin.getheroesplugin().getClassManager().getClass(s);
} |
c808325a-f943-47e4-97b6-2326fb7fc785 | 7 | private void advise(Actor actor, Actor other) {
final Skill tested = (Skill) Rand.pickFrom(other.traits.skillSet()) ;
if (tested == null) return ;
final float level = actor.traits.useLevel(tested) ;
utters(other, "I'm interested in "+tested.name+".") ;
if (level < other.traits.useLevel(tested))... |
e45294c3-f1a1-44b1-bf79-4ec8352f5f62 | 7 | public double[] distributionForInstance(Instance instance) throws Exception {
double[] probs;
//also needed for logitboost
if (m_isLeaf && m_hasConstr) { //leaf
//leaf: use majoraty class or constructor model
probs = modelDistributionForInstance(in... |
d5989bd2-e54c-4fa9-a8e4-447cc96809cb | 9 | public String nextToken() throws JSONException {
char c;
char q;
StringBuffer sb = new StringBuffer();
do {
c = next();
} while (Character.isWhitespace(c));
if (c == '"' || c == '\'') {
q = c;
for (;;) {
c = next();
... |
b296a77a-2c7c-4e71-9f26-1d5a37dc503c | 3 | @Override
public boolean equals( Object o ) {
if ( !(o instanceof DoorCoordinate) ) return false;
DoorCoordinate d = (DoorCoordinate)o;
return ( x==d.x && y==d.y && v==d.v );
} |
60c9574d-31c1-4519-88f6-479728c2d5cc | 5 | @Override
public void run() {
while (!done) {
timeOutMinutes = mgr.getTimeout(); // update dynamically
Map<Lock,T> map = ((PessimisticLockManagerImpl)mgr).getLockStore();
if (map.keySet().size() > 0) {
System.out.println("LockReaper: Locks currently held at " + new Date() + ":");
}
for (Lock lock ... |
43ce5d76-dbab-4ae5-92ad-e35564b8835a | 3 | public static ImageIcon loadImageIcon( String imageFile ) {
ImageIcon result = null;
InputStream stream;
try {
stream = Model.class.getClassLoader().getResourceAsStream( imageFile );
result = new ImageIcon( ImageIO.read( stream ) );
} // try
catch ( IllegalArgumentException error ) {... |
0373bb52-0b3e-4208-b939-87436fe3730a | 5 | public String buscarGrupoEstudioPorNombre(String nombre) {
ArrayList<GrupoEstudio> geResult= new ArrayList<GrupoEstudio>();
ArrayList<GrupoEstudio> dbGE = tablaGrupoEstudio();
String result="";
try{
for (int i = 0; i < dbGE.size() ; i++){
if(dbGE.get(i).getNombre().eq... |
afa1bea5-30c9-4854-9ccb-3fc6d2596c90 | 2 | public Item dequeue() {
if (isEmpty())
throw new NoSuchElementException();
// Remove from the front.
Item t = q[front];
front = (front + 1) % (N + 1);
if (size() < N / 2)
q = resize(N / 2);
System.out.println("dequeue -> front: " + front + " rear: " + rear);
System.out.println(toString());
retu... |
0e5f08f8-0897-42bf-8457-9788c09fa303 | 1 | public void run() {
Comic comic = new Comic(title, imgFilename);
try {
ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(comicFilename));
oos.writeObject(comic);
oos.close();
} catch(Exception ex) {}
System.out.println("Saved " + comicFilename);
} |
4f3e1c74-62c0-40c0-9c1a-8721c22f977a | 1 | public void visit_ladd(final Instruction inst) {
stackHeight -= 4;
if (stackHeight < minStackHeight) {
minStackHeight = stackHeight;
}
stackHeight += 2;
} |
3ee0744c-f4c3-4482-a4d2-7f964949a9ab | 3 | public boolean isGeneEqual(Gene g)
{ return ((allel1 == g.allel1 && allel2 == g.allel2) || (allel1 == g.allel2 && allel2 == g.allel1)); } |
91301bde-4e96-4b93-8b98-911d103c695e | 7 | private JSONWriter append(String string) throws JSONException {
if (string == null) {
throw new JSONException("Null pointer");
}
if (this.mode == 'o' || this.mode == 'a') {
try {
if (this.comma && this.mode == 'a') {
this.writer.write('... |
341175ec-82cd-46db-9ba7-174d38aa0085 | 9 | @Override
public void buttonClicked(JButton button)
{
if (button == cancel)
{
fileName.setText("");
setVisible(false);
}
else if (button == browse)
{
int choice = fc.showSaveDialog(this);
if (choice == JFileChooser.APPROVE_OPTION)
{
File file = fc.get... |
7e0f948d-b747-40c1-9c50-495977479d34 | 1 | private void updateDesktopSize(boolean repaint) {
// This is just flailing to get it to redraw itself.
Outliner.jsp.revalidate();
Outliner.jsp.validate();
Outliner.jsp.getHorizontalScrollBar().repaint();
Outliner.jsp.getVerticalScrollBar().repaint();
if (repaint) {
Outliner.desktop.repaint();
}
... |
9c789402-29d3-42ba-a51b-35416ca58728 | 9 | private int[][] extractMovements(byte[] b) {
int[][] movs = new int[b.length - 8][4];
for (int i = 0; i < b.length - 8; ++i) {
switch (b[i + 8]) {
case Constants.EAST:
movs[i][3] = 1;
break;
case Constants.NORTH:
movs[i][0] = 1;
break;
case Constants.NORTHEAST:
movs[i][3] = 1;
mo... |
d8e1b764-a79a-4a4b-8384-d96f9e069c9e | 6 | public static String getShipName(Color faction)
{
if(faction.equals(RED))
{
return "Queen's Fancy";
}
else if(faction.equals(YELLOW))
{
return "Sea Lion";
}
else if(faction.equals(WHITE))
{
return "Seeker";
}
else if(faction.equals(GREEN))
{
return "Misericorde";
}
else if(faction... |
4839fba4-cd13-486d-8174-2624f4c14da4 | 8 | public void scrollView(Graphics2D g2d, int scrollSpeed) {
int flashInterval = (1000 / scrollSleep) / 2;
boolean doFlash = false;
flashCounter++;
if (flashCounter >= flashInterval) {
flashCounter = 0;
doFlash = true;
}
if (isFlash && doFlash) {
int width = imageData.getWidth();
int height = imag... |
7ac70005-f694-4442-8580-8e1c7536d057 | 3 | public static void gRepaint() {
if (controls != null)
GUI.controls.canvas.repaint();
if (player.graph != null)
player.graph.canvas.repaint();
if (layeredPane != null)
GUI.layeredPane.repaint();
} |
c07fa821-dfc2-4224-8e20-2e6aee8a187d | 1 | public void disableComponent(String comp) {
Iterator<GameActor> it = actors.values().iterator();
while(it.hasNext()) {
GameActor actor = it.next();
actor.disableComponent(comp);
}
} |
865b9357-451b-4289-8522-21520362afcb | 4 | long getNextHandle(FileHandle handle) {
while (true)
{
long handleTest = rand.nextLong();
if (handleTest < 0)
handleTest *= -1;
if (handleTest == 0)
continue;
synchronized (handles)
{
if (!handles.containsKey(handleTest))
handles.put(handleTest, handle);
}
return handleTest... |
ec6ee5f7-a07d-4ae6-82a5-19730aa108a8 | 2 | public static MethodType tMethod(String signature) {
int hash = signature.hashCode();
Iterator iter = methodHash.iterateHashCode(hash);
while (iter.hasNext()) {
MethodType methodType = (MethodType) iter.next();
if (methodType.getTypeSignature().equals(signature))
return methodType;
}
MethodType meth... |
8e118496-c828-4cd9-919d-700ce3a23684 | 3 | public List<List<Object>> calculateMostProbableKMer() {
List<List<Object>> mostProbableKMer = new ArrayList<List<Object>>();
List<String> allKMers = getAllKMers();
double highestProbability = -1;
letterSplit();
for (String s : allKMers) {
double probability = calcul... |
90cce2c1-7703-46df-beea-4e8066de33b7 | 0 | @Override
public void startSetup(Attributes atts) {
super.startSetup(atts);
setEnabled(false);
addActionListener(this);
Outliner.documents.addTreeSelectionListener(this);
Outliner.documents.addDocumentRepositoryListener(this);
} |
1997f285-0812-416c-b3c1-f534a9855e1e | 1 | public void info(final String msg) {
if(disabled) return;
else logger.info("" + route_name + "-" + connection_id + "[info]: " + msg);
} |
c53bed3d-997b-47ef-8d2e-fe96bc0aeae2 | 8 | public static int mainInt(String... args) throws Exception {
if (args.length != 5 && args.length != 4) {
throw new IllegalAccessException("Usage: HTMLLauncher outputDir testSuite startUrl multiWindow browser");
}
File dir = new File(args[0]);
if (!dir.exists() && !dir.mkdirs()... |
6ce6d463-3a5b-4d7a-b83d-b0e8594d664e | 4 | final public void put(final K key, final V value) {
int index = computeHash(keyData(key)) % size ;
if (index < 0) index += size ;
if (table[index] != null) {
for (Entry <K, V> link = table[index] ; link != null ; link = link.next)
if (equals(link.key, key)) {
link.value = value ;
... |
2b3c394f-afa3-430a-8b1f-06ef9442261e | 2 | public CitiesStatisticsByYears deserialize(JsonElement json, Type type,
JsonDeserializationContext context) throws JsonParseException {
JsonObject root = json.getAsJsonObject();
JsonElement epam = root.get("EPAM");
TypeToken<Map<String, Map<String, List<Integer>>>> mapToken = new TypeToken<Map<String, Map<Stri... |
93cded40-05c7-4850-961f-83de0c0da099 | 2 | public Newline(Map<? extends Attribute, ?> attrs) {
this.attrs = attrs;
} |
80817a5c-2e64-47a9-a710-95a2fb3cc46d | 8 | public void addVariable(int index, String access, String type, String name,
boolean setget) {
// default access modifier = write nothing in front
if (access.equals("default"))
access = "";
// set the code part
String code = access + " " + type + " " + name + ";";
// change the access modifiers names to ... |
7fb7b2b8-f5f1-4c88-bac5-ff2dc2ff9561 | 1 | public String toString() {
return getValue() ? "true" : "false";
} |
e5c0448c-cdb3-4cf8-bb65-f35e4f8cf9e9 | 4 | public void viewAutomaton(JTableExtender table){
InputTableModel model = (InputTableModel) table.getModel();
if(model.isMultiple){
int row = table.getSelectedRow();
if(row < 0) return;
String machineFileName = (String)model.getValueAt(row, 0);
updateV... |
31b5e436-a507-4439-98d0-b371478f9df2 | 7 | public static String exportDKBrics(Grammar g) {
String s = "";
// nonterminals and productions
s += "\n" + productionsToDKBrics(g.startSymbol);
for (NonTerminal n : g.nonTerminals.values()) {
if (n != g.startSymbol) {
s += "\n" + productionsToDKBrics(n);
}
}
s += "\n/* terminals */\n";
... |
1c082c6d-5715-4615-bc62-b09e260c4be8 | 8 | public static void Math135Semester() throws IOException
{
System.out.println("Damon decides to take Math 135, Algebra. Damn he is brave.");
BufferedReader r = new BufferedReader (new InputStreamReader(System.in));
//Week 1
DamonWeek.Week();
DamonLearning.WeekOne();
//Week 2
DamonWeek.Week();
D... |
9a8fb4cb-57a1-4656-b191-a4718790235e | 3 | public boolean validateClients()
{
boolean ret = true;
String clientIDString = "";
ArrayList<Integer> clientIDs = new ArrayList<Integer>();
dB.runQuery("SELECT client_id,TIME_TO_SEC(TIMEDIFF(NOW(),last_client_update)) FROM clients WHERE client_is_active = true");
while(dB.next())
{
if(dB.getInt(2) > CLI... |
dd8313c8-21da-4353-b585-ad2255c572c5 | 8 | @Override
public void run() {
while (true) {
List<Astroid> astroids = new ArrayList<Astroid>();
List<Bullet> bullets = new ArrayList<Bullet>();
for (Moveable m : display.vh.vel) {
try {
Astroid a = (Astroid) m;
astroids.add(a);
} catch (Exception e) {
try {
Bullet b = (Bullet) m... |
7980660d-db2b-4995-8b7a-0ea6327f1215 | 6 | @Override
public void render(Graphics2D g, LevelEditorComponent ed)
{
if (isZone)
g.setColor(Colors.zone);
else
g.setColor(Colors.view);
g.drawRect(X, Y, Width - 1, Height - 1);
g.drawRect(X + 1, Y + 1, Width - 3, Height - 3);
Rectangle ViewableP... |
329d3b3e-0549-427d-b403-c0dc92a1a828 | 8 | @Override
public void run() {
while (true) {
try {
synchronized (this) {
while (queries.isEmpty()) {
this.println("Waiting for query");
this.wait(1000); // for something to do
}
this.println("Query received");
ChannelQueryPair<Channel, Query> channelQueryPair = queries.poll();
... |
767ba288-4714-4f97-8149-9759afb83cc4 | 1 | public void addNCards(Card c, int n){
for(int i = 0; i < n; i++)
this.cardList.add(c);
} |
15d6309a-1ec8-4dc0-afe2-7ce0f56f8843 | 7 | public List func_71516_a(ICommandSender par1ICommandSender, String par2ArrayOfStr[])
{
if (par2ArrayOfStr.length == 1)
{
return func_71530_a(par2ArrayOfStr, new String[]
{
"on", "off", "list", "add", "remove", "reload"
});
... |
b6e15d38-dcd7-44a7-af49-ee70b968a010 | 9 | @Override
public String getAlignmentName(Environmental E)
{
if(E instanceof Physical)
{
if((((Physical)E).phyStats().disposition()&PhyStats.IS_GOOD)==PhyStats.IS_GOOD)
return Faction.Align.GOOD.toString();
if((((Physical)E).phyStats().disposition()&PhyStats.IS_EVIL)==PhyStats.IS_EVIL)
return Faction... |
4c3f0d8f-d11b-47cb-91a9-483e264b7515 | 0 | public void mousePressed(MouseEvent arg0) {} |
c18d4fb9-3a20-4cf4-9a02-08fbafdd5a4d | 7 | public void displayGraph(Map<Server, Set<Application>> connections) {
graph.clear();
if(connections != null) {
int serverCounter = 0;
int applicationCounter = 0;
for (Server server : connections.keySet()) {
Node serverNode;
if((serverNo... |
c155d78e-dc49-4a19-bf0f-3428dbd4733b | 4 | public double[] calculateEnergyConsumption(SoftwareSystem system, FunctionalRequirement functionalRequirement, SequenceAlternative sequenceAlternative) {
double consumption[] = { 0, 0 };
system.getActuallyUsedHardwareSets().clear();
for (Message message : sequenceAlternative.getMessages()) {
double[] component... |
2011f2de-c703-4dc2-ab91-e1dcdcb976fc | 0 | public String getId() {
return id;
}//getID |
1707d7c9-dc4c-44f9-a0d7-50c9c2305ea6 | 4 | public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 1: // FIRST_NAME
return FIRST_NAME;
case 2: // LAST_NAME
return LAST_NAME;
case 3: // STATUS
return STATUS;
case 4: // ID
return ID;
default:
return ... |
2b0051c3-2966-464b-af07-a840ab29e05f | 8 | private static Point[] removeRedundancy(Point[] points) {
List<Point> p = new ArrayList<Point>();
for (Point i : points)
p.add(i);
for (int i = 1; i < p.size() - 1;) {
Triangle t = new Triangle(p.get(i - 1), p.get(i), p.get(i + 1));
int[] a, b;
a = Triangle.connVect(t.getA(), t.getB());
b = Trian... |
1b5a5909-06a6-40db-82bd-5869b132c5cb | 4 | @Override
public void run() {
int translated = 0;
double [] tdouble = null;
while( translated < this.size )
{
try {
w.acquire();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
continue;
}
synchronized(this.datas)
{
tdouble = this.da... |
616bb9b6-03e5-4d89-a8d0-638f64f0ca7d | 9 | public final SS_play_expr file_silence(SS_statement stat) throws RecognitionException {
SS_play_expr expr = null;
try {
// SayScript.g:316:5: ( COLON | COMMA | PERIOD | SEMICOLON )
int alt20=4;
switch ( input.LA(1) ) {
case COLON:
{
alt20=1;
}
break;
case COMMA:
{
alt20=2;
... |
18547750-9771-4a8c-8805-830b4176bb36 | 0 | private String calc(String input) {
return input.substring(2, input.length() - 1) + input.substring(0, 1);
} |
65393c00-5338-4b91-aa3e-4c29e59720a5 | 5 | static boolean doListsContainSameItems(Vector<Integer> listA, int[] arrayB) {
Vector<Integer> listB = new Vector<>(arrayB.length);
for (int itemB : arrayB) {
listB.add(itemB);
}
for (int itemA : listA) {
if (!listB.contains(itemA)) {
return false;
... |
dc3717c0-ee16-48bd-b3d3-eeb9f37dff36 | 3 | public void setRedraw (boolean value) {
checkWidget();
if (value) {
if (--drawCount == 0) {
if (items.length - itemsCount > 3) {
CTableItem[] newItems = new CTableItem [itemsCount];
System.arraycopy (items, 0, newItems, 0, itemsCount);
items = newItems;
}
updateVerticalBar ();
updateHorizont... |
390e921b-faa3-40c7-a403-cd4dbd199d79 | 7 | public Feedback recordScore(String term, String couId, String[][] table) {
String command = "record;score;" + term + ";" + couId;
String line = null;
ArrayList<String> list = new ArrayList<String>();
for (int i = 0; i < table.length; i++) {
String l = "";
for (int j = 0; j < table[i].length; j++) {
if... |
080feaf5-7c2d-406f-ae71-ab5f5162a224 | 4 | public DeleteQuery in(String... args) {
if (args.length == 1) {
for (String arg : args) {
if (arg.startsWith("(")) { // nested select
query.append(" IN ").append(arg);
} else { // just single value, same as below
query.append(" ... |
63602246-d62d-4a02-a74b-03e6620bff5e | 4 | public final void setBounds(float var1, float var2, float var3, int var4, int var5, int var6, float var7) {
this.vertices = new Vertex[8];
this.quads = new TexturedQuad[6];
float var8 = var1 + (float)var4;
float var9 = var2 + (float)var5;
float var10 = var3 + (float)var6;
var1 -= var... |
5f41f18d-6221-47c6-a0e2-e40686548402 | 1 | public LightTrailPart(Grid grid, LightTrail lightTrail) {
super(grid);
if (lightTrail == null)
throw new IllegalArgumentException("A LightTrailPart is always part of a LightTrail.");
this.lightTrail = lightTrail;
} |
89b9f7c4-f56d-42a8-ad86-8253fce4c22d | 4 | public static SelectItem[] getSelectItems(List<?> entities, boolean selectOne) {
int size = selectOne ? entities.size() + 1 : entities.size();
SelectItem[] items = new SelectItem[size];
int i = 0;
if (selectOne) {
items[0] = new SelectItem("", "---");
i++;
... |
2b878710-3df1-4f70-a120-4d5caa347d6b | 1 | @SuppressWarnings("unchecked")
public ArrayList arbitrary(Random random, long size)
{
int length = (int) Arbitrary.random(random, 0,
Math.min(Integer.MAX_VALUE, size));
ArrayList list = new ArrayList(length);
for (int i = 0; i < length; ++i) {
... |
043ee58d-7b8f-4e35-a45e-a7ba68db1f83 | 4 | public static void countingSort(int[] arrIn, int[] arrOut,int top ){
int [] array = new int[top];
for(int i =0;i< top;i++)
array[i] = 0;
for(int i =0;i< arrIn.length;i++)
array[arrIn[i]] = array[arrIn[i]] +1;
for(int i =1;i< top;i++)
array[i] = array[i-1]+ array[i];
for(int j = arrIn.length... |
33fa40a8-3abc-41a7-9e36-7601da72236b | 0 | public static void main(String[] args) {
withoutGenerics();
withGenerics();
comparableExanple();
} |
84c44029-27a7-4f83-9c40-0d9a83226143 | 6 | public void rotate(boolean clockWise)
{
setPreviousPosition();
switch(index)
{
case 1:
break;
case 2:
switch(position)
{
case 0:
column += 1;
... |
3ff13bf3-cca9-4029-ad46-963abb506396 | 4 | public static Player Menu()
{
int[] stats = new int[3];
String name;
int input;
Player decoy = new Player();
Player player=null;
boolean keep=false;
Scanner inMenu = new Scanner(System.in);
//Initial Output
System.out.println("===============================================");
... |
fe986b99-242c-4d21-9cd9-64cd3495d607 | 0 | public static void main(String[] args) {
int numbers[] = {1, 2, 3, 5, 8, 13};
System.out.println("First member of this array is "
+ numbers[0]);
System.out.println("Last member of this array is "
+ numbers[numbers.length - 1]);
} |
d12d4dad-8a0e-433d-aaf9-3933b87a2067 | 9 | public void GenerateIcons() {
icons = new ImageIcon[6];
icons[0] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR));
icons[1] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR));
icons[2] = new ImageIcon(new BufferedImage(width, ... |
dd0ac5b4-0b9f-4b43-8bcf-e410b07a99a0 | 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... |
62ef2db2-0db7-4ac0-abf7-e387cd207541 | 3 | public int getBytesAdded(ArrayList<ByteRange> ranges) {
int bytesAdded = 0;
for (ByteRange range : ranges) {
if (range.getByteStart() == 0 || range.getByteStart() == -1) {
bytesAdded += range.getByteEnd();
} /*else {
// TODO IMPORTANT: In modification bytes are not added, are modified!!
byte... |
51ebf8fe-1fa4-4dc4-aa50-2f2d448a006f | 5 | public DistanceInstance nextQuery() {
// need to save out the i-th field, if it's been prepared.
// poll sublearners in random order, to be fair
// indices [0,innerLearners.length-1] are the inner learners,
// index innerLearners.length is the comboLearner
ArrayList indices = new ArrayList(innerLearners.lengt... |
ff183fb0-4ee2-4dff-a3f8-dc1e3c0f57c4 | 0 | public String getAnnounceUrl() {
return this.announceUrl;
} |
b97c1dd1-95be-4e17-8766-828d9a024b26 | 3 | public static void main(String[] args) throws SQLException {
ShowEmployeesNamesandDepartmentOOP command = new ShowEmployeesNamesandDepartmentOOP();
Collection<DepartmentAdd> allEmployeesBasicInformation = command
.getAllEmployeesBasicInformation();
if (allEmployeesBasicInformation == null
|| allEmployeesB... |
00a70834-a84f-4d72-a844-fa507f650b6c | 3 | public Iterable<WeightedDirectedEdge> pred(int v)
{
List<WeightedDirectedEdge> pred = new LinkedList<>();
for (int i = 0; i < V(); i++)
{
for (WeightedDirectedEdge e : adj(i))
if (e.to() == v)
pred.add(e);
}
return pred;
} |
2eb384aa-f7c9-4d71-9a1e-81f9f6c79e7b | 0 | public Destination destination(final String dest) {
return new Destination() {
private String label = dest;
public String readLabel() {
return label;
}
};
} |
05d8deff-2b9e-46e5-9c18-22f98f6954a6 | 2 | @Override
public void epoch(){
super.epoch();
//Deep learning stopping criteria
//If no improvement, add another deep learning layer
if (DL_layers <= DL_maxlayers && DL_stop.epoch(this)){
DL_stop.reset();
resetModel();
deepLearn();
}
} |
addbc02d-fdb7-4d86-8c09-b781188d4e83 | 8 | @Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if(!super.okMessage(myHost,msg))
return false;
if(!(affected instanceof MOB))
return true;
final MOB mob=(MOB)affected;
if((msg.amITarget(mob))
&&(msg.targetMinor()==CMMsg.TYP_DAMAGE)
&&((msg.value())>0))
{
... |
4dd34bcc-ad11-49e9-8e52-ab4fd5f7209d | 7 | private Tile findTileFor(Map map, int row, int start, boolean startAtSea) {
Tile tile = null;
Tile seas = null;
int offset = (start == 0) ? 1 : -1;
for (int x = start; 0 <= x && x < map.getWidth(); x += offset) {
tile = map.getTile(x, row);
if (tile.isDirectlyHigh... |
50c2ba4d-7f78-4303-89cc-2a2e8e3ffb4b | 0 | public Circle(int center_x, int center_y, int radius){
this.center_x = center_x;
this.center_y = center_y;
this.radius = radius;
} |
71b895e7-6653-4482-a84a-9381e49f2b07 | 6 | int compareTo(BigNumber y) {
if (equals(y)) {
return 0;
}
if (digits.size() > y.digits.size()) {
return 1;
}
if (digits.size() < y.digits.size()) {
return -1;
}
if (digits.size() == y.digits.size()) {
for (int i = 0; i < digits.size(); i++) {
if (digits.get(i).compareTo(y.digits.get(i)) ==... |
d6e986a2-0ba2-41c0-a37b-2e0dd66d7c29 | 8 | private double distance(Instance first, Instance second) {
double distance = 0;
int firstI, secondI;
for (int p1 = 0, p2 = 0;
p1 < first.numValues() || p2 < second.numValues();) {
if (p1 >= first.numValues()) {
firstI = m_trainInstances.numAttributes();
} else {
fir... |
bd8b2e8d-31bb-4ef9-a77f-aea216c5d816 | 2 | Channel getChannelByName(String cname) {
boolean returned = false;
for (Channel c: channels) {
if (c.getName().equals(cname)) {
returned = true;
return c;
}
}
Channel newc = new Channel(cname);
channels.add(newc);
... |
c6ed53af-0fc3-4923-a9fd-46d833feebe2 | 2 | public static void main(String[] args) {
if (args.length != 2) {
System.out.println("Invalid parameters number");
System.out.println("Usage:");
System.out.println("ru.compscicenter.db.tolmachev.nosqldb.client.commandline.CommandLine connection_host connection_port");
... |
0069fd4f-0538-415e-9ef1-507aea5144f8 | 0 | public void setObtained(boolean value) {
this.obtained = value;
} |
3071075b-74bf-4b83-98a1-928631129f79 | 6 | public static double comparerLong(char[] c) {
double[] nbApparitions=new double[26];
double s=0;
for(int i=0;i<c.length;i++) {
if(c[i]>=65 && c[i]<=90) {
nbApparitions[c[i]-65]++;
s++;
}
if(c[i]>=97 && c[i]<=122) {
nbApparitions[c[i]-97]++;
s++;
}
}
double res=0;
for(int i=0;i<26... |
a7188cf4-6981-494b-89dc-5fc872d8f610 | 6 | public void onWorldUpdate(int x, int y, World lvl)
{
if(this.idle)
{
if(rand.nextInt(5) == 1 && Block.getBlock(lvl.getBlockAt(x, y)) == this)
{
Particle p = new Particle();
p.addKillerBlock(Block.getBlock("water_All"));
p.setColor(rand.nextBoolean() ? Col... |
4dbda41e-4589-4723-a305-75391fb37654 | 6 | @Override
public void onPluginMessageReceived( String channel, Player player, byte[] message ) {
DataInputStream in = new DataInputStream( new ByteArrayInputStream( message ) );
String task = null;
try {
task = in.readUTF();
if ( task.equals( "TeleportToPlayer" ) ) {
... |
4e79f79b-622b-40a3-80f5-c500cd4214ea | 4 | public void enterParkedState(int parkingTime, int intendedDuration) throws VehicleException {
if (isParked || isQueued){
throw new VehicleException ("Vehicle is already in a parked or queued state");
}
if (parkingTime <= 0){
throw new VehicleException ("Parking Time <= 0");
}
if (intendedDuration < Cons... |
50604c54-e52b-49ac-b747-3164c0ca4070 | 9 | protected static String[] readPinNames(HDLTokenizer input)
throws HDLException {
Vector list = new Vector();
boolean exit = false;
input.advance();
while (!exit) {
// check ';' symbol
if (input.getTokenType() == HDLTokenizer.TYPE_SYMBOL && input.getSymbol() ... |
93a6698e-efbe-4e5d-96eb-ad1a037acc70 | 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... |
cd5ad7f0-107d-4e12-9229-8c9f31b606b2 | 9 | public static Image getSC2MImageCache(String SC2M_WEB_PATH, String loc){
Image image = null;
String defaultAva = "images/styles/DarkCore/misc/unknown.gif";
if(loc == null){loc = defaultAva;}
else if(loc.equals("null")){loc = defaultAva;}
else if(loc.equals("")){loc = defaultAva;}
//loc = "cache/"+loc;
//F... |
fd71b025-ad71-473a-8b15-3f4deba6aaf4 | 9 | void QuickSort(String a[], int lo0, int hi0) {
int lo = lo0;
int hi = hi0;
String mid;
if (hi0 > lo0) {
/*
* Arbitrarily establishing partition element as the midpoint of the
* array.
*/
mid = a[(lo0 + hi0) / 2];
// loop through the array until indices cross
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.