method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
b89a3439-ce82-42ed-b7a6-5d2ed96bb8de | 5 | public int Consensus() {
for (int r = 1; r <= process.getNo(); r++) {
if (r == process.pid) {
process.broadcast("VAL", process.getX() + "," + r);
if(verbose )Utils.out(p.getPid(),"broadcast VAL message with payload:"+process.getX() + "," + r);
} else {
// process ID each is the coordinator of this r... |
87d256d7-1700-4c59-89da-bf31ea21d59c | 8 | @Override
public void decode(final ByteBuffer buf, final int available, final StringBuilder log) throws Exception
{
// Start decoding
final short command_code = buf.getShort();
final Command command = Command.forCode(command_code);
if (command == null)
throw new Exception("Received unknow... |
8f81da58-8390-45d4-9556-91fddfe646dc | 8 | protected void initPrototypeId(int id)
{
String s;
int arity;
switch (id) {
case Id_constructor: arity=1; s="constructor"; break;
case Id_toString: arity=1; s="toString"; break;
case Id_toLocaleString: arity=1; s="toLocaleString"; break;
... |
d5ddc2c6-6861-4447-a9de-1bf5ece622f3 | 3 | @WebMethod(operationName = "ReadTransfert")
public ArrayList<Transfert> ReadTransfert(@WebParam(name = "trans_id") String trans_id) {
Transfert trans = new Transfert();
ArrayList<Transfert> transs = new ArrayList<Transfert>();
ArrayList<QueryCriteria> qc = new ArrayList<QueryCri... |
e6aa151f-7751-45f5-a53c-9188535d2d1d | 7 | public final GalaxyXSemanticParser.expression_return expression() throws RecognitionException {
GalaxyXSemanticParser.expression_return retval = new GalaxyXSemanticParser.expression_return();
retval.start = input.LT(1);
int expression_StartIndex = input.index();
CommonTree root_0 = null;... |
a75b628e-cd4c-4ee8-82d0-0e92a2958e91 | 7 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
DocumentDescriptor other = (DocumentDescriptor) obj;
if (documentId != other.documentId)
return false;
if (documentLocation == nu... |
ded91032-8427-4f21-a550-819cdc23e295 | 3 | @Override
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() == 2) {
for (Component ele : elements) {
if (ele.contains(e.getPoint())) {
setSelected(ele);
repaint();
ele.fireDefaultAction(new Point(e.getXOnScreen()
+ ele.width / 2, e.getYOnScreen() + ele.height / 2));
// ... |
8362109c-7406-454b-ab70-cf4152908acd | 8 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
return false;
final boolean success=proficiencyCheck(mob,0,auto);
final Set<MOB> h=properTargets(mob,givenTarget,auto);
if(h==null)
... |
c82cc482-2782-42d9-a8dc-16792f086d2d | 2 | public boolean IsPlayerBirthday(BirthdayRecord birthday) {
// Is there a birthday record for this player?
if (birthday != null) {
// Get current date without year/time
SimpleDateFormat sdf = new SimpleDateFormat("MM-dd");
String today = sdf.format(new Date());
String bdate = sdf.format(birthday.birthda... |
ef8c1aa1-b709-4ab3-8e9a-6893ce5b5c9b | 7 | public void mousePressed(MouseEvent e) {
final int s = 30; // cell size
final int x = e.getX() / s;
final int y = e.getY() / s;
final int button = e.getButton();
// clicked outside the board
if (x < 0 || y < 0 || x > grid.xCells || y > grid.yCells)
return;
... |
7de3f120-b1bf-404c-b71a-03fc9e8e393e | 0 | public FSANondeterminismDetector() {
} |
5aa5cab1-4871-4d3b-954d-990be7333780 | 9 | public void deleteCharacter(ClientPacket p) {
/* determine guid here from packet then respond okay */
boolean[] guidMask = new boolean[8];
byte[] guidBytes = new byte[8];
BitUnpack bitUnpack = new BitUnpack(p);
guidMask[2] = bitUnpack.getBit();
guidMask[1] = bitUnpack.getBit();
guidMask[5] = bitUnpa... |
b73583ce-e42c-4a99-b92b-e4ad1751ce37 | 9 | private boolean sideCast(Type from, Type to, Warner warn) {
// We are casting from type $from$ to type $to$, which are
// non-final unrelated types. This method
// tries to reject a cast by transferring type parameters
// from $to$ to $from$ by common superinterfaces.
boolean re... |
46399557-2520-47c6-9536-ddec10241eab | 8 | public void write(JsonWriter out, Map<K, V> map) throws IOException {
if (map == null) {
out.nullValue();
return;
}
if (!complexMapKeySerialization) {
out.beginObject();
for (Map.Entry<K, V> entry : map.entrySet()) {
out.name(String.valueOf(entry.getKey()));
... |
372c73ab-654e-4279-aba5-d3f6194c7229 | 6 | public DenseMatrix64F getQ( DenseMatrix64F Q ) {
if( Q == null ) {
Q = new DenseMatrix64F(N,N);
for( int i = 0; i < N; i++ ) {
Q.data[i*N+i] = 1;
}
} else if( N != Q.numRows || N != Q.numCols )
throw new IllegalArgumentException("The provid... |
73fec757-27ac-46e6-b25e-8c9f4b51f431 | 7 | public void drawMemBltOrder(MemBltOrder memblt) {
int x = memblt.getX();
int y = memblt.getY();
if (x > this.right || y > this.bottom)
return; // off screen
int cx = memblt.getCX();
int cy = memblt.getCY();
int srcx = memblt.getSrcX();
int srcy = memblt.getSrcY();
// Perform standard clipping chec... |
ede5c2d1-a764-4ffb-8cdd-2521281c2190 | 7 | @Override
public int takeStep()
{
fillVariables();
if (this.gloBallBehindLine(this.gloBall, this.gloMyPosition.x - (this.ourField * 0.4), ourField)) {
if (this.ourField * this.gloBall.x < 0.4) {
if (myRobotAPI.canKick()) {
myRobotAPI.kick();
} else {
myRobotAP... |
d7c59f2c-71dd-47a8-acd0-4dd736934a11 | 9 | public Object asType(Class<?> targetType) {
if (Number.class == targetType || BigDecimal.class == targetType) {
return this.nval;
}
if (BigInteger.class == targetType) {
return BigInteger.valueOf(this.nval.longValue());
}
if (Double.class == targetType) {
return this.nval();
}
if (Float.class == ... |
1d827123-47b1-4a10-b205-57de3b1a2076 | 6 | @EventHandler
public void BlazeFireResistance(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.getBlazeConfig().getDouble("Blaze.Fir... |
c96879dd-16f5-440e-bc0a-325df67a2c59 | 6 | public InputStream getInputStream(InputStream in) {
SimpleFilter simpleFilter = null;
if (filterID == X86_FILTER_ID)
simpleFilter = new X86(false, startOffset);
else if (filterID == POWERPC_FILTER_ID)
simpleFilter = new PowerPC(false, startOffset);
else if (filte... |
ed8114b6-1c7d-4b71-b058-f616c7ecb507 | 6 | private static boolean method496(char arg0) {
return arg0 >= ' ' && arg0 <= '\177' || arg0 == ' ' || arg0 == '\n' || arg0 == '\t' || arg0 == '\243' || arg0 == '\u20AC';
} |
97afe3b7-6109-404b-8d22-7799c57bfd4b | 9 | ImagePlus showDialog(String title) {
int[] wList = WindowManager.getIDList();
if (wList==null) {
IJ.noImage();
return null;
}
String[] titles = new String[wList.length];
int n = titles.length;
if (n == 1) {
IJ.showMessage("No image to insert. Open a second image first, or use Insert File or Paste... |
4d57318f-e8c0-41a0-bca3-8d65c32adc62 | 8 | @Override
public void setBloc(int x, int y, int z, BlocService b) {
if (!((x >= 0) && (x < nbBlocLargeur()))) {
throw new PreconditionError("setBloc");
}
if (!((y >= 0) && (y < nbBlocHauteur()))) {
throw new PreconditionError("setBloc");
}
if (!((z >= 0) && (z < nbBlocProfondeur()))) {
throw new Pre... |
91d388dc-b49c-4c41-9458-cba78386dc39 | 8 | public String getStatusBarText() {
String gravityInfo = (options.isGravityDebugStatus())
?" | Gravity Info: abvG " + (model.getRobotLocation().y < 200) +
", abvH " + (model.getHoles().contains(new Rectangle(model.getRobotLocation().x,
model.getRobotLocation().y + 25, 25, 25))):"";
return "Status: "... |
bfd48fe6-55d2-414e-826b-06523d74ae4b | 5 | private void calculateGlobalBest(){
int best = 0;
if(maximum){
for(int i = 0; i < fitness.size(); i++){
if(fitness.get(i) > fitness.get(best)){
best = i;
}
}
}else{
for(int i = 0; i < fitness.size(); i++){
if(fitness.get(i) < fitness.get(best)){
best = i;
}
}
}
globalBest... |
114b04d8-937b-41e9-ae6b-488874d00189 | 2 | public boolean controllersActive() {
try {
if (activeControllers.size() > 0)
return true;
else
return false;
}
catch (Exception e) {
System.exit(0);
return false;
}
} |
6e1e5891-5018-4657-8c33-cd3608191081 | 7 | @Override
public void paintComponent(Graphics stift) {
super.paintComponent(stift);
for (SchachbrettFeld feld : felder) {
//Größe der SchachbrettFelder (Quadrat)
int b = feldGroesse;
int x = (feld.spalte) * b;
int y = (feld.reihe) * feldGroesse;
... |
4c261de9-5c40-4089-8778-f5979b57c436 | 6 | @Override
public boolean onCommand(CommandSender sender, Command cmd,
String commandLabel, String[] args) {
try {
this.commands.execute(cmd.getName(), args, sender, sender);
} catch (CommandPermissionsException e) {
sender.sendMessage(ChatColor.RED
... |
f61c6c1d-d10e-4a71-a743-e1b31ca4d4e6 | 2 | public final void changeTimeout(int timeOut)
throws GetHttpException {
if(timeOut < 1000 || timeOut > 20000)
throw new GetHttpException("The timeout vale is not correct");
GetHttpPage.timeOut= timeOut;
} |
b2c417fb-5291-4b0c-882e-fe23ce43a13c | 0 | public SocketServerConnection(Socket socket, long connectionId) {
super(socket, connectionId);
} |
9af35984-09d9-4a40-8883-cc6330be4630 | 0 | public ApplicationEventPublisherAdapter() {
applicationEventPublisher = null;
} |
1befd5bd-1956-4040-9eb1-4021f99e8c66 | 1 | public static void prune() {
File oldfolder = new File(subdirectory + File.separator + OKmain.getPruneDate());
if (oldfolder.exists()) {
oldfolder.delete();
}
} |
d3622850-c36a-4911-b508-0efeafea8581 | 3 | public double getY(UIBounds bounds) {
switch(this) {
case TOP:
return 0;
case CENTER:
return -bounds.getHeight() * 0.5;
case BOTTOM:
return -bounds.getHeight();
default:
return 0;
}
} |
a2246c44-1c1c-4318-bc94-048016825c09 | 3 | public void guardar() throws FileNotFoundException, IOException{
Juego j = new Juego();
FileOutputStream out = null;
ObjectOutputStream sd = null;
Iterator i = Biblio.entrySet().iterator();
Map.Entry m;
try {
out = new FileOutputStream(this.file);
... |
1274e309-9312-4e6c-8388-589035b8fb05 | 9 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
if(commands.size()<1)
{
mob.tell(L("You must specify an item to fence, and possibly a ShopKeeper (unless it is implied)."));
return false;
}
commands.add(0,"SELL"); // will be instantly de... |
0fb0ad4d-c2e5-42e0-bfe7-5cd3b5c19018 | 7 | @SuppressWarnings("deprecation")
@EventHandler
public void PlayerInteract(PlayerInteractEvent event)
{
final Player p = event.getPlayer();
int amount = p.getItemInHand().getAmount();
if(p.hasPermission("skeptermod.useitem.chaoschimera") || (p.isOp()))
{
if(p.getItemInHand().getType().equals(Material.EMERAL... |
ea2549ef-b09e-4dac-97ef-1479af6c43b6 | 3 | public static boolean conflitoColuna(int posicaox, int posicaoy, int valorteste, Celula[][] sudoku){
int colunateste = posicaoy;
for(int i=0;i<=8;i++){
if(i==posicaox){
continue;
}
Celula celulatestar = sudoku[i][colunateste];
if(celulatest... |
d91dda84-7f93-4473-8058-0f73e5f6099b | 9 | private final void method552(byte[] bs, int[] is, int i, int i_0_, int i_1_, int i_2_, int i_3_, int i_4_, int i_5_, int i_6_, int i_7_, int i_8_, aa var_aa, int i_9_, int i_10_) {
aa_Sub1 var_aa_Sub1 = (aa_Sub1) var_aa;
int[] is_11_ = var_aa_Sub1.anIntArray5487;
int[] is_12_ = var_aa_Sub1.anIntArray5488;
int i... |
88996fbf-56b1-4f6e-9d9c-8c240a6fdc1c | 7 | protected void selfTrain(Instance testInst) {
int maxInstances = this.maxInstancesOption.getValue();
int poolSizeRatio = poolSizeOption.getValue();
int poolLimit = maxInstances / poolSizeRatio;
int poolCount = 0;
VotedInstancePool vInstPool = SelfOzaBoostID.getVotedInstancePool()... |
35e657d3-df16-49a9-bf1d-8971ba3184ac | 8 | public boolean overlap(Interval a, Interval b) {
if ((b.start >= a.start && b.start <= a.end)
|| (b.end >= a.start && b.end <= a.end)
|| (a.start >= b.start && a.start <= b.end)
|| (a.end >= b.start && a.end <= b.end)) {
return true;
} else {
return false;
}
} |
41b92497-24c7-4e27-a7c2-a585ac5c5d1a | 1 | @Override
public void run() {
InputStream is;
try {
is = client.getInputStream();
DataInputStream dis = new DataInputStream(is);
Date d = new Date(dis.readLong());
System.out.println("Client " + d + " socket: "
+ client.toString());
client.close();
} catch (IOException e) {
// T... |
79b10efc-738d-4887-b90b-6cbff662c9ee | 5 | public static boolean isA(Class<?> sub, Class<?> sup)
{
boolean res = false;
if (isSubClassOf(sub, sup))
{
res = true;
}
else if (sup.isInterface() && implementsInterface(sub, sup))
{
res = true;
}
return res;
} |
5f7674f1-2ea9-4e48-8aa4-967d78248b40 | 0 | @Before
public void setUp() {
} |
fd3348fd-6c15-45c6-874e-e8c8fd53fe91 | 8 | public PrintService accept(PrintRequestAttributeSet set) {
UIUtilities.forceFocusToAccept();
mService = UIUtilities.getTypedSelectedItemFromCombo(mServices).getObject();
if (mOrientation != null) {
PrintUtilities.setPageOrientation(set, (PageOrientation) mOrientation.getSelectedItem());
}
if (mPaperType !=... |
3b5ef279-f49f-4419-b4e3-76a47f9d26ee | 4 | public ResultSet retryResult(String query) {
boolean passed = false;
Statement statement = null;
ResultSet result = null;
while (!passed) {
try {
//Connection connection = getConnection();
this.connection = this.getConnection();
... |
f606b537-2cd0-44ac-96ce-e7545091874b | 4 | public int[] points(String[] matches)
{
int[] r = new int[matches.length];
for(int i = 0; i < matches.length; i++)
{
String[] a = matches[i].split("(?!^)");
for(String q : a)
{
if(q.equalsIgnoreCase("W"))
r[i] += 3;
else
if(q.equalsIgnoreCase("D"))
r[i] += 1;
else
... |
02499454-7b41-406c-9320-78ec7eec0cbd | 0 | public boolean hasNoWildCards()
{
return (wildCardRank == NOWILDCARD);
} |
6fd44006-bb98-485e-a92f-ae36f94f2821 | 2 | public void trimTrailingWhitespace() {
while (length > 0 && Character.isWhitespace(c[length - 1])) {
length--;
}
} |
ca74dc66-e3e4-4158-bbdd-db5b02dd03fb | 2 | public final boolean subIDEquals(Object obj) {
if (obj == this) {
return true;
}
if (obj instanceof UniqueID) {
UniqueID other = (UniqueID) obj;
return mSubID == other.mSubID;
}
return false;
} |
72055ba8-f48f-458d-96f3-a917c8d94177 | 4 | public String toString() {
String string = "A matrix consisting of " + matrix.size() + "*" + matrix.size() + " nodes.\n\n";
for (int y = 0; y < matrix.size(); y++) {
for (int x = 0; x < matrix.size(); x++) {
Node node = getNode(x, y);
if (node instanceof Wall) {
string += "/|/";
} else if (no... |
168208d1-09ab-4cf2-ba00-331b1109fe19 | 9 | public void decryptWithoutKey(String textfileName) throws FileNotFoundException { //makes some shit
ObligatoryMath om = new ObligatoryMath();
List<String> mrblist = ch.parseTextToListOfBigramms("mostRepeatedNgramms"); //list with most repeated bigramms
MostRepeatableBigrammsCounter mrb = ne... |
f1bf0ed7-78e1-4f18-9dff-f063a70cc41b | 8 | public boolean rightPlace(MOB mob,boolean auto)
{
final Room R=mob.location();
if(R==null)
return false;
if((!auto)&&(R.domainType()&Room.INDOORS)>0)
{
mob.tell(L("You must be outdoors for this chant to work."));
return false;
}
if((R.domainType()==Room.DOMAIN_OUTDOORS_CITY)
||(R.domain... |
1204bd9d-c8fa-41f7-a37f-8152eec10560 | 4 | private void handleInput(Skin skin, boolean openNewSkin, boolean openChooser, boolean saveSkin) {
dispose();
if (saveSkin) {
Main.save(skin);
}
if (!openNewSkin) {
if (!openChooser) {
Main.shutdown();
} else {
Main.sh... |
49782606-a797-446c-9b34-0d6e04a79b3b | 0 | public int value() {
return i;
} |
6bb98eb3-eff5-431c-9b27-8517e0ed4ba1 | 6 | public static String buildStringFromCommandArray(List<String> command) throws CommandExecutionException {
logger.debug("CommandExecuter(): buildStringFromCommandArray(): Begin. Executing command from string array.");
String line;
int lineCount = 0;
StringBuilder cmdOutput = new StringBuilder();
ProcessBuilder... |
99c83cd4-77bf-4d9d-a9c3-753e63a8199d | 0 | public void setDefaults()
{
setIcon(new ImageIcon(getClass().getResource("/ICON/x.gif")));
setPreferredSize(new Dimension(22, 22));
setToolTipText("Dismiss Tab");
} |
30af8e18-c152-4eef-93d1-25bebf806e0f | 0 | public void setLooping(boolean looping) {
this.looping = looping;
} |
481c620f-8b15-4c30-9a52-ad312299218d | 4 | public OlympicBubbleplot(String csvfile) {
// Help mainly found at:
// http://www.ifs.tuwien.ac.at/~rind/w/doku.php/java/prefuse-scatterplot
super(new Visualization());
table = new Table();
// Read table from csv file
try {
table = new CSVTableReader().readTable(csvfile);
} catch (DataIOException e... |
ee20e362-57ec-463b-9659-0a578a6bd170 | 6 | public static Point[] getMinMaxPointRotation(int width, int height, double radians) {
DoublePoint cr = new DoublePoint(width/2, height/2); //Gets the center point
DoublePoint[] p = { //Rotate the four points
rotatePoint(0, 0, cr.x, cr.y, radians),
rotatePoint(0, height, cr.x, cr.y, radians),
rotatePoin... |
a748e2f9-d0f4-40e8-aefb-a31329a5f43f | 8 | private static Object js_unshift(Context cx, Scriptable thisObj,
Object[] args)
{
if (thisObj instanceof NativeArray) {
NativeArray na = (NativeArray) thisObj;
if (na.denseOnly &&
na.ensureCapacity((int)na.length + args.length))
... |
0a60cd0e-2ea8-4781-99e3-714752546303 | 0 | private Discretizer() {
} |
07fdab61-04c3-4e34-9fd5-72a0c4d5cf9c | 3 | @Override
public Curriculum unmarshall(InputStream xmlStream)
throws UnmarshallerException {
SAXReader reader = newSAXReader();
try {
Document document = reader.read(xmlStream);
String term = selectSingleNodeText(document,
"/curr:curriculum/@te... |
9de4f4fd-7ec2-4161-9ae7-5e6395c39089 | 5 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Vector2f vector2f = (Vector2f) o;
if (Float.compare(vector2f.x, x) != 0) return false;
if (Float.compare(vector2f.y, y) != 0) return false;
... |
5493876b-d053-449d-9789-6ecb904b6442 | 1 | public List<ExtensionsType> getExtensions() {
if (extensions == null) {
extensions = new ArrayList<ExtensionsType>();
}
return this.extensions;
} |
d5e5c888-979c-43a6-9ba2-f97659d0975d | 1 | public SAXCodeAdapter(final ContentHandler h, final int access) {
super(h);
labelNames = new HashMap();
if ((access & (Opcodes.ACC_ABSTRACT | Opcodes.ACC_INTERFACE | Opcodes.ACC_NATIVE)) == 0) {
addStart("code", new AttributesImpl());
}
} |
bf5ca159-c940-4f20-9008-1fc2b4924b52 | 5 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
PrintWriter out = response.getWriter();
// Get the list of all variables for browse by the selected codebook
if (request.getParameter("codebook") != null) {
response.setContentType("text/html"... |
672aaa9b-b20f-456e-a9fa-a3710e00c5fe | 5 | public static void setLookAndFeel() {
if(lnfClassName != null) {
try {
UIManager.setLookAndFeel(lnfClassName);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} ... |
2a7fef8b-89a1-41d3-a446-308d9e0fb075 | 2 | public static BigDecimal String2BigDecimal(String str)
{
BigDecimal bigDecimal = null;
if (str != null && str.trim().length() != 0)
{
bigDecimal = new BigDecimal(str);
}
return bigDecimal;
} |
cb2048e3-9155-43e5-9541-c49630ddb2ad | 6 | private String buildEntityString(InanimateEntity item) throws XMLStreamException {
StringBuilder str = new StringBuilder();
Entities itemEnum = item.asEnum();
// The enum name of the object, as that is the easiest distinction
str.append(itemEnum.name()+XMLValues.SPACE);
//if it need more detail, it will be in... |
4ca4e39f-d408-4511-b0c2-0538d0915200 | 7 | public static JPanel EditMovieObjectCard (){
System.out.println("EditMovieObjectCard - flag");
JPanel card = new JPanel();
card.add( new JLabel("Movie Functions. 2011"));
try{
Globals.ActiveMovie = Globals.ATA.BusFlightArray[Globals.ActiveFlightObjID].MovieArray[Globals.ActiveMovieOb... |
0716953c-98da-4b71-9fc7-acf0b355aa1c | 6 | @Override
public SnpEffectPredictor create() {
// Read gene intervals from a file
if (fileName == null) fileName = config.getBaseFileNameGenes() + ".txt";
if (verbose) System.out.print("Reading gene intervals file : '" + fileName + "'\n\t\t");
readRefSeqFile(); // Read gene info
beforeExonSequences(); // S... |
5c5635b4-110c-4496-b11a-a3486abbe298 | 5 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final OffrirPK other = (OffrirPK) obj;
if (!Objects.equals(this.vis_matricule, other.vis_matricule)) {
... |
55fb3fc7-3092-4587-8ff7-a76a3d1c249e | 7 | public static Map<String, Object> getMapFromJsonObject(JSONObject jsonObj) {
Map<String, Object> map = new HashMap<String, Object>();
for (String key : jsonObj.keySet()) {
JSONValue jsonVal = jsonObj.get(key);
if (jsonVal instanceof JSONNull) {
map.put(key, null);
} else if... |
89f1ed04-0c35-40b9-91f3-b11b266d970f | 5 | protected InputStream getInputStream(URL requestUrl, Map<String, String> params) throws ApiException {
OutputStreamWriter wr = null;
try {
URLConnection conn = openConnection(requestUrl);
conn.setDoOutput(true);
wr = new OutputStreamWriter(conn.getOutputStream());
StringBuilder data = new StringBuilder(... |
259d2cea-0908-4a86-84dd-e2945a90894d | 9 | public static int pageCount(String hql, String paras[]) {
Session s = null;
Transaction tx = null;
int pageCount = 0;
try {
s = HibernateUtil.openSession();
;
tx = s.beginTransaction();
Query q = s.createQuery(hql);
if (paras != null && paras.length != 0) {
for (int i = 0; i < paras.length; i... |
c45098af-e539-4f24-9a62-27f2fee587bb | 0 | @Override
public <T extends PersistentObject> Collection<T> list(Class<T> entityClass) {
return (Collection<T>) dataStore.values();
} |
11f0275e-8c85-4716-b903-7cbcec461563 | 8 | private int addNeighbours(Point target, List<Point> list){
int count = 0;
if (target.y - 2 >= 0) if (this.maze[target.x][target.y - 2] == true) {list.add(new Point(target.x, target.y - 1));count++;}
if (target.y + 2 <= this.length - 2) if (this.maze[target.x][target.y + 2] == ... |
21617597-807d-44a4-881b-3f7cad8e19a1 | 0 | public ServerOutputThread (Socket socket){
this.socket = socket;
} |
8c086dad-2b2f-4325-b51c-fbab730f3fbc | 1 | public PreferenceBoolean getUseCreateModDates() {
if (useDocumentSettings()) {
return this.useCreateModDates;
} else {
return Preferences.getPreferenceBoolean(Preferences.USE_CREATE_MOD_DATES);
}
} |
651c367b-6e5a-4ef6-bafb-fdcc13cdb01e | 8 | private static Collection<Circle> filterOverlaps(Collection<Circle> input)
{
Collection<Circle> output = new ArrayList<>(input.size());
// for each circle
for(Circle c1 : input)
{
// at first it doesn't have overlaps
boolean hasOverlaps = false;
... |
98c5e546-96e2-401b-8777-a4cfba83448e | 7 | static final String method1788(byte i, long l) {
try {
anInt6016++;
if (l <= 0L || (l ^ 0xffffffffffffffffL) <= -6582952005840035282L)
return null;
if (l % 37L == 0L)
return null;
int i_0_ = 0;
long l_1_ = l;
int i_2_ = -20 % ((i - -6) / 62);
for (/**/; l_1_ != 0L; l_1_ /= 37L)
... |
3fc6bdbf-c7f3-4683-baf0-05837fac5884 | 2 | public UserModelBean checkUser(String login, String pwd) {
try {
// create connection
connection = java.sql.DriverManager.getConnection("jdbc:mysql://"
+ dB_HOST + ":" + dB_PORT + "/" + dB_NAME, dB_USER, dB_PWD);
// Cr�ation de la requ�te
java.sql.Statement query;
// Creation de l'�l�ment de req... |
e9772a1a-63b0-416f-809f-a81f1cb05287 | 4 | public Resource getcurs(Coord c) {
Resource ret;
for (Widget wdg = lchild; wdg != null; wdg = wdg.prev) {
if (!wdg.visible)
continue;
Coord cc = xlate(wdg.c, true);
if (c.isect(cc, wdg.sz)) {
if ((ret = wdg.getcurs(c.add(cc.inv()))) != null)
return (ret);
}
}
return (cursor);
} |
38ba3491-51e7-4c06-882e-6d0d6c5916b2 | 4 | public void shutdown(){
// 保证所有链接都处于空闲状态
while(this.count > this.pool.size()){
try {
Thread.currentThread().sleep(200);
} catch (InterruptedException e) {
e.printStackTrace();
}// 睡200毫秒
}
// 设置销毁标记
this.isReleasing = true;
// 关闭所有链接
while(!this.pool.isEmpty()){
try {
this.po... |
871cd08a-ad6c-495c-a78e-ec58b8091285 | 5 | public static int velocityUnitStringToIndex(String unit) {
switch (unit) {
case "kph":
return 0;
case "mph":
return 1;
case "m/s":
return 2;
case "kn":
return 3;
case "kts":
... |
9d1b84f2-ee3c-422b-9697-c0186170ae49 | 7 | public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line = "";
StringBuilder out = new StringBuilder();
while ((line = in.readLine()) != null && line.length() != 0) {
int nSet = Integer.parseInt(line.trim());
for (int... |
50e660c4-1e63-4971-9065-9c7a06c4b1a7 | 2 | public static ArrayList<Question> getQuestionsByQuizID(int quizID) {
ArrayList<Question> questionList = new ArrayList<Question>();
try {
String statement = new String("SELECT * FROM " + DBTable + " WHERE quizid = ?");
PreparedStatement stmt = DBConnection.con.prepareStatement(statement);
stmt.setInt(1, qui... |
a73f834a-6c97-40ca-b57f-2d3be214dc6a | 8 | public void init() {
JPanel panel = new JPanel();
GroupLayout groupLayout = new GroupLayout(this);
groupLayout.setHorizontalGroup(
groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addContainerGap()
.addComponent(panel, GroupLayout.DEFAULT_SIZE, ... |
5185e50c-4c89-4789-b0ea-fdff40e323a0 | 2 | @Override
public void run() {
try {
OutputStream os = socket.getOutputStream();
while(true){
//由Socket对象得到输出流,并构造PrintWriter对象
PrintWriter pw = new PrintWriter(os);
System.out.println("1111111111====");
//由系统标准输入设备构造BufferedReader对象
BufferedReader buffer = new BufferedReader... |
65290928-1850-4306-9a5f-6a410f2c3704 | 8 | boolean isScientificNotation(String s) {
s = s.trim();
char[] arr = s.toCharArray();
int index_of_e = indexOfChar(arr, 'e');
if (index_of_e > 0) {
// e 左边第1倍不是数字,并且也不是小数点
if (!isDigital(arr[index_of_e - 1]) && arr[index_of_e - 1] != '.') {
return f... |
469a86c2-b2ab-40e9-9c32-6230e4977a66 | 1 | public boolean matches( Class<?> clazz )
{
return Modifier.isStrict( clazz.getModifiers() );
} |
08defe9c-fe52-499b-8eb4-7fb45af1e955 | 2 | public Logger getLogger(final String name) {
for (Logger logger: loggers) {
if (logger.getName().equals(name)) {
return logger;
}
}
return null;
} |
e0b5b091-b902-44a7-b629-5899a163731d | 1 | @Override
public void dragEnter(DropTargetDragEvent dtde) {
mDragDockable = getDockableInDrag(dtde);
if (mDragDockable != null) {
mDragInsertIndex = -1;
updateForDragOver(dtde.getLocation());
dtde.acceptDrag(DnDConstants.ACTION_MOVE);
} else {
dtde.rejectDrag();
}
} |
fff3b024-5111-4dfc-8c52-18ebef242c89 | 2 | public String toString() {
StringBuffer sb = new StringBuffer();
sb.append("[").append("total=").append(totalRecode).append(",pages=")
.append(pageRecode).append(",pageNumber=").append(curPageNum)
.append(",pageCount=").append(pageCount).append(",isFirstPage=")
... |
5ba5c54b-866a-4857-b7e6-82ec4c0bc679 | 5 | public Prototype loadPrototype(InputStream is, String chunkname, String mode) throws IOException {
if (mode.indexOf('b') >= 0) {
if (undumper == null)
error("No undumper.");
if (!is.markSupported())
is = new BufferedStream(is);
is.mark(4);
final Prototype p = undumper.undump(is, chunkname);
if ... |
2a203a27-fa6f-45ce-82de-602a492e2bc9 | 9 | @Override public void setParameter(String paramname, int a){
if(paramname == "Age"){ age = a;}
if(paramname == "Fade"){fade = a;}
if(paramname == "Mat"){ mat = a;}
if(paramname == "Matcount"){ matcount = a;}
if(paramname == "MirrX"){hoodx = a;if(mirror){setLocation(hoodx, hoody);}}
if(paramname == "Mi... |
5ece83fd-dfe5-490b-b5c1-a6bc4022891d | 0 | protected void setY(int _y) {
this.y = _y;
} |
123ed17d-97e6-4646-af6c-ecbe6ba1f48c | 8 | public int nthElement(int[] lowerBound, int[] upperBound, int n){
long low = -bound; long hi = bound;
int length = lowerBound.length;
n++;
while(low<=hi){
int target = (int) ((hi+low)/2);
int smaller = 0, equal = 0;
for(int i=0; i<length; i++){
... |
1aec819b-6b38-4290-adb4-0763d041a462 | 4 | public void playBackgroundMusic(){
if (NineManMill.PLAY_MUSIC){
if (NineManMill.bgplayer!=null && NineManMill.bgplayer.isActive()){
return; //already playing
}
try {
NineManMill.bgplayer.playBGMusic();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}... |
541f5ddc-a723-462d-aa8c-2bec58f140eb | 6 | public boolean getOptionOrdinalValue(EnumOptions par1EnumOptions)
{
switch (EnumOptionsMappingHelper.enumOptionsMappingHelperArray[par1EnumOptions.ordinal()])
{
case 1:
return this.invertMouse;
case 2:
return this.viewBobbing;
cas... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.