method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
f416b699-2de9-46c5-86da-ace73fc0eda0 | 4 | public Jeu() {
// titre de la fenêtre
super("Snake");
jouer = false;
// créer le modèle du jeu
this.modele = new ModeleDuJeu();
// fermeture de l'application lorsque la fenêtre est fermée
setDefaultCloseOperation(EXIT_ON_CLOSE);
// pas de redimensionnement possible d... |
386d5a8e-7f40-4174-b0f7-9b635855f3a2 | 8 | private int[] simulatedAnnealingDecode(DecodeHelper helper, int steps, int tries){
Sentence globalBest = null;
for(int n=0; n<tries; n++){
Sentence curr = new Sentence(helper);
if(n == 0) globalBest = curr;
boolean betterSentenceFound = true;
while(betterSentenceFound){
betterSentenceFound = false;
... |
5bbb525e-8eac-4d74-b25f-06eb3940532d | 3 | public boolean contains(Moveable obj){
return (x + width > obj.getX() && x < obj.getX() + obj.getWidth() &&
y + height > obj.getY() && y < obj.getY() + obj.getHeight());
} |
5210e9ae-9a1c-4d78-b185-abc33e9cc2ed | 2 | private boolean releaseItem(ParkingPlace place) {
LOCK.lock();
try {
int index = PLACES.indexOf(place);
if (index == -1) {
return false;
}
if (PLACES.get(index).isUsed()) {
place.togleUsed();
return true;
}
} finally {
LOCK.unlock();
}
return false;
} |
14032b65-1ac9-4ea8-a458-f9703f311ac6 | 2 | public float[] getPoint(int number)
{
if((number<Way.size()) && (number >= 0))
{
return(Way.elementAt(number));
}
else
{
return(new float[]{-1,-1});
}
} |
d90d7a79-725e-42b0-9da5-7cd52e4df142 | 9 | public boolean skipPast(String to) throws JSONException {
boolean b;
char c;
int i;
int j;
int offset = 0;
int length = to.length();
char[] circle = new char[length];
/*
* First fill the circle buffer with as many characters as are in the
... |
2b9b35d1-9e32-4102-9a34-703ae85cfd90 | 5 | private static String exportCountData() {
String output = "seconds,";
int size = virusCount.lastEntry().getValue().size(), i = 0;
for (Virus virus : virusCount.lastEntry().getValue().keySet()) {
i++;
output += virus;
if (i == size)
output += "\n";
else
output += ",";
}
for (Map.Entry<Long,... |
59c81236-704e-4124-80c0-6fa10edb3ffd | 3 | @SuppressWarnings("unused")
public static void ox_Xx()
{
try {
Method[] xooso = References.class.getMethods();
for(Method xod : xooso)
{
Reference sds = xod.getAnnotation(Reference.class);
if(sds != null)
{
classes.add(xod.getReturnType());
String sndsn = xod.getName();
sndsn = s... |
d448060f-bb69-40dc-8c31-120c1c766ed6 | 8 | public static void main(String[] args){
Scanner in = new Scanner(System.in);
int[][] num = new int [100][100];
int index=0;
while(in.hasNext()){
String line = in.nextLine();
String[] nums = line.split("\\s+");
int col = 0;
for(String n : nums){
num[index][col++] = Integer.parseInt(n);
}
in... |
2aaaae32-6c08-46bb-a7ba-5f04def8bb71 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Bus other = (Bus) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
if (p... |
34dd61fe-7337-40cb-a89a-e2dbaf471b6b | 1 | public void testEmptyPassWord(){
Client c =Client.getInstance();
try {
c.connect(url,userName,"");
fail();
} catch (XmlRpcException e) {
log.error(e.getMessage());
}
} |
3c260761-56be-446a-be1b-30e87d8faa26 | 7 | public static NwCell[][] getMatrix( ProbSequence seq1, ProbSequence seq2 ) throws Exception
{
NwCell[][] matrix = new NwCell[seq2.getColumns().size() + 1][seq1.getColumns().size() + 1 ];
matrix[0][0] = new NwCell(0, NwCell.Direction.INIT);
for (int x=1; x <= seq1.getColumns().size(); x++)
matrix[0][... |
48848695-cce8-43fd-b144-25fb418e16d0 | 6 | private void saveFile(){
// Create a file chooser
final JFileChooser fileChooser = new JFileChooser();
JPanel pnlTab = (JPanel)some.tabs.getTabComponentAt(some.tabs.getSelectedIndex());
String s1 = ((JButton)pnlTab.getComponent(2)).getActionCommand();
boolean flag = fals... |
9ed80019-f794-474a-bf62-3e8ac3dab5dc | 5 | public void info() {
System.out.println("FILE INFO\n----------");
if(file.exists()){
System.out.println("Nombre: " + file.getName());
System.out.println("Dir Absoluta: " + file.getAbsolutePath());
System.out.println("Path: " + file.getPath());
System.out.p... |
e7def8cf-6bf6-48db-afe7-d252831c70b2 | 4 | public static String getLyrics(String artist, String title) {
// Prepare artist and title for LyricWiki's URL format
artist = artist.replace(' ', '_');
String mod_title = title.replace(' ', '_');
Logger.LogToStatusBar("Getting lyrics ("+artist+" : " +mod_title+")!");
String url = "http://lyrics.wikia.com/"... |
9c939637-728b-4a07-a725-b48036c7cd51 | 7 | private int alphabeta(int m, int dt, int a, int b, Board B, boolean max) {
if (dt == 0 || findPossibleMoves(max, B).length == 0) {
return getRating(max, B, m);
} else if (max == true) {
for (int i : findPossibleMoves(max, B)) {
Board nB = B;
n... |
6859d044-017f-4bc0-9e52-b8e6fd2c76e8 | 2 | public void flagAncestors(int[] MoleculeID, int size, int val){
if ((size!=0)){
val = MoleculeID[MoleculeID.length-size];
this.flag();
//System.out.printf(""+toStringf()+" flagged\n");
if(children!=null){
children.get(val).flagAncestors(MoleculeID, size-1, val);
}
... |
b2277d1a-e17b-4190-b506-3f931cdad268 | 0 | public PDATransition(State from, State to, String inputToRead,
String stringToPop, String stringToPush) {
super(from, to);
setInputToRead(inputToRead);
setStringToPop(stringToPop);
setStringToPush(stringToPush);
} |
64d3bf04-0c6a-4aca-bc55-ea117c1d81e3 | 5 | private CategoryType readCategory(String title){
String s[] = title.split("_");
if(s[0].compareTo("bass") == 0)
return CategoryType.BASS;
else if(s[0].compareTo("beats") == 0)
return CategoryType.BEATS;
else if(s[0].compareTo("harmony") == 0)
return CategoryType.HARMONY;
else if(s[0].compareTo("me... |
a69e6276-210e-42b5-bcd1-d748a6b67bfa | 5 | public void down()
{
//The piece goes to the lowest square possible
if (currentPiece.isMoving()&&!dropped&&!paused)
{
int i;
for (i=0; i<20&&willWork(0,i); i++){}
blackoutPiece();
currentPiece.add(0,i-1);
validatePiece();
points+=(i-1)*3;
dropped=true;
justDropped=true;
currentPiece.se... |
dc3b1c9d-4613-49be-855e-3e928b5d4e22 | 2 | @Override
public boolean equals(Object obj) {
if (!(obj instanceof Message)) {
return false;
}
Message other = (Message) obj;
return Objects.equals(other.getFieldsNameAndValue(), getFieldsNameAndValue())
&& Objects.equals(other.getMessageName(), getMessageName());
} |
58750220-0536-4ca3-9ae9-a7ac5d8506e6 | 8 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Pair<?, ?> other = (Pair<?, ?>) obj;
if (!Objects.equals(this.left, other.left)) {
return fal... |
682db577-896d-457e-b383-6fc45664a4d1 | 9 | public Byte put(DataPacket packet) {
byte ackStack = 0x00;
ackStack |= packet.getSource();
this.lock.lock();
//
if (this.oneToOne.containsKey(ackStack) == false/* || this.oneToOne.get(ackStack).getValue() == (byte)0*/ || this.oneToOne.get(ackStack).getValue() == (byte) 0) {
System.out.println(... |
aeae25e9-23bd-4b32-9e05-3b482279851a | 0 | public int getTargetY() {
return targetY;
} |
6e22922a-f132-4599-ab8c-ebe509d5e9a4 | 5 | public boolean Export(ResultBean resultBean){
boolean bl = false;
try{
Util util = new Util();
boolean orFirst = false;
String file_Name, battle_Type;
boolean type = util.str_bl(resultBean.getBattle_Type());
if(type){
battle_Type = Const.DOUBLE;
}else{
battle_Type = Con... |
23fe1555-4ee9-49c7-b4cc-bdca7567c3e8 | 2 | public void setPWFieldFontcolor(int[] fontcolor) {
if ((fontcolor == null) || (fontcolor.length != 4)) {
this.pWFieldFontColor = UIFontInits.PWFIELD.getColor();
} else {
this.pWFieldFontColor = fontcolor;
}
somethingChanged();
} |
cbae0905-7046-43ff-9b82-bd69ce2c5454 | 4 | private static void verifyFileCheckSumHasChanged(File file, final boolean mustExist, final String invalidCheckSum, boolean releaseMode) throws NoSuchAlgorithmException, IOException {
if (!mustExist && !file.exists()) return;
final String currentFileCheckSum = FileCheckSumGenerator.generateFileChec... |
da4f4e47-6411-4d98-a0b3-7298fba9641d | 5 | protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String action = request.getParameter("action");
if (action!= null) {
if (action.equals("supprimerUtilisateur")) {
String login =... |
cd779cab-d50d-41d3-85af-f8fa730017ad | 2 | @Override
public void render()
{
for(int x = 0; x < Game.WIDTH; x+= Tile.TILE_SIZE)
{
for(int y = 0; y < Game.HEIGHT; y+= Tile.TILE_SIZE)
{
g.drawImage(Images.WALL, x, y, Tile.TILE_SIZE, Tile.TILE_SIZE, null);
}
}
g.drawImage(Images.HELP_GUI, 0, 0, Game.WIDTH, Game.HEIGHT - 28, null);
super.re... |
d4352097-3831-49c8-9b39-4fa77f896bdd | 8 | public HashMap<String, Integer> computeFeatOccurrences(String tagged) throws XMLStreamException {
// String tagged is XML-string
// Read files features.txt and store the features in a list
List<String> featuresList = new ArrayList<String>();
String currentLine;
BufferedReader br = null;
try {
br = new B... |
9d46d4ce-c9e6-4b3d-b283-a6efc40b3893 | 1 | @EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerLoginEvent(PlayerLoginEvent event){
if(!plugin.getConfig().getBoolean("DelayCheck"))
return;
plugin.getServer().getScheduler().scheduleAsyncDelayedTask(plugin, new BlacklistTask(plugin,event.getPlayer()),30);
} |
5d171d53-cff3-46c3-8ba5-d494fe77dfcd | 4 | public String getItemName(int ItemID) {
for (int i = 0; i < server.itemHandler.MaxListedItems; i++) {
if (server.itemHandler.ItemList[i] != null) {
if (server.itemHandler.ItemList[i].itemId == ItemID) {
return server.itemHandler.ItemList[i].itemName;
}
if (ItemID == -1)... |
320dc139-a835-4159-925a-6c2266e4d854 | 2 | private static HashMap<String, String[]> getRegisteredPluginInfo() {
String pluginsFolder = "./lib/dbPlugins/";
File file = new File(pluginsFolder + "register.txt");
HashMap<String, String[]> registeredPlugins = new HashMap<String, String[]>();
try {
BufferedReader br = new BufferedReader(new FileReader(file... |
75f1f8e0-687c-4941-82a7-0d115a38c45d | 3 | public static void makeSaleReport(List<Sell> sellList){
StringBuilder data=new StringBuilder();
for(Sell b:sellList){
data.append(b.toReport());
data.append("\n");
}
try {
FileOutputStream file=new FileOutputStream(new File("reportSale.txt"));
file.write(data.toString().getBytes());
file.flush(... |
8ccce363-76d7-40a6-9fbe-fdd3c261b7ab | 4 | private Type getType(char flag) {
for (char c : bools) {
if (c == flag) return Type.BOOLEAN;
} for (char c : strings) {
if (c == flag) return Type.STRING;
} return Type.UNREGISTERED;
} |
8c3585ce-1bb0-4b53-8b02-216c7d0234f0 | 7 | public char scanQuotedChar() throws StringScanException {
StringScanException exception = null;
char retval = 0;
int idxSave = idx;
skipWhiteSpace();
if (idx == len) {
exception = new StringScanException(idx, "end of input");
} else if (buf[idx++] == '\'') {
try {
retval... |
87154af0-d059-4fc0-971f-38e5213ab23a | 4 | public int[] calcStockSpan(int[] prices) {
int[] spans = new int[prices.length];
Stack<Integer> indexes = new Stack<Integer>();
indexes.push(0);
spans[0] = 1;
for(int i = 1; i < prices.length; i++) {
while(!indexes.isEmpty() && prices[i] >= prices[indexes.peek()]) {
indexes.pop();
}
spa... |
b52fc348-2de3-4990-b250-101c19799206 | 0 | private void swap(int[] array, int left, int right){
int temp = array[left];
array[left] = array[right];
array[right] = temp;
} |
64c2bbfb-01a3-4e18-affa-b157b54dd7bd | 3 | public void setMaskVisible(boolean isMaskVisible) {
this.isMaskVisible = isMaskVisible;
if (isMaskVisible) {
if (maskFormatter == null) {
try {
maskFormatter = new MaskFormatter(createMaskFromDatePattern(datePattern));
maskFormatter.set... |
b0f44d58-535e-42b4-be27-1aeea2ca5a13 | 7 | @Override
public String makeMobName(char gender, int age)
{
switch(age)
{
case Race.AGE_INFANT:
case Race.AGE_TODDLER:
return name().toLowerCase()+" puppy";
case Race.AGE_CHILD:
switch(gender)
{
case 'M':
case 'm':
return "boy " + name().toLowerCase() + " puppy";
case 'F':
... |
5fbe4f58-3fee-4dac-b804-8cf9902a850d | 8 | @Override
public String healthText(MOB viewer, MOB mob)
{
final double pct=(CMath.div(mob.curState().getHitPoints(),mob.maxState().getHitPoints()));
if(pct<.10)
return L("^r@x1^r is raging in bloody pain!^N",mob.name(viewer));
else
if(pct<.20)
return L("^r@x1^r is covered in blood.^N",mob.name(viewer))... |
9081f377-4621-4556-abe3-291e6893f687 | 3 | private void saveFile(File folder, String file, String link) {
deleteOldFiles();
if (!folder.exists()) {
this.fileIOOrError(folder, folder.mkdir(), true);
}
downloadFile(link, folder);
// Check to see if it's a zip file, if it is, unzip it.
final File dFi... |
8b614e2b-f69c-4a0e-a625-d07cf4264397 | 9 | public static void main(String[] args) throws Exception {
// process command line arguments
if (args.length < 5) {
System.out.println("usage: TestRdt myIp myPort " +
"wSize timeout [ debug ] " +
"[ discProb delta runLength ] " +
"[ peerIp peerPort ]");
System.exit(1);
}
InetAddress myIp = Ine... |
c2dcbb46-4b0e-41cb-bbf4-9759cb48de07 | 4 | @Override
public boolean equals(Object obj) {
if (obj == null || !(obj instanceof Trapezium)) {
return false;
}
Trapezium other = (Trapezium)obj;
return (this.getMinorBase() == other.getMinorBase() && this.getHeight() == other.getHeight() && this.getMajorBase() == other.g... |
7ebc8297-359e-4b87-89c3-85f7b6a60275 | 5 | public static void main(String[] args) {
Scanner in = new Scanner(System.in);
char grade = in.next().charAt(0);
switch (grade) {
case 'A':
System.out.println("Excellent");
break;
case 'B':
System.out.println("Good");
break;
case 'C':
System.out.println("So so");
break;
case 'D':
System.out.println("Fails"... |
31fbd4f3-8387-4767-b9e2-f633b1b9a815 | 8 | @Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if((affected instanceof MOB)
&&(msg.amISource((MOB)affected))
&&(msg.targetMinor()==CMMsg.TYP_DAMAGE)
&&(msg.tool() instanceof Weapon)
&&(msg.value()>0)
&&(msg.target() instanceof MOB)
&&(((Weapon)msg.tool()).weaponClassif... |
63e6fdba-087c-48e0-9576-803b6c69156f | 5 | public static void ex11(){
int [][] array=new int[5][5];
int multi=1;
for(int i=0; i<5; i++){
for(int j=0; j<5; j++){
array[i][j]=(int)(Math.random()*10);
multi=multi*array[i][j];
if(j<4){System.out.print(array[i][j]+"\t");}
else{System.out.println(array[i][j]+"\tMultipicació fila => "+multi);}
}
m... |
8080baa0-8dfd-4ba1-8100-0e4ea4910f20 | 1 | public static boolean saveDB(Statement st) {
try {
st.execute("UPDATE Player SET Coins='" + coins + "' WHERE Name='" + userName + "'");
st.execute("UPDATE Player SET Playtime='" + playtime + "' WHERE Name='" + userName + "'");
st.execute("UPDATE Player SET lck_lvl='" + lck_lvl + "' WHERE Name='" + userName +... |
2b50c857-96fc-4ffa-8ce4-341b3f8c435f | 3 | public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case WHAT:
return isSetWhat();
case WHY:
return isSetWhy();
}
throw new IllegalStateException();
} |
234fea59-6eb6-42ed-ac92-45aec2877681 | 0 | public String getName() {
return name;
} |
726eb226-c5c5-4a3c-9395-c4ebf77b4e0e | 7 | public static int getMethodCountForName(Class<?> clazz, String methodName) {
Assert.notNull(clazz, "Class must not be null");
Assert.notNull(methodName, "Method name must not be null");
int count = 0;
Method[] declaredMethods = clazz.getDeclaredMethods();
for (Method method : declaredMethods) {
if (methodN... |
a0cbfcdb-2f06-4531-babd-45d39ef7ad4f | 6 | public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html;charset=utf-8");
response.setStatus(HttpServletResponse.SC_OK);
JSONObject result;
Pattern p = Pattern.compile("/db/api/([\\w]+)/([\\w]+)/... |
1c35e3fd-c4d4-4e48-b4b5-ddec1f0e4bc7 | 2 | @Override
public Set<Category> getCategories() {
Set<Category> categories = new HashSet<Category>();
PreparedStatement pStmt = null;
ResultSet rs = null;
try {
pStmt = conn.prepareStatement("SELECT * FROM CATEGORY ORDER BY id");
rs = pStmt.executeQuery();
while (rs.next()) {
Categ... |
31f57b23-4bfa-4ada-83c6-88f7eaef3ac7 | 8 | public synchronized int hashCode() {
if (__hashCodeCalc) {
return 0;
}
__hashCodeCalc = true;
int _hashCode = 1;
if (getCaregiver() != null) {
_hashCode += getCaregiver().hashCode();
}
if (getSchTask_address() != null) {
_hashCo... |
56bd378f-47c2-4318-b291-78f7cfad5b0f | 0 | private FalseStartLabel()
{
super();
setFont(DefaultUIProvider.getQuestionPriceFont());
} |
bcf65001-6005-4301-8f1a-90bb8e33d13e | 6 | @Override
public void run() {
try {
BamWindow window = bamWindows.getWindow();
ReferenceBAMEmitter emitter = new ReferenceBAMEmitter(referenceFile, counters, window, options);
//Store intermediate results in temporary files
String tmpDataPrefix = "." + generateRandomString(12);
File data = new F... |
9b8a2c7b-bc5f-466c-9efc-7822ea7a90f2 | 0 | public String getSectorWork() {
return sectorWork;
} |
b97ad7a2-74b9-4abc-89d6-6a486cd44421 | 0 | public void setYCoordinate(double y)
{
yCoordinate=y;
} |
448c08b8-df84-4b8e-ba0f-066c6272b741 | 4 | public ConfigurationHolder getExactWorld(String world) {
for (ConfigurationHolder holder : this) {
if (holder.getType() == ConfigurationType.WORLD)
if (holder.getWorld().equalsIgnoreCase(world))
if (holder.getName().equalsIgnoreCase(world))
return holder;
}
return null;
} |
bb8592b2-e1dd-40a2-b13c-a1258d0ebd8f | 7 | private Map<String, Class<?>> loadExtensionClasses() {
final SPI defaultAnnotation = iFaceType.getAnnotation(SPI.class);
if (defaultAnnotation != null) {
String value = defaultAnnotation.value().trim();
if (value != null && value.length() > 0) {
if (defaultExtensionName == null) {
defaultExtensionNam... |
88aac78b-f072-442b-b03c-8faaeedf24e5 | 2 | public double sign(double x){
if (x > 0){
return 1;
}else if (x < 0){
return -1;
}else{
return 0;
}
} |
25044b05-0af0-4d0e-90aa-6aca0110322c | 3 | private void addAuthenticationRealm(Metadata metadata) throws XPathExpressionException {
String jdbcRealmBinding = metadata.getRuntimeParameter("glassfish3", "auth-realm.database", null);
if (jdbcRealmBinding == null) {
return;
}
// Verify that the database binding exists
... |
063544bf-d9f6-4890-a81f-276375e97ee0 | 1 | public static void main( String[] args )
{
Client application; // declare client application
// if no command line args
if ( args.length == 0 )
application = new Client( "127.0.0.1" ); // connect to localhost
else
application = new Client( args[ 0 ] ); // use args to connec... |
979b82aa-5123-41d1-82b0-300b2f9b0ee0 | 7 | private void showSimpleLine2D(List<Cubie> cubes, int lineNumber, Face face) {
boolean showFaceIdentified = face.equals(this.rubiksCube.getPressedFaceIdentified())
&& this.rubiksCube.isFaceMove();
for (int columnIndex = 0; columnIndex < this.rubiksCube.getSize(); columnIndex++) {
double x... |
6e3bc515-1913-4b24-a8f7-3544e0ffc416 | 3 | public boolean execute(CommandSender sender, String[] args) {
GroupManager groupManager = Citadel.getGroupManager();
String groupName = args[0];
String senderName = sender.getName();
if(groupManager.isGroup(groupName)){
Faction group = groupManager.getGroup(groupName);
if(group.isFounder(senderName)){
... |
654c6152-64ce-4bb4-80c2-67fc59c155e1 | 7 | public Object nextValue() throws JSONException {
char c = nextClean();
String string;
switch (c) {
case '"':
case '\'':
return nextString(c);
case '{':
back();
return new JSONObject(this);
case '[':
... |
cde17258-d53c-4e00-a452-42340e38ef3a | 3 | @Override
public void actionPerformed(ActionEvent e) {
OutlinerDocument doc = (OutlinerDocument) Outliner.documents.getMostRecentDocumentTouched();
OutlinerCellRendererImpl textArea = doc.panel.layout.getUIComponent(doc.tree.getEditingNode());
if (textArea == null) {
return;
}
Node node = textArea.n... |
907efe2c-840a-45b4-b877-372fac8246a8 | 3 | public Object getValueAt(int row, int col) {
if(row>-1 && col>-1 && data!=null)
return data[row][col];
else
return null;
} |
c3a86143-a373-4e9e-bf6e-9f3bb5498e90 | 8 | private boolean requirementsMetSpend(){
if(requireApSpentTree > DDOCharacter.getTreePointsSpent(prestige)) //make sure enough points are spent
return false;
if(requireClassLevel > DDOCharacter.hasClassLevels(prestige)) //x class levels required for most enhancements
return false;
if(requireAllOf... |
e0e3dc24-b0bf-46b4-98d4-d54328090b3a | 0 | public void pysaytaHyppy() {
isoHyppy = 0;
} |
f599d1f8-307b-447f-9b52-12aa4b6fb34b | 0 | public Image getImage() {
return myImage;
} |
13105416-6279-49c1-ac4d-9735239c71d7 | 5 | @Test
public void testPlaylistMusic() {
try {
PlaylistMusic pl = new PlaylistMusic("/home/andreluiz/a.mp3");
} catch (CannotReadException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (TagExc... |
7db37bde-7c79-44a2-91b7-6fb6da4f43c4 | 6 | public Time(int hour, int min) {
if(hour < 0 || hour > 23 || min < 0 || min > 59) {
if (hour == 24 && min == 0) {
this.hour = hour;
this.min = min;
}
else {
throw new IllegalArgumentException();
}
}
this.hour = hour;
this.min = min;
} |
06154b3c-2c49-4d12-9e42-dd82109bd8dd | 2 | @Override
public boolean onMouseUp(int mX, int mY, int button) {
Iterator<IScreenItem> it = screenItems.iterator();
while(it.hasNext()) {
IScreenItem item = it.next();
if(item.onMouseUp(mX, mY, button)) {
return true;
}
}
r... |
e52d1c59-6c97-4f40-93f7-87f1981561fd | 6 | public static String promptStudentStatus(){
Scanner myKey = new Scanner(System.in);
String status = null;
boolean successful = false;
do{
System.out.println("What is the status of this student?\nPress 1 for alumni\nPress 2 for graduate\nPress 3 for undergraduate\nPress 4 for a graduate TA\nPress 5 for a und... |
3918f2e2-0a68-4720-a7cb-8a99983b2fae | 0 | public DataModel getDataModel() {
return dataModel;
} |
0b5896b8-8387-4e4e-a9e7-3a40b55b8a20 | 2 | private void expressionList()
{
if (have(NonTerminal.EXPRESSION0))
{
do
{
expression0();
} while (accept(Token.Kind.COMMA));
}
} |
3b0ce2dc-a26e-4702-99df-de403fac7b93 | 0 | @Test
public void testMakePayment() {
this.card2.makePurchase(100);
this.card2.makePayment(25);
assertEquals(75, this.card2.getBalance());
} |
b8d4a159-fee8-4b4b-acbf-91d4f9d4866c | 9 | public static int divide(int num1, int num2) {
if (num2 == 0) {
throw new RuntimeException("Divisor cannot be 0!");
}
if (num1 == 0) {
return 0;
}
if (num1 < 0 && num2 < 0) {
return divide(negate(num1), negate(num2));
} else if (num1 < 0 && num2 > 0) {
return negate(divide(negate(num1), num2))... |
65ad3f46-8cb9-4ec4-9ebc-b95da24e3830 | 8 | @Override
public void affectCharStats(MOB affectedMOB, CharStats affectableStats)
{
if((!noteach)&&(affectedMOB.isAttributeSet(MOB.Attrib.NOTEACH)))
affectedMOB.setAttribute(MOB.Attrib.NOTEACH,false);
for(final int i: CharStats.CODES.BASECODES())
{
if(stats[i] >=0)
affectableStats.setStat(i,stats[i])... |
2082320d-71fb-45fc-a0a3-ad6ce003d7bf | 9 | public void keyPressed(KeyEvent e){
try{
if(e.getKeyCode() == KeyEvent.VK_W){
hero.setDir(90);
hero.move();
} else if(e.getKeyCode() == KeyEvent.VK_A){
hero.setDir(180);
hero.move();
} else if(e.getKeyCode() == KeyEvent.VK_S){
hero.setDir(270);
hero.move();
} else if(e.g... |
99b6bee5-23ec-4476-a8f5-3191b7820fc6 | 7 | public boolean canMove(int oldX, int oldY, int newX, int newY, boolean isNewSpotEmpty) {
int deltaX;
int deltaY;
deltaX = Math.abs(newX-oldX);
deltaY = Math.abs(newY-oldY);
if (deltaX == deltaY && deltaX == 1 && deltaY == 1){
return true;
}else if (deltaX == 0 && deltaY == 1){
return true;
}... |
593504dd-9cdb-40c5-bdbe-628a4bba2009 | 9 | @Override
public void input(float delta) {
if (Input.getMouseDown(0)) {
Input.setCursor(false);
Input.setMousePosition(centerPosition);
mouseLocked = true;
}
if (Input.getMouseDown(1) && rightClickUnlock) {
Input.setCursor(true);
mouseLocked = false;
}
if (Input.getKey(unlockMouseKey)) {
... |
3b9a5011-caba-44cf-8529-76940ee557da | 9 | public Object parse(String arg) throws ParseException {
File result = null;
try {
result = new File(arg);
if (mustExist && !result.exists()) {
throw (new ParseException(result + " does not exist."));
}
if (mustBeDirectory && result.exists() && !result.isDirectory()) {
... |
aeaf4019-1698-4988-b2ca-4c0b8b00d6a7 | 7 | public boolean begin(String[] args)
{
//read in system properties
String OS = System.getProperty("os.name");
systemInfo.put("OS", OS);
String localIP = "No Network Connection";
try {
localIP = InetAddress.getLocalHost().getHostAddress().toString();
} catch (UnknownHostException e) {
e.printStackTrace... |
0c7b38e9-1a1c-4294-a393-aeb0303b4478 | 4 | public void permanentlyRemoveElement(Element element) {
if (element == null)
throw new IllegalArgumentException("The given parameters are invalid!");
final Position elemPos = getElementPosition(element);
if (validPosition(elemPos)) {
if (element instanceof Removable)
((Removable) element).remove();
... |
25a018e4-a0dd-4479-ad33-d11d91636790 | 8 | public boolean isRunningCmd(ZooKeeper zk) {
List<String> hostnameNotOk = new ArrayList<String>();
for (int i = 0; i < retryTimesInline; ++i) {
List<String> hostnameList = getZkHostNameList(zk);
if (hostnameList == null
|| hostnameList.size() < hostNameTaskAll.size()) {
try {
Thread.sleep(timeo... |
71fd4595-49de-473e-b3bb-9a59266c28c2 | 4 | public int count(String dithered, String[] screen) {
int res = 0;
char[] dits = dithered.toCharArray();
for (int i = 0; i < screen.length; i++) {
String temp = screen[i];
char[] temps = temp.toCharArray();
for (char c : temps) {
for (char d : d... |
dbdce293-72e0-4118-b0bc-23e2fd8e7a46 | 0 | @Override
public boolean supportsMoveability() {return true;} |
190cc2b3-044a-4732-98a8-8d41d0baec41 | 4 | public DatosIteracion masEficiente() {
DatosIteracion d = new DatosIteracion("auxiliar");
Lectura l = new Lectura(999999, 0, 0);
d.getValoresLecturas().add(l);
for (int i = 0; i < this.getValoresIteraciones().size(); i++) {
if ((d.getValoresLecturas(d.getValoresLecturas().size() - 1)
.getCapturados()... |
4d0d55a2-8171-491c-bebf-cf0d9fec83c6 | 5 | @Override
public boolean conditionArret() {
boolean isEqualToZero = false;
int somme;
for (int j = 0; j < transitionResultante.length; j++) {
somme = 0;
for (int k = 0; k < transitionResultante[0].length; k++) {
somme += transitionResultante[j][k];
... |
d6d6c424-8d8e-4e7d-9229-01a081ffa308 | 4 | public void addChild(WorldObject object) {
if (object == null) return;
if (children.contains(object)) return;
WorldObject p = getParent();
while (p != null) {
if (p == this) {
new KatamaException("Cannot add an object as a relative of itself!", "Object: "... |
d76e9696-6276-4912-b760-f2aa472e6ce8 | 0 | public final static Logger getLogger() {
return LoggerFactory.getLogger(CFAction.class);
} |
bb43af0b-4295-4df9-a599-522d8238114d | 1 | public ArrayList getAnswersBooleans() {
ArrayList collectedAnswers = new ArrayList();
for (int i = 0; i < table.getModel().getRowCount(); i++) {
collectedAnswers.add(tableModel.getValueAt(i, 1));
}
return collectedAnswers;
} |
fc41b782-82c0-4900-b58f-03428a7e4319 | 2 | public void play() {
//se sale si el sonido no a sido cargado
if (!isLoaded())
return;
//vuelve a empezar el sound clip
clip.setFramePosition(0);
//Reproduce el sonido con repeticion opcional.
if (looping)
clip.loop(Clip.LOOP_CONTINUOUSLY);
else
clip.loop(repeat);
} |
4b1d963b-ba2e-413e-a09b-289ec8ed799c | 4 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Connection other = (Connection) obj;
if (this.from != other.from) {
return false;
}
... |
3479cd3d-2aa1-4450-9875-77d46986f363 | 4 | public static databook QueryInfo(String title){
int i = 0;
double d = 0;
databook bk = new databook();
ResultSet restl=null;
try{
contct=connector.getConnection();
Sttt=contct.prepareStatement("select * from bk where title= '"+title+"'");
restl=Sttt.executeQuery();
while(restl.next(... |
3e38d8b8-09f5-4eb8-9482-2da3b93020bb | 5 | public boolean setServer(String server)
{
boolean validServer = false;
if(server.length() > 0)
{
Socket toServer;
try {
this.server = server;
System.out.println("Connecting to: " + server);
toServer = new Socket(server,directorySocket);
ObjectOutputStream outToServer = new ObjectOutputStrea... |
aaf2b510-cbbb-4b55-ae77-f98d88636781 | 7 | public Network bond(Network B, int bondingSiteA, int bondingSiteB){
Network C;
ArrayList<Node> nodesA = this.copyNodes();
ArrayList<Node> nodesB = B.copyNodes();
ArrayList<Node> nodesC = new ArrayList<Node>();
int numNodesA = this.numNodes;
int numNodesB = B.getNumNodes();
... |
8ded5182-5091-4450-9e1d-ca37b9bf48cf | 5 | public TeamProfile(Team tempTeam)
{
//Set team equal to param in object
team = tempTeam;
//Initialize objects
txtComments.setText(team.stats.getComments());
/***************SETUP TABLE**************/
//Pull data for table into a 2D array
Object [] columnName... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.