method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
ccfaaae1-9b9a-4c95-88bc-c24afb5a95ef | 3 | @Override
public void execute( CommandSender sender, String[] args ) {
if ( !( sender.hasPermission( "bungeesuite.motd" ) || sender.hasPermission( "bungeesuite.admin" ) ) ) {
ProxiedPlayer p = ( ProxiedPlayer ) sender;
p.chat( "/motd" );
} else {
for ( String spli... |
4bbc45b2-d99f-47c4-acb9-130842a835b6 | 8 | static private int jjMoveStringLiteralDfa6_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return jjStartNfa_0(4, old0);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(5, active0);
return 6;
}
switch(curChar)
{
cas... |
7c5c6efe-ebaa-4b93-9e17-9a04e35367f5 | 0 | @Override
public String getTitle() {
return "Java Blocks Game";
} |
7683433e-1090-4e6f-8820-369ab2a4628e | 9 | public static double lbeta(double a, double b) {
double corr, p, q;
p = q = a;
if (b < p) p = b;/* := min(a,b) */
if (b > q) q = b;/* := max(a,b) */
/*!* #ifdef IEEE_754 /*4!*/
if (Double.isNaN(a) || Double.isNaN(b)) return a + b;
/*!* #endif /*4!*/
/*... |
66606b4b-0303-4dfa-8bdb-c0793a4a7fee | 0 | public void setName(String name) {
this.name = name;
} |
4b60ecb3-9ef4-4e7b-a06c-b87750d16cf7 | 1 | public void printArray() {
System.out.println("WORDS");
for (String i : parsedArray)
System.out.println(i);
// Prints the number of unique words
System.out.println("\nNUMBER OF WORDS: " + parsedArray.size());
} |
32d3d0fa-7882-4a2f-b5a3-428fabe3f7ba | 0 | public void removeAnt() {
// Set ant to null
this.ant = null;
} |
bc0ccc81-8b00-4bee-9334-2c4e2f281542 | 0 | public void initBlocks(BlockManager blockManager){
blockManager.register((short)20, Glass.class);
} |
4f131081-1b08-4a88-98bd-dd15d32229b8 | 5 | public void tarjanSCC(int u) {
dfs_num[u] = dfs_low[u] = dfsNumberCounter++;
s.push(u);
visited[u] = true;
for (int i = 0; i < ady[u].size(); i++) {
int v = ady[u].get(i);
if (dfs_num[v] == -1)
tarjanSCC(v);
if (visited[v])
dfs_low[u] = Math.min(dfs_low[u], dfs_low[v]);
}
if (dfs... |
9ef7d60a-8374-44bc-b91c-279c6fc4ac1c | 3 | @Override
public List<ConnectionLabel> getLabels() {
List<ConnectionLabel> result = new ArrayList<>();
for( Item item : getDiagram().getItems() ) {
if( item instanceof ConnectionLabel ) {
ConnectionLabel label = (ConnectionLabel) item;
if( label.getConnection() == this ) {
result.add( label );
... |
b1509d5d-247b-455b-9a6c-1bd18c372d32 | 4 | public static PearsonDictionaryEntry fromJSON(JSONObject obj) throws JSONException {
PearsonDictionaryEntry entry = new PearsonDictionaryEntry();
entry.headword = obj.optString(KEY_PEARSON_HEAD_WORD);
entry.id = obj.optString(KEY_PEARSON_ID);
entry.posTag = obj.optString(KEY_PEARSON_POS);
entry.url = obj.optS... |
f1ae443b-71cb-42a7-a178-482a7c4861ca | 8 | private Dimension computeSize(Container target, boolean minimum) {
synchronized (target.getTreeLock()) {
int hgap = getHgap();
int vgap = getVgap();
int w = target.getWidth();
if (w == 0) {
w = Integer.MAX_VALUE;
... |
bed5af52-5920-47e0-bfe9-e3b2c9379298 | 9 | public void keyPressed(KeyEvent e) {
Screen3D screen = (Screen3D) e.getSource();
switch (e.getKeyCode()) {
case KeyEvent.VK_UP:
screen.isUpPressed = true;
screen.isRepaintNeeded = true;
break;
case KeyEvent.VK_DOWN:
... |
9d97fd30-f3cf-452e-aa20-27d5c096aac0 | 8 | public void generateAction(String serviceName, HashMap<String, String> actionFields,
String responseField, String handlerClass, String simpleName, String packageName,
boolean cacheable, String postfix) {
String actionName = serviceName + simpleName + "Action" + postfix;
String responseName = servic... |
ca4995df-4e09-4cf6-a047-7b64191e8543 | 3 | public static void main(String[] args) {
List<Pet> pets = Pets.arrayList(12);
Iterator<Pet> it = pets.iterator();
while (it.hasNext()) {
Pet p = it.next();
System.out.print(p.id() + ":" + p + " ");
}
System.out.println();
// A simpler approach, when possible:
for (Pet p : pets)
System.out.p... |
f5c430ba-5a09-4852-bb5a-69dfdf737d20 | 1 | public static Hand PickBestHand(ArrayList<Hand> Hands) throws exHand {
Hand x = Hands.get(0);
Hand y = Hands.get(1);
if (x.HandStrength > y.HandStrength)
return x;
else
throw new exHand();
} |
5863743b-ed4b-4d65-a8e0-68be38370551 | 3 | public String getClassName(int i) throws ClassFormatException {
if (i == 0)
return null;
if (tags[i] != CLASS)
throw new ClassFormatException("Tag mismatch");
String clName = getUTF8(indices1[i]);
try {
TypeSignature.checkTypeSig("L" + clName + ";");
} catch (IllegalArgumentException ex) {
throw n... |
bfd78efa-92eb-4b37-a030-4bdb76780a7f | 2 | public void tick()
{
if(yVelocity < 0)
{
if(level.blockFree(this,false,1))
{
y += yVelocity;
}
else
{
yVelocity = 0;
}
}
else
{
y += yVelocity;
}
... |
3ea72a17-d937-4cba-9214-f2d2eeb9fe97 | 2 | static void restart()
{
for(int i=0;i<pad.length;i++)
{
for(int l=0;l<pad[i].length;l++)
{
pad[i][l].dye(defColor);
place[l]=place.length-2;
}
}
player=0;
moves=0;
console.setText("");
} |
c9dd8564-5fe8-4a48-b844-89b792227184 | 9 | private static String getCause(int statusCode) {
String cause = null;
switch (statusCode) {
case NOT_MODIFIED:
break;
case BAD_REQUEST:
cause = "The request was invalid. An accompanying error message will explain why. This is the status code will be returned during rate limiting.";
break;
case NOT_A... |
ceb45c6b-60a6-4a7e-86e4-a1196a53fe92 | 2 | @RequestMapping("alterarQuantidadeItemListaDeDesejos")
public ModelAndView alterarQuantidadeItemListaDeDesejos(
UsuarioProduto usuarioProduto) {
ModelAndView mav = new ModelAndView("loginAdmin");
if (loginController.isLogado() || adminController.isLogado()) {
usuarioProduto.setUsuario(loginController.usua... |
86b6c4d0-3059-4bd8-98a2-01406fd91793 | 8 | private Node traceSingleEdge( Node node, Path str, TraceReturnValue trv,
SkipType type )
{
Node contNode;
int length,strLen;
// set default return values
trv.searchDone = true;
trv.edgePos = 0;
// search for the first character of the string in the outgoing
// edge of node
... |
ac669d07-533c-41f9-a714-b40f3cd67cba | 6 | private T transformSQLtoObject(ResultSet resultSet) {
T t;
try {
t = (T) targetClass.newInstance();
} catch (InstantiationException | IllegalAccessException e) {
throw new RuntimeException(e);
}
try {
if (resultSet.next()) {
Li... |
d9cffecf-4c8a-49ce-a050-9aaf8ae22b24 | 9 | @Override
public void actionPerformed(ActionEvent e) {
if(e.getSource() == widokRozmiesc.mnI_UstawieniaLokalne)
{
widokRozmiesc.widokGlowny.widokUstawien.widokUstawienZdarzenia.setOknoMacierzyste("OknoRozmiesc");
pokazOknoUstawienLokalnych();
}
if(e.getSource() == widokRozmiesc.mnI_Wyjscie)
{
wyj... |
b56c1f28-611f-4c51-9f18-4b3221001e0f | 9 | public static Vector replaceSourcesWithId(Vector srcs,
String serverName) {
Vector replacedSrcs = new Vector();
Object obj;
for (int i=0; i<srcs.size(); i++) {
obj = srcs.elementAt(i);
if (obj instanceof RMIServerProxy) {
RMIServerProxy rmisp = (RMIServerProxy)obj;
if (rmisp.getServerName... |
075b49b0-8c9c-4c71-8b02-5d2978b19365 | 1 | public int getPages(int intRegsPerPag, ArrayList<FilterBean> alFilter, HashMap<String, String> hmOrder) throws Exception {
int pages;
try {
oMysql.conexion(enumTipoConexion);
pages = oMysql.getPages("hilo", intRegsPerPag, alFilter, hmOrder);
oMysql.desconexion();
... |
e5a009b0-2710-489a-a4f6-f8f30005ea67 | 3 | public static void renderChunks(String worldName, List<CoordXZ> coords)
{
if (!renderEnabled()) return;
World world = Bukkit.getWorld(worldName);
int y = (world != null) ? world.getMaxHeight() : 255;
for (CoordXZ coord : coords)
{
renderChunk(worldName, coord, y);
}
} |
9a5f1ebe-d9af-4df7-ba35-75f75a61aa6c | 9 | protected void writeEncoded(Writer writer,
String str)
throws IOException {
for (int i = 0; i < str.length(); i += 1) {
char ch = str.charAt(i);
switch (ch) {
case '<':
writer.write('&'); writer.write('l'); writer.write('t');
... |
179fbb4e-0087-4834-bbdb-0a81110f4f64 | 9 | public int selectFromList(String prompt, List<String> options, int defaultOption) {
if (prompt != null) {
output.println(prompt);
}
Iterator<String> iterator = options.iterator();
int i = 1;
while (iterator.hasNext()) {
String option = iterator.next();
output.println(i + " - " + option);
i++;
}
... |
c2b91749-3288-4865-9750-d83f41d05ddf | 6 | public boolean setNodeParams(String region, String agent, String plugin, Map<String,String> paramMap)
{
boolean isUpdated = false;
int count = 0;
try
{
while((!isUpdated) && (count != retryCount))
{
if(count > 0)
{
... |
e04dd4d9-5db3-474e-993f-1da81110749e | 2 | private void sharePot(ArrayList<Integer> winners) throws Exception {
if (state.getStage() == STAGE.SHOWDOWN) {
int splitPot = state.getPot() / winners.size();
for (Integer winner : winners) {
playerList.get(winner).receiveMoney(splitPot);
ArrayList<Card> winnerCards = new ArrayList<Card>(); // only for ... |
43a0f5cf-fb8e-4186-8625-0fb25664147c | 7 | public String toPString()
{
String str = new String();
for(int n=0; n < a.size() ; n++)
{
final BigInteger num = a.elementAt(n) ;
if ( num.compareTo(BigInteger.ZERO) != 0 )
{
... |
063693cb-5594-4c98-bf46-307aeb8827f0 | 3 | public boolean isGameOver() {
for (int i = 0; i < getBoardWidth(); i++) {
for (int j = 0; j < getBoardHeight(); j++) {
if (board[i][j].willEvolve()) {
return false;
}
}
}
return true;
} |
06fb9343-0d94-4f11-a8d9-4504fcecfe5a | 9 | private void performOperation(Operation op) {
Set<String> times = timeToPitch.keySet();
double startRef = op.timeReference?Double.valueOf(op.startReference):Double.valueOf(op.startReference)/samplingRate;
double endRef = op.timeReference?Double.valueOf(op.endReference):Double.valueOf(op.endReference)/samplingRat... |
1759da10-a7b1-4065-a9f7-4270b8988a58 | 1 | public static void main(String[] args){
int sum=0;
for(int i=1901;i<2001;i++){
sum+=sundays(i);
}
System.out.println(sum);
} |
7c8e04a9-8d5a-486e-b5a2-6c909ee52bab | 8 | public static void main(String[] args) {
//setting the verbosity
if (args.length == 1 && args[0].equals("verbose")) {
VERBOSE = true;
}
//settings the look n' feel
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalled... |
7d20de2a-d292-472c-b17c-2013d51bdf54 | 9 | public int maxPoints(Point[] points) {
int len=points.length;
HashMap<Float,Integer> map=new HashMap<Float,Integer>();
int max=0;
for(int i=0;i<len;i++){
map.clear();
map.put(Float.MIN_VALUE, 0);
int duplicate=1;
for(int j=0;j<len;j++){
if(j==i){
cont... |
cfe216eb-f73f-48c1-ad62-e8b3ce491c8b | 7 | public void checkVerticalCollision() {
if (tileBoundary.intersects(hero.getBoundaries().get(
Player.ENTIRE_PLAYER))) {
switch (type) {
case GROUND:
hero.setJumped(false);
if (hero.getSpeedX() == 0 && !hero.isDucked()) {
hero.setSpriteAction(ActionState.STANDING);
} else if (hero.getSpeedX()... |
4a0edd5c-ca3d-484c-9f58-0d7bfa3f8e76 | 3 | public void addPath(Byte A, Byte B) {
if(!networkTreeMap.containsKey(A))
networkTreeMap.put(A, new TreeSet<Byte>());
if(!networkTreeMap.containsKey(B))
networkTreeMap.put(B, new TreeSet<Byte>());
networkTreeMap.get((byte)A).add((byte)B);
networkTreeMap.get((byte)B).add((byte)A);
if(autoUpdate) {
... |
cfa9e16b-6426-4d56-b491-6f3c8b6af1ba | 2 | public String getCode(){
String str = "";
if(statement.toString()!=null)
str = statement.getCode();
if(statements.toString()!=null){
str += statements.getCode();
}
return str;
} |
ba56720e-af30-484e-902d-d5b68651c498 | 8 | private static String escapeJSON(String text) {
StringBuilder builder = new StringBuilder();
builder.append('"');
for (int index = 0; index < text.length(); index++) {
char chr = text.charAt(index);
switch (chr) {
case '"':
case '\\':
builder.append('\\');
builder.append(chr);
break;
... |
7e891074-5c44-4c2a-a382-ea7dc3866d0e | 6 | public void changeLevelOrder() {
if (gamePosition <= 0) return;
try {
Scanner scan = new Scanner(new File("levels/allLevels.txt"));
ArrayList<String> temp = new ArrayList<String>();
while (scan.hasNext()) {
temp.add(scan.nextLine());
}
if (!temp.contains(filename + ".txt")) {
if (gamePosi... |
30aee6ad-8177-43d5-94bc-33a71f6c4297 | 3 | public boolean isOnBoard(Point p)
{
return p.x<8&&p.x>=0&&p.y<8&&p.y>=0;
} |
0bba22d3-49da-4dd5-8dca-39ce11238211 | 3 | public static byte[] hex2bytes( String hex )
throws NumberFormatException {
if( hex == null )
return null;
if( hex.length()%2 != 0 )
throw new NumberFormatException( "Cannot convert hex strings with odd numbers of characters to byte arrays." );
byte[] arr = new byte[ hex.length() / 2 ];
int hi, lo;
... |
c85760a6-9eaa-4b9a-a227-e79fdc76573b | 9 | public static boolean isAppropriate(String target, String path) {
Pattern targetPattern = Pattern.compile(DELIMITER_PATTERN);
Matcher targetMatcher = targetPattern.matcher(target);
Pattern pathPattern = Pattern.compile(DELIMITER_PATTERN);
Matcher pathMatcher = pathPattern.matcher(path);... |
d861fda7-3609-4a64-a3cc-1c416b0d24f5 | 4 | public HashMap<String, Integer> findMaxRepeats(Node node, int length,
int repeats, String acc)
{
HashMap<String, Integer> returnArr = new HashMap<String, Integer>();
acc += input.substring(node.stringStart, node.stringEnd);
if (node.length() >= length && node.count >= repeats
&& isLeftDivers... |
e599a881-33fa-4bde-9eb2-eed300d26110 | 6 | public void addUpdatePosilek(int ID)
{
boolean flaga=true;
for (int i=0 ; i<PosilkiUpdate[0] ; i++)
{
if(ID==PosilkiUpdate[i+2])
{
flaga=false;
break;
}
}
if(flaga)
{
// Count ArraySize
if (PosilkiUpdate[0]+2 >=PosilkiUpdate[1])
{
int[] tempArray = new int[PosilkiUpdate[1]];
... |
6ac61b1a-a127-493a-8c00-c952e3852940 | 8 | public void paintComponent(Graphics pGraphics) {
super.paintComponent(pGraphics);
int width = getSize().width;
int lpwidth = launchPanel.getPreferredSize().width;
//Left Location
if(locGrid == TOP_LEFT || locGrid == BOTTOM_LEFT) {
if(closed_flag) {
//Side Image
pGraphics.d... |
9f9a2b45-90d3-496b-badb-e0dff98aa472 | 0 | public AntTest() {
} |
c89c8009-3b22-4bfc-ad49-a76896282dd5 | 7 | public void execute() {
if (pins[3].value && !lastClock) {
if (pins[0].value) //if T = 1
{
pins[1].value = !last_val;
pins[2].value = !pins[1].value;
last_val = !last_val;
}
//else no change
}
if (hasSet()... |
269907ee-fbf8-4a91-9f2a-fefece4eedc4 | 3 | public boolean checkDifference()
{
// überprüfe welche der beiden PDFs an welcher stelle unterschiedlich sind
boolean isPDF1Diff = pdfStructure1.checkDifference();
boolean isPDF2Diff = pdfStructure2.checkDifference();
if(difference != DifferenceType.VISUAL)
difference = DifferenceType.VISUAL;
// üb... |
aca414d1-09ef-44b4-8be4-b35168befb6d | 5 | @Test(expected = UnmatchingParenthesisException.class)
public void testInfixToPostfix12() throws DAIllegalArgumentException,
DAIndexOutOfBoundsException, ShouldNotBeHereException,
BadNextValueException, UnmatchingParenthesisException {
try {
infix.addLast(")");
QueueInterface<String> postFix = calc.infix... |
570bd049-b245-4d9b-8ae0-689413f7edd2 | 7 | public void UpdateArrayOfInUseIDs()
{
//Redefining the 'In Use IDs' array
arrayInUseIDs = new int[game.AL_GameObjects.size() + game.AL_TextObjects.size()];
//Filling the 'In Use IDs' array
for (int numCycle = 0; numCycle < arrayInUseIDs.length; numCycle++)
{
if (game.AL_GameObjects.size() > 0 && nu... |
316e6065-4c88-469e-9e6f-a0d6b6814ae4 | 0 | public String getValidTime() {
return ValidTime;
} |
3a59887f-49cd-43fe-b2e1-0651c765f044 | 1 | public void jsFunction_toConsole(String str) {
deprecated();
if(UI.instance.cons != null) UI.instance.cons.out.println(str);
} |
24ce2d86-c087-4328-bd4d-7b49b2e6aeeb | 4 | @Override
public Value evaluate(Value... arguments) throws Exception {
// Check the number of argument
if (arguments.length == 1) {
// get Value
Value value = arguments[0];
// If numerical
if (value.getType().isNumeric()) {
return new Value(new Double(Math.sqrt(value.getDouble())));
}
if (va... |
7de6e7ca-8996-4080-9807-b70a055ea6fb | 1 | public void atualizar(InstituicaoSubmissao instituicaosubmissao) throws Exception
{
String sql = "UPDATE instituicaosubmissao SET nome = ? WHERE id = ?";
try
{
PreparedStatement stmt = ConnectionFactory.getConnection().prepareStatement(sql);
stmt.setString(1, instituicaosubmissao.getNome());
stmt.setLo... |
6cdeb5eb-ca26-4e29-8b5c-f7c03e0011c2 | 2 | public static void main(String args[]) {
InputStream in = System.in;
try{
byte[] cs=new byte[1204];
System.out.println("ʹbyte");
while(in.read(cs)!=-1){//read()ҪֽΪ
String str=new String(cs).trim();
System.out.println(str);
}
in.close();
OutputStream out=System.out;
cs="ʹoutputStream... |
05240fe2-ad60-43ce-b07e-6368e85f335b | 3 | public void resendChunk(Player player)
{
Vector[] cache = this.locCache.get(player.getName());
World w = Bukkit.getWorld(p.getWorld());
if(cache != null)
{
for(Vector v : cache)
{
if(v == null) continue;
Location l = v.toLocatio... |
ab5a241e-d07d-4ed1-ad46-f1e39e1e351e | 8 | private boolean r_factive() {
int among_var;
// (, line 132
// [, line 133
ket = cursor;
// substring, line 133
among_var = find_among_b(a_7, 2);
if (among_var == 0) {
return false;
}
// ], line 133
bra = cursor;
// call R1, line 133
if (!r_R1()) {
return false;
}
switch (among_var) {
... |
5f765a3e-2f2e-460c-9c03-40ddf9cae3dc | 6 | private static final Image scaleLum(final double scale, final float[] rgb,
final double whiteLum, int width, int height)
{
// pusty obraz wynikowy o odpowiednim rozmiarze
BufferedImage retImg = new BufferedImage(width, height, BufferedImage.TYPE_3BYTE_BGR);
// kolor bialy zeskal... |
7c1b4644-78c6-45e6-8239-0cc01ebef86a | 2 | public void checkUpdater() {
String s = getConfig().getString("update");
if (s.equalsIgnoreCase("Check")) {
new updater(this, 56079, this.getFile(), updater.UpdateType.NO_DOWNLOAD, false);
getLogger().info("[" + getDescription().getName() + "] " + "Updater: check-update enabled!"... |
0757ac19-98f9-4b20-88ee-6a3bd21f1ab8 | 4 | public void fusionWithLinearLightFullAlpha(CPLayer fusion, CPRect rc) {
CPRect rect = new CPRect(0, 0, width, height);
rect.clip(rc);
for (int j = rect.top; j < rect.bottom; j++) {
int off = rect.left + j * width;
for (int i = rect.left; i < rect.right; i++, off++) {
int color1 = data[off];
int alp... |
526d91d7-7fa7-4344-9871-29b0fb93245c | 6 | final void method3923(boolean bool, int i) {
if (i != 1) {
if ((i ^ 0xffffffff) != -1) {
if ((i ^ 0xffffffff) == -3)
method3874(Class328_Sub3.aClass229_6519, 117,
OndemandWorker.aClass229_3196);
else if (i == 3)
method3874(Class167.aClass229_2207, 111,
Class348_Sub23_Sub2.aClas... |
a111cd09-542f-4fa6-a2d0-8014faeac111 | 0 | public JButton getBtnProchaineGeneration() {
return btnProchaineGeneration;
} |
ad56f927-3d5e-44cf-9574-9c4af75e483a | 1 | void removeTailLightTrail() {
if (lightTrail.size() > MAX_LIGHTTRAIL_LENGTH)
removeTail();
} |
deca9841-6ee1-48fc-b8df-80110acb57ae | 6 | public static void saveTiles(final ScrabbleBoard board, File file) {
try {
if (!file.exists()) {
file = new File(file.getParentFile(), (file.getName() + ".game"));
file.createNewFile();
}
try (final FileWriter writer = new FileWriter(file)) {
... |
b56fb4dc-674b-40a1-89f4-99a6af5fde16 | 3 | public static double pow(double x, int n) {
if (0 == n) return 1;
else {
double tmp = pow(x, n/2);
if (0 == n % 2) {
return tmp * tmp;
} else {
if (n > 0) {
return tmp * tmp * x;
} else {
return tmp * tmp / x;
}
... |
6126f38b-4597-42ba-998a-72022ea8da86 | 8 | public String addBinary(String a, String b) {
if( a == null)
return b;
if(b == null)
return a;
int lengtha = a.length();
int lengthb = b.length();
int length = lengtha > lengthb ? lengtha :lengthb;
length++;
char[] arrayA = new char[length]... |
0957b80f-3cb1-4b85-bf06-4dca8aa130cd | 6 | public static Cons collectDefinedModulesFromSystemFile(SystemDefinition system) {
{ Cons startupforms = SystemDefinition.collectStartupFormsFromSystemFile(system);
Module module = null;
Cons modules = Stella.NIL;
{ Cons form = null;
Cons iter000 = startupforms;
for (;!(iter000 ==... |
8c9db9c0-5e3f-492b-b04d-4b77c7d8d5b3 | 0 | public String getStartUrl() {
return startUrl;
} |
57d9f571-4015-4e68-95a3-704c3b7b693a | 4 | public BufferedImage combine8BY8Images(BufferedImage[] images, int newXSize, int newYSize){
int size = images.length;
BufferedImage combined = new BufferedImage(newXSize, newYSize, BufferedImage.TYPE_INT_ARGB);
Graphics g = combined.getGraphics();
int x = 0;
int y = 0;
for(int i = 0; i < size;i++){
g.d... |
96ac9040-643f-48bf-951e-7cd8181a0293 | 2 | public static void main(String[] args) {
System.out.println("People: " + petPeople.keySet());
System.out.println("Pets: " + petPeople.values());
for (Person person : petPeople.keySet()) {
System.out.println(person + " has:");
for (Pet pet : petPeople.get(person))
System.out.println(" " + pet);
}
} |
6de61abd-2f03-46eb-a442-cf117423c66b | 3 | private void updateStatus() {
switch (getSkinnable().getStatus()) {
case DESELECTED:
selected.setOpacity(0);
deselected.setOpacity(1);
icon.getStyleClass().setAll("icon");
icon.setOpacity(1);
break;
case SELE... |
9ca701de-2df7-47aa-9b61-5b9b925df5cb | 8 | public String toString() {
String card = "";
switch (this.rank) {
case ACE:
card += "A";
break;
case JACK:
card += "J";
break;
case QUEEN:
card += "Q";
break;
case KING:
card += "K";
break;
default:
card += this.rank;
break;
}
switch (this.suit) {
case HEARTS:
card +... |
0fcf3f9b-ab56-4e13-9be5-daf82a719ce1 | 4 | public Main() {
// Set up topologie View
//v = new View();
//v.setVisible(true);
//v.initNodes(getInitPoints(5));
// Configure Filters
lf = new LinkFilter();
//lf.registerLinkFilter(2, 3, new LinkPlot("Raw"));
knnc = new KNNControl(lf);
knnc.set... |
fdc002b2-ac63-4108-8370-5c96e29d217c | 4 | public boolean isCompressedGenotypes() {
return !hasGenotypes() && (getNumberOfSamples() > 0) && (hasInfo(VCF_INFO_HOMS) || hasInfo(VCF_INFO_HETS) || hasInfo(VCF_INFO_NAS));
} |
ec852140-7080-4d78-b873-51fa2534cb23 | 6 | public Element setNamespace(Namespace namespace) {
if (namespace == null) {
namespace = Namespace.NO_NAMESPACE;
}
if (additionalNamespaces != null) {
final String reason = Verifier.checkNamespaceCollision(namespace,
getAdditionalNamespaces());
if (reason != null) {
throw new IllegalAddExceptio... |
486541af-652a-4922-a720-4b4e52d431b6 | 9 | private static void addRingLooks(MaplePacketLittleEndianWriter mplew, MapleCharacter chr) {
mplew.write(chr.getEquippedRing(0) != 0 ? 1 : 0);
for (MapleRing ring : chr.getCrushRings()) {
if (ring.getRingId() == chr.getEquippedRing(0)) {
mplew.writeInt(ring.getRingId());
... |
66e62832-dd92-40cf-af8a-1e9d7bccf6fa | 7 | public static int [] combinationsAtIndex(int m, int n, double i){
if(!(m >= n)&&!(n >= 1))
System.out.println("m >= n >= 1 required");
double c=combinations(m,n);
if(!(0 <= i)&&!(i < c))
System.out.println("0 <= i < comb(m,n) required");
int [] result = new int [0... |
08ac51bc-aff0-4968-a896-10cd6ad2d196 | 6 | public String[] obtenerRespuestasCorrectas(int tamaño){
String csvFile = "dataset/iris_prueba_resultados.csv";
BufferedReader br = null;
String line = "";
String cvsSplitBy = ",";
String respuestas [] = new String [tamaño];
int contador = 0;
try {
br = new BufferedReader(new FileReader(csvFile));
... |
709dc6e9-2b27-4cdd-bee4-a78467a7dd0a | 2 | @Override
public Object invoke(Context context,List<Object> arguments) {
if (!arguments.isEmpty()){
Object val = arguments.get(0);
if (val instanceof Number){
return Math.sin(((Number)val).doubleValue()* Math.PI / 180);
}
}
return 0;
} |
d179086f-23b6-41a5-a6b3-879db4d0dab7 | 0 | public Point2D getRelativePos() {return pos;} |
16ac5b42-905b-451a-9c85-21534dec9799 | 5 | private void updateTabla(){
//** pido los datos a la tabla
Object[][] vcta = this.getDatos();
//** se colocan los datos en la tabla
DefaultTableModel datos = new DefaultTableModel();
tabla.setModel(datos); ... |
c383b1a8-460c-4ab5-b6b2-3b7289efe71b | 8 | public LinkedList<AStarNode> getAdjacentTo(AStarNode sourceNode) {
LinkedList<AStarNode> adjacent = new LinkedList<AStarNode>();
AStarNodeVector3D current = (AStarNodeVector3D)sourceNode;
for (int x = (int)current.getLocation().getX() - 1; x <= current.getLocation().getX() + 1; x++) {
if (x >= 0 && x < map.get... |
0affcb17-aece-42d2-abc0-e0a7314cf21c | 5 | public static void sendMessage(Player from, Player to, byte[] message) {
if (to.getPrivateChat() == 2 || (to.getPrivateChat() == 1 && !to.getFriends().containsKey(from)) || to == null) {
PacketSender.sendMessage(from, "That player is currently offline.");
} else {
PacketSender.sendPrivateMessage(to, from.getU... |
1b4c9b2f-ca91-4b51-aec5-eae21fe9e978 | 4 | public static void lagFil(String filNavn,String innhold)
{
Formatter output = null;
try
{
//exception handling left as an exercise for the reader
FileWriter fileWriter = new FileWriter(filNavn, true);
output = new Formatter (fileWriter);//Åpner fila for skriving, hvis den ikke finnes, opprettes... |
41bb61fb-42e8-4355-9a15-30f88cd33b44 | 7 | protected void setHumanProp() {
// キャッシュ読み取り
try {
humanProp = (HumanProp) cache.get("humanProp");
if (humanProp == null)
throw new InvalidValueException(null);
} catch (InvalidValueException ive) {
if (humanProp == null) {
// データストア読み取り
startDatastore();
Entity humanPropEntity = getEntit... |
9fce8a95-ffb3-4311-a271-9046cc434fc3 | 9 | protected void addNewAciton() {
// Action type
Object typeValueItem = typeNAJcbx.getSelectedItem();
String typeValue = null;
if (typeValueItem != null ) {
typeValue = typeValueItem.toString();
}
// Claims", "Counter Claims", "Evidene", "Counter Evidence",
// "Bi-polar Questions", "Response to Bi-pol... |
ee57c947-3259-41cc-880a-47cedd4a828d | 0 | public Game generate(){
return new Game(GameMaster.fromGenerator(new TargetGenerator()), new Board());
} |
c927e4a0-da83-4a23-a881-56784b785660 | 5 | public static ArrayList<String> createTagPool(Map imagesTags) {
if (PRINT == 1)
System.out.println("Creating tagpool...\n");
ArrayList<String> tagpool = new ArrayList<String>();
/* Iterate through the map */
Iterator itMap = imagesTags.entrySet().iterator();
while... |
059aba7f-db3c-4369-855b-57b9e6926dad | 4 | @Override
public void driveCommand(short velocity, short radius)
throws RoombaIFException {
checkIsOpened("driveCommand");
if (velocity > 500) {
velocity = 500;
} else if (velocity < -500) {
velocity = -500;
}
if ((radius > 2000) & (radius ... |
907fdf8f-1863-4fc5-b531-bffa2b9043fd | 8 | @Override
public int compareTo(Todo other) {
boolean thisCompleted = isCompleted();
boolean thisMsdOnly = isMsd();
boolean thisDueDate = !thisMsdOnly && !thisCompleted;
boolean otherCompleted = other.isCompleted();
boolean otherMsdOnly = other.isMsd();
boolean otherDu... |
e99e6897-6829-4c40-95ea-ae1ac022da2f | 1 | @Test
public void throwInvalidBudgetTypeExceptionWhenBudgetTypeIsInValidTestOne() throws Exception {
try {
budgetFactory.requestBudgetByType("INVALID");
fail("Budget Type is not valid.");
} catch (InvalidBudgetTypeException e) {
assertEquals("Invalid Budget Type.... |
f9be8d7c-a1c9-474a-b0eb-ab193f83df99 | 1 | public Digit[] read(String buffer) {
lines = buffer.split("\n");
validateInput(lines);
int numberOfDigits = lines[0].length()/3;
Digit[] result = new Digit[numberOfDigits];
for (int i = 0; i < numberOfDigits; i++) {
result[i] = parseDigit(digitIndex(i));
}
return result;
} |
18cd0086-c32d-4f10-ba68-9ddb755aac99 | 3 | private void registerReflectiveClass(CtClass clazz) {
CtField[] fs = clazz.getDeclaredFields();
for (int i = 0; i < fs.length; ++i) {
CtField f = fs[i];
int mod = f.getModifiers();
if ((mod & Modifier.PUBLIC) != 0 && (mod & Modifier.FINAL) == 0) {
Stri... |
0492be09-cf0c-40f1-a0b8-366894013f66 | 7 | protected void checkMaintenance() {
// TODO: In principle, this should be extensible to Vehicles as well.
if (! (basis instanceof Venue)) return ;
final World world = ((Venue) basis).world() ;
if (world == null) return ;
final boolean needs = (state != STATE_RAZED) && (
(state == STATE_SALVA... |
344ec107-a34e-4ac6-b9f4-c6d50aca0229 | 6 | private void ReadMenu(){
Do("Reading menu");
choiceIndex = (int)(Math.random()*4);
//Non-normative scenarios
//If out of cheapest item and cheap customer, then customer leaves
if(reordering){
reordering = false;
if(name.equals("Cheapskate")){
print("Cheapskate alert. Can't afford food. Leaving");
... |
93db3e41-b3b3-4a65-ab5d-680c20f11baf | 2 | public void insertAt(int index, int value)
{
if(isFull())
throw new ArrayIndexOutOfBoundsException();
for(int i = size; i >= index; i--)
ListArray[i] = ListArray[i-1];
ListArray[index] = value;
size++;
} |
0b348cc0-a8cf-4955-afed-93d16590ad43 | 3 | private Value expression() throws Exception
{
Value previous, rval;
previous = rval = term();
while(scan.sym == Token.add || scan.sym == Token.sub) {
Token op = scan.sym;
scan.next();
previous = rval;
Value next = term();
Instruction ins;
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.