method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
8fa82baf-13e3-49b3-bf67-9b117d40a9be | 2 | public void addDefaultExcludes()
{
super.addDefaultExcludes();
int excludesLength = excludes == null ? 0 : excludes.length;
String[] newExcludes;
newExcludes = new String[excludesLength + 1];
if ( excludesLength > 0 )
{
System.arraycopy( excludes, 0, newEx... |
9105a8c1-59e4-4117-9d48-d11a0155ed3b | 8 | private void checkServerDN(X509Certificate paramX509Certificate)
throws CertificateException {
String str1 = paramX509Certificate.getSubjectX500Principal()
.getName();
MyProxyLogon.logger.fine("MyProxy server DN: " + str1);
int i = str1.indexOf("CN... |
eb6f535f-e1ee-44ca-bff6-16ce296e2981 | 5 | public String getTime() {
if (running == true)
endTime = System.currentTimeMillis();
long elapsed = endTime - startTime;
String time = "";
// hours
time += (elapsed / 3600000);
time += ":";
// minutes
int min = (int) ((elapsed / 60000) % 60);
if (min / 10 == 0)
time += "0";
time += m... |
6031f27e-8ce7-43dd-bdee-f52200007c1c | 9 | private boolean r_mark_suffix_with_optional_U_vowel() {
int v_1;
int v_2;
int v_3;
int v_4;
int v_5;
int v_6;
int v_7;
// (, line 159
// or, line 161
lab0: do {
... |
5a23c448-d6b5-4d5d-bd0f-8e63e61e7e3d | 3 | private Edge lookupEdgeFromCorner(Corner c, Corner downslope) {
for (Edge e : c.protrudes) {
if (e.v0 == downslope || e.v1 == downslope) {
return e;
}
}
return null;
} |
0b03099c-5346-41cd-9895-332e8a64d8cb | 8 | public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String line = "";
StringBuilder out = new StringBuilder();
int times = 1;
d: do {
line = br.readLine();
if (line == null || line.length() == 0)
break d;
int sets =... |
9c9faf4b-852d-4dab-ae1e-83b7f4af0830 | 0 | protected void onInvite(String targetNick, String sourceNick, String sourceLogin, String sourceHostname, String channel) {} |
edfcf518-66a1-40dd-87e9-684f6d69e76f | 8 | public GrahamScan(Point2D[] pts) {
// defensive copy
int N = pts.length;
Point2D[] points = new Point2D[N];
for (int i = 0; i < N; i++)
points[i] = pts[i];
// preprocess so that points[0] has lowest y-coordinate; break ties by
// x-coordinate
// points[0] is an extreme point of the convex hull
// (... |
4cdc60da-8250-44f7-81f6-de6e2f7308cf | 3 | * @return the meeting with the requested ID, or null if it there is none.
* @throws IllegalArgumentException if there is a meeting with that ID happening in the future
*/
public PastMeeting getPastMeeting(int id) throws IllegalArgumentException
{
Meeting m = getMeeting(id);
if(m == null)
{
return (PastMe... |
ed9c6b1d-4fbe-4ad3-a117-98e15342ca0b | 4 | public static int findSecond(int[] times, int first) {
int second = -1;
int secondLowestTime = Integer.MAX_VALUE;
for (int i = 0; i < times.length; i++) {
if (i == first) // already checked
continue;
if (times[i] < secondLowestTime && times[i] > times[first]) {
secondLowestTime = times[i];
seco... |
525818d8-e74d-44fe-82cf-d7113cc2cf6e | 7 | @Override
public String getApplicableMask(MOB studentM, Ability A)
{
if((studentM==null)||(A==null))
return "";
final String AID=A.ID();
final AbilityMapping personalMap = getPersonalMapping(studentM, AID);
if(personalMap != null)
return personalMap.extraMask() == null ? "" : personalMap.extraMask();
... |
5a2e8bdd-3ffa-49ec-9ee1-07b3ac6c2aa0 | 5 | private void Adicionar_ButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Adicionar_ButtonActionPerformed
try {
if(Equipa1_RadioButton.isSelected()) {
if(!AutoGolo_CheckBox.isSelected()) {
modelo1.addElement(Jogador_ComboBox.... |
fa970610-5c7d-41a3-872c-6f4badf4efc7 | 7 | public static void loadModules() {
try {
File f = new File("mods.config");
if (!f.exists())
f.createNewFile();
Scanner scan = new Scanner(f);
while (scan.hasNext()) {
String s = scan.nextLine();
try {
Object ob = Class.forName(s).newInstance();
modules.add((Module) ob);
} catch (... |
97bf5976-9620-41d7-95cc-fb142518b0dd | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (!(obj instanceof Node<?>))
return false;
Node<?> other = (Node<?>) obj;
return this.getElem() == other.getElem()
&& this.getNext() == other.getNext();
} |
201b1d64-eb83-4176-83af-a22faa88aae1 | 6 | private static void audioModWalkFolder(File base, File folder, SoundPool pool) throws IOException
{
if (folder.exists() || folder.mkdirs())
{
for (File file : folder.listFiles())
{
if (!file.getName().startsWith("."))
{
... |
55e6b005-c5fb-4e97-a98e-1f92cecf79e7 | 8 | private ArrayList adjustContributionList(ArrayList contributionList) {
IContributionItem item;
// Fist remove a separator if it is the first element of the list
if (contributionList.size() != 0) {
item = (IContributionItem) contributionList.get(0);
if (item.isSeparator())... |
c4709cd8-26c9-40cc-991b-cb587ebb28ac | 8 | public List<Point> executeQuickHull(List<Point> inputPoints) {
List<Point> convexHull = new ArrayList<>();
if (inputPoints.isEmpty()) {
throw new IllegalArgumentException("Cannot compute convex hull of zero points.");
}
// search extreme values
Point rightmostPoint =... |
411034c3-5bd5-4de7-b05f-b1c36889efae | 8 | public TreeMethodExpression(TreeStore store, FunctionMapper functions, VariableMapper variables, TypeConverter converter, String expr, Class<?> returnType, Class<?>[] paramTypes) {
super();
Tree tree = store.get(expr);
this.builder = store.getBuilder();
this.bindings = tree.bind(functions, variables, converte... |
e824187b-7b97-4f3f-b4d8-05220146531b | 0 | public void setRepeat(int repeat) {
this.repeat = repeat;
} |
5b8bd5e3-4056-4711-963b-a2d4c4a515a9 | 9 | /* */ public static void applyPlayerAction(String action)
/* */ {
/* 360 */ Player p = PlayerList.getInstance().getPlayer(Config.USERNAME);
/* 361 */ p.setPlayerAction("");
/* */
/* 365 */ if (action.startsWith("openShop"))
/* */ {
/* 367 */ int shopId = Integer.parseInt(actio... |
6deaba7c-4bb3-4d0d-abc9-4f04109fcdf8 | 6 | public String getType(File file) throws IOException {
String nombre = file.getName();
if (nombre.contains(".html")) {
return "text/html";
}
if (nombre.endsWith(".css")) {
return "text/css";
}
if (nombre.endsWith(".txt")) {
return "text/... |
49d2008c-1efd-4b08-8f28-95f0677a0d76 | 3 | @Override
public DatabaseTable createTable(String name, Class<?> layout) {
DatabaseTable table = new SQLiteDatabaseTable(this, name);
if (tableExists(name)) {
return table;
}
if (!table.create(layout)) {
return null;
}
return table;
} |
66aa3f13-b8fe-4e7e-8e29-6bbb8fe6284e | 7 | public void removeOnline() {
String file = "C:\\Users\\aawor_000\\workspace\\TCPServer\\src\\Status\\Online.txt";
try {
File inFile = new File(file);
if (!inFile.isFile()) {
System.out.println("Parameter is not an existing file");
return;
}
// Construct the new file that will later be renamed t... |
3ffaf470-1c12-4a67-9f06-04c5926d127f | 8 | public Updater(Plugin plugin, int id, File file, UpdateType type, boolean announce)
{
this.plugin = plugin;
this.type = type;
this.announce = announce;
this.file = file;
this.id = id;
this.updateFolder = plugin.getServer().getUpdateFolder();
final File plug... |
345ff88a-8ddc-49d7-936d-eefcc3bc690e | 3 | @Override
public void virusAttack(int iterationNum) {
if (updateInfectionStatus && iterationNum != this.timeOfUpdate) {
this.infectionStatus = true;
} else {
if (random.getResult()) {
this.updateInfectionStatus = true;
this.timeOfUpdate = itera... |
aad563e8-b3cc-4a4e-90f7-a5ea91360a8e | 0 | public void go()
{
frame = new Frame("Frame Test borderlayout title !");
bn = new Button("Bn");
bs = new Button("Bs");
bw = new Button("Bw");
be = new Button("Be");
bc = new Button("Bc");
frame.add(bn,BorderLayout.NORTH);
frame.add(bs,BorderLayout.SOUTH);
frame.add(be,BorderLayout.EAST);
fram... |
92997e3c-52d8-428e-937e-7ff9ad3095f7 | 9 | public String getSchemeSpecificPart()
{
StringBuffer schemespec = new StringBuffer();
if (m_userinfo != null || m_host != null || m_port != -1)
{
schemespec.append("//");
}
if (m_userinfo != null)
{
schemespec.append(m_userinfo);
schemespec.append('@');
}
if (m_ho... |
8444cc1f-063e-483f-9aeb-7ca231677c7c | 9 | public static void clientRemove(final Socket socket,DataInputStream datais,String basepath) {
boolean success=false;
DataOutputStream dataOutputStream=null;
OutputStream outputStream=null;
try {
outputStream=socket.getOutputStream();
dataOutputStream = new DataOutputStream(outputStream);
// 读取到请求的url
... |
955fc0da-2d73-4cef-98bd-3c92a8f3b19d | 5 | public static final byte getVillageByItem(int itemid) {
byte i = 0;
switch (itemid) {
case 4000241:
i = 1;
break;
case 4000332:
i = 2;
break;
case 4000131:
i = 3;
break;
... |
fdb0e882-1f0c-40f1-9cb3-427a99ac5b44 | 5 | public boolean siirto(int korMista, int levMista, int korMinnne, int levMinne) {
if (logiikka.siirto(korMista, levMista, korMinnne, levMinne)) {
if (musta != null && logiikka.vuoro().equals(musta.vari.name())) {
tekoalySiirto(musta);
}
if (valkoinen != null &&... |
483d8f5f-4069-4de7-9b8c-06cbc481699a | 6 | @Override
public void map(LongWritable key, Text value, OutputCollector<LongWritable, DoubleArrayWritable> output, Reporter reporter) throws IOException {
StringTokenizer tokenizer = new StringTokenizer(value.toString(), ";");
DoubleWritable[] ratings = new DoubleWritable[Coefficient.MAX_RATINGS];
String[] jokeR... |
2a39ba96-9ff7-438e-94a4-34269f1a1e04 | 9 | public static String parseMissionInfoRewardData(Map parseFunctionParam, String field, String content, Boolean isSingle) {
content = content.replaceAll("<br>", "\r\n");//将<br>替换为\r\n '11:6,2:31
StringBuilder tmpContent = new StringBuilder();
if (content.isEmpty() || content.equals("0")) {
... |
f7dcb5ee-c638-40e4-a774-7009fca87cd2 | 8 | public static void mapping()
//all the mapping() does is look at the random number generated thats stored in x
//then assigns the proper row letter to z. Then adds 1 to the integer stored in y
//and prints out to console
{
if(x==0){
z = "A";
System.out.print(z);
System.out.print(y+1);}
if(x==1){
z=... |
ae7cf134-c061-4803-8f4e-a9868d2739fc | 3 | public void setupMenu() {
menuBar = new JMenuBar();
menu = new JMenu("Menu");
menuBar.add(menu);
fileLogin = new JMenuItem("Enter Nickname");
menu.add(fileLogin);
fileLogin.addActionListener(new ActionListener() {
@Override
public void actionPer... |
4ce7defa-ced6-434f-add8-e88b7d30095f | 0 | public void setClaveles(int claveles) {
this.claveles = claveles;
} |
ea7d614d-4b4a-4fca-810d-3227eac4a37c | 2 | public Panel(String tit){
super.setLayout(null);
this.titulo = tit;
boton = new JButton("Agregar "+titulo);
//Persona persona;
correos = new Correos();
numeros = new Numeros();
//titulo = new JLabel(tit);
//titulo.setBounds(40, 20, 200, 20);
//add(titulo);
Object[][] datos = {};
String... |
09d2b1d9-e253-4e60-ba0f-43fd6a5629c7 | 9 | public Field findFieldWithAnnotationAttributeAndValue(Class<? extends Annotation> annotationClass,String attributeName, String attributeValue) {
for(Field field : getFields()) {
if(field.isAnnotationPresent(annotationClass)) {
Annotation annotation = field.getAnnotation(annotationClass);
try {
Method ... |
4708cd35-3efa-4920-b570-b254cc860598 | 7 | protected boolean isPrimitiveWrapper(Object input) {
return input instanceof Integer || input instanceof Boolean ||
input instanceof Character || input instanceof Byte ||
input instanceof Short || input instanceof Double ||
input instanceof Long || input instanceo... |
dbb25564-ee8d-4362-88ad-e3495a057117 | 8 | static boolean f(int[] arr) {
if(arr.length==1)return arr[0]==10;
for(int i=0;i<arr.length-1;i++) {
int[] s=new int[arr.length-1];
for(int k=0;k<i;k++)s[k]=arr[k];
for(int k=i+2;k<arr.length;k++)s[k-1]=arr[k];
for(int k=0;k<4;k++)
if(k!=3||arr[i+1]!=0) {
s[i]=operar(arr[i],arr[i+1],k);
if(... |
55ad4b65-e4e6-4711-9614-749e2e886445 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
NamedElement other = (NamedElement) obj;
if (doc == null) {
if (other.doc != null) {
re... |
d1ac136a-a784-4ea5-af83-2a93a8715d73 | 1 | public ArrayList<Teacher> teachers(ResultSet rs) throws Exception {
DBConnector db = new DBConnector();
ArrayList<Teacher> data = new ArrayList<>();
while (rs.next()) {
data.add(new Teacher(db.getPerson(rs.getInt("personid"))));
}
return data;
} |
2bb6dc96-89e4-4fd9-8d84-1a82f4e27558 | 1 | public Collection pdomFrontier(final Block block) {
if (domEdgeModCount != edgeModCount) {
computeDominators();
}
return block.pdomFrontier();
} |
a78127f0-b3da-4c75-a675-981cf570bea3 | 7 | public void run() {
Log.i(TAG, "BEGIN mConnectedThread");
if (listener != null) listener.newDeviceConnected(this);
if (D) Log.i(TAG, "Starting the TimeoutThread for "+mTimeoutThread.getTime()+" milliseconds");
mTimeoutThread.start();
byte[] buffer = new... |
2c4f54ac-6d29-44df-9a35-8473ceece94e | 4 | public void info(String name, int cost, int flow, int dist, boolean visited, List<String> adj, List<String> adjEnt) {
txtInfoVertexName.setText(name);
txtInfoCost.setText(String.valueOf(cost));
txtInfoFlow.setText(String.valueOf(flow));
txtInfoDist.setText(String.valueOf(dist));
... |
0a56353d-24ef-4db3-a506-cee8fd55742d | 9 | @Override
public OptimusData readDouble(ArrayID aid, PID pid,OptimusShape pshape, OptimusShape starts,
OptimusShape offs) throws IOException {
int[] start = starts.getShape();
int[] off = offs.getShape();
Partition p = this.rmanger.getPartitionById(aid, pid);
if( p == null)
{
System.out.println("Wron... |
a6ade993-f403-4d39-9dca-94ee4f3e8e3b | 7 | @Override
protected boolean theLawIsEnabled()
{
if((holdingClan.length()==0)
||(!allowLaw)
||(totalControlPoints<0)
||(!CMProps.getBoolVar(CMProps.Bool.MUDSTARTED))
||(CMSecurity.isDisabled(CMSecurity.DisFlag.ARREST)))
return false;
if(flagFound(null,holdingClan))
return true;
if(CMSecurity.isDebu... |
e5a3055d-3702-4023-bcfa-c3d9983a9438 | 0 | public BigInteger getIterationCount() {
return iterationCount;
} |
a845f0fe-2774-4d2f-8c01-f7711b123e4e | 5 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
TracksHaveHashtagsEntityPK that = (TracksHaveHashtagsEntityPK) o;
if (hashtagId != that.hashtagId) return false;
if (trackId != that.trackId) r... |
da1d0ffd-2518-4b84-a99f-57f688f55ed1 | 0 | public String getSuffix() {
return suffix.get();
} |
c90c5af2-6e74-45f9-8b23-bbf66cccb495 | 1 | public void addRejectedUser(long uid) {
if (!this.aWaitingId.contains(uid))
return;
this.aWaitingId.remove(uid);
this.aRejectedId.add(uid);
} |
bc1ead90-de50-4d8e-ab1f-e10080f29146 | 8 | public Object getValue(String columnName,ObjectType type) throws DAOException{
Object obj = null;
try{
switch(type){
case DOUBLE:
obj = this.getResultSet().getDouble(columnName);
break;
case INTEGER:
obj = this.getResultSet().getInt(columnName);
break;
case STRING:
obj = this.g... |
f89f070b-c139-408b-a753-66ef6c384be4 | 9 | @Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof MeterNeedle)) {
return false;
}
MeterNeedle that = (MeterNeedle) obj;
if (!PaintUtilities.equal(this.outlinePaint, that.outlinePaint)) {
... |
ee0e763f-dd4f-418c-8b55-fc23c4942b7c | 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 fe... |
bc1f08d7-9e68-4e4d-8237-adf70113e444 | 0 | SymbolNotFoundError(String name)
{
this.name = name;
} |
fa96fadf-599c-4f96-842b-0fc5c275d896 | 0 | @Override
public void setCallObjectType(RemoteCallObjectType remoteCallObjectType) {
this.remoteCallObjectType = remoteCallObjectType;
} |
b2223434-9e41-4b88-baa9-e5a15d34bfe6 | 0 | public void setCheckoutDate(Date checkoutDate) {
this.checkoutDate = checkoutDate;
} |
3d77347e-9a9a-46cb-b9f7-b6fa8ddb21d2 | 7 | public void onSaveNode(MindMapNode node) {
if (this.node != node) {
return;
}
boolean editorContentEmpty = true;
// // TODO: Save the style with the note.
// StyleSheet styleSheet = noteViewerComponent.getDocument()
// .getStyleShee... |
ae6bc89b-4b61-461d-82de-be82c49780f1 | 8 | public ParseArgs(String args[]) throws FileNotFoundException {
String[] argsReal = getRealArag(args);
if (argsReal.length < 1) {
throw new IndexOutOfBoundsException(
"\nError Params: \n\t[0]--start type(server|client|hive)\n\t");
}
startType = argsReal[0];
if (!startTypeE.isContains(startType)) {
... |
dab14fa4-4aad-4f80-bd81-79da0f24a789 | 8 | @Override
public int hashCode() {
int prime = 31;
int prime1 = 43;
int prime2 = 59;
int tFieldId = fieldId;
int tTitle;
if (title == null) {
tTitle = prime1;
}
else {
tTitle = title.length();
}
... |
c098e886-75e8-4e55-94c5-7c8de164d6ee | 3 | public ArrayList<String> checkFileFolder() {
for (final File fileEntry : folder.listFiles()) {
if(fileEntry.getName().contains(".jpg") || fileEntry.getName().contains(".png")){
files.add(fileEntry.getName());
}
}
return files;
} |
70e1dbd3-ecc1-40a0-841b-47d7f9111582 | 7 | public static boolean isReservedComment(String candidate) {
int START_STATE = 0;
int TERMINAL_STATE = 2;
char next;
if (candidate.length()!=2){
return false;
}
int state = START_STATE;
for (int i = 0; i < candidate.length(); i++)
... |
123c12fe-70a1-420a-87cf-52ea42a2bba1 | 0 | public Layer(boolean isB) {
this.ditems = new ArrayList<>();
this.isBlueLayer = isB;
this.active = false;
this.hidden = false;
this.deleted = false;
} |
3e4cf0bb-b687-4f65-a74c-85ca41b4f84c | 2 | public void act(){
if (id == 3 || id == 5){
//if its describing a mob, always refresh to change hp
//if its selecting a tower, refresh to show cooldown
refresh();
}
} |
7fa022fb-c75e-4d32-9f75-80637bd05b95 | 8 | public String getCurProductRelativeDate (ProductBean curProd)
{
Calendar submissiondate= curProd.getSubmissiondate();
int subyear = submissiondate.get(Calendar.YEAR);
if(subyear > 2000) {
subyear = submissiondate.get(Calendar.YEAR) - 2000;
}
int submonth = submissiondate.get(Calen... |
d3fd9f98-d707-4301-a1fd-71059081d707 | 7 | static public String doubleToString(double d) {
if (Double.isInfinite(d) || Double.isNaN(d)) {
return "null";
}
// Shave off trailing zeros and decimal point, if possible.
String s = Double.toString(d);
if (s.indexOf('.') > 0 && s.indexOf('e') < 0 && s.indexOf('E') < 0) {
... |
814f78b4-1a99-4ece-a490-4233af8e1d22 | 5 | @Override
public void execute(CharSequence str) {
HasSubSection selectedItem = editor.getSelectedItem();
if(selectedItem instanceof Section) {
Section section = (Section) selectedItem;
HasSubSection parent = section.getParent();
int index = 0;
while(!parent.getSubSection(index).equals(section)) ++in... |
59f37083-7779-40fe-89f8-018e008dd193 | 0 | public String system()
{
return "This method will be completed in a later lab";
} |
caa7e361-61da-4695-9fdc-ddc6a1c7d41d | 7 | public ReducerDataflowItem(String[] title, String[] values) {
for(int i = 0; i < title.length; i++) {
float v = Float.parseFloat(values[i]);
if(title[i].equals("ShCompMB"))
ShCompMB = v;
else if(title[i].equals("ShRawMB"))
ShRawMB = v;
else if(title[i].equals("InRec"))
InRec = v;
else if(ti... |
e1272fe4-e3a7-436e-a87e-fd5f62e9af81 | 2 | private void inv5ActionPerformed(java.awt.event.ActionEvent evt)
{
if(!game.getInBattle())
{
outputText.setText(game.useItem(4) + "\n" + game.getCurrentRoom().getExitString());
if(game.itemRemoved())
inv5.setText... |
aab60386-35f1-461c-b8b8-187f2f9d68c9 | 5 | protected List<RwsAttribute> parseAttributes(List<Element> elements) {
if (elements == null || elements.size() == 0) {
return null;
}
List<RwsAttribute> rwsAttributes = new Vector<RwsAttribute>();
for (Element ele : elements) {
RwsAttribute rwsAttribute = new RwsA... |
909f617a-6c5b-4dbb-98c3-2bf5e6f88322 | 5 | @EventHandler(priority = EventPriority.LOWEST)
public void onFishingAttempt(PlayerFishEvent e) {
final Player player = e.getPlayer();
if (Settings.world
|| WorldSettings.worlds.contains(e.getPlayer().getWorld()
.getName())) {
if (Settings.fishing
&& !PermissionHandler.has(e.getPlayer(),
Pe... |
34a539ee-8c06-4048-96f8-bc45732d596d | 0 | public List<PhpposSalesEntity> getMovimientosPosFromFecha(Date desde,
Date hasta){
DetachedCriteria criteria = DetachedCriteria.forClass(PhpposSalesEntity.class);
criteria.add(Restrictions.between("saleTime", desde, hasta));
return ge... |
ab146593-4717-4a79-ab08-3b0a878ac140 | 2 | void int_mat(int[][] matric){
for(int i=1;i<cnt;i++)
{
for(int j=1;j<cnt;j++)
{
matric[i][j] =1;
}
}
} |
af0b929c-1f09-4502-aec4-8f86579bb08e | 3 | public static boolean authorize(HttpRequest rx)
{
boolean ret;
if(rx.method().equals("POST") && rx.cookieValue("CPA") != null)
ret = rx.hasHeader("Authorization") && rx.header("Authorization").equals(Config.i().oauth_token);
else
ret = SessionsCache.contains(rx.cookieValue("CPA"));
return ret;
} |
e2ef21cc-e19a-4a23-845d-ce4e24d9c0a9 | 9 | byte[] readCodewords() throws FormatException {
FormatInformation formatInfo = readFormatInformation();
Version version = readVersion();
// Get the data mask for the format used in this QR Code. This will exclude
// some bits from reading as we wind through the bit matrix.
DataMask dataMask = Data... |
ac281c3a-5dfc-49cb-8810-97d99e95607f | 9 | void updatePoint(Point pr) {
pr.ownerlist.clear();
double mindist = Math.sqrt(size*size);
//ArrayList<Pair> ownerlist = new ArrayList<Pair>();
for (int j =0 ; j<king_outpostlist.size(); j++) {
for (int f =0; f<king_outpostlist.get(j).size(); f++) {
... |
b47367c5-f2e9-46f9-8459-34681f6143cc | 9 | protected boolean eval(IEvaluationContext context, Expr a, boolean strict)
throws ExprException {
if (a == null)
return false;
if (a instanceof ExprEvaluatable) {
a = ((ExprEvaluatable) a).evaluate(context);
}
if (a instanceof ExprNumber) {
... |
7a1c5787-a449-41e7-8d3e-4fd3513ba3e9 | 2 | public boolean fieldConflicts(FieldIdentifier field, String newAlias) {
String typeSig = (Main.options & Main.OPTION_STRONGOVERLOAD) != 0 ? field
.getType() : "";
/*
* Fields are similar to static methods: They are not overriden but
* hidden. We must only take care, that the reference of every
* getfi... |
720219d1-a70e-423f-86bc-6cf80f914986 | 7 | private final void genVideo() {
File inputFile = this.getVideoFileSource();
if (inputFile == null) {
if (this.isOutputEncoding()) this.encodeAll(2, "No video input");
return;
}
final Videncode self = this;
String filename = "output";
double[] time = this.getVideoFileSourceEncodeDuration();
double l... |
95b9c01c-7d82-4782-8323-d0f783d14f72 | 2 | @Test
public void insertMultipleElementsContains() {
for (int i = 0; i < 5; i++) {
l.insert(v);
}
l.insert(a);
for (int i = 0; i < 5; i++) {
l.insert(v);
}
assertTrue(l.contains(a));
} |
680da00e-23a9-42f4-876e-0b02ed99830e | 5 | private void jButton_ContinueActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_ContinueActionPerformed
try {
if("CashPurseAccount".equals(type)){
JOptionPane.showMessageDialog(this, "Cash Purse Account label cannot not be edited", "Cash Purse label edit", JOp... |
3b81b87a-500a-4c1d-bca2-308e6f3fbbc5 | 0 | public void setCp(String cp) {
this.cp = cp;
} |
c1a58c63-d80c-49af-b447-bdae1f446a4c | 4 | public PlanArbeiten(JSONObject o, Object obj) throws FatalError {
super("Arbeiten");
if (isInt(obj)) {
hours = (Integer) obj;
} else {
try {
hours = o.getInt("Stunden");
stop = o.getBoolean("Stopp");
} catch (JSONException en) {
configError();
}
}
if (this.hours < 1) {
Output.... |
94b4dc71-4be1-4c93-878d-8a025e312d73 | 5 | private void makeMoves() {
Direction d = null;
int destination;
List<Worm> list = new LinkedList();
for (int i = 0; i < size_x * size_y; ++i) {
if (tiles[i] instanceof Worm) {
list.add((Worm) tiles[i]);
}
}
for (Worm worm : list) ... |
783acbfb-3a9f-4779-a0d4-629352acb5f4 | 8 | private void getRelevantActionsfromPlan(Literal preCondition,
List<Action> providers) {
for (Action possibleAction : plan.getActions()) {
for (Literal literalToCompare : possibleAction.getEffects()) {
boolean equalNames = literalToCompare.getName().equals(
preCondition.getName());
boolean equalVal... |
92c6deca-ff09-4bed-a7f0-eb42c03ffeea | 5 | @command(
maximumArgsLength=2,
minimumArgsLength=1,
usage="<name>",
description="Clears a value.",
permissions="*"
)
public void clear(CommandSender sender,String[] args){
for(Field f:this.getClass().getFields()){
if(f.getName().equalsIgnoreCase(args[0])){
if(f.isAnnotationPresent(config.class)){
... |
ac7247a2-acc0-4d39-beb9-4faaf57acc96 | 1 | public double coutAttaque(Territoire t){
try {
return t.coutAttaque(joueurEnCours.getPeuple());
}
catch (Exception e) {}
return 0.0;
} |
bce3bef5-6bac-410c-9987-24382b94dc07 | 9 | public static void process1(PeerFunc peerFunction){
String filename = null;
boolean exit = false;
long startTime, endTime;
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
Scanner scan = new Scanner(System.in);
while(!exit){
System.out.println("\n1 Register a file\n2... |
bebbc9da-8712-4109-8de1-f21f5c669350 | 6 | final boolean method2628(int i, byte i_0_, r var_r, int i_1_) {
anInt4119++;
r_Sub1 var_r_Sub1 = (r_Sub1) var_r;
int i_2_ = 13 % ((i_0_ - -21) / 45);
i_1_ += ((r_Sub1) var_r_Sub1).anInt10474 + 1;
i += ((r_Sub1) var_r_Sub1).anInt10468 - -1;
int i_3_ = i_1_ * ((Class330) this).anInt4113 + i;
int i_4_ = ((r_Sub1) v... |
260591ac-b5d6-4cb1-84b9-5bb4b58a7fec | 6 | @EventHandler
public void PlayerHeal(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.getPlayerConfig().getDouble("Player.Heal.Dodge... |
760fda6f-f9f8-405e-815c-95a57c041585 | 8 | public PeakSet subSet(double mz, double interval) {
if (size() == 0) {
return new PeakSet();
}
if (Double.compare(mz, first().getMz() - interval) < 0) {
return new PeakSet();
}
if (Double.compare(mz, last().getMz() + interval) > 0) {
return n... |
53b7c386-fc76-41c6-b541-ea4115de1e9b | 4 | public void scroll(Direction up, int i) {
switch(up) {
case UP:
if(yOffset >= -4600) yOffset -= i;
break;
case DOWN:
if(yOffset < 0) yOffset += i;
break;
}
} |
52371bf4-4180-45c7-b0d0-155fd8278114 | 6 | public void MoveGhost(){
Random random = new Random();
int randNumber = random.nextInt(4) + 1;
int x = 0;
int y = 0;
switch (randNumber) {
case 1:
x = 0;
y = 1;
break;
case 2:
x = 1;
y = 0;
break;
case 3:
x = 0;
y = -1;
break;
case 4:
x = -1;
y = 0;
break;
}
... |
954c0841-6085-491d-b098-5e64c5494b85 | 2 | public static void main(String[] args)
{
List<DummyUser> list = new ArrayList<DummyUser>();
String userName = "User";
for(int i = 0; i < 25; i++)
{
DummyUser user = new DummyUser();
user.setName(userName + i);
list.add(user);
}
System.out.println(list.size());
Configuration configuration = n... |
761fb042-1d87-4611-bf9b-50527a9bfc5a | 5 | public void update() {
input.update();
if (input != null) {
if (input.up) {screen.changeOffset(0, -1);
System.out.println("up");}
if (input.down) {screen.changeOffset(0, 1);
System.out.println("down");}
if (input.left) {screen.changeOffset(-1, 0);
System.out.println("left");}
if (input.right) {... |
85d6d2e0-44bf-4526-89b7-7eb220ff587e | 0 | public UsersFacade() { } |
570d2023-6977-4954-940a-21f26a967f25 | 2 | public void renderNewGame() {
for (int k = 0; k < WIDTH; k++) {
for (int i = 0; i < HEIGTH; i++) {
bi.setRGB(k, i, Color.BLACK.getRGB());
}
}
ii = new ImageIcon();
ii.setImage(bi);
gamePane.setIcon(ii);
gamePane.validate();
} |
2fff221f-6fa3-41f4-9681-2dece719eabd | 8 | private static BufferedImage renderExpression(Expression expr) {
BufferedImage plus = render("+");
ArrayList<BufferedImage> terms = new ArrayList<BufferedImage>();
//total up the width of all parts of the expression, and find the height of the tallest one
int width = 0, height = 0;
for(int i = 0; i < expr.... |
14e1eb66-c808-4f62-8e96-5f9fd8f0a2f0 | 9 | public void show() {
// Return true if successful.
try {
final FreeMindMain frame = getFrame();
if (htmlEditorWindow == null) {
htmlEditorWindow = new HTMLDialog(this);
}
htmlEditorWindow.setBase(this);
final SHTMLPanel htmlEdit... |
41a33ce7-2d89-4292-bb55-c6a3acb16ca7 | 3 | public ValueType dereference() {
if(code >= A.code && code <= J.code)
return getByCode((byte)(code+0x8));
if(this == ValueType.SP)
return ValueType.PEEK;
throw new IllegalStateException("Can not dereference type "+this);
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.