method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
89d2c2a9-a488-4d27-8567-285ad612a983 | 4 | public void arc(double x, double y, double r, double angle1, double angle2) {
if (r < 0) throw new RuntimeException("arc radius can't be negative");
while (angle2 < angle1) angle2 += 360;
double xs = scaleX(x);
double ys = scaleY(y);
double ws = factorX(2*r);
double hs = ... |
e70c5fab-49be-4a93-8d7d-78286279dd19 | 9 | public static Offer parseOffer(StringBuffer inputHtml, String cardName) {
double bestPrice = Double.MAX_VALUE;
int stockNumber = 0;
Document doc = Jsoup.parse( String.valueOf( inputHtml ) );
Elements india = doc.select( "div.row" );
for ( Element table : doc.select( "table" ) ) {
for ( Element row : table... |
eed05ee8-1d90-4822-a3ba-c5d3335c6782 | 5 | public void setFieldsFromJson(StaplerRequest req, JSONObject json) {
Object endpointsJson = json.get("endpoints");
if (
(endpointsJson == null) ||
(endpointsJson instanceof JSONObject && ((JSONObject)endpointsJson).isEmpty()) ||
(endpointsJson instanceof JSONArray && ... |
2cb53a73-8541-41a2-9712-efda66e87a15 | 7 | private void writeResponse(Channel channel, String responseText) {
ByteBuf buf = Unpooled.copiedBuffer(responseText, CharsetUtil.UTF_8);
// Decide whether to close the connection or not.
boolean close = HttpHeaders.Values.CLOSE.equalsIgnoreCase(request.headers().get(HttpHeaders.Names.CONNECTION... |
8c6b86a4-5042-40bf-a9d4-ecfcc37023be | 8 | private String prepareConfigString(String configString) {
int lastLine = 0;
int headerLine = 0;
String[] lines = configString.split("\n");
StringBuilder config = new StringBuilder("");
for (String line : lines) {
if (line.startsWith(this.getPluginName() + "_COMMENT")) {
String comment = "#"
+... |
39abb4f9-9b58-476f-a93a-67fb16f7270f | 4 | public boolean login(String user, String password) {
this.user = user;
Map<String, String> logins = new HashMap<String, String>();
try {
openConnection();
ResultSet res = st.executeQuery("SELECT Name,Password FROM Player");
while (res.next()) {
logins.put(res.getString("Name"), res.getString("Passwo... |
cf0bd76b-243a-4edd-906b-895fa89bdcb9 | 4 | public CtConstructor[] getConstructors() {
CtMember.Cache memCache = getMembers();
CtMember cons = memCache.consHead();
CtMember consTail = memCache.lastCons();
int n = 0;
CtMember mem = cons;
while (mem != consTail) {
mem = mem.next();
if (isPubC... |
d9879ede-46e6-4eaf-afa4-26b119d3a65d | 9 | @Override
public String mountString(int commandType, Rider R)
{
switch(rideBasis)
{
case Rideable.RIDEABLE_AIR:
case Rideable.RIDEABLE_LAND:
case Rideable.RIDEABLE_WAGON:
case Rideable.RIDEABLE_WATER:
return "board(s)";
case Rideable.RIDEABLE_SIT:
case Rideable.RIDEABLE_TABLE:
case Rideable.RIDEA... |
cf0c9d2c-5ed4-41c2-9324-98d3ae00e76e | 1 | private Object toValue(String name, double[] vals, Map<String, Object> parameter) {
Object orig = parameter.get(name);
if (orig.toString().indexOf('{') > -1) {
// this is an array (hopefully 1dim)
return Conversions.convert(vals, String.class);
} else {
return... |
d7b3351c-cb1f-41fe-bb37-457280655840 | 0 | public void setNodeDrawer(NodeDrawer drawer) {
this.nodeDrawer = drawer;
} |
fd2154b3-2916-4d9f-a4bd-92a0adb8f667 | 2 | @Override
protected AFUNIXInputStream getInputStream () throws IOException {
if ( !this.connected && !this.bound ) {
throw new IOException("Not connected/not bound");
}
return this.in;
} |
b095d0e6-70a7-48f4-b2fe-aaaa35b3f69a | 4 | @Override
public void putAll(Grid<? extends V> grid) {
if (grid == null) {
throw new IllegalArgumentException("Grid must nor be null");
}
for (Cell<? extends V> cell : grid.cells()) {
cells.add(ImmutableCell.copyOf(cell));
}
} |
a60a676d-4b6f-46c6-bfca-6267a7496752 | 9 | public synchronized void reconnect() throws UnknownHostException, IOException, HttpException,
UnsupportedAuthenticationException, AuthenticationCancelledException {
close();
if (!client.isProxyConfigured()) {
// #ifdef DEBUG
log.debug(MessageFormat.format(Mess... |
e046783a-ce0d-4f4b-99bc-bf5f8c5b96bb | 4 | public void scrollTo(int index) {
if (loadingDone) {
setAvatarIndex(index);
if (index < 0)
setAvatarIndex(0);
else if (index >= avatars.size())
setAvatarIndex(avatars.size() - 1);
damaged = true;
repaint();
}
... |
c479f7c8-1da0-493f-b451-34ac06770ea7 | 5 | protected List<Rule> expandDefeasibleRule(final Rule rule) throws RuleException {
if (rule.getRuleType() != RuleType.DEFEASIBLE) return null;
String originalRuleLabel = rule.getOriginalLabel();
List<Rule> newRules = new ArrayList<Rule>();
List<Literal> headLiterals = rule.getHeadLiterals();
try {
if (head... |
562835ee-dbcb-426d-b35a-00bb4f16d962 | 8 | public static String get_Unicode_I18n_String(String data)
{
if (data == null)
{
return null ;
}
StringBuffer buffer = new StringBuffer() ;
int len = data.length() ;
int index = 0 ;
int escapeCounter = 0 ;
while ( index < len )
{
char c1 = data.charAt(index) ;
i... |
d07040dc-905b-4c1a-b9f5-fe613766c905 | 4 | public void insert( AnyType x )
{
SkipNode<AnyType> current = header;
bottom.element = x;
while( current != bottom )
{
while( current.element.compareTo( x ) < 0 )
current = current.right;
// If gap size is 3 or at bottom level and
// must insert, then promo... |
b58323e5-bc62-41a0-81d5-e10a1af3d53b | 2 | public void formTourTypeList(SessionRequestContent request) throws ServletLogicException {
Criteria criteria = new Criteria();
User user = (User) request.getSessionAttribute(JSP_USER);
if (user != null) {
criteria.addParam(DAO_USER_LOGIN, user.getLogin());
ClientType type... |
1d63ecbd-5fa6-4cc5-b16b-62a4952c4a4c | 3 | public static void sendFileConfirm
(
Socket sckIn
, String strId
, boolean blnConfirm
)
throws Exception
{
if
(
strId != null && strId.length() > 0
)
{
EzimDtxSemantics.initByteArrays();
String strConfirm = blnConfirm
? EzimDtxFileSemantics.OK
: EzimDtxFileSemantics.NG;
OutputSt... |
384e4e05-67ac-4c46-955f-955d1503f26a | 2 | private ArrayList<ArrayList<Integer>> removeDuplicated(ArrayList<ArrayList<Integer>> input) {
HashSet<ArrayList<Integer>> set = new HashSet<ArrayList<Integer>>();
ArrayList<ArrayList<Integer>> result = new ArrayList<ArrayList<Integer>>();
for(ArrayList<Integer> o : input){
if(set.add... |
eb36ca89-899e-4524-9389-0ceccf424429 | 9 | public void optimizeParam(int numItns) {
// update histograms and set the max # of times that each topic
// has occurred in any document...
int[] limits = new int[T];
Arrays.fill(limits, -1);
for (int j=0; j<T; j++) {
Arrays.fill(topicDocHist[j], 0);
for (int d=0; d<D; d++)
... |
5765dc77-23a3-49c4-a5f0-81f47bd6b617 | 3 | @Override
public boolean lockRead(Long connectionId, String objectType, boolean raise) throws Exception {
// check lock
synchronized (readLocks) { //aObjectType - [SAPM.SPM]
String lockStart = objectType + lockSeparate;
for (int i = 0; i < readLocks.size(); i++) {
String lockName = readLoc... |
289448b3-645c-41ea-9204-4bc7f46f37b1 | 2 | final public Token getToken(int index) {
Token t = token;
for (int i = 0; i < index; i++) {
if (t.next != null) t = t.next;
else t = t.next = token_source.getNextToken();
}
return t;
} |
33d03460-eb49-4153-b1c8-95cd0819dd34 | 5 | private void firstNameTextFieldKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_firstNameTextFieldKeyTyped
firstNameLabel.setForeground(Color.black);
int strLength = firstNameTextField.getText().length(); // Vi checker længden på vores String så vi kan begrænse dens max længde i vores IF-st... |
85f637cd-2c1b-42e3-acb0-db4c7371df64 | 3 | private static void moving() {
while (true) try {
Thread.sleep(2);
if (posYR >= 630) {
posYR = 630;
}
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} |
fc390e6b-74a9-4ee1-adef-4242f5bfb4ee | 5 | public static void encodePayload(Packet[] packets, EncodeCallback<byte[]> callback) {
if (packets.length == 0) {
callback.call(new byte[0]);
return;
}
final ArrayList<byte[]> results = new ArrayList<byte[]>(packets.length);
for (Packet packet : packets) {
... |
49cbda20-e64b-4f0e-a144-2b38428d1159 | 6 | public final void run() throws FatalError {
printJump();
if (!Utils.fightAvailable(20)) {
return;
}
Utils.visit("challenge/");
Utils.visit("sieben/intro/");
Utils.visit("sieben/index/");
try {
JSONObject ob = Utils.getJSON("sieben/siebenData/");
Control.sleep(5);
Output.printTab("Kampf mi... |
e57c69a6-f0a8-40aa-999d-94e83aeb7820 | 8 | protected boolean computeCell(int col, int row)
{
boolean liveCell = getCell(col, row);
int neighbours = countNeighbours(col, row);
boolean nextCell = false;
if (neighbours < 2) nextCell = false;
if (liveCell && (neighbours == 2 || neighbours == 3)) nextCell = true;
if (liveCell && neighbours... |
7b7926ad-c5d9-4cd9-a006-1dd216810da8 | 9 | public JPanel initializeJPanelDayNumbers()
{
dayNumberPanel = new JPanel();
dayNumberPanel.setBackground(new Color(-1));
dayNumberPanel.setLayout(new GridLayout(0, 7));
cal.set(5, 1);
int dayThatThisMonthsStarts = 0;
String firstDayOfMonth = (new SimpleDateFormat("EEE... |
cbdc47c0-d940-4a71-8e76-46fe65c9d81c | 4 | public boolean handleRecord(Core root, GedcomRecord record, GedcomReader reader) {
String tag = record.getTag();
Family family = (Family)root;
if (tag.equalsIgnoreCase("NCHI")) {
family.setChildCount(Integer.parseInt(record.getContent()));
return true;
} else if (tag.equalsIgnoreCase("HUSB")) {
fami... |
651917a7-c467-4bc8-b7ee-2a519b9f6cb7 | 4 | public String getActionType(Instance vision) throws Exception {
// Set default action type to Turn.
double action = actionNumMap.get("turn");
// Make the decision on action type by model.
try {
action = actionTypeCls.classifyInstance(vision);
} catch (Exception e) {
System.err.println("Cannot ... |
df03f584-051e-470f-ac17-44d5bfdbabfe | 4 | public static PrefixOperation getPrefixOperation(String type, Expression param){
String noSpace = type.replaceAll("\\s+","");
String s = noSpace.toLowerCase();
if( "sin".equals(s) ){
return new Sin( param );
} else if ("cos".equals(s) ){
return new Cos( param );
} else if ("tan".equals(s) ){
return ... |
fb767eed-4390-4a00-9dd1-77c533d130ed | 9 | public String nextToken() throws JSONException {
char c;
char q;
StringBuilder sb = new StringBuilder();
do {
c = next();
} while (Character.isWhitespace(c));
if (c == '"' || c == '\'') {
q = c;
for (;;) {
c = next();
... |
cda999dd-6594-4609-99b9-63a737a73d0d | 3 | public ArrayList<HashMap<String, String>> getOdigo(int id){
/*
* epistrefei ta stoixia enos sugkekrimenou odigou
*/
ArrayList<HashMap<String, String>> odigoi=new ArrayList<HashMap<String, String>>();
HashMap<String, String> map = new HashMap<String, String>();
try {
pS = conn.prepareStatement("SELECT *... |
9653acc0-6d45-49f9-ab32-10763f575158 | 3 | private final void unpack() {
@SuppressWarnings("hiding")
final Map<String, AbstractInputStream> streams = Deserializer_0.this.io.openInZip(this.idx);
if (streams == null) {
return;
}
streams.remove("sdd");
this.serialSongs = streams.size();
Deserializer_0.this.io.setProgressSize(this.serialSon... |
cc1139a0-a857-4de3-9709-b8fbb41cfb39 | 3 | public void preload(String root) {
File file = new File(root);
File[] files = file.listFiles();
for(File f : files) {
if(f.isDirectory()) {
preload(f.getPath());
}
else if(f.isFile()) {
getData(f.getPath());
}
... |
3e0eee09-7187-4b47-a579-9a05ce98b166 | 8 | public Response serve( String uri, String method, Properties header, Properties parms, String data )
{
try{
String response_string=null;
if(data!=null){
data=data.toUpperCase();
System.out.println(DateFormat.getTimeInstance(DateFormat.FULL).format(Calendar.getInstance().getTime()));
System.out.prin... |
bfc7768f-838e-4b35-9462-eb5b3f42af32 | 8 | @Override
protected void eatCombinationOne() {
int green = 0;
int red = 0;
for (Iterator<Plant> it = plants.iterator(); it.hasNext();) {
Plant pl = it.next();
if (pl.getType() == Plant.GREEN_PLANT && green < 1) {
it.remove();
green++;
}
if (pl.getType() == Plant.RED_PLANT && red < 1) {
... |
d1c002f9-c58d-4bdf-bf55-dbc44fc64aa4 | 0 | public static void main(String[] args) {
Main1 main1 = new Main1();
main1.show();
} |
0b6a2e3c-3090-40f4-be3d-00ec99b9042d | 6 | private static Object coerceParameter(String parameterNoCase, Class<?> class1) {
if (class1.getName().equals("java.lang.String")) {
return parameterNoCase;
} else if (class1.getName().equals("java.lang.Long")) {
try {
return Long.parseLong(parameterNoCase);
} catch (NumberFormatException nfe) {
ret... |
f1aa166d-f7a6-4c96-a605-f489105220de | 2 | public boolean accept(java.io.File f) {
if (f.isDirectory()) {
return true;
}
boolean flag = false;
String fileName = f.getName().toLowerCase();
String ext = fileName.substring(fileName.lastIndexOf(".") + 1,
fileName.length());
if (USBConfig.EXTS.contains(ext)) {
flag = true;
}
return flag;
} |
645cb706-c9e8-4507-956a-0f4bbc845c26 | 3 | private void changeTravBit(boolean canWalk, boolean canSwim, boolean canFly) {
travBit = 0x0;
if(canWalk) {
travBit |= walkingMask;
}
if(canSwim) {
travBit |= swimmingMask;
}
if(canFly) {
travBit |= flyingMask;
}
} |
a424e1ee-3dc0-463d-b16d-b0282e4670be | 6 | /* */ public boolean canPlayOffline()
/* */ {
/* */ try
/* */ {
/* 819 */ String str1 = (String)AccessController.doPrivileged(new PrivilegedExceptionAction() {
/* */ public Object run() throws Exception {
/* 821 */ return Util.getWorkingDirectory() + File.separato... |
e6d78cbd-704a-4e74-9e72-0df1469c20a9 | 6 | private boolean filter(HttpServletRequest req) {
boolean filter = true;
String requestURI = req.getRequestURI();
if (requestURI.contains("/carrinho/bootstrap/")
|| requestURI.contains("/carrinho/css/")
|| requestURI.contains("/carrinho/js/")
|| req... |
aaf0f146-71ac-4164-82a2-b456e3288841 | 4 | public void messagePlayers(String message) {
Player[] players = Bukkit.getOnlinePlayers();
for (int i = 0; i < players.length; i++) {
if (players[i].hasPermission("chattery.see")) {
try {
if (!bot.getPlugin().getPlayerHandler().ignoring(players[i].getName())) {
players[i].sendMessage(message);
... |
754026c7-54ac-4d38-a999-8a8a66770549 | 0 | public void setCsaIdElemento(int csaIdElemento) {
this.csaIdElemento = csaIdElemento;
} |
66e9290b-1b85-48b4-8fc8-b247436009e1 | 4 | public void openBraceNoSpace() {
if ((Options.outputStyle & Options.BRACE_AT_EOL) != 0)
println("{");
else {
if (currentLine.length() > 0)
println();
if ((Options.outputStyle & Options.BRACE_FLUSH_LEFT) == 0
&& currentIndent > 0)
tab();
println("{");
}
} |
638c2d46-a36c-40f2-8a25-1b8a5dc1149c | 0 | public void setId(long Id) {
this.Id = Id;
} |
ae642345-dd00-4e66-877b-aaec892aa16e | 7 | public static String getKatakanaNotes(String note) {
if (note.equals("do")) {
return "ド";
}
if (note.equals("re")) {
return "レ";
}
if (note.equals("mi")) {
return "ミ";
}
if (note.equals("fa")) {
return "ファ";
}
if (note.equals("so")) {
return "ソ";
}
if (note.equals("ra")) {
return... |
932f2a21-5d5d-4356-879e-f3a8855b4239 | 9 | @Override
public Template[] getTemplates(String contextTypeId) {
String ctx = getCtx();
if (ctx.contains("@@{")) ctx = ctx.substring(ctx.indexOf("@@{") + 3);
if (ctx.contains("@{")) ctx = ctx.substring(ctx.indexOf("@{") + 2);
System.out.println("templates " + contextTypeId + " - " + ctx);
List<Template> resu... |
694c5ddf-6d1c-438b-94d4-08ad4b7402db | 6 | public static BigInteger parseBigInteger(String sval) throws NumberFormatException {
int beginIndex = 0;
int rx = 10;
boolean specialRadix = false;
if (sval.length() > 2 && sval.charAt(0) == '0') {
char radixIndicator = Character.toLowerCase(sval.charAt(1));
switch(radixIndicator) {
case 'b': rx = 2; ... |
f60655a7-e3a5-4c0f-8629-1a17575bf930 | 6 | private static int getPartition(char[] arr, int start, int end)
{
int partition = arr[start];
int low = -1;
int high = end + 1;
while (low < high)
{
low++;
while (arr[low] < partition && low < end) low++;
high--;
... |
954a0ac3-0d67-4bfa-b6a2-8b82601cf323 | 7 | public void destory() {
if (isDesotry) {
return;
}
isDesotry = true;
listener.onClose();
listener = new ListenerAdapter() {
};
// 关闭连接 释放线程
if (heartbeatTask != null && !heartbeatTask.isInterrupted()) {
heartbeatTask.interrupt();
}
if (socket != null && !socket.isClosed() && socket.isConnected... |
0dd138a9-ff68-428b-b8ed-04f7d297e8fc | 3 | public void testFindScript() throws Throwable {
System.out.println("ParserTest4.testFindScript()");
assertNotNull(page);
List<HTMLComponent> children = page.getChildren();
for (HTMLComponent c : children) {
if (c instanceof HTMLForm) {
System.out.printf("FORM: onSubmit=%s%n", ((HTMLForm)c).getOnSubmit... |
8f615e4d-4b3f-448d-a34c-3f6373ac9333 | 9 | public Cookie getSessionCookie(HttpSession session,boolean requestIsSecure)
{
if (_handler.isUsingCookies())
{
Cookie cookie = _handler.getSessionManager().getHttpOnly()
?new HttpOnlyCookie(SessionManager.__SessionCookie,session.getId())
:new Cookie(Sessio... |
6f51da50-abe2-44e5-afb3-3e10b2e1b2fd | 3 | public File hankiTiedosto(String otsikko){
String alkupolku = System.getProperty("user.home") +"\\Documents\\GitHub\\Japanimaatti\\Japanimaatti\\JapanimaatinTiedostot"; //kovakoodausta tavallaan...
JFileChooser valitsija = new JFileChooser(alkupolku);
valitsija.setDialogTitle(otsikko);
i... |
0889a9d1-51ad-4109-a304-d31fbe86367e | 9 | protected TrieEntry<K,V> higherEntry(K key) {
// TODO: Cleanup so that we don't actually have to add/remove from the
// tree. (We do it here because there are other well-defined
// functions to perform the search.)
int keyLength = length(key);
if (keyLength... |
03cab9b9-b152-454f-9a39-8d52d17a7e65 | 7 | private static Set<Class<?>> getFromDirectory(File directory, String packageName) throws ClassNotFoundException {
Set<Class<?>> classes = new HashSet<Class<?>>();
if (directory.exists()) {
for (String file : directory.list()) {
if (file.endsWith(".class")) {
... |
54418b85-467c-425f-a126-a4ce1f58e980 | 8 | static final String method2766(boolean bool, Throwable throwable)
throws IOException {
anInt8823++;
String string;
if (throwable instanceof RuntimeException_Sub1) {
RuntimeException_Sub1 runtimeexception_sub1
= (RuntimeException_Sub1) throwable;
string
= (((RuntimeException_Sub1) runtimeexception_sub1... |
d8edcc98-3f45-492b-995a-213f126290c7 | 7 | public void fire(Player player){
if(log == 0){
posx = player.getPlayerX();
posy = player.getPlayerY();
}
if(log < 150){
isVisible = true;
if(dir == 3){
posx = posx +5;
log = log + 5;
}
if(dir == 1){
posx = posx - 5;
log = log + 5;
}
if(dir == 0){
posy = posy - 5... |
6916831e-c995-4844-879f-f72f3cbe76cf | 2 | public final static OperatingSystemType getOperatingSystem() {
String osName = System.getProperty("os.name").toLowerCase();
if (osName.indexOf("win") != -1) {
return OperatingSystemType.WINDOWS;
} else if (osName.indexOf("linux") != -1) {
return OperatingSystemType.LINUX;
}
return OperatingSystemType.UN... |
cf1fafac-67df-4c4d-a780-20fd4368d8f8 | 5 | private void SHSaveButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SHSaveButtonActionPerformed
// TODO add your handling code here:
String name, wants;
boolean power, legitimacy, urgency, cooperation, threat;
String findName = (String) StakeholderList.getSelected... |
043c31e8-1aee-4e80-bc53-a9a9e6caa4d7 | 6 | public static String numberToString(Number number) throws JSONException {
if (number == null) {
throw new JSONException("Null pointer");
}
testValidity(number);
// Shave off trailing zeros and decimal point, if possible.
String string = number.toString();
if (string... |
a5aa6851-4164-44fb-ac45-8a6ac804c185 | 1 | public void updateGameInformation(HashMap<String, GameObjectInformation> gameObjectInformation) {
Iterator<Entry<String, GameObjectInformation>> it = gameObjectInformation.entrySet().iterator();
while(it.hasNext()){
Entry<String, GameObjectInformation> entry = it.next();
gameObjects.get(entry.getKey()).setGam... |
21b0eceb-61f4-4d4f-ab6e-39a19a6736bc | 9 | private String getFiltro(){
String filtro = "";
boolean filtro_armado = false;
if (mediador.mediadorPrincipal.getUsuario().getPermiso()<2)
filtro = ""; //TODO agregar filtro de q solo modifique elementos de la organizacion de la q pertenece el usuario
if (tFnombre!=null && !tFnombre.getText().trim().isEmp... |
d3c020c2-da8e-4cab-9729-06e06a5652b7 | 3 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final TblClientId other = (TblClientId) obj;
if (!Objects.equals(this.ClientCode, other.ClientCode)) {
... |
c9e493f0-e20d-46dd-aee9-4e68c9e1c4aa | 2 | public int getRate()
{
int rate = 0;
if (this.type.equalsIgnoreCase("Premium"))
{
rate = 10000;
}
if (this.type.equalsIgnoreCase("Medium"))
{
rate = 5000;
}
else
{
rate = 3000;
}
return rate;
} |
400870b5-959a-4e19-b0cf-088559ae01d2 | 8 | @Test
public void testError() {
long maxLong = Long.MAX_VALUE;
long minLong = Long.MIN_VALUE;
double maxDouble = Double.MAX_VALUE;
double minDouble = Double.MIN_VALUE;
try {
helper.getConvertor(Long.class, Integer.class).convert(maxLong, Integer.class);
... |
dcf91e9e-d5f8-495f-8a32-95e69d7f6d85 | 5 | void drawCard(Graphics g, Card card, int x, int y) {
int cx;
int cy = 0;
if (card == null) {
cx = 4 * 123;
cy = 2 * 79;
}
else {
cx = (card.getValue()-1)*79;
switch(card.getSuit()) {
case Card.CLUBS:
... |
30aacee4-de78-4ff1-81a6-8e083f6382a9 | 9 | public void writeUTF(String s) throws IOException {
int numchars = s.length();
int numbytes = 0;
for (int i = 0 ; i < numchars ; i++) {
int c = s.charAt(i);
if ((c >= 0x0001) && (c <= 0x007F)) numbytes++;
else if (c > 0x07FF) numbytes += 3;
else ... |
d964f054-5cf9-48b0-b0b6-3720f4437e77 | 5 | public void actionPerformed(ActionEvent e) {
if (aliens.size()==0) {
ingame = false;
}
ArrayList ms = craft.getMissiles();
for (int i = 0; i < ms.size(); i++) {
Missile m = (Missile) ms.get(i);
if (m.isVisible())
m.move();
... |
746d9666-8024-4669-8787-ce4aaad110ce | 1 | public void init() {
for (int i=0; i<100; i++) {
theta[i]=random.nextInt(4);
}
} |
d86a66a9-9b3a-4c7b-a097-d7184a8c489a | 1 | @Override
public final Logger getLogger(final String name) {
Logger slf4jLogger = null;
// Protect against concurrent access of loggerMap
synchronized (this) {
slf4jLogger = loggerMap.get(name);
if (slf4jLogger == null) {
logger.Logger logger = new logger.Logger(name);
slf4jLogger = new LoggerAdapt... |
c0886484-7d86-43fd-9a87-ee0712411846 | 0 | public Sparrow(String name, float weight, FlyingAbility flyingAbility) {
super(name, weight, "chirp", flyingAbility);
} |
36131853-e9ba-4ee3-8b50-e1dec516db07 | 0 | @Override
public boolean equals(Object obj) {
return EqualsBuilder.reflectionEquals(this, obj);
} |
b3ab3955-5d36-4842-a2bb-8765fd4a58d4 | 3 | @Override
public GameElement GetCollision(Vector<GameElement> Elements) {
// define the rectangle from the base element
Rectangle RectA = new Rectangle(this.getBoundBox().getX(),
this.getBoundBox().getY(),
this.getBound... |
ec9fbaa5-3ea9-4e86-9584-c8ae7db6ffcc | 9 | @Override
public void execute() {
if (Bank.open()) {
/*
If we have:
no items in our bank or inventory OR
no nature runes in our bank or inventory OR
no fire runes in our bank or inventory
we want to stop the script.
... |
355607b5-8cf8-4974-8d72-7af6d9d4dd12 | 2 | public Object put(Object key, Object value) {
for (Iterator i = backing.iterator(); i.hasNext();) {
Map.Entry entry = (Map.Entry) i.next();
if (key.equals(entry.getKey()))
return entry.setValue(value);
}
backing.add(new SimpleEntry(key, value));
return null;
} |
4ef581ae-4f70-49eb-bead-0bc474441225 | 8 | public static byte[] generateEncryptedMPPEPassword(byte[] input, int room, byte[] secret, byte[] vector) {
final int authVectorLength = 16;
final int authPasswordLength = authVectorLength;
final int maxStringLength = 254;
// NOTE This could be dodgy!
int saltOffset = 0;
// byte digest[] = new byte[authVec... |
12e92c81-96b0-444c-981f-87649c5c7c35 | 8 | protected static char getChar(int sixBit) {
if (sixBit >= 0 && sixBit <= 25)
return (char)('A' + sixBit);
if (sixBit >= 26 && sixBit <= 51)
return (char)('a' + (sixBit - 26));
if (sixBit >= 52 && sixBit <= 61)
return (char)('0' + (sixBit - 52));
if (si... |
fb6ac666-804b-45d5-907d-d24160407409 | 6 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Service service = (Service) o;
if (id != service.id) return false;
if (name != null ? !name.equals(service.name) : service.name != null) return... |
e41328ff-1c69-46ad-ac80-504794b80b17 | 8 | private void drawShapes(GraphicsContext gc) {
gc.setFill(Color.GREEN);
gc.setStroke(Color.BLUE);
gc.setLineWidth(1);
gc.fillText(tl.name, 40, 20);
int begin = tl.timelineEvents.firstEntry().getValue().getStartYear();
int end = tl.timelineEvents.lastEntry().getValue().getS... |
3f5c4c3d-8a7b-4fb9-a20b-19b0bc31dd64 | 4 | private int countNeighbours (int[] position){
int res = 0;
int[][] positions = new int[8][2];
int[] tlc = {position[0] - 1, position[1] - 1};
positions[0] = tlc;
int[] t = {position[0], position[1] - 1};
positions[1] = t;
int[] trc = {position[0] - 1, position[1] + 1};
positions[2] = trc;
int[] l = ... |
cebdfded-25b3-4357-9d40-ed6618808493 | 8 | public boolean similar(Object other) {
if (!(other instanceof JSONArray)) {
return false;
}
int len = this.length();
if (len != ((JSONArray)other).length()) {
return false;
}
for (int i = 0; i < len; i += 1) {
Object valueThis = this.ge... |
3349b8b0-f1f5-4636-9ba7-a2383d29b412 | 9 | public void startElement(String uri, String localName, String qName, Attributes attributes) throws FileFormatException {
if(qName.equals("bmonitor")) {
// ignore
}
else if(qName.equals("monitor")) {
String val = attributes.getValue("port");
if(val == null) {
throw new FileFormatException("port... |
3d8785cd-9630-4e0c-a25a-3412c1900544 | 1 | public Account getBuyer() {
if(this.isEnded()){
return this.getLatestBid().getBuyer();
}else{
return null;
}
} |
53fa7b15-c910-47cd-a3f7-beb382d565f5 | 6 | private void expression3()
{
if (have(NonTerminal.EXPRESSION3))
{
if (accept(Token.Kind.NOT))
{
expression3();
}
else if (accept(Token.Kind.OPEN_PAREN))
{
expression0();
expect(Token.Kind.CLOSE_PAREN);
}
else if (have(NonTerminal.DESIGNATOR))
{
designator();
}
else if ... |
a4abefba-c434-440e-9e0d-401869a0c96d | 3 | private String decrypt() {
try {
byte[] dec = Base64.decode(this.getEncryptedPass());
byte[] utf8 = this.decrypter.doFinal(dec);
return new String(utf8, "UTF8");
} catch (javax.crypto.BadPaddingException e) {
} catch (IllegalBlockSizeException e) {
} catch (UnsupportedEncodingException e) {
}
retu... |
dff36553-1d47-466f-9071-94cd8e657686 | 1 | MailChimpConfigFromProperties() {
try (InputStream resource = MailChimpConfigFromProperties.class.getResourceAsStream("/mailchimp.properties")) {
final Properties properties = new Properties();
properties.load(resource);
this.subdomain = properties.getProperty("subdomain");
this.apiKey = pro... |
64b99298-cc44-42db-9661-b3c332d9094f | 7 | private Vector<FilenameInputSplit> getPathInputSplits(FileSystem fs, Vector<FileStatus> files, long chunkSize)
throws IOException {
Vector<FilenameInputSplit> splits = new Vector<FilenameInputSplit>();
splits.add(new FilenameInputSplit());
for (FileStatus status : files) {
if (... |
0947cb40-7671-4537-83d5-d97dafe5af3c | 6 | public void adjustBeginLineColumn(int newLine, int newCol) {
int start = tokenBegin;
int len;
if (bufpos >= tokenBegin) {
len = bufpos - tokenBegin + inBuf + 1;
} else {
len = bufsize - tokenBegin + bufpos + 1 + inBuf;
}
int i = 0, j = 0, k = 0;
int nextColDiff = 0, columnDiff = 0;
while (i < l... |
8b15bf84-52ab-4767-993a-fe4d5959948e | 3 | private String downloadUpdate(String url, File file) throws Exception {
if (file.isDirectory()) {
if (!file.delete()) {
throw new Exception("Unable to delete plugins/" + dataFolder.getName() + "/GetPerms.jar/");
}
}
if (file.exists()) {
file.delete();
}
return plugin.downloadFile(url, temporary... |
6b99fa09-a73b-4ad1-ab2b-f953f16f3985 | 2 | LanguagePattern(Class<? extends ConstructFactory<?>> factoryClass,
PatternComponent... components) {
this.factoryClass = factoryClass;
this.combinedPattern = TokenPattern.or(components);
startFactory();
} |
0baafe52-f6f4-44c0-8e1b-0c6c6d56bc1d | 2 | public static void main(String[] args) {
ExecutorService executor = Executors.newFixedThreadPool(2);//two threads, try setting by 1 to observe time
System.out.println("Starting ...");
long start = System.currentTimeMillis();
Worker worker = new Worker();
for (int i = 0; i < 2; i+... |
33be68e7-6000-47a5-a11d-2640ea319995 | 0 | public static void waitInput(String playerName){
System.out.println(playerName + "さん、石を置いてください 例)a1 ※パスは[00]、降参は[99]");
} |
fe9d7c27-e14f-41fd-bcf1-de77976cc67b | 1 | ByteVector put12(final int b, final int s) {
int length = this.length;
if (length + 3 > data.length) {
enlarge(3);
}
byte[] data = this.data;
data[length++] = (byte) b;
data[length++] = (byte) (s >>> 8);
data[length++] = (byte) s;
this.length = length;
return this;
} |
865055e1-6db8-43d4-81e4-1d464db359f4 | 1 | public static synchronized ApiThreadPool getDefaultPool() {
if (apiThreadPool == null) {
apiThreadPool = new ApiThreadPool();
}
return apiThreadPool;
} |
571b5137-ce94-4d45-a6d3-c8453426ebd4 | 1 | private void tblClientesMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tblClientesMouseClicked
Object valueAt = tblClientes.getValueAt(tblClientes.getSelectedRow(), 0);
this.idDoClienteSelecionado = (Integer) valueAt;
qtdCliques = evt.getClickCount();
if(qtdCliques ==... |
01e86e08-8b93-4826-a051-0d567d7dd966 | 5 | public static String[][] checkForErrors(ArrayList<Sentence> sentences) {
int numSentences = sentences.size();
int numPossibleErrors = 2;
int i = 0, j = 1;
String[][] errors = new String[numSentences][numPossibleErrors];
for (Sentence s : sentences) {
if (s.getClauses... |
b111f09b-d5f8-4f59-a822-72b9d55435bb | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Vertragsstop)) {
return false;
}
Vertragsstop other = (Vertragsstop) object;
if ((this.id == null && other.id !... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.