method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
0bc335f0-e85f-456d-8875-961d8e038002 | 1 | public void cancelCommunication(final SubLWorker worker) throws IOException {
final Integer id = worker.getId();
if (id.intValue() < 0) {
//@note serial communications cannot be canceled right now
return;
}
final String command = "(fif (" + "terminate-active-task-process"
+ " " +... |
639bb2a4-557a-43eb-b9ab-b8792292c01e | 7 | @Override
public void executeMsg(final Environmental myHost, final CMMsg msg)
{
super.executeMsg(myHost,msg);
if((affected!=null)
&&(affected instanceof MOB)
&&(msg.amISource((MOB)affected)||msg.amISource(((MOB)affected).amFollowing())||(msg.source()==invoker()))
&&(msg.sourceMinor()==CMMsg.TYP_QUIT))
{
... |
d3e96029-1e70-49a0-9bcc-267695318104 | 1 | private void itmMnuLancarHorasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_itmMnuLancarHorasActionPerformed
if (usuarioLogado.getTipo().equals("Encarregado")) {
LancarHorasAtividadeForm lancarHorasAtividadeForm = null;
lancarHorasAtividadeForm = new LancarHorasAtivi... |
70e209d7-fab4-4fc0-889c-1fdf2136669c | 5 | public JFinalClassLoader(WebAppContext context, String classPath) throws IOException {
super(context);
/*
* classPath = System.getProperty("java.class.path");
* getProperty()将许多条classPath路径以File.pathSeparatorChar (Windows中为 ; )相隔
* 的方式连接成一条字符串。
* 如: ... |
061b8abc-eab8-4cfa-97ad-01f790db68b2 | 4 | public static String addCustomParamsToUrl(String url,
CustomParameter... customParams) {
String retVal = url;
if (retVal != null && customParams.length > 0) {
StringBuilder builder = new StringBuilder(retVal);
for (int i = 0; i < customParams.length; i++) {
if (i == 0) {
builder.append(QUESTION_MA... |
e24dc4d7-9c7c-405b-ac98-138a8af3837a | 7 | public boolean bootstrap2()
{
String userId = node.getUserId();
boolean bootstrapped = false;
System.out.println(userId + ": Bootstrapping...");
for (Contact c : bootstrapList)
{
node.getRouteTable().add(c);
}
//while (!bootstrapList.isEmpty() &&... |
6469dd1b-b89c-41fd-b5a5-22c34fccda99 | 0 | public Task getById(Integer taskId) {
Criteria criteria = sessionFactory.getCurrentSession().createCriteria(Task.class);
criteria.add(Restrictions.eq("id", taskId));
return (Task) criteria.uniqueResult();
} |
4f8d0af5-0dd2-43f5-b4bc-b35e6b813824 | 3 | public static CharacterPriorityHandlingEnum getPriorityHandlingEnum(int priority) {
switch (priority) {
case 1:
return THE_GOOD;
case 0:
return THE_BAD;
case 2:
return THE_UGLY;
}
return null;
} |
740c43b8-fdd4-4bde-a817-a28654c1f53e | 0 | @Override
@Transactional
public void add(Employee employee) {
sessionFactory.getCurrentSession().save(employee);
} |
4c4aea58-4e76-4455-b6af-29165a48f5ec | 3 | protected Object[] getCellsToShift(mxCellState state)
{
mxGraph graph = this.getGraph();
Object parent = graph.getModel().getParent(state.getCell());
boolean down = isShiftDownwards();
boolean right = isShiftRightwards();
return graph.getCellsBeyond(state.getX()
+ ((down) ? 0 : state.getWidth()), state.... |
54fb5825-5ff4-4b3d-bf49-64b48a47fd99 | 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... |
0f788c91-5932-4446-905b-3fa24a54e923 | 2 | @Test
public void test() {
if (!MongoHelper.delete(attachment, "attachments")) {
TestHelper.failed("delete failed");
}
if (MongoHelper.fetch(attachment, "attachments") != null) {
TestHelper.failed("vote was not deleted");
}
System.out.println("Delet... |
77d6cb52-bbcd-49d9-9a7f-245079a09a65 | 4 | public String save() {
EntityManager manager = this.getManager();
CategoriaDAO categoriaDao = new CategoriaDAOJPA(manager);
FabricanteDAO fabricanteDao = new FabricanteDAOJPA(manager);
MarcaDAO marcaDao = new MarcaDAOJPA(manager);
FornecedorDAO fornecedorDao = new FornecedorDAOJ... |
7dfcb1fa-93ab-46bc-87d4-d8b480247d94 | 3 | public void add(Property pProperty) throws PropertyException
{
if(pProperty != null) {
Property tExisting = null;
if(mProperties == null) {
mProperties = new LinkedList<Property>();
} else {
tExisting = get(pProperty.getClass());
}
if(tExisting == null) {
mProperties.add(pProperty)... |
b9147c0b-2ae8-460b-a2b2-1e5de4355907 | 9 | public void checkLibraries() {
// Check if all libraries that are required are loaded.
for (Restriction r : this.restrictions) {
for (actionType type : actionType.values()) {
for (Requirement req : r.getRequirements(type)) {
if (req == null)
continue;
List<Library> libs = req.getRequiredLib... |
77e067e8-b26e-4101-a567-008875a5e7f4 | 9 | public boolean isEqual(Object obj) {
if (obj == this) {
return true;
}
if (obj == null) {
return false;
}
if (obj instanceof Transition) {
Transition trans = (Transition) obj;
if ((trans.densityCurve == this.densityCurve)
&& (trans.id.equals(this.id))
&& (trans.name.equals(this.name))
... |
127f5672-7f72-478e-a75e-07193c20312a | 1 | public static void main(String[] args) {
int[] num = {1,1,2};
List<List<Integer>> list = new Permutations_II().permuteUnique(num);
for(int i =0 ;i< list.size();i++){
System.out.println(Arrays.toString(list.get(i).toArray()));
}
} |
bd27de8a-32c1-4f65-85c9-4192d42913a2 | 2 | @Override
/**
* @see IPlayer#playTurn(Pile, Pile, int)
*
* Return a card from our hand that we wish to play in the current trick. Use the cards already
* played in the trick, and who played what cards to make the decision. The variable whoPlayedFirstCard
* is the index of the player that played the first ca... |
2d4146f1-75ca-4334-829c-ece2a9343925 | 7 | public void render() {
try {
lastTime = curTime;
curTime = System.currentTimeMillis();
totalTime += curTime - lastTime;
if (totalTime > 1000) {
totalTime -= 1000;
fps = frames;
frames = 0;
}
f... |
1137a32b-0d60-45bd-b91e-bd8aa9338384 | 3 | public static String ofMethod(CtClass returnType, CtClass[] paramTypes) {
StringBuffer desc = new StringBuffer();
desc.append('(');
if (paramTypes != null) {
int n = paramTypes.length;
for (int i = 0; i < n; ++i)
toDescriptor(desc, paramTypes[i]);
... |
24191fd9-8ee9-40f7-a01c-2fc642e52728 | 4 | public void sort(int[] array)
{
int length = array.length;
for (int gap : gaps)
{
for (int i = 0; i < length; i++)
{
int temp = array[i],
j = i;
for (; j >= gap && array[j - gap] > temp; j -= gap)
array[j] = array[j - gap];
array[j] = temp;
... |
c9d90ba8-e95e-4dee-b247-a179a523f7d4 | 5 | public Document parseULand(Document my) throws JDOMException,IOException,FileNotFoundException {
// Assume filename argument
String filename = "servExtract.xml";
//Building with SAXBuilder without validation
SAXBuilder b = new SAXBuilder();
// Create document for Userla... |
c33c4d50-2e3d-4bcd-a4a8-681f3176efc1 | 2 | public void create(String name){
if (name != null || name != ""){
update(Database.CREATE_SUBTASK);
}
} |
5da059cb-4e58-4fb3-8455-efbeef1e06b2 | 4 | public static void fadeIn(Music music, float volumeRaise ,float endVolume, boolean background){
if(!music.playing()){
if(background){
music.loop(1, 0);
}else{
music.play();
}
}
if(music.playing() && music.getVolume() < endVolume){
music.setVolume(music.getVolume() + volumeRaise);
}
} |
9dedeff7-fd01-485b-910d-c06de8bb0278 | 0 | @Test
public void findDuplicateTypeHand_whenThreeTensAndThreeTwosExist_returnsFullHouseTensOverTwos() {
Hand hand = findDuplicateTypeHand(tensFullWithThreeTwos());
assertEquals(HandRank.FullHouse, hand.handRank);
assertEquals(Rank.Ten, hand.ranks.get(0));
assertEquals(Rank.Two, hand.ranks.get(1));
} |
3c9c7cb7-0ca3-4718-8d25-154ec2174206 | 3 | void parseButtons(JButton[] buttons) {
for (int i = 0; i < buttons.length; i++) {
if (buttons[i].getText().toLowerCase().contains("close")) {
buttons[i].addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
w... |
88ca0540-7e90-4c2f-bf56-9d0cb222c570 | 0 | public void testApp()
{
assertTrue( true );
} |
7827fae7-930f-4559-b847-8e1d379bed5a | 7 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final int dirCode=CMLib.directions().getDirectionCode(CMParms.combine(commands,0));
if(!preInvoke(mob,commands,givenTarget,auto,asLevel,0,0.0))
return false;
if(!super.invoke(mob,commands,given... |
20266841-7187-461f-a572-dbe6bd7fa648 | 3 | public void book(boolean debit) {
for (Account selectedAccount : table.getSelectedObjects()) {
if (selectedAccount != null) {
BigDecimal amount = journalInputGUI.askAmount(selectedAccount, debit);
if (amount != null) {
journalInputGUI.addBooking(ne... |
e83e596e-73bd-47d5-8ba8-daef245d8873 | 7 | public void run()
{
if (DEBUG) log("Now running TaskAddition command");
if (taskViewsToUpdate != null)
{
if (DEBUG) log("Get existing tasks from TaskCommander");
ArrayList<Task> tasks = TaskCommander.getTasks();
if (DEBUG) log("Add the task contained in this command to the existing tasks... |
73f5bf79-555f-4f5c-a1b4-d48ead8759f5 | 0 | private void restartGame() {
resourceManager.setCurrentMap(1);
map = resourceManager.reloadMap();
renderer.setBackground(
resourceManager.loadImage("background"+resourceManager.getCurrentMap()+".jpg"));
lives = 3;
score = 0;
municiones = 3;
... |
62d07e8e-6d3e-44f9-a2d7-5166f6da3511 | 0 | public Point2D getCenter() {
return new Point2D(x+(width/2), y+(height/2));
} |
215d450e-514a-48ab-aa84-a322152bfa71 | 3 | @Test
public void test()
throws IOException
{
IterableBufferedReader underTest = new IterableBufferedReader( newBufferedReader(), 40 );
int count = 0;
System.out.println( "################ Test 40" );
for ( String eachLine : underTest ) {
System.out.printl... |
aacdbcc1-24e7-4ba0-af6e-ba8098e64347 | 0 | @Test
public void conwaySimple2() {
x = 3;
y = 3;
rule = new RuleSet("23/3");
grid = new Grille(x, y, rule);
boolean[][] originalValue = {{true, false, false}, {true, true, false}, {true, false, false}};
grid.setBooleans(originalValue);
Grille expectedGrid1 ... |
814ec9ef-bbd9-4339-94d4-01f8bb86d14c | 6 | public boolean isBalanced(BTnode root)
{
int lh,rh;
boolean l,r;
if(root == null)
return true;
l = isBalanced(root.left);
r = isBalanced(root.right);
lh = (root.left != null) ? root.left.height : 0;
rh = (root.right != null) ? root.right.height : 0;
root.height = (lh > rh) ? lh :rh;
r... |
57d9c6f6-38ff-47be-a22c-72404f3ad736 | 7 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Dia other = (Dia) obj;
if ((this.dia == null) ? (other.dia != null) : !this.dia.equals(other.dia)) {
... |
d4234c2f-9d7b-46e6-948f-3460b1f6b470 | 0 | @Override
public String getDesc() {
return "Default";
} |
35032cab-9758-4eea-9b2e-0d2b8ae147e0 | 7 | public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
int n = in.nextInt();
int[][] m = new int[n][n];
for(int i = 0 ; i < n ; i++){
for (int j = 0 ; j < n ; j++){
m[i][j] = in.... |
c281feab-7463-43e9-a670-538817f96afe | 0 | @Override
public double getPerimeter() {
return 2 * _width + 2 * _height;
} |
3d903c2f-5bce-458d-a30c-1e2c5f786fb9 | 3 | private ASPlayer setCurActivity(ASPlayer data, TableType table, int value) {
switch(table) {
case DAY: data.curDay.activity = value;
break;
case WEEK: data.curWeek.activity = value;
break;
case MONTH: data.curMonth.activity = value;
break;
default: plugin.severe("Invalid Type in setCurActivity");
}... |
5a915fbf-9460-4e39-bb45-7053402b60e5 | 7 | @Override
void update() {
super.update();
boolean colliding = Player.x + Player.SIZE > x && Player.x < x + SIZE && Player.y + Player.SIZE > y && Player.y < y + SIZE;
if (colliding && !remove && Player.health < 100) {
Player.health = (Player.health >= 75)? 100 : Player.health + 20... |
53e8cb57-1dfc-440c-bbf4-b30d1222f0cd | 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... |
0163802c-c4dd-4c6b-96f6-f13daa4fa963 | 8 | public RRDCommand getConnection() throws Exception {
if (finished) throw new Exception("Already finished");
RRDPoolMember member = null;
synchronized (this) {
while (true) {
for (int i = 0; i < poolsize; i++) {
if (pool[i] == null) {
... |
8f301415-5f30-4f03-b82d-f70d02e20315 | 2 | public void setEdge(Direction direction, Edge edge) {
if (hasDirection(direction)){
throw new IllegalArgumentException("This edge has already been set");
}
if (edge == null){
throw new IllegalArgumentException("The edge may not be null");
}
edges.put(direction, edge);
} |
1358cfde-d3ca-4d21-8d82-aefb37dfcc1a | 4 | private Tree memberExpressionPro(){
Tree expression=null;
Symbol identifier = null;
if((identifier = accept(Symbol.Id.IDENTIFIER_NAME))!=null){
if(accept(Symbol.Id.PUNCTUATORS,"\\[")!=null){
if((expression = expressionPro()) != null){
if(accept(Symbol.Id.PUNCTUATORS,"\\]")!=null){
return new Mem... |
55a0d8c9-a65b-47ed-940a-23b31101589a | 5 | public CopyOnWriteArrayList<Comprador> planificar(List<Comprador> compradores) {
ArrayList<Comprador> prioridad1 = new ArrayList<Comprador>();
ArrayList<Comprador> prioridad2 = new ArrayList<Comprador>();
ArrayList<Comprador> sinPrioridad = new ArrayList<Comprador>();
for (Comprador comp... |
323d9604-0d41-4ff5-b574-74b3ee261b09 | 0 | public int getSkillId() {
return skillId;
} |
d4aadc0e-0bc2-4285-840c-3aa5144fde7c | 5 | protected int readLength()
throws IOException
{
int length = read();
if (length < 0)
{
throw new IOException("EOF found when length expected");
}
if (length == 0x80)
{
return -1; // indefinite-length encoding
}
if... |
58b64914-a3d1-4718-a1c6-57cebc50d90f | 5 | public RentacarBooking(JSONObject json) throws JSONException {
super(json);
if (json.has(REQUEST)) {
try {
JSONArray requestArray = json.getJSONArray(REQUEST);
JSONObject request = requestArray.getJSONObject(0);
setRentalcar(new Rentacar(null, request));
if(request.has("SessionVars")) {
JSON... |
cbefa583-6513-4595-9300-33e10b8705d2 | 5 | final int[] method1433(int i, int i_14_) {
if (i != 0)
method1427((byte) 108);
anInt2566++;
if (anInt2559 == anInt2565) {
((Class191) this).aBoolean2570
= aClass348_Sub6Array2563[i_14_] == null;
aClass348_Sub6Array2563[i_14_] = aa_Sub3.aClass348_Sub6_5206;
return anIntArrayArray2564[i_14_];
}
... |
e58f1030-5a37-48dc-aa07-e1ad98ea1224 | 0 | public int getId() {
return this.id;
} |
9b6ec6aa-b9fe-460e-a2c4-5b98a4df2741 | 1 | public void moveItemById(int itemId, BagLocation targetBag, int targetItemSlot) throws IOException {
this.prepareMoveItem(itemId);
try {
//TODO: explain why this sleep is needed
Thread.sleep(20);
} catch (InterruptedException ex) {
// ignore
}
... |
6543287e-be6f-46f9-ad6f-b2c4d6b41444 | 3 | public Vector<BaseRace> getRankedRaces(int rank) {
Vector<BaseRace> br = new Vector<>();
for (ClassMap item : _classMap) {
if (item.getClassType().getName().equals(_class.getName())) {
if (item.getAverage() == rank) {
br.add(item.getRace());
... |
894cce50-fd3a-4386-93bd-52d56c79034a | 2 | private boolean isNotReplacedByLambda(char ch, String comb) {
for (int k = 0; k < comb.length(); k++) {
if (ch == comb.charAt(k))
return true;
}
return false;
} |
d23bc28e-8afc-41ca-865d-18c24ce752c7 | 6 | private void release(Location blankLocation){
int temp_X = blankLocation.getX();
int temp_Y = blankLocation.getY();
Location temp = null;
for(int i=temp_X-1;i<=temp_X+1;i++){
for(int j=temp_Y-1;j<=temp_Y+1;j++){
if(isValidX(i) && isValidY(j)){
temp = new Location(i,j);
if(isUnclickedState(temp)... |
4f8969a0-9bdb-47a9-ab03-56f01e3a5fd5 | 8 | private void drawLevelProgress(Graphics2D graphics) {
Color color;
String message;
if (lives == 0) {
color = Color.RED;
message = "GAME OVER";
}
else if (level.isLastWave() && spawnTicks >= 30 && spawnTicks <= 270) {
color = Color.YELLOW;
... |
737912a5-cebc-43a6-aa40-5c1e59137530 | 4 | protected void processKeyEvent(NativeKeyEvent e) {
int id = e.getID();
EventListener[] listeners = eventListeners.getListeners(NativeKeyListener.class);
for (int i = 0; i < listeners.length; i++) {
switch (id) {
case NativeKeyEvent.NATIVE_KEY_PRESSED:
((NativeKeyListener) listeners[i]).nativeKeyPress... |
8e7691d8-9308-4354-b2a9-089585c4b4d4 | 9 | @Test
public void reTest4() {
userInput.add("hi");
userInput.add("my name is meng meng");
userInput.add("can i teach you a recipe");
userInput.add("french fries");
// removableFiles.add("french fries");
userInput.add("france");
removableFiles.add("france");
userInput.add("you need potatoes");
userInpu... |
a3b3f538-c8fc-4a93-8e34-5dc96693f99d | 3 | public static void main(String[] args) throws SQLException {
ShowEmployeesAlphabeticallyOOP command = new ShowEmployeesAlphabeticallyOOP();
Collection<ShowAllEmployeesBasicInfo> allEmployeesBasicInformation = command
.getAllEmployeesBasicInformation();
if (allEmployeesBasicInformation == null
|| allEmploy... |
c8078613-252a-4441-bbcd-8b9adcefed80 | 5 | public int getRowCount(String path, Map<String, String> filterMap) {
try {
Class.forName("com.hxtt.sql.dbf.DBFDriver");
String connString = String.format("%s%s", "jdbc:dbf:/", path.substring(0,path.lastIndexOf("\\")));
String encoding = "cp866";
java.util.Properties prop = new java.util.Properties();... |
7a2e37d8-5cac-456d-8dab-9242c4b4fcee | 8 | public static void DamonSportsReport()
{
int overPowered = 820;
int heavyWeight = 600;
int mediumWeight = 400;
int lightWeight = 200;
int maxChest = 840;
int bigChest = 300;
int smallChest = 50;
int maxBack = 820;
int ma... |
69b03cf7-08c0-4408-b4eb-175036a33564 | 9 | protected static Object getParamArg(Class cl)
{
if (! cl.isPrimitive())
return null;
else if (boolean.class.equals(cl))
return Boolean.FALSE;
else if (byte.class.equals(cl))
return new Byte((byte) 0);
else if (short.class.equals(cl))
return new Short((short) 0);
else if (ch... |
86cceb5e-8c0c-4b84-bfd3-9e03cf3c8ffa | 7 | public static void ex10() throws NumberFormatException, IOException{
System.out.print("Nº Filas => ");
int f=Integer.parseInt(stdin.readLine());
System.out.print("Nº de columnes => ");
int c=Integer.parseInt(stdin.readLine());
int[][] array=new int[f][c];
int cont=2;
for(int i=0; i<f; i++){
for(int j=0; j<c; j... |
25221f05-5cdc-48fc-98e5-c198febd8be1 | 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 '\\':
... |
ecf85b1d-bc91-4d35-b3dc-7d0050436e2f | 5 | private static void detalles(TipoProtocolo tipo) {
for(Servidor server : servidores){
if( (tipo == TipoProtocolo.HTTP && server instanceof ServidorWeb) ||
(tipo == TipoProtocolo.DNS && server instanceof ServidorDNS) )
server.printInformacion();
}
} |
db460136-faca-444f-be46-d22b836750b0 | 5 | public void setAttackValueToBlock(int x, int y, int v, String p)
{
if(v > Block.getBlock(getBlock((chunkID < 0 ? 15-x : x),y)).resistance*50f)
{
if(Block.getBlock(getBlock((chunkID < 0 ? 15-x : x),y)).onBlockDestroyedByPlayer(p, 16*chunkID+(chunkID < 0 ? 15-x : x), y, lvl))
{... |
b9043ea2-8497-4853-b303-92f74d1656c6 | 6 | public void keyPressed(KeyEvent kE) {
int key = kE.getKeyCode();
if (key == KeyEvent.VK_UP) Ball.getInstance().move(0, -1);
if (key == KeyEvent.VK_RIGHT) Ball.getInstance().move(1, 0);
if (key == KeyEvent.VK_DOWN) Ball.getInstance().move(0, 1);
if (key == KeyEvent.VK_LEFT) Ball.getInstance().move(-1, 0);
i... |
31a1a0b2-259f-422a-8b9f-f8b3ce3fd021 | 8 | public String populate(URI uri) {
if ( ! this.matches(uri))
{
throw new IllegalArgumentException( "URI does not match regular expression");
}
String retval = pattern;
while (retval.contains("{scheme")) {
retval = subEdit(retval, "{scheme", uri.getScheme(), getScheme());
}
while (retval.contains... |
f7488fdc-606e-4a3f-b1ab-3add42c09ba4 | 4 | public static void createVocab(String line)
{
// Validate
String[] split = line.split(":");
if ((split.length != 3 || ((!split[0].equalsIgnoreCase("m") && !split[0].equalsIgnoreCase("f")))) && split.length != 2)
return;
Vocab v = new Vocab(line);
vocabList.add(v);
} |
1baa469a-55c1-4a89-937e-49a2facc0491 | 2 | public String getIntroductionByPID(Statement statement,String PID)//根据PID获取停车场介绍
{
String result = null;
sql = "select introduction from Park where PID = '" + PID +"'";
try
{
ResultSet rs = statement.executeQuery(sql);
while (rs.next()) {
result = rs.getString("introduction");
}
}
catch (SQL... |
5323e44e-dc18-45b2-9dd7-bcf28edac68d | 2 | public static boolean isValidFontName(String name) {
for (String element : GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames()) {
if (element.equalsIgnoreCase(name)) {
return true;
}
}
return false;
} |
5a9dd795-4fe3-4d65-a587-12a5bc1b96d6 | 0 | public Constraint add(final GeneralValidator validator) {
validator.validate(builder.getParamValue(), builder.getValue());
return this;
} |
3298e163-9d89-4d7f-988c-4091b14e9acd | 8 | private void correctMove(AIHockeyist hockeyist, AIMove move) {
List<AIPoint> evade = new ArrayList<AIPoint>();
for (AIHockeyist opp : opponents) {
AIUnit.LocationTicks lt = hockeyist.predictCollision(opp);
AIPoint p = lt == null ? null : lt.location;
if (p != null) {
... |
345849bc-a045-4cc0-82ad-6d89ad51f4b0 | 4 | public int reverse(int x) {
int r = x;
if (r < 0){
r = -r;
}
if (r == 0){
return x;
}
else{
int a = 0;
while (r > 0){
a = a * 10 + (r % 10);
r = r / 10;
}
if (x < 0){
... |
01bd0b01-0cb1-45cf-9eed-f575a462a0df | 9 | private Object readValue() throws JSONException {
switch (read(2)) {
case 0:
return new Integer(read(!bit() ? 4 : !bit() ? 7 : 14));
case 1:
byte[] bytes = new byte[256];
int length = 0;
while (true) {
int c = read(4);
... |
7d453990-fad8-4c28-a76c-62b1c05526d7 | 4 | public HTTPServer(Configuration config) {
// Print out some information
System.out.println("Current version: " + HTTPServer.class.getPackage().getImplementationVersion());
System.out.println("Serving at: " + "http://" + ServerHelper.getServerIp() + ":" + config.getPort());
System.out.println("Directory... |
0a104700-96ad-4681-945c-f58f10765eb1 | 3 | public void loopSong(String song)
{
//Don't play a song if the jukebox has been muted
if(muted)
{
return;
}
//If no song with that name exists
if(!songs.containsKey(song))
{
System.err.println("Breakout: No song called " + song + " exists");
return;
}
//Stops and rewinds the current so... |
99f2bd08-d799-435e-bbcc-254b2f7ade64 | 4 | private void defprops() {
for(String p : sysprops)
props.put(p, System.getProperty(p));
Runtime rt = Runtime.getRuntime();
props.put("cpus", rt.availableProcessors());
InputStream in = ErrorHandler.class.getResourceAsStream("/buildinfo");
try {
try {
if(in != null) {
Properties info = new Propert... |
986736ec-17f4-4518-8463-de1ab0de788f | 0 | @Override
protected void paintComponent(Graphics g) {
Color bg = new Color((int) (opacite * r), (int) (opacite * v), (int) (opacite * b));
g.setColor(bg);
g.fillOval(0, 0, this.getSize().width, this.getSize().height);
} |
0b4f167d-8cfe-49c0-9767-d9bb6a1d0c74 | 4 | public boolean comprobarVictoria(int j, int columna, int color){
boolean victoria=false;
boolean victoriaVertical=victoriaVertical(j, columna, color);
boolean victoriaHorizontal=victoriaHorizontal(j, columna, color);
boolean victoriaDiagonalDerecha=victoriaDiagonalDerecha(j, columna, color);... |
aed7a972-8f89-46df-b611-bc8c36b9e595 | 6 | public void loadFileDialog()
{
JFileChooser fc = new JFileChooser();
if(fc.showOpenDialog(mainFrame) != JFileChooser.CANCEL_OPTION)
{
try
{
GraphData data;
data = (GraphData) ObjectSerializer.readFromFile(fc.getSelectedFile().getPath());
if(data != null)
{
for(int i=0; i<fun... |
6a1139da-2d39-48aa-b396-64f6b45aadc9 | 7 | private spindle.core.dom.Literal generateLiteral(CtLiteral cLiteral) throws ParserException {
String name = cLiteral.getAtom();
boolean isNegation = false;
String modeName = cLiteral.getMode();
boolean isModeNegation = false;
List<CtLiteral.Not> cNegations = cLiteral.getNot();
for (CtLiteral.Not cNegation ... |
146d83d4-419b-4bec-8bfd-5ece3acb5940 | 8 | @POST
@Path("/Remove")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response Remove (UserResponse data)
{
if (data == null
|| data.password == null
|| data.username == null)
return Response
.status(400) ... |
563be4e2-2bfc-4a92-a4ff-bbacae9bb3a1 | 3 | public void searchBairro() {
facesContext = FacesContext.getCurrentInstance();
requestContext = RequestContext.getCurrentInstance();
List<Bairro> listBairro;
try {
bairro.setCidade(cidade);
listBairro = genericDAO.searchObject(Bairro.class,"bairro",
null, nul... |
1ba384c4-22ca-4e87-ae2a-3f620c7d5579 | 3 | private void btnExcluirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExcluirActionPerformed
if (existeClienteSelecionado() && exclusaoConfirmada()) {
try {
excluir();
} catch (ValidacaoException ex) {
_unitOfWork.rollback();
... |
4ee9655c-d808-40ca-bd5c-ff9cbe41aee8 | 3 | public void updateBooking(String choice, String choiceId) {
int first = Integer.parseInt(choice);
long userId = Long.parseLong(choiceId);
String status;
if (first == 0) {
status = "checked-in";
} else {
status = "checked-out";
}
Query q =... |
23674270-a32f-47fe-bca9-0a6f1639db84 | 7 | public void setPosition(Position paramPosition)
{
if ((this.LastCell != null) && (this.LastPosition != null))
{
if ((this.LastPosition.x != paramPosition.x) || (this.LastPosition.y != paramPosition.y))
{
this.LastCell.x = this.LastPosition.x;
this.LastCell.y = this.LastPosition.y;
... |
0e5dae31-0069-4f38-97a8-eba1582d06e9 | 8 | public static List<String> topologicalSort(Graph graph)
{
if(!graph.getDirected())
throw new UnsupportedOperationException();
ConcurrentLinkedQueue<Vertex> q = new ConcurrentLinkedQueue<Vertex>();
List<String> result = new LinkedList<String>();
for(Vertex v : graph.getVertices().values()){
if(v.get... |
f048cff8-4a70-41c2-ae78-b8a8b514419f | 0 | public ChocolateChipProtected() {
print("ChocolateChipProtected()");
} |
23b11c2c-ac1d-4a93-abdb-1b680b80658e | 0 | private void initTextField(){
Dimension dimensionTextField = new Dimension(290,24);
JLabel nameFile = new JLabel ("File name");
nameFile.setBounds(10, 40, 100, 24);
fieldNameFile = new JTextField();
fieldNameFile.setSize(dimensionTextField);
fieldNameFile.setLocation(na... |
a0a5411b-cab4-44ad-84e6-4d09912e9f54 | 2 | public Albero<T> figlio(int pos) {
if ((pos >= numMaxFigli) || (pos < 0))
throw new ArrayIndexOutOfBoundsException();
return figli.get(pos);
} |
ba3288ec-27cb-4792-a7c3-78c096d2404c | 6 | public void csNewTurn(Random random, ChangeSet cs) {
TransactionSession.completeAll(cs);
setTurn(getTurn().next());
cs.addTrivial(See.all(), "newTurn", ChangePriority.CHANGE_NORMAL,
"turn", Integer.toString(getTurn().getNumber()));
logger.finest("ServerGame.csNewTur... |
55d65d2c-cc6c-49f0-909e-5d43e35ed6ef | 8 | private void visitStandardCall(Node node, Node child)
{
if (node.getType() != Token.CALL) throw Codegen.badTree();
Node firstArgChild = child.getNext();
int childType = child.getType();
String methodName;
String signature;
if (firstArgChild == null) {
i... |
54b93bd4-667d-478a-965d-22a479158582 | 1 | public void setSource( ItemKey<? extends Box> source ) {
this.source = source;
} |
bf7683ed-0069-408b-af24-2d586b515a1c | 6 | private static void createComposant(String s, String obj) {
String [] split = null;
if(s.contains("*")){
split = s.split("\\*");
}else if(s.contains("&")){
split = s.split("\\&");
}
int nb = 0;
int w = 0;
ArrayList<String> labels = new ArrayList<String>();
for(int i = 0 ; i < split.length ; i++){
... |
2af99d37-d9e6-4707-9f45-21d1ae5b417b | 5 | private boolean removePlayerFromGroup(String playerName, String groupName) {
List<String> members;
groupName = plugin.groups.searchInGroups(groupName);
if (plugin.getServer().getPlayer(playerName) == null) {
return false;
}
playerName = plugin.getServer().getPlayer(playerName).getName();
if (... |
44fa9c56-ffbb-49ce-a772-d70b8b004bd9 | 5 | @Test
//Click one by one on Tabs:
public void test() throws IOException {
List<WebElement> navTab = getWebElementsByCss("#cnn_hdr-nav" , "li");
for(int i=0;i<navTab.size()-1;i++){
if(i==1 || i==2 || i==13 || i==14){
navTab.get(i).findElement(By.tagName("a")).click();
nav... |
1787bc58-d981-4527-880f-d66b5fbc85a9 | 3 | @SuppressWarnings("rawtypes")
public static int binarySearch(Comparable[] orderedArray, Comparable element){
int index_a = 0;
int index_b = orderedArray.length;
int half_a_b = (index_a + index_b)/2;
while(index_a < index_b){
if (element.compareTo(orderedArray[half_a_b]) == 0){
return half_a_b;
... |
3e58cbda-bef9-4733-aa01-4ac84e73e5ae | 2 | public void addFstore(int n) {
if (n < 4)
addOpcode(67 + n); // fstore_<n>
else if (n < 0x100) {
addOpcode(FSTORE); // fstore
add(n);
}
else {
addOpcode(WIDE);
addOpcode(FSTORE);
addIndex(n);
... |
54980d88-2915-4375-ab53-2394a277023f | 5 | public void propertyChange(PropertyChangeEvent e) {
if (e.getPropertyName().contains("INITIAL")) {
initialPropertyChange(e);
} else if (e.getPropertyName().contains("IMAGE")) {
imagePropertyChange(e);
} else if (e.getPropertyName().contains("TEXT")) {
textPropertyChange(e);
} else if (e.getPropertyNam... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.