method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
146ad1eb-c319-431d-b9dc-f835c7698831 | 7 | public static JSWindow jWaitNewWindow(String name, int timeout) {
int curr = 0;
if (timeout == 0) timeout = 10000;
while (curr < timeout) {
if (JSBotUtils.lastCreatedWindow != null &&
JSBotUtils.lastCreatedWindow.cap.text != null &&
JSBotUtils.... |
8dcd91ee-c2ec-451e-8e51-51dc02f25a16 | 8 | public void putAll( Map<? extends Character, ? extends Integer> map ) {
Iterator<? extends Entry<? extends Character,? extends Integer>> it =
map.entrySet().iterator();
for ( int i = map.size(); i-- > 0; ) {
Entry<? extends Character,? extends Integer> e = it.next();
... |
42a6b75b-ad0c-4681-8cf9-541ecb90b872 | 5 | public void clickAction(){
// extra code that runs after a successful state change
switch(assignedState){
case SETUP:
cong.setState(Cong.STATE.GAME);
cong.game.resetGame(); //Move this to "GAME" when the "SETUP" window is used
break;
... |
44f5f1bb-74bf-4add-8e9e-40502f05fbc4 | 2 | private boolean doesCurrentMatchNeedSaving() {
if (currentMatch != null) {
if (currentMatch.isInProgress()) {
//TODO: The "hasn't already been saved" part.
//EXTRA: Let users turn these warnings off via the options.
return true;
}
}
return false;
} |
24ba932d-d68c-422f-a717-f925de10d38c | 3 | public Boolean convert(String source) {
String value = source.trim().toLowerCase();
if ("".equals(value)) {
return null;
} else if (Boolean.TRUE.toString().equals(value)) {
return true;
} else if (Boolean.FALSE.toString().equals(value)) {
return false;
}
throw new IllegalArgumentException("Invalid ... |
5f3c3f7b-9b0e-4935-9fbe-1f0a048c5722 | 1 | public static Couleur selectCouleurById(int id) throws SQLException {
String query = null;
Couleur couleur = new Couleur();
ResultSet resultat;
query = "SELECT * from Couleur where ID_COULEUR =? ";
PreparedStatement pStatement = ConnectionBDD.getInstance().getPreparedStatemen... |
d1a2d9d8-e546-49c2-b597-3ee1f42eb460 | 5 | private static boolean modifySchedule(Schedule bean, PreparedStatement stmt, String field) throws SQLException{
String sql = "UPDATE prescriptions SET "+field+"= ? WHERE work_day = ? and username = ?";
stmt = conn.prepareStatement(sql);
if(field.toLowerCase().equals("work_from"))
stmt.setTime(1, bean.get... |
563e89d0-a9ca-478d-baed-e4f9784f6c52 | 6 | private void benachrichtigen(List<Paar> liste,
String methode,
boolean abschaltenMit) {
if (selektiert != null && eigentuemer != null
&& liste.contains(eigentuemer)) {
try {
Object erg = eigentuemer
.getObjekt()
.getClass()
.get... |
fb91384c-0712-4055-9fc4-60ce3d35c50f | 2 | private void addClasses(Document doc, Set<? extends Coverable> files, Element classesElement) {
for (Coverable file : files) {
Element classElement = doc.createElement("class");
classesElement.appendChild(classElement);
classElement.setAttribute("name", file.getUri());
... |
c8855b8a-9b80-4b61-9c73-5cb19ed80568 | 1 | public void close(){
try {
// oos.close();
// ois.close();
in.close();
out.close();
socket.close();
} catch (IOException e) {
System.out.println("رʧܣ");
e.printStackTrace();
}
} |
09a7baa1-c9fc-4d04-b23a-6d154dcf833d | 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... |
180af4a6-7d51-4dcc-932d-38dfbfaa4ac6 | 7 | public Strength nextWeaker()
{
switch (strengthValue) {
case 0: return weakest;
case 1: return weakDefault;
case 2: return normal;
case 3: return strongDefault;
case 4: return preferred;
case 5: return strongPreferred;
case 6:
default:
System.err.println("Invalid call to nex... |
10812476-d3ab-4501-9e2a-652838c0d21a | 8 | public static int[] objectRecognition(int[][] image) {
int[] objects = {0, 0, 0, 0, 0, 0};
for (int x = 0; x < image.length; x++) {
for (int y = 0; y < image[x].length; y++) {
if (image[x][y] == 0) {
objects[0]++;
} else if (image[x][y] == ... |
45ef0b0f-267f-4a66-abf3-3ecc380499cb | 4 | public static String[] stripComments(String[] lines, String... identifiers)
{
List<String> list = new ArrayList<String>();
for(String line : lines)
{
for(String s : identifiers)
{
if(line.contains(s))
{
line = line.substring(0, line.indexOf(s));
}
}
if(line.length() > 0)
{
lis... |
bb0c28b6-ed49-4d8d-aa81-629254912117 | 2 | @Override
public void handleEmptyEventQueue() {
// TODO Auto-generated method stub
super.handleEmptyEventQueue();
if (exec1xTraffic) {
TrafficExportImport.changeReabilityModel();
TrafficExportImport.readEvents("./Traffic/" + id_execution + "_traffic_"+ Tools.getNodeList().size() + ".txt");
//Tr... |
f8ce0bac-925d-44c2-aa5e-209d8e1f1d1e | 9 | @Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
g.setColor(drawInfo.color);
Graphics2D g2 = (Graphics2D) g;
g2.setStroke(drawInfo.stroke);
strokeWidth = (int) (drawInfo.stroke.getLineWidth() + 0.5);
switch (drawInfo.type) {
case Rect:
if (drawInfo.fill) {
if (drawI... |
a7ac56c2-ab93-43da-9861-e82d9beb8cc0 | 9 | @Override
public void perform(ISConnection connection, Map<String, String> params) {
fakulta = params.get("fakulta");
obdobi = params.get("obdobi");
predmet = params.get("predmet");
// URL encode a vstupni kodovani!
nbloku = params.get("nbloku");
// no idea where thi... |
764cf4f1-86f8-434b-83bf-00cea45034a6 | 8 | public boolean menuHandler(String string){
boolean bool = true;
String buffer = "";
String choice = string.toLowerCase();
view.print(buffer);
switch (choice) {
case "find":
view.print(plan.find(view.findPrompt()));
break;
case "add":
... |
76fa469d-8bb5-4414-9518-908ca0188412 | 6 | @EventHandler
public void IronGolemHeal(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getIronGolemConfig().getDouble("IronGolem.H... |
4e237187-c8de-4deb-90e3-db7e979ed243 | 8 | public String longestPalindromeII(String s) {
int[][] A = new int[s.length()][s.length()];
int max = 1, x = 0;
for (int i = 0; i < s.length(); i++) {
A[i][i] = 1;
}
for (int i = 0; i < s.length() - 1; i++) {
if (s.charAt(i) == s.charAt(i + 1)) {
A[i][i + 1] = 2;
max = 2;
x = i;
}
}
fo... |
abcf8c76-0706-454d-b03f-e8a84c2c1734 | 8 | public void printResults(HashMap<Integer, Character> input){
if(type){
int countA = 0;
int countB = 0;
int countC = 0;
int countD = 0;
int countE = 0;
for (Character x : input.values()) {
switch (x) {
case 'A':
countA++;
break;
case 'B':
countB++;
break;
case 'C':... |
03003dbd-43df-436a-8837-d4410f83f141 | 8 | public void startServer() {
if (!isRunable) {
Socket socket = null;
try {
serverSocket = new ServerSocket(8080);
isRunable = true;
while (true) {
socket = serverSocket.accept();
poolConnections.execu... |
f4b72867-8710-42b1-8969-1a2abc0733c2 | 8 | public static void main(String[] args) throws FileNotFoundException, DocumentException {
File[] pdfs = new File("./input").listFiles();
PDFUtil pdfUtil = null;
for (File file : pdfs) {
if (file.getName().endsWith("pdf")) {
pdfUtil = new PDFUtil(file);
while (pdfUtil.goToNextPage()) {
String r... |
e71c69bf-c40e-48c2-bb3f-5674a1e8054d | 3 | public static void benchmarkFloatLargeArrayNative()
{
System.out.println("Benchmarking FloatLargeArray native.");
long length = (long) Math.pow(2, 32);
long start = System.nanoTime();
FloatLargeArray array = new FloatLargeArray(length, false);
System.out.println("Constructor ... |
3163c49d-16b2-4274-bbfe-1133436945be | 0 | private ChatHistory() {
history = new ArrayList<IMessage>();
} |
27c1b11d-8ed3-4331-b1c0-c409bd837739 | 0 | public void setPrice(BigDecimal price) {
this.price = price;
} |
f44f1eb3-3fa0-4bb7-b428-d443707509ce | 5 | private void initComponents() {
setTitle("Import tables");
TableListPanel = new javax.swing.JScrollPane();
TableList = new javax.swing.JList();
ImportSubmitButton = new javax.swing.JButton();
SelectAllCheck = new javax.swing.JCheckBox();
setDefaultCloseOperation(javax.sw... |
88001163-8341-4a4a-b49f-5d4a6d407a4a | 6 | private String aftDo(String[] list) {
int val =0;
int length = list.length;
if(length == 0)
return null;
else
list[length -1] ="";
for(int j = list[0].length()-1; j>=0;j--){
val = (val / 10) ;
for(int i=0; i< list.length-1;i++ ){
... |
0b97306e-d576-45d1-b9af-465249a0d170 | 5 | public void validate() {
//
// Make sure the position table is correct
//
if (positionTable != null && activeTabbedPane == 1) {
TableModel model = positionTable.getModel();
if (model instanceof AbstractTableModel) {
AbstractTableModel tableModel =... |
0ec876fd-8986-4af8-8f9d-370c406d0c1d | 8 | public void onMessage(String channel, String sender, String login, String hostname, String message) {
//...
if (AntiFlood.test(message))
AntiFlood.run(this, channel, sender, message);
//...
if (ParseUrl.test(message))
ParseUrl.run(this, channel, sender, message);
//...
if (BlockchainInfo.test(messa... |
6678fbe4-c89b-4743-8907-60604c689c11 | 3 | public PluginsData() {
String[] plugins = ArrayUtils.addAll(plugins1, plugins2);
Arrays.copyOf(plugins, plugins.length + 1);
plugins[plugins.length - 1] = jQuery;
pluginsSet = new LinkedHashSet<String>(Arrays.asList(plugins));
jQueryAuthorizedVersionsSet = new LinkedHashSet<Strin... |
bf8a81a3-310b-4ceb-a01c-234ed5992349 | 0 | public void receiveDamage(int damage)
{
this.hp = this.hp - damage;
} |
b7b85515-93ce-4c3a-8607-1419cae5aa0f | 0 | private Paddle getPaddle() {
return new Paddle(0, 0, (int)(HORIZONTAL_SCALE * width), (int)(VERTICAL_SCALE * height));
} |
c226246d-05e9-4187-b858-32f8f73c57e5 | 3 | public String open() {
Shell dialog = createContent();
UI.centerShell(shell, dialog);
dialog.open();
while (!dialog.isDisposed()) {
if (!dialog.getDisplay().readAndDispatch())
dialog.getDisplay().sleep();
}
if (!dialog.isDisposed()) {
dialog.close();
}
System.out.println("#User typed:... |
47c1a76c-cdfb-414b-802e-b6a819afea09 | 4 | public void buildAllModels() throws Exception {
// get training dataset.
DatasetBuilder builder = new DatasetBuilder(prototypeName);
// get ActionType attribute from ActionType dataset.
// Use it to get index number of different action
Instances dataset = builder.getDataset(StringUtil.ACTION_TYPE);
Attribut... |
4befd2f9-d51d-4084-acc6-862c2e85813f | 0 | public Account getLatestAccount(){ return accountsCatalog.get(accountsCatalog.size()-1); } |
d2176a8a-1a7c-4be0-b9ee-7df94ec0c046 | 8 | final private void createAndAddNumber(String number) throws InvalidInputException
{
//see if we were given a valid number
try
{
if (!number.trim().equals(""))
{
if (this.OUTPUT_MODE == Calculate.OUTPUT_EXACT_MODE)
{
Fraction newNumber = new Fraction(new BigDecimal(number.trim()), Fraction.ONE_... |
0384e064-79be-4e8e-afac-3c2e42a8d614 | 5 | public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("[");
boolean first = true;
for(int i = 0; i < list.position(); i++) {
int offset = i;
int length = 0;
while(offset + length < list.position() &&... |
75cf8e16-8d99-4705-a56d-f1d9a8f34d0e | 5 | private void setLeadProjekt() {
ArrayList<String> al = null;
try {
String query = "select sid from spelprojekt where aid=" + selectedAnstalld;
al = DB.fetchColumn(query);
} catch (InfException e) {
e.getMessage();
}
if (al != null) {
... |
6acbd259-3c3a-4ff1-9dd1-ae5ad857a1ec | 6 | @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (null == obj) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
TourType eq = (TourType)obj;
if (!super.equals(eq... |
ff157b86-395d-4aaf-af93-975944c23a2b | 3 | @Override
public BigDecimal calculate(Expression expression) {
BigDecimal leftOperand = expression.getLeftValue();
BigDecimal rightOperand = expression.getRightValue();
if(leftOperand == null || rightOperand == null || rightOperand.compareTo(new BigDecimal(0)) == 0){
return null;
}
BigDecimal result... |
107087eb-1ee3-4894-b230-e66458b58358 | 8 | @EventHandler()
public void onPlayerInteract(PlayerInteractEvent e) {
Block b = e.getClickedBlock();
if(b == null || !(b.getState() instanceof Sign)) {
return;
}
Sign s = (Sign)b.getState();
String lines[] = s.getLines();
if(!"[dodgeball]".equalsIgnoreCase... |
83e7fbfc-99ba-43c7-bedc-f060b9c6abc8 | 9 | public static boolean wordPattern(String pattern, String str) {
if (str == null || pattern == null)
return false;
if (pattern.length() == 0 && str.length() == 0)
return true;
HashMap<Character, String> map = new HashMap<Character, String>();
String[] strs = str.split(" ");
if (strs.length != pattern.len... |
31677af4-d208-4650-b840-4e738d51a53e | 3 | @Override
public void rotateYPlus() {
if(orientation == Y) return;
orientation = (orientation == Z ? X : Z);
for(int i = 0; i < others.length; i++) {
IntPoint p = others[i];
others[i] = new IntPoint(p.getZ(), p.getY(), -p.getX());
}
} |
93be9612-87f4-4e92-8cb9-71f4c1813d8e | 5 | public Grammar exportGrammar() {
// Are any yet unconverted?
if (objectToProduction.keySet().size() != alreadyDone.size()) {
highlightUntransformed();
JOptionPane
.showMessageDialog(
convertPane,
"Conversion unfinished! Objects to convert are highlighted.",
"Conversion Unfinished", ... |
0acc4d45-a8b5-4a37-855c-900a4b929246 | 9 | int insertKeyRehash(double val, int index, int hash, byte state) {
// compute the double hash
final int length = _set.length;
int probe = 1 + (hash % (length - 2));
final int loopIndex = index;
int firstRemoved = -1;
/**
* Look... |
68454248-d600-46f2-a8f4-76643944a67e | 0 | public int subtract(int _a, int _b) {
return _a - _b;
} |
955909de-da47-45ef-ac39-44ef73a75a5d | 2 | public Object lookupObject(String name) throws ObjectNotFoundException
{
try {
Socket sock = new Socket(servername, port);
OutputStream out = sock.getOutputStream();
out.write(lookupCommand);
out.write(endofline);
out.write(endofline);
... |
22fdd589-4a23-49de-998c-cf8054572b8d | 5 | private void eventDead() {
eventCount++;
if(eventCount == 1) {
player.setDead();
player.stop();
}
if(eventCount == 60) {
transition.clear();
transition.add(new Rectangle(
GamePanel.WIDTH / 2, GamePanel.HEIGHT / 2, 0, 0));
}
else if(eventCount > 60) {
transition.get(0).x -= 6;
transitio... |
f472f176-b876-4fc8-b472-74fd42fdfa9d | 8 | public static boolean isPermutation(String a, String b){
if(a.length()!=b.length())return false;
int n = a.length();
HashMap<Character, Integer> m = new HashMap<Character, Integer>();
char c;
for(int i = 0; i < n;i++){
c = a.charAt(i);
if(!m.containsKey(c)) m.put(c, 1);
else m.put(c, m.get(c... |
ba9bda5b-1fc8-4ee1-8406-b7d22a600ac9 | 2 | public void testFormat_yearOfEra_twoDigit() {
DateTime dt = new DateTime(2004, 6, 9, 10, 20, 30, 40, UTC);
DateTimeFormatter f = DateTimeFormat.forPattern("YY").withLocale(Locale.UK);
assertEquals(dt.toString(), "04", f.print(dt));
dt = new DateTime(-123, 6, 9, 10, 20, 30, 40, U... |
94090ed4-ed51-4e29-9308-67a87dbe6bf8 | 2 | public void expire() {
expire++;
if (expire == 20 || y > FRAME_HEIGHT) {
isExpired = true;
}
} |
70292e07-c107-4b2c-a4da-41d5732de7ae | 8 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
MOB target=mob;
if((auto)&&(givenTarget!=null)&&(givenTarget instanceof MOB))
target=(MOB)givenTarget;
if(target==null)
return false;
if(!super.invoke(mob,commands,givenTarget,auto,asLe... |
5bd8316c-c6b4-4a31-b293-c0ce32e09e59 | 8 | public static void main(String args[]) throws Throwable {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder();int caso=1;
for (String ln;(ln=in.readLine())!=null;caso++) {
StringTokenizer st=new StringTokenizer(ln);
int K=parseInt(st.nextToken()),... |
fa79d412-0843-4f9a-b18a-392c1cc91c71 | 4 | public void teleport(CommandSender cs, Command cmd, String string,
String[] args) {
final Player player = (Player) cs;
if (player.hasPermission("warpsandports.teleport.tp") || player.isOp()) {
if(args.length == 0){
player.sendMessage(ChatColor.GREEN
+ "All players will be teleported to you in "
... |
036340e6-71cd-4982-94b7-8bcc2defe9bf | 2 | public double getRate(String currencyCode) {
double val = 0;
for (Object rate : this.rates) {
JSONObject obj = (JSONObject) rate;
if (obj.get("code").equals(currencyCode)) {
val = (Double) obj.get("rate");
}
}
return val;
} |
d3c08caf-da21-4c97-a8e0-2c412e50386d | 4 | public void comenzar() {
List<String> olib = new ArrayList<String>();
List<String> olibnames = new ArrayList<String>();
List<String> dspace = new ArrayList<String>();
List<String> dspacenames = new ArrayList<String>();
List<String> epersons = new ArrayList<String>();
List... |
12238e81-e94a-4b6b-afed-ceb9d403760c | 1 | public void setSuper(final boolean flag) {
int modifiers = classInfo.modifiers();
if (flag) {
modifiers |= Modifiers.SUPER;
} else {
modifiers &= ~Modifiers.SUPER;
}
classInfo.setModifiers(modifiers);
this.setDirty(true);
} |
a9a81162-e9ae-4cd6-825a-2fb35f51a41e | 1 | private void compute_pcm_samples10(Obuffer buffer)
{
final float[] vp = actual_v;
//int inc = v_inc;
final float[] tmpOut = _tmpOut;
int dvp =0;
// fat chance of having this loop unroll
for( int i=0; i<32; i++)
{
final float[] dp = d16[i];
float pcm_sample;
pcm_sample = (float)(((vp[10 +... |
4664c93d-88bd-45b4-8521-a98c473ff708 | 5 | public void edit(Ausencia ausencia) throws NonexistentEntityException, Exception {
EntityManager em = null;
try {
em = getEntityManager();
em.getTransaction().begin();
ausencia = em.merge(ausencia);
em.getTransaction().commit();
} catch (Exception ... |
863275a2-6420-44dc-b90c-d3be31e26744 | 5 | private static double[] getResistPoints(int lineNumber, double[] highPrices) {
double[] rPoints = new double[lineNumber];
for(int i =0;i<lineNumber-1;i++){
double price = 0;
for(int j=-5;j<=0;j++){
if((i+j>=0) && (i+j<lineNumber-1) && highPrices[i+j]>price){
... |
041b6018-1cfa-4309-8e4b-61fb9e8067a7 | 1 | public static void postorderTreeWalk(Node node){
if(node != null){
postorderTreeWalk(node.left);
postorderTreeWalk(node.right);
System.out.print(node.key+" ");
}
} |
15a12462-072b-494f-9500-08671e36b87b | 7 | @Override
public boolean mayICraft(final Item I)
{
if(I==null)
return false;
if(!super.mayBeCrafted(I))
return false;
if((I.material()&RawMaterial.MATERIAL_MASK)!=RawMaterial.MATERIAL_WOODEN)
return false;
if(I instanceof Ammunition)
return true;
if(!(I instanceof Weapon))
return false;
if(... |
0b47b923-50de-4072-a1ca-7265b4a6937d | 7 | public boolean login() throws LoginException {
log.debug("calling login");
try {
if (callbackHandler == null) {
throw new LoginException("No callback handler");
}
Callback[] callbacks = configureCallbacks();
callbackHandler.handle(callback... |
842a412e-3d46-4604-bc97-ce83a9506f3f | 7 | @Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
final String method = request.getMethod();
final String url = url(request);
//note that head and get requests call doGet
final String cacheKey = makeKey(re... |
063ce0e3-d274-4aa3-87a6-c6906d000a74 | 0 | @After
public void tearDown() {
} |
30e649b1-64d9-4b3c-af6c-9cc3916d8913 | 7 | public void keyPressed(KeyEvent q)
{
int keyCode=q.getKeyCode();
if (keyCode==q.VK_UP)
{
TetrisMain.getMainApplet().getGame().rotatePiece();
}
if (keyCode==q.VK_LEFT)
{
TetrisMain.getMainApplet().getGame().shiftPiece(-1);
}
if (keyCode==q.VK_RIGHT)
{
Te... |
9c17db35-1782-41aa-b8d3-d5f98c669966 | 6 | private void update(int[] x, int bowlId, int round) {
if (bowlIds.contains(bowlId+round*nplayer)==false) {
info.add(x.clone());
bowlIds.add(bowlId+round*nplayer);
}
mu=0;
for(int[] y:info){
mu+=score(y);
}
mu=mu/info.size();
sigma=0;
scores.clear();
for(int[] y:info){
int s=score(y);
si... |
b7532c10-ddd7-4f3a-acf0-869f7ebb3745 | 5 | private void go(){
int[] p = new int[(int)1e6];
for(int i=2;i<1e6;i++) p[i] = 1;
sieve(p);
int max = 0;
int maxa = 0;
int maxb = 0;
// for(int i=2;i<1e6;i++) System.out.println(p[i]);
for (int i=-999; i<1000;i++){
for (int j=-999; j<1000;j++){
int count = 0;
while(isPrime(count, i, j, p)==1){
... |
4a5f8c49-bdd9-47ab-a118-1bce02131701 | 1 | public static boolean isPrinting(Component component) {
PrintProxy proxy = UIUtilities.getSelfOrAncestorOfType(component, PrintProxy.class);
return proxy != null && proxy.isPrinting();
} |
c3cdca17-7181-426e-b228-1fd798e8b3fe | 9 | protected void computeRect(Raster[] sources,
WritableRaster dest,
Rectangle destRect) {
int formatTag = MediaLibAccessor.findCompatibleTag(sources, dest);
MediaLibAccessor srcMA1 =
new MediaLibAccessor(sources[0], destRect, forma... |
aef74a0e-9ec0-4283-bf08-aa712aa14e7c | 1 | private boolean isCreateVapp(IProperty[] properties, IControllerServices controllerServices){
String createVapp = controllerServices.getStringPropertyValueByName(properties, Utils.CREATE_VAPP);
return createVapp.equals("Yes") ? true : false;
} |
9ea3deb6-e9de-4d33-ba42-cdaf62d4c7bb | 7 | public static void startGameOfLife(boolean drawPoints, GameOfLife game){
StdDraw.setCanvasSize(512, 512); // Adjust the size of the window
StdDraw.setBorder(0); // We added this function ourself in order to adjust the border size
StdDraw.setPenRadius(1/n);
int livecells = 0;
for(int i = 0; i<n; i++){
for(... |
5ca32c08-6060-434e-8c42-f78b6f148e62 | 8 | @Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if(!super.okMessage(myHost,msg))
return false;
if((msg.tool() instanceof Ability)
&&(CMath.bset(((Ability)msg.tool()).flags(),Ability.FLAG_WEATHERAFFECTING)))
{
if(abilityCode()==1)
{
final Ability A=(Ability)msg.to... |
b73fcd05-06c5-49d3-aeac-180c1ee45463 | 6 | private String getMatch(String s) {
for (int i = 0; i < dataList.size(); i++) {
String s1 = dataList.get(i).toString();
if (s1 != null) {
if (!isCaseSensitive
&& s1.toLowerCase().startsWith(s.toLowerCase())) {
return s1;
... |
f30020a0-b62c-4404-b1ae-58627596cded | 6 | public static boolean copyFile(String in, String out) {
File inFile = new File(in);
File outFile = new File(out);
FileChannel inChannel = null;
FileChannel outChannel = null;
try {
inChannel = new FileInputStream(inFile).getChannel();
outChannel = new FileOutputStream(outFile).getChannel();
// ha... |
215acb96-da0c-48c3-92e7-d401db3051b3 | 1 | public static void listDetroitEmployees(EntityManager entityManager) {
TypedQuery<Employee> query = entityManager.createQuery(
"select e from Employee e join e.address a where a.town = 'Detroit'",
Employee.class);
List<Employee> resultList = query.getResultList();
entityManager.close();
for (Emplo... |
e843d7f6-0d0c-46d0-b00c-84a6d8e626fa | 0 | public Boolean getDealerWin() {
return dealerWin;
} |
52a868c1-adf6-4652-9ebd-0af5f305ade3 | 2 | private LocalDate getDate(String toParse) {
//create a new date
LocalDate newDate = LocalDate.now();
//if the string to parse is not valid
if (toParse.length() < 5) {
return newDate;
}
//get the line with the date
if (toParse.indexOf("°") > 0) {
... |
a13d791b-3c21-41f5-ae58-703703a9198d | 6 | public static File getSettingsDir(String program){
String userHome = System.getProperty("user.home", ".");
File work = new File(userHome);
switch(Meta.getOS()){
case Meta.OS_LINUX:
work = new File(userHome, "."+program+"/");break;
case Meta.OS_WINDOWS:
... |
7f17fe7d-ed15-400e-985a-fd9e72fb5b7e | 3 | private int updateCommitList(int resID, int reservID, int status)
{
int result = GridSimTags.AR_COMMIT_FAIL;
ARObject data = searchBooking(resID, reservID);
if (data != null)
{
if (status == GridSimTags.AR_COMMIT_SUCCESS)
{
data.setCommitted()... |
39d085f9-8917-44eb-90a2-83f592bb0462 | 2 | public static boolean isSetToDefaults() {
for (Entry<String, Fonts> entry : DEFAULTS.entrySet()) {
if (!entry.getValue().mDefaultFont.equals(UIManager.getFont(entry.getKey()))) {
return false;
}
}
return true;
} |
04bbcbc6-a9ac-4579-a9a4-e08915cda70c | 1 | private boolean setupPermissions()
{
RegisteredServiceProvider<Permission> permissionProvider = getServer().getServicesManager().getRegistration(net.milkbowl.vault.permission.Permission.class);
if (permissionProvider != null) {
permission = permissionProvider.getProvider();
}
return (permission != null);
} |
f5bda40a-d3c0-49c1-8006-23c342300986 | 1 | @Before
public void prepareSampleDoc(){
URL url = CSVDocumentTest.class.getResource(TEST_DOC_LOCATION);
try {
this.sampleDoc = new CSVDocument(Paths.get(url.toURI()), true);
} catch (URISyntaxException e) {
e.printStackTrace();
}
} |
8d3df574-79d7-4df5-92a2-5e158687196e | 2 | private int getCubeRoot() {
for(int i = 1; i < 11; i ++){
if(i * i * i == solutionFitness.size()){
return i;
}
}
return 0;
} |
fb5c7ece-e740-49aa-a947-d44e47ac8e27 | 8 | protected final List<String> parseQuotesAndStripCommand(String [] args){
final List<String> argList = new ArrayList<String>();
for(int i = 0; i < args.length; i++){
String arg = args[i];
if(arg.charAt(0) == quote){ //We have quotes to strip
f... |
cd48bfac-864f-497e-9d17-a1bac3681b77 | 5 | public void eot() {
if( getReadyState() == READYSTATE.NOT_YET_CONNECTED ) {
closeConnection( CloseFrame.NEVER_CONNECTED, true );
} else if( flushandclosestate ) {
closeConnection( closecode, closemessage, closedremotely );
} else if( draft.getCloseHandshakeType() == CloseHandshakeType.NONE ) {
closeConne... |
8c0aa72d-9aa7-47a5-8222-96200cc6a353 | 4 | protected static int findClosingBracket(String str, int fromIndex) {
int count = 0;
int i = fromIndex;
do {
i++;
if (i >= str.length()) {
return -1;
}
switch (str.charAt(i)) {
case ']':
count++;
... |
e3fffc01-a88c-43fc-8b13-2120a3a9b132 | 4 | @Test
public void removeCompletedRowNotAtBottom() {
testee = new Board(30, 12) {
@Override
public void addNewShape(Shape shape) {
super.addNewShape(new LShape());
}
};
testee.addNewShapeAtRandom();
rotateClockwiseMoveSidewaysThenToB... |
dd270e8c-59ae-4f28-9bf2-b4729fa45c87 | 1 | public static boolean shouldTrackViewportHeight(Component comp) {
Container parent = comp.getParent();
if (parent instanceof JViewport) {
Dimension available = parent.getSize();
Dimension prefSize = comp.getPreferredSize();
return prefSize.height < available.height;
}
return false;
} |
cbdc572c-f122-484e-bd1a-cae89ccc9099 | 7 | public static Rule_dirRegisters parse(ParserContext context)
{
context.push("dirRegisters");
boolean parsed = true;
int s0 = context.index;
ArrayList<Rule> e0 = new ArrayList<Rule>();
Rule rule;
parsed = false;
if (!parsed)
{
{
ArrayList<Rule> e1 = new ArrayList<Rule>()... |
035a3216-42c5-46ee-8f38-d376351486aa | 0 | public void setEmail(String email) {
this.email = email;
} |
55ab1a59-2d99-4b60-a605-5a8294c77539 | 2 | private static Access findAccessByName(String name, Collection<Access> ins) {
for (Access access : ins) {
if (name.equals(access.getField().getName())) {
return access;
}
}
return null;
} |
29b94164-f688-432e-9812-1ef6ae463902 | 7 | private boolean detectCasherType()
{
String table = this.getBillTable();
int n = 0;
if (table.length() == 240)
{
int k = 0;
String nom = "";
String curNameReal = "";
String curName = "";
String curCode = "";
fo... |
8cd45ce1-a05a-4277-bf4f-3dd1302ba291 | 2 | @Override
public void write(int b) throws IOException {
if (migrated || handler == null) {
handler = new RandomAccessFile(targetFile, "rw");
handler.seek(offset);
migrated = false;
}
handler.write(b);
offset++;
} |
96700609-362e-4f20-bde1-443cd6857fe4 | 6 | public double[] subtractWeightedMean_as_double() {
if (!weightsSupplied) {
System.out.println("subtractWeightedMean_as_double: no weights supplied - unweighted values returned");
return this.subtractMean_as_double();
} else {
boolean holdW = Stat.weightingOptionS;
if (weightingReset) {
if (weighting... |
8a811722-d7fc-4b0c-b45e-55856e2cd83d | 4 | private synchronized void deque(Packet np)
{
int dest = getNextHop(np);
if (dest == -1) {
return;
}
// other side is a Sim_entity
int tag = 0;
if (dest == outEnd2_ || dest == outEnd1_)
{
// for junk packets only
if (np.getT... |
fcbf7e0c-95ab-43aa-9cd3-534b25c09cc1 | 8 | public static Proposition stringtoProposition(String s){
switch(s){
case "Facing East": return Proposition.IS_FACING_EAST;
case "Facing West": return Proposition.IS_FACING_WEST;
case "Facing North": return Proposition.IS_FACING_NORTH;
case "Facing South": return Proposition.IS_FACING_SOUTH;
case "... |
a48cdd04-f7d5-4a05-8a1c-e227e732ab2b | 5 | public void calculateScore() {
// readScores();
if (score > people.get(people.size() - 1).getScore()) {
String name = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
name = JOptionPane.showInputDialog(null,
"You have gotten a new high score!\nYour Score: " + score
+ "\nPlease enter... |
4eeddc9a-dc71-4361-85b6-08354e555371 | 1 | public CacheableNode get(long key) {
CacheableNode cacheableNode = (CacheableNode) cache.get(key);
if (cacheableNode != null) {
recent.insertBack(cacheableNode);
}
return cacheableNode;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.