method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
822f877f-83a3-4df3-a9b9-833d42bf5540 | 5 | public void openInventory(){
HUD.dispInv = true;
HUD.dispSignText = false;
if(HUD.inMouse != HUD.empty){
//if bag is closed with object in hand then put it in first open one
for(int i = 1; i < HUD.inventory.length; i++){
if(HUD.inventory[i].getItemNum() == HUD.empty.getItemNum()){
HUD.inve... |
ec3348a4-0b3a-4d4b-8a14-e14f8a170df9 | 5 | private void drawConditionalComponents() {
for (int i=0; i<=partState&&i<getStateCount(); i++)
drawComs.get(i).execute();
if (smileState
&& getStatesRemaining() <= 5
&& !isManDead())
drawSmile();
drawClearAnimation();
} |
559cca15-d52a-418e-a97b-e3afc8420357 | 5 | public Writer write(Writer writer) throws JSONException {
try {
boolean b = false;
Iterator keys = keys();
writer.write('{');
while (keys.hasNext()) {
if (b) {
writer.write(',');
}
Object k = ke... |
3cf219aa-2a24-418e-b25c-c7598eaf4f5f | 5 | public EntityPlayer getClosestPlayer(double var1, double var3, double var5, double var7) {
double var9 = -1.0D;
EntityPlayer var11 = null;
for (int var12 = 0; var12 < this.playerEntities.size(); ++var12) {
EntityPlayer var13 = (EntityPlayer) this.playerEntities.get(var12);
... |
b62a19cd-7d58-45ef-8f76-f9bf76501fb7 | 4 | @Test
public void testFactorise() {
System.out.println("testFactorise");
Polynomial quadratic = PolynomialParser.parse("30x^5 – 166x^4 – 542x^3 + 2838x^2 + 1520x – 800");
ConcurrentSkipListSet<Double> expResult = new ConcurrentSkipListSet<>();
expResult.add(5.0);
expResult.ad... |
03b22153-8e31-4979-886e-b11a4d6352e3 | 1 | static void newLine() throws IOException {
if (allowed) {
debug.newLine();
debug.flush();
}
} |
406d3bf0-ac5c-437a-8cf4-33f08de69460 | 5 | @Override
public void execute(CommandSender sender, String worldName, List<String> args) {
this.sender = sender;
if (worldName == null) {
error("No world given.");
reply("Usage: /gworld setdifficulty <worldname> <peaceful|easy|normal|hard>");
} else if (!hasWorld(worldName)) {
reply("World not found:... |
1ee50333-e1dc-4cd5-9ed6-6d09b9b6b8fe | 0 | public PowerUp getPower(){
return power;
} |
643112b8-9ba0-4ce6-9331-481a8d2dd8e6 | 6 | public Map<String, List<TrigerState[]>> generateYFunctions(){
Map<String, List<TrigerState[]>> tmp_functions = new HashMap<>();
for (Map.Entry<String, List<boolean[]>> entry : y_functions.entrySet()) {
String string = entry.getKey();
List<boolean[]> list = entry.getValue... |
62b4304e-0051-4d7b-8c35-717439b4b8f7 | 3 | public static String readBinFile(String filePath)
{
byte[] fileBytes = {00};
try
{
fileBytes = Files.readAllBytes(Paths.get(filePath));
}
catch(IOException e)
{
System.err.println("Error reading Challenge:");
e.printStackTrace();
}
if(fileBytes[0] != 0x7C)
return "fail";
String loaded = "... |
153dc09e-eebc-4bd6-b38e-4ebe17bf2bad | 2 | public void act()
{
if (steps < sideLength && canMove())
{
move();
steps++;
}
else
{
turn();
turn();
steps = 0;
}
} |
0e83f689-b00f-49c1-b8a7-e871ae69a709 | 4 | public void muokkaaTiedostonTiettyjaRiveja(ArrayList<String[]> muokattavatRivit){
luoLukija();
ArrayList<String> tiedostonSisalto = new ArrayList();
boolean olikoMuokattujenListalla = false;
while (lukija.hasNextLine()){
String[] rivinTeksti = lukija.nextLine().split... |
49427226-df15-40a3-9260-1a2e53e08e71 | 9 | public static double learnSymmetricConcentration(int[] countHistogram,
int[] observationLengths,
int numDimensions,
double currentValue) {
double currentDigamma;
// The histogram arrays are presumably allocated before
// we knew what went in them. It is therefore likel... |
4e5a6382-83c0-45fa-9ce0-36194525686d | 5 | public EncryptedIsoPartition(FileBase iso, long offset) throws IOException
{
if (masterkey == null)
{
try
{
FileBase keyfile = new ExternalFile("key.bin", "r");
masterkey = keyfile.getContents();
keyfile.close();
}
... |
f10b31d5-e19b-42d7-a3b6-0d2ec0af41c0 | 7 | static final void method294(AbstractToolkit var_ha, int i) {
anInt328++;
if (Class5_Sub1_Sub1.aClass262_9931.getSize(i) != 0) {
if ((((Class348_Sub51) BitmapTable.aClass348_Sub51_3959)
.aClass239_Sub25_7271.method1829(-32350)
^ 0xffffffff)
== -1) {
for (Class348_Sub7 class348_sub7
= ((Class348_... |
03071889-aefe-4b61-9f21-be7e6d2db3f3 | 5 | private void renderVisibleObjects(Graphics g) {
for (VisibleObject object : visibleObjects) {
if (!(object instanceof AnimationBasedVisualEffect)) {
object.render(g);
}
}
for (VisibleObject object : visibleObjects) {
if (object instanceof AnimationBasedVisualEffect) {
object.render(g);
}
... |
904bf66f-3557-4f68-ba39-5bd5358791ba | 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... |
646f5080-63f8-40c0-a0f7-3894fc3a817d | 3 | void addFragSet( FragKind kind, int offset, BitSet bs, String frag )
{
this.versions.or(bs);
if ( this.offset == -1 )
this.offset = offset;
this.state = SectionState.state(kind);
for (int i = bs.nextSetBit(1); i>= 0;
i = bs.nextSetBit(i+1))
{
... |
f0cc75a3-ac2f-45cd-b296-816ec6043019 | 5 | @Test
public void testInfixToPostfix7() throws DAIllegalArgumentException,
DAIndexOutOfBoundsException, ShouldNotBeHereException,
BadNextValueException, UnmatchingParenthesisException {
try {
infix.addLast("+");
infix.addLast("(");
infix.addLast("(");
infix.addLast("1");
infix.addLast("+");
i... |
13a941fb-2255-4964-89ce-50f4e2d10248 | 4 | @Override
public List<Integer> sort(List<Integer> list) {
// checking input parameter for null
if (list == null) {
throw new IllegalArgumentException("ArrayList not specified!");
}
int i, j;
// moving forward through array.
for (i = 1; i < list.size(); ... |
2a71f554-27ac-47a6-9637-6177fa1df63b | 5 | public static <T, N extends ModifiableBinaryTreeNode<T, N>> N successor(N t)
{
if (t == null)
{
return null;
}
else if (t.getRight() != null)
{
N p = t.getRight();
while (p.getLeft() != null)
{
p = p.getLeft();
}
return p;
}
else
{
N p ... |
00530848-0381-40dc-849f-d8bc88cf2540 | 4 | public final void grow(int size) {
if (locals != null) {
size += count;
if (size > locals.length) {
int nextSize = locals.length * 2;
// GlobalOptions.err.println("wanted: "+size+" next: "+nextSize);
LocalInfo[] newLocals = new LocalInfo[nextSize > size ? nextSize
: size];
System.arraycopy... |
e3c75438-73d1-4497-825f-50d3af4bbed2 | 7 | private void executeSphereAction() {
if (action.length() == 0 || !onTheSphere()) {
return;
}
if (action.contains("Add")) {
executeAdding();
main.save(vortexes, corridors);
}
else if (action.contains("Define")) {
executeDefining();
main.save(vortexes, corridors);
}
else if (action.contain... |
3be41180-382c-461f-8702-08457c754ed5 | 7 | @Override
public void insert (K i) {
if(i == null)
return;
if(contains(i))
return;
if(root == null) {
root = new Node<K, V>(i, null, null);
size++;
return;
}
Node<K, V> cur = this.root;
if(!cur.getKey().shorter(i)) {
root = new Node<K, V>(i, null, cur);
cur.setPrev(root);
si... |
b990664b-1f53-4585-902b-e26fc8d910fe | 3 | public BacklogBean get(BacklogBean oBacklogBean) throws Exception {
if (oBacklogBean.getId() > 0) {
try {
oMysql.conexion(enumTipoConexion);
if (!oMysql.existsOne("backlog", oBacklogBean.getId())) {
oBacklogBean.setId(0);
} else {
... |
573d9b6f-8561-4925-a71e-900eea9f1bed | 3 | @Override
public boolean onKeyDown(int key) {
Iterator<IGameScreen> it = screens.iterator();
while(it.hasNext()) {
IGameScreen screen = it.next();
if(screen.onKeyDown(key)) {
return true;
}
}
if(camera.onKeyDown(ke... |
a0a89523-c540-4d48-87e6-62ef4492bbd7 | 1 | private final void drawIHudable(Graphics2D drawScreen, int offsetX, int offsetY) {
// Iterate over our list of items which want to be shown on the HUD and
// grab their graphic icons, ie [HealthImage] as mentioned within this
// method's header comments
int drawY = drawHudComponentsY;
for (IHUDable hudable : ... |
914d6402-7aa4-4ddd-9bd6-26dd8bdfb2ea | 3 | private int getCurActivity(ASPlayer data, TableType table) {
switch(table) {
case DAY: return data.curDay.activity;
case WEEK: return data.curWeek.activity;
case MONTH: return data.curMonth.activity;
default: plugin.severe("Invalid Type in getCurActivity");
}
return 0;
} |
90b94e9e-76fd-4fef-a836-f40d640fe30d | 5 | private boolean isValidISBN(String ISBN) {
if (!isValidStringData(ISBN)) {
return false;
} else if (ISBN.length() != 13) {
return false;
} else {
for (int index = 0; index < 13; index++) {
if ((ISBN.charAt(index) < '0')
... |
b5d3c6e5-f8b1-4c2e-a8d9-454265d055a5 | 3 | @Override
public void renderControl(Graphics2D g) {
BufferedImage Control = new BufferedImage(this.getSize().getWidth(), this.getSize().getHeight(), BufferedImage.TYPE_INT_ARGB);
Graphics2D g2d = (Graphics2D) Control.getGraphics();
if(this.getBackgroundColor() != null)
{
... |
35f2bf20-4e6f-483d-906b-26f8ae88919d | 7 | private void siftDownComparable(int i, E e) {
Comparable<? super E> key = (Comparable<? super E>) e;
int half = size >>> 1;
while (i < half) {
// Assume left child is least
int childIdx = (i << 1) + 1;
Object child = queue[childIdx];
int rightIdx =... |
445f7465-0a64-44d2-80fd-97a9cd2a09f0 | 1 | @Override
public byte[] save(JoeTree tree, DocumentInfo docInfo) {
StringBuffer buf = prepareFile(tree, docInfo);
try {
return buf.toString().getBytes(PropertyContainerUtil.getPropertyAsString(docInfo, DocumentInfo.KEY_ENCODING_TYPE));
}
catch (UnsupportedEncodingException e) {
e.printStackTrace()... |
9ed55962-044b-4d95-a8f3-3620d4909430 | 8 | private static double getAPearson(int sample1ID, int sample2ID, List<String> samples,
HashMap<String, HashMap<String, Holder>> dataMap, boolean compareSame16S)
{
List<Double> list1 = new ArrayList<Double>();
List<Double> list2 = new ArrayList<Double>();
HashMap<String, Holder> firstMap= dataMap.get(... |
652915cc-6b53-4e6e-81de-c63e5d37709a | 9 | private static void play() {
Game g = new Game();
Scanner scanner = new Scanner(System.in);
char c;
g.Output();
while (g.isKeepPlaying()) {
c = scanner.next().charAt(0);
switch (c) {
case 'W':
case 'w':
g.Move(Game.UP);
g.Output();
break;
... |
b8bd8d34-56d6-4723-bd01-3d151e8fea92 | 0 | public SplashScreen(int d) {
duration = d;
} |
1f6f3d0d-b030-4531-be75-423b5ad56f26 | 2 | public static void main(String[] args) {
try {
String host;
int port;
String name;
if (args.length == 0) {
host = "localhost";
port = 8080;
Random rnd = new Random();
name = "Guest_" + rnd.nextInt(100);
} else {
host = args[0];
port = Integer.parseInt(args[1]);
name = args[... |
65dce743-52c9-4b24-aa56-e6e50af8df0e | 1 | public int putRef(int tag, Reference ref) {
String className = ref.getClazz();
String typeSig = ref.getType();
if (tag == FIELDREF)
TypeSignature.checkTypeSig(typeSig);
else
TypeSignature.checkMethodTypeSig(typeSig);
int classIndex = putClassType(className);
int nameIndex = putUTF8(ref.getName());
... |
62b7797b-b9a4-45bf-a44a-119f7923a9a5 | 2 | public static void toggleExpansionText(Node currentNode, JoeTree tree, OutlineLayoutManager layout, boolean shiftDown) {
if (currentNode.isExpanded()) {
currentNode.setExpanded(false, !shiftDown);
} else {
if (shiftDown) {
currentNode.ExpandAllSubheads();
} else {
currentNode.setExpanded(true, true... |
e087d3fe-288b-4fad-974a-493dc0010350 | 8 | private World() {
setFocusable(true);
addKeyListener(new KeyListener() {
@Override
public void keyPressed(KeyEvent kE) {
int key = kE.getKeyCode();
switch (key) {
case KeyEvent.VK_UP:
bUP = true;
break;
case KeyEvent.VK_DOWN:
bDOWN = true;
break;
case KeyEvent.VK_RIGH... |
798b189e-29e4-4f0c-8fbb-f506e0cc2493 | 3 | public String toString() {
String title = "*************************"+newLine;
title += "* Garage OpenClassrooms *"+newLine;
title += "*************************"+newLine;
String str = title;
try {
ois = new ObjectInputStream(
new BufferedInputStream... |
81438e76-6ee1-4903-b359-12bd56128a5b | 9 | public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st;
int n = Integer.parseInt(br.readLine());
Booking[] bookings = new Booking[n];
for(int i=0; i<n; i++){
st = new Strin... |
07e26a7a-3c90-4efb-aaad-69fa974c1d70 | 1 | private void initialize() {
avatar_image = null;
x = 22;
y = 234;
speedX = 0;
speedY = 0;
jumpcount = 0;
canjump = true;
isDead = false;
mvState = Mouvement_State.STOPED;
for (int i = 2; i < 10; i++)
enmies.add(i);
} |
e2a61585-13ff-43c0-a497-0a84dd395c0d | 1 | protected void processWindowEvent(
WindowEvent event )
{
if (event.getID() == WindowEvent.WINDOW_CLOSING)
{
actionCancel();
}
super.processWindowEvent(event);
} |
ecdf2654-767c-4b87-b020-c725684c2b34 | 7 | public Insets getBorderInsets(Component c) {
if (c instanceof JComponent && ((JComponent) c).getComponentCount() == 0)
return new Insets(0, 0, 0, 0);
Direction orientation = getTabAreaDirection(c);
return orientation != null ? new Insets(drawTop(orientation) ? 1 : 0,
... |
0a3ab549-e3d2-4e0b-8f81-6adf5dae57af | 2 | private int findIndexOfATimeZone(String tz){
for (int i = 0; i < timeZones.length; i++){
if (tz.contains(timeZones[i])){
return i;
}
}
return -1;
} |
8b7a8d61-4c43-4041-bdc3-f29a21c8ac12 | 2 | @RequestMapping(value = {"/EntidadBancaria/id/{idEntidad}"}, method = RequestMethod.GET)
public void readID(HttpServletRequest httpRequest, HttpServletResponse httpServletResponse, @PathVariable("idEntidad") int idEntidad) {
try {
String json = null;
ObjectMapper jackson = new Object... |
18ef1d78-99f1-4aad-b8d8-7fbe9ec5eeb2 | 1 | public static ArrayList<Triangle> convertVerticesToTriangles( Vector3f[] vertices, int[] indices )
{
ArrayList<Triangle> list = new ArrayList<Triangle>();
int index = 0;
while ( index < indices.length )
list.add( new Triangle( vertices[indices[index++]], vertices[indices[index++]], vertices[indices[index++]]... |
bf72ff4b-a110-4c41-bf8a-b27d46931d02 | 9 | public int classifyHand()
{
if(isRoyalFlush())
return 9;
else if(isStraightFlush())
return 8;
else if(isFour())
return 7;
else if(isFullHouse())
return 6;
else if(isFlush())
return 5;
else if(isStraig... |
048d996f-401a-46b3-9baa-c051f4651ca5 | 9 | @SuppressWarnings("unchecked")
private void updateList() {
boolean foundSelected = false;
Students st[] = new Students[1];
view.getStudentList().setListData(((Students []) students.toArray(st)));
GPA g[] = new GPA[1];
view.getGPAList().setListData(((GPA []) gpa.toArray(g)));
Departments d[] = new D... |
f8747c7b-feb8-4d86-8085-a84664c402e1 | 9 | private void handleSubCommandPlayers(String[] args, Player executingPlayer) {
if (args.length == 1) {
GrubsMessager.sendMessage(executingPlayer, GrubsMessager.MessageLevel.ERROR, "Not enough arguments.");
}
if (GrubsDefendShed.getGameState() == GrubsDefendShed.GAME_STATES.ACCEPT_PLAYERS ||
GrubsDefendShed... |
8c4ac7e7-c1bf-473e-b980-8267d50f1249 | 0 | @Override
public void init(WorkingMemoryEntryPoint startEntryPoint)
{
this.startEntryPoint = startEntryPoint;
} |
08dd3efd-4789-4e8a-960e-1fefde203e26 | 6 | public static void Pickup(String Item) {
boolean added = false;
if(Item.startsWith("Book: ")) {
Item = Item.replace("Book: ", "");
}
int ItemID = GetItemID(Item);
for(int i=0; i<Items.roomItems.length-1; i++) {
if(Items.roomItems[Rooms.currentRoom-1][i] == ItemID) {
for(int j=0; j<Inventory.lengt... |
88590856-982c-4731-ad1a-af08247c2de5 | 8 | @Override
public boolean setRingRight(Wearable ring) throws NoSuchItemException, WrongItemTypeException {
if (ring != null) {
if (ring instanceof Ring) {
if (ring.getLevelRequirement() > level || ring.getStrengthRequirement() > stats[0]
|| ring.getDexterityRequirement() > stats[1] || ring.getMagicRequir... |
59bd4651-b761-4aa9-8789-169bd835752e | 4 | private HttpURLConnection sendRequestImpl(Request request)
throws URISyntaxException, IOException, HmacException {
HttpURLConnection conn = getConn(request);
if (conn.getResponseCode() == 404
&& request.getPackageStreamGetter() != null) {
// The package isn't in ... |
01e3364c-0981-4aee-8360-c24afd040b6d | 5 | public static boolean readUserSelectedFile() {
if (fileDialog == null)
fileDialog = new JFileChooser();
fileDialog.setDialogTitle("Select File for Input");
int option = fileDialog.showOpenDialog(null);
if (option != JFileChooser.APPROVE_OPTION)
return false;
File selected... |
3dcdf0e9-c099-4ba5-89f6-68c5a6cb82c9 | 1 | public void testParseStandardFail3() {
PeriodFormatter parser = ISOPeriodFormat.standard();
try {
parser.parsePeriod("PTS");
fail();
} catch (IllegalArgumentException ex) {}
} |
4f21964a-6f94-4e56-b31a-238a03b53d8a | 7 | public void ammuntionType(String type, int playerRace){
if (type == "Gun"){
bulletColor = Color.LIGHT_GRAY;
bulletSize = 6;
bulletDamage = 10;
}
else if (type == "Bomb"){
bulletColor = Color.DARK_GRAY;
bulletSize = 14;
bulletDamage = 20;
}
else if (type == "Ray"){
bulletColor = Color.CYAN... |
6e694cf4-323d-4597-8e4f-6a4a51c0f0c8 | 7 | public static void insert (int uid, int pid, int quantity, int price) throws SQLException {
PreparedStatement s = null;
try {
try {Class.forName("org.postgresql.Driver");} catch (ClassNotFoundException ignore) {}
currentCon = DriverManager.getConnection(dbName);
String query = "INSERT INTO carts (uid, pid,... |
41c1f165-d354-41f8-8df9-9f68d0c43e73 | 1 | private void ensureCapacity(int capacity) {
if (capacity > data.length) {
data = Arrays.copyOf(data, capacity * 3 / 2 + 1);
}
} |
51f4b760-a5e2-4def-8bb6-7b032522332c | 9 | public boolean isMatchGreedy(String s, String p) {
int i = 0;
int j = 0;
int star = -1;
int mark = -1;
while (i < s.length()) {
if (j < p.length()
&& (p.charAt(j) == '?' || p.charAt(j) == s.charAt(i))) {
++i;
++j;
} else if (j < p.length() && p.charAt(j) == '*') {
star = j++;
mark =... |
094c2f01-ba38-4bd1-934a-7ccc8f61eabb | 3 | @Override
public void run()
{
while (!end)
{
//-------------------------------------------------------
// Updates
//-------------------------------------------------------
if(!pause) // if not pause update
{
updateScreen();
}
//-------------------------------------------------------... |
901e67cd-2696-4a30-901a-d0b910eb748b | 8 | routeMap(serverCall call, Boolean connectionsAllowed) throws JSONException, IOException, badApplicationScriptParsingException {
String variable = new communicationInterface().navigatePage(call).get(0);
JSONObject common = new JSONObject(variable);
JSONArray stationList = common.getJSONObject("stationInfo")... |
204818e2-8a15-4100-b95d-203713739562 | 0 | public boolean hasNext() {
return nextline != null;
} |
2a97876f-a347-4078-bd46-ffdac679d30e | 5 | public void readFields(DataInput in) throws IOException {
try {
p = in.readByte();
k = in.readInt();
s = in.readInt();
if(k == 0) {
s = 0;
}
// If p is negative, M does not exist
if (p < 0) {
p = (byte) -p;
int m = (int)Math.pow(2, p);
M = n... |
bdb1a941-9cd7-4109-bda6-f493e5ed8ee7 | 4 | protected void renderIn(Box2D area, Texture tex, Box2D UV) {
final float scale = stretch ? 1 : Math.min(
bounds.xdim() / texture.xdim(),
bounds.ydim() / texture.ydim()
) ;
GL11.glColor4f(1, 1, 1, absAlpha) ;
final Box2D drawn = new Box2D().set(
area.xpos(), area.ypos(),
stre... |
693f2591-08ae-4346-8eb9-a2abc02b164a | 2 | private void acao140(Token token) throws SemanticError {
if (idAtual instanceof IdentificadorVariavel) {
if (idAtual instanceof IdentificadorVariavelRegistro) {
regAtual = (IdentificadorVariavelRegistro) idAtual;
} else {
throw new SemanticError(
"Apenas registros podem ser qualificados",
to... |
4f5cda07-d8c1-4e0f-81d4-3ed3e69cab0f | 8 | public static void main(String[] args) {
if (args.length != 1) {
System.out.println("This simple demo utility must be called with a JPEG file. For example:");
System.out.println(" bin/jshowsize.sh myWonderfulJpegFile.jpg");
return;
}
JpegData parser = new JpegData();
try {
RandomAccessF... |
6fbd5482-534c-4203-8cf2-720b917d891c | 4 | @Override
public boolean checkTable(String table) {
try
{
Connection connection = open();
Statement statement = connection.createStatement();
ResultSet result = statement.executeQuery("SELECT * FROM " + table);
boolean check = false;
if (result != null)
check = true;
result.close();
state... |
5b00e678-e33e-4fa2-975a-42d6f51c6842 | 3 | public static ArrayList<SchoolBean> viewSchools(){
Connection con=DBConnection.getConnection();
ArrayList<SchoolBean> list=new ArrayList<SchoolBean>();
if(con==null)
return null;
try {
Statement pt=con.createStatement();
ResultSet rs=pt.executeQuery("select * from school");
//rs.next();
while(... |
415f224b-136f-4c6d-866e-d08ee97f2128 | 0 | public CheckResultMessage checkF08(int day) {
return checkReport.checkF08(day);
} |
dcba04ac-36b5-4705-ba18-9c3d81b7ba1d | 1 | private static boolean isStartsWithConsonant(Word word) {
List<Character> vowels = Arrays.asList('a', 'e', 'i', 'o', 'u');
if (vowels.contains(word.getValue().toLowerCase().charAt(0))) {
return false;
}
return true;
} |
62db5ce6-3b3c-4af1-a06a-6132ba7377d5 | 4 | @Override
public DataTable generateDataTable (Query query, HttpServletRequest request) throws DataSourceException
{
DataTable dataTable = null;
for (final String url : this.urlYahoo)
{
try (final Reader stockData = new FilterCsv (new BufferedReader (new InputStreamReader (new URL (url).openStream()))))
... |
a2c7eeb5-20dc-40a7-bff6-03f19eda4ef9 | 5 | private static LinkedList createUsers(BufferedReader buf, LinkedList routers)
throws Exception {
String line;
String name;
String baudRate;
String router_name;
StringTokenizer str;
LinkedList users = new LinkedList();
while ((line = buf.readLine()) != nul... |
0fcd46a4-cf79-4c91-8d53-88a502df4b3a | 0 | public String getOS() {
return "string";
} |
0237dfe3-3d46-436f-b05a-b0f86d57d3f9 | 2 | int[] randperm(int upto) {
int perm[] = new int[upto];
int freenums[] = new int[upto];
for (int i = 0; i < upto; i++) {
freenums[i] = i + 1;
}
for (int i = 1; i <= upto; i++) {
int num = (int) Math.floor(random() * (upto + 1 - i) + 1.0);
perm[... |
685c60f4-871e-4b71-9000-aadb8b1a240b | 7 | public boolean isRoyal() {
if(isStraight() && isFlush()) {
List<PokerCard> sorted = new ArrayList<PokerCard>();
for(Card card: _cards) {
sorted.add((PokerCard)card);
}
Collections.sort(sorted, new CardComparator());
// Debug
... |
3b1a9eb8-8109-4d07-9975-290da6cfe9f3 | 1 | @Override
public Object getValue() {
if(!this.getNodeProperty().getDataType().isAssignableFrom(URL.class))
return null;
return (Object)url;
} |
97b031fd-d2e9-4784-976a-e09c8fee313b | 1 | public Benutzer neuerBenutzerErstellen(String Benutzername,
String Passwort, int idOrgaEinheit, boolean Gesperrt) {
Benutzer rueckgabe = null;
try {
rueckgabe = new Benutzer(Benutzername, Passwort, idOrgaEinheit,
Gesperrt, db);
} catch (SQLException e) {
System.out.println("Zugriffschicht: neuerBenu... |
6f807cd1-f1e2-4b90-9d0b-01cea4135fb3 | 1 | public static boolean getBit(Integer value, Integer bitNr) {
if((value & (1 << bitNr)) != 0) {
// The bit was set
return true;
}
else {
return false;
}
} |
02b95b39-96ef-4e05-a2f4-92a5f322feb2 | 9 | public void checkCommand(final String command, final ArrayList<String> args) {
if (command.equals(util.Protocol.CMD_CONNECTED)) {
cmdCONNECTED(args);
} else if (command.equals(util.Protocol.CMD_FEATURES)) {
cmdFEATURES(args);
} else if (command.equals(util.Protocol.CMD_START)) {
cmdSTART(args);
} else ... |
52e9e90a-8a12-43e2-a4c6-4a7adaeadc22 | 3 | public int [] ordenaX(int [] arr)
{
for(int i=0; i< x.length-1; i++)
{
for(int j= 0; j<x.length-1-i; j++)
{
if(x[j] > x[j+1])
{
int aux=x[j];
x[j]=x[j+1];
x[j+1]=aux;
}
... |
eadb6143-bf7f-4180-b0af-f37ef0f2ef46 | 1 | @Override
public void run()
{
try
{
Class.forName("org.sqlite.JDBC");
} catch (ClassNotFoundException ex)
{
Logger.getLogger(Kurs.class.getName()).log(Level.SEVERE, null, ex);
}
formMain frm = new formMain();
frm.set... |
3b7a0348-62b1-4444-b554-ac08740d4ed8 | 9 | @Override
public boolean isMetal(Environmental E)
{
if(E instanceof Item)
return((((Item)E).material()&RawMaterial.MATERIAL_MASK)==RawMaterial.MATERIAL_METAL)
||((((Item)E).material()&RawMaterial.MATERIAL_MASK)==RawMaterial.MATERIAL_MITHRIL);
if(E instanceof MOB)
{
final MOB M=(MOB)E;
if(isGolem(M)... |
151a61b6-f7a8-462a-bc37-e0460d524452 | 0 | @Test
public void test_AddTwoPositives() {
assertEquals("FAILED: test_AddTwoPositives", simpleObject.add(1,2), 3);
} |
5da067a5-406d-48b6-b7a2-5ef9b141d69d | 7 | public static void main(String[] args) {
Locale.setDefault(Locale.US);
Scanner s = new Scanner(System.in);
double num = s.nextDouble();
if(num < 0 || num > 100){
System.out.println("Fora de intervalo");
}else if(num >= 0 && num <= 25){
System.out.print... |
46d4dbd5-1fc8-4ece-80bb-83eadcd6515c | 1 | private void feedbackTripComment () {
TripComponent t = tripList.getSelectedValue();
if (t == null)
return;
t.getTrip().setComment(detailsCommentText.getText());
return;
} |
30e9cff7-203a-4750-b07d-97a7acb49a4d | 8 | public void undump(StringTokenizer st) {
reset();
int e = new Integer(st.nextToken()).intValue();
if (e == -1) {
return;
}
elm = sim.getElm(e);
speed = new Integer(st.nextToken()).intValue();
value = new Integer(st.nextToken()).intValue();
int ... |
f30eb273-7d88-4d8e-917c-690d16950d4c | 6 | public void expandToWorldTree(RNG rng, float parentHeight, float parentWidth, float parentDepth, float parentXPos, float parentYPos, float parentZPos, int index, int subCount)
{
ExceptionLogger.log("Expanding Area \""+identifier+"\"", LoggerLevel.FINEST);
VariableResolver resolver = new VariableResolver();
resol... |
ed374ffe-43e0-4567-bc0d-d5efc59a909c | 7 | private final void genAudioPreviewClips(final int id) {
File inputFile = this.getAudioFileSource();
if (inputFile == null) return;
final Videncode self = this;
String filename = (id == PREVIEW_FIRST ? "preview.start" : "preview.end");
double[] time = this.getAudioFileSourceEncodeDuration();
Bitrate bitrate... |
ab479c85-31a5-4fc1-9020-22719e3038af | 2 | @Override
public void execute(CommandSender s, String[] args){
if(s.isOp() && s instanceof Player){
Player p = (Player) s;
Location newSpawn = p.getLocation();
PKSQLd.saveParsedData("MAPSPAWN", LocationParser.locToString(newSpawn));
p.sendMessage("Set spawn to " + LocationParser.locToString(newSpawn));
... |
fdacf5f1-ca88-4e64-8185-1d2c6947d298 | 8 | @Override
public void run() {
try {
ObjectInputStream in = new ObjectInputStream(serverConnection.getSocket().getInputStream());
while (!serverConnection.getSocket().isClosed() && in != null) {
/** Get all data from the packet that was sent. */
byte[] data = new byte[client.getConfig().PACKET_BUFFER_SI... |
0cfda1ce-4fa8-4631-a289-25f1042e1a5d | 7 | public void ReadCameraFileList() throws Exception {
if (Parent.GetNoCameraParameter()) {
return;
}
URLConnection conn = null;
BufferedReader data = null;
String line;
String result;
StringBuffer buf = new StringBuffer();
URL CameraFileReadURL ... |
08e18cdf-0821-4a07-85da-111e9d9f50b5 | 6 | @Override
public ActionForward execute(final ActionMapping mapping, final ActionForm form, final HttpServletRequest request,
final HttpServletResponse response) {
log.info("メッセージ送信処理開始");
PaymentForm commForm = (PaymentForm)form;
// 商品情報は未入力でも送信可能
// if (commForm == null... |
70d5432e-51ab-474a-99c3-fd37c4e0d331 | 3 | private String decrypt() {
try {
byte[] dec = Base64.decode(this.getEncryptedPass());
byte[] utf8 = this.decrypter.doFinal(dec);
return new String(utf8, "UTF8");
} catch (javax.crypto.BadPaddingException e) {
} catch (IllegalBlockSizeException e) {
} catch (UnsupportedEncodingException e) {
}
retu... |
8ea33956-c540-4d0f-8d7c-33b18513beb3 | 3 | public void add(Object o) throws PropertyException {
if (o instanceof Event)
addEvent((Event) o);
else if (o instanceof Date)
addDate((Date) o);
else if (o instanceof Place)
addPlace((Place) o);
else
throw new PropertyException("Unable to add object of type "
+ o.getClass().getName() + " to an ... |
31f91fc6-835c-4a6f-8867-07613afe6d3f | 4 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null || getClass() != obj.getClass())
return false;
Matrix3 other = (Matrix3) obj;
if (!Arrays.deepEquals(m, other.m))
return false;
return true;
} |
8670123e-2d11-4b33-950b-2347524ab7fc | 0 | public CtrlPrincipal getCtrlPrincipal() {
return ctrlPrincipal;
} |
6b70ff87-8399-4820-a0f1-1de1eb02bca8 | 8 | final public void Relation_expression() throws ParseException {
/*@bgen(jjtree) Relation_expression */
SimpleNode jjtn000 = new SimpleNode(JJTRELATION_EXPRESSION);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);
jjtn000.jjtSetFirstToken(getToken(1));
try {
Expression... |
f59c467a-3ad3-428e-a90a-919e65cde003 | 3 | private static void test_set(TestCase t) {
// Print the name of the function to the log
pw.printf("\nTesting %s:\n", t.name);
// Run each test for this test case
int score = 0;
for (int i = 0; i < t.tests.length; i += 3) {
int bits = (Integer) t.tests[i];
int exp = (Integer) t.tests[i + 1];
int arg... |
7fadd184-885b-4502-ab2b-828bf89ac113 | 7 | public JSONObject sendRequest(String address, String protocol, String postData) throws IOException, JSONException {
HttpConnection connection = null;
try {
connection = (HttpConnection) Connector.open("http://" + MarketTyvikJ2ME.options.ServerPath.getString() + "/" + address);
connection.setRequestP... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.