method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
9f103531-d3c7-4262-af3e-2b96a7d335e5 | 4 | public void loadAllAssets(){
try {
ResultSet dbAllAssets = null;
Statement statement;
statement = connection.createStatement();
dbAllAssets = statement.executeQuery( "SELECT Asset.ID, Asset.assetName, Asset.assetType, Task.taskID" +
... |
b7ce9ad2-a0cc-42f8-a723-2dffdc347f71 | 6 | @EventHandler
public void WolfFireResistance(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.getWolfConfig().getDouble("Wolf.FireRe... |
4dbb6d7c-3343-4665-b49c-b17386794ca6 | 0 | public CheckResultMessage checkDayofMonth2() {
return checkReport1.checkDayofMonth2();
} |
e354c04c-2a16-4b45-b29d-c2e01363a79c | 8 | public ArrayList<Franchise> GetOneFranchise(int FranID)
throws UnauthorizedUserException, BadConnectionException, DoubleEntryException
{
/* Variable Section Start */
/* Database and Query Preperation */
PreparedStatement statment = null;
ResultSet results = nu... |
829e2726-8362-4785-b3ad-058305eaa337 | 4 | @Override
public void dragGestureRecognized(DragGestureEvent dge) {
if (mDividerDrag == null && mModel.hasSelection() && allowRowDrag()) {
Point pt = dge.getDragOrigin();
RowSelection selection = new RowSelection(mModel, mModel.getSelectionAsList(true).toArray(new Row[0]));
if (DragSource.isDragImageSupport... |
9ded058c-ff95-4fd3-88be-3b6751d28d69 | 1 | public void addQLButtonListener(ActionListener listen){
for(JButton btn : quick_btns){
btn.addActionListener(listen);
}
} |
3ef05521-7471-4d47-ab1f-757e691ee65a | 8 | public String toString() {
if (m_Classifiers == null) {
return "Vote: No model built yet.";
}
String result = "Vote combines";
result += " the probability distributions of these base learners:\n";
for (int i = 0; i < m_Classifiers.length; i++) {
result += '\t' + getClassifierSpec(i) + ... |
aa79144d-bc71-42a5-a274-328991ba5741 | 9 | public void actionPerformed(ActionEvent e) {
if(e.getSource() == widokGlowny.btn_DolaczDoGry)
pokazOknoDolacz();
if(e.getSource() == widokGlowny.btn_UtworzSerwer)
pokazOknoUtworz();
if(e.getSource() == widokGlowny.mnI_UstawieniaLokalne)
{
widokGlowny.widokUstawien.widokUstawienZdarzenia.setOknoMacierz... |
1f5c0b94-f267-4002-819d-f1a081659471 | 0 | @Before
public void setUp() {
} |
d8eb98e4-c80c-4750-a522-83fef6c73fe0 | 1 | public String getLabelCode(){
String str = element.getLabelCode();
if(program != null)
str += program.getLabelCode();
return str;
} |
8d00bc51-44d1-4b7e-8d06-520f444553db | 8 | public static int convertToInt(StateActor state){
switch (state){
case UP : return 8;
case DOWN : return 2;
case LEFT : return 4;
case RIGHT : return 6;
case ATTACKINGUP : return 88;
case ATTACKINGDOWN : return 22;
case ATTACKINGLEFT : return 44;
case ATTACKINGRIGHT : return 66;
default : return 5... |
4968374b-c405-44bb-8a4d-351f77999237 | 2 | public static ArrayList<String> getAnswerListByXMLElem(XMLElement root) {
ArrayList<String> answerList = new ArrayList<String>();
for (int i = 0; i < root.childList.size(); i++) {
XMLElement elem = root.childList.get(i);
if (!elem.name.equals("answer"))
System.out.println("Answer list unexpected name " +... |
52bfd5c0-998e-4b52-ba76-341b5bbdb28e | 8 | public void compare ( DBParams schema_params, String fileName ) throws Exception {
String strXML = "";
// Прочитаем текст из файла
try {
byte[] encoded = Files.readAllBytes(Paths.get(fileName));
strXML = new String(encoded);
} catch (IOException e) {
Syst... |
ac91865b-31cb-4a48-8ea4-a971362b99e6 | 9 | private void init() {
/*
* Citire fisier de configurare
*
* Daca apar erori la citire, atunci utilizatorul va fi informat
* printr-un Message Dialog si metoda va face return, fara alte operatii
* (practic trebuie repornita aplicatia)
*
* sau putem face o facilitate: un dialog window, in care i... |
dbfb892b-7eee-49d5-baa4-4bd1ec64ea0e | 6 | public static void main(String[] args) throws IOException
{
Double[][] d = new Double[2][8];
for(int x = 0;x<8;x++)
{
d[0][x] = 40.0*Math.random();
d[0][x] = 20-d[0][x];
d[0][x] = function(d[0][x]);
d[1][x] = 1.0*x;
}
... |
757eaeaa-daba-485e-a73d-cfce365df7a2 | 2 | public int getInitWeek(String initWeek) {
/**
* getWeekNow(String initWeek)
*
* @para nowWeek 系统日期中的星期 返回当月中的1号是从星期几开始
*/
int nowWeek = 0;
for (int i = 0; i < 7; i++) {
if (initWeek.equalsIgnoreCase(stringWeekEn[i])) {
nowWeek = i;
break;
}
}
return nowWeek;
} |
0b87ee3c-6f76-47fc-a894-97937e19db60 | 7 | public void serviceInactive(ReceivableService receivableService) {
for(ReceivableEvent receivableEvent : receivableService.getReceivableEvents()) {
Set<ServiceID> serviceIDs = eventID2serviceIDs.get(receivableEvent.getEventType());
if(serviceIDs != null) {
synchronized(serviceIDs) {
serviceIDs... |
50e7e8f2-9a8a-4dcc-82cf-a7d145b73257 | 0 | public String getLastName() {
return lastName;
} |
dfeb4b52-acb3-4dd7-aecd-923028f93d97 | 9 | public void backproject(Volume v)
{
int width = v.getWidth();
// Compute center of volume vc.
int cvx = v.getWidth() / 2;
int cvy = v.getHeight() / 2;
int cvz = v.getDepth() / 2;
// Compute center of projection image... |
0773b320-e5e9-452e-a684-b4b3f3738e0a | 6 | public void actionPerformed(ActionEvent arg0) {
if (arg0.getSource() instanceof JButton){
executeSelection();
return;
}
JRadioButton sourceb = (JRadioButton)arg0.getSource();
source = sourceb.getText();
Runnable changePic = new Runnable() {
public void run(){
SubMenuEntry entry = null;
for... |
dd72f16b-1a50-4caf-970f-6d3032447c80 | 9 | private void btSalvarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btSalvarActionPerformed
Paciente p = new Paciente();
if (!(txCodigo.getText().equals("")) || (txCodigo.getText().equals(null))) {
p.setCodigo(Integer.parseInt(txCodigo.getText()));
}
p.se... |
96bbb6e4-38fc-46bd-ba40-43d429ebdaa4 | 2 | @Override
public List<Character> getAll() {
List<Character> clients = new ArrayList<Character>();
try
{
ResultSet rs = getAll.executeQuery();
while(rs.next()){
Character p = new Character();
p.setId(rs.getInt("id"));
p.setDescription(rs.getString("description"));
p.setName(rs.getSt... |
3a71d577-83b5-4a06-a14c-d64d35bd9c9e | 8 | public void putAll( Map<? extends Long, ? extends Double> map ) {
Iterator<? extends Entry<? extends Long,? extends Double>> it =
map.entrySet().iterator();
for ( int i = map.size(); i-- > 0; ) {
Entry<? extends Long,? extends Double> e = it.next();
this.put( e.getKey... |
5136a01c-ba23-419a-b1de-721a5e4a0951 | 5 | public static void loadkeys() {
OKmain.maxlogs = readString("max-logs-to-keep");
OKmain.chatlogs = readBoolean("enable-chat-logging").booleanValue();
OKmain.cmdlogs = readBoolean("enable-command-logging").booleanValue();
OKmain.cmdconsolelogs = readBoolean("enable-command-logging-to-cons... |
c2d9160b-e639-4d58-a0bd-6afd9e9318dd | 2 | private void buildFromDatabase(HashMap<String, ClassInfo> db) {
for(ClassInfo info : db.values()) {
if(checkClass(db, info)) {
list.add(info);
}
}
} |
facb7d33-b72f-4cb1-9f3b-801e5136580c | 0 | public FindReplaceResult getResult(int index) {
return (FindReplaceResult) results.get(index);
} |
74f0b5f6-b0c6-46cc-aa73-cca8743636d2 | 6 | @Override
public int getKillStreak(int player_id) {
PreparedStatement pst = null;
ResultSet rs = null;
try {
pst = conn.prepareStatement("SELECT killstreak FROM ffa_leaderboards WHERE player_id=?");
pst.setInt(1, player_id);
rs = pst.executeQuery();
while (rs.next()) {
return rs.getInt("killstrea... |
a8cbde67-7472-4af4-9c18-3f4511dfa0f6 | 0 | @Basic
@Column(name = "FUN_ENDEUDAMIENTO")
public Integer getFunEndeudamiento() {
return funEndeudamiento;
} |
c8643b0f-b4a8-4491-85bf-6bb2a662b37c | 8 | private ChatCommand getNextCommand()
{
print(">");
String command = scanner.nextLine();
if (command.length() != 1)
{
return ChatCommand.NO_COMMAND;
}
switch (command.charAt(0))
{
case 'q':
... |
4e2edd9e-d7e6-4079-9700-9315e5ca386b | 4 | @Test
public void testLinkedHashMapLong() {
long minTime = Long.MAX_VALUE;
long maxTime = Long.MIN_VALUE;
long avgTime = 0;
long beforeTime = 0;
long afterTime = 0;
long curTime = 0;
Random random = new Random();
int value;
AbstractProcessor<L... |
db37f4a5-8091-4f1e-b21a-30fac0a00038 | 6 | private Expression parseComparisonExpression() {
Token token = tokens.lookahead();
Expression expr;
switch (token.type) {
case EQUAL:
tokens.consume();
expr = new Equal(parseVersion());
break;
case NOT_EQUAL:
tokens.consume();
expr = new NotEqual(parseVers... |
f7c9493c-df48-4a37-8ef7-0723893d891d | 6 | void createCanvas(Composite parent) {
int style = SWT.NO_BACKGROUND;
if (dbItem.getSelection()) style |= SWT.DOUBLE_BUFFERED;
canvas = new Canvas(parent, style);
canvas.addListener(SWT.Paint, new Listener() {
public void handleEvent(Event event) {
GC gc = event.gc;
Rectangle rect = canvas.getClientArea(); ... |
b297a085-75da-4ea0-ba32-3f2d13041603 | 8 | public static double[][] readMatrix(Path path, HamaConfiguration conf,
int rows, int columns, int blockSize) {
int finalRows = getBlockMultiple(rows, blockSize);
int finalCols = getBlockMultiple(columns, blockSize);
double[][] matrix = new double[finalRows][finalCols];
SequenceFile.Reader reader = null;
... |
b853efe0-da53-41b6-b061-3d499130ad09 | 8 | @Override
public double[] calculateFractal3DWithoutPeriodicity(Complex pixel) {
iterations = 0;
double temp = 0;
Complex[] complex = new Complex[3];
complex[0] = new Complex(pixel);//z
complex[1] = new Complex();
if(parser.foundZ()) {
parser.setZ... |
d8a0690f-581d-4078-8dcc-82e863f256d2 | 1 | public void trimHistory() {
while (history.getSize() > history_location + 1) {
history.removeElementAt(history.getSize() - 1);
}
} |
fdd26054-2dfb-43d9-8940-3015a678538b | 9 | private void findProbableRoutes() {
ArrayList<StopAdapter> list = new ArrayList<>();
if (mProbableRoutes.size() == 0) {
mRejectedRoutes.clear();
}
synchronized (mStopHistory) {
int index = mStopHistoryIndex;
for (int i = 0; i < mStopHistory.size(); i++) {
index = incIndex(index);
if (mStopHisto... |
f2afad21-909f-4d41-87a7-3941a983f4da | 3 | public static void main(String[] args) throws Exception{
String dictFile = "words.txt";
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String line;
TopQueue topQueue;
if(args.length == 1) {
dictFile = args[0];
}
else if(... |
d23a7323-3b05-42ca-bc20-7c2cf704cb1d | 1 | public void addListener( L listener ) {
if( listener == null ) {
throw new IllegalArgumentException( "listener must not be null" );
}
listeners.add( listener );
} |
3995db33-5015-4b24-b673-e3df8dfb2a35 | 0 | @Override
public void loadOp() throws DataLoadFailedException {
ConfigurationSection sec = getData("server", "op");
YamlPermissionBase permBase = new YamlPermissionOp(sec);
load(PermissionType.OP, permBase);
} |
c4e28990-e0a6-4bbd-9552-738afaadc90f | 4 | void saveSettingsToAltimeter()
{
settingsDialog.enableButtons(false);
new Thread(new Runnable() {
public void run() {
try {
log("Writing settings to altimeter ...", "message");
Settings settingsToWrite = settingsDialog.getSettings();
altimeter.settings = settingsToWrite;
altimeter.writeS... |
469dc93f-c256-4b31-9f3d-4eea5f938803 | 4 | public void visitVarInsn(final int opcode, final int var) {
if (var < 4 && opcode != RET) {
minSize += 1;
maxSize += 1;
} else if (var >= 256) {
minSize += 4;
maxSize += 4;
} else {
minSize += 2;
maxSize += 2;
}
if (mv != null) {
mv.visitVarInsn(opcode, var);
}
} |
70bc7c03-5480-4a30-af4c-af42b1ebe1fb | 7 | public boolean CanSet(Pos setPos, Stone myColor) {
// 第一条件 石がないこと
if (getColor(setPos) == Stone.NONE) {
ArrayList<Pos> directionList = Pos.getToAllDirection();
for (Pos direction : directionList) {
// 探索の開始位置をセット
Pos nawPos = new Pos(setPos.getX(), setPos.getY());
// 相手の石があったか
boolean enemy... |
e8e8da86-48e3-455b-81a9-d1b7526081a2 | 8 | public void addToRoom(final Room R, final Item fromShip, final int fromDir)
{
if(R==null)
return;
final Ability A=CMClass.getAbility("Spell_Light");
if((A!=null)&&(R.fetchEffect(ID())==null))
{
final boolean isInDark=CMLib.flags().isInDark(R);
A.setInvoker(invoker());
A.setSavable(false);
A.setE... |
0ec05523-ab4f-4848-9dfa-433e37b62a13 | 4 | public void refreshCurve() {
// System.out.println("Curve refreshing");
needsRefresh = false;
double lengthx = end.x - start.x;
double lengthy = end.y - start.y;
double centerx = ((double) (start.x + end.x)) / 2.0;
double centery = ((double) (start.y + end.y)) / 2.0;
d... |
98a41af9-42af-48af-a5cf-292e89d67d28 | 7 | @Override
public boolean equals(final Object obj) {
if (this == obj) return true;
if (obj == null) return false;
if (getClass() != obj.getClass()) return false;
final Quaternion other = (Quaternion) obj;
double x1 = Math.round(r * re) / r;
double y1 = Math.round(r * i) / r;
double z1 = Mat... |
26800e96-bcd0-44a8-96f6-e3800c75977d | 0 | public Vector<DiscoveredClient> getClients()
{
return clientList;
} |
a08eca4f-f3d6-48a0-a9d6-3e8c92af9829 | 3 | private String CharToCombined(char c)
{
// binary format of ascii of char c
String binaryStringShort = Integer.toBinaryString((int)c);
// fill the 0s to get 8 bits
StringBuffer paddingBuffer = new StringBuffer();
while(paddingBuffer.length() < 8 - binaryStringShort.length())
{
paddingBuffer.append("... |
aaf63999-1ee2-4b2e-8551-8355e1dcc43c | 4 | private static void inputCheck(short localPort, short serverPort, int retransmissionInterval) {
if (localPort > 65535 || localPort < 1024 || serverPort > 65535 || serverPort < 1024) {
System.err.println("Port number must be in between 1024 and 65535");
System.exit(1);
}
} |
cc650a17-fb30-422f-815c-2cb2fdc53722 | 6 | public static Object getProperty(Object obj, String propertyName)
{
if (obj == null)
return null;
try
{
BeanInfo info = Introspector.getBeanInfo(obj.getClass());
PropertyDescriptor[] descriptors = info.getPropertyDescriptors();
for (int i = 0; ... |
6be40eb5-d7ad-4e57-b396-4608e0c2a037 | 6 | public AbstractInsnNode clone(final Map labels) {
FrameNode clone = new FrameNode();
clone.type = type;
if (local != null) {
clone.local = new ArrayList();
for (int i = 0; i < local.size(); ++i) {
Object l = local.get(i);
if (l instanceof L... |
d570484f-a8c6-4d9e-9497-31786d6ab34f | 8 | private static int getJobMaxNeed(ArrayList<Pair> list, ReservedRequest job) {
int s = 0;
for (int i = 0; i < list.size(); i++) {
Pair pair = list.get(i);
if (pair.time >= job.getInitialTime()) {
if (pair.time == job.getInitialTime())
s = i;
else
s = i - 1;
break;
}
}
//
int k ... |
9bd86ed5-6f7c-45ae-967c-09dfcd4f8817 | 6 | public Solucao One_flip_best(Solucao inicio, int x){
this.solucoes.put(inicio.getCustototal(), inicio);
for(Coluna col : inicio.getColunas()){
for(Integer colx : inicio.getLinhasX().keySet()){
if(col.getNome()!=inicio.getLinhasX().get(colx).getNome()){
... |
3070bde1-5bd3-423f-b4aa-0a979177a479 | 2 | public void resize(int width, int height, int dx, int dy) {
for (MapLayer layer : this) {
if (layer.bounds.equals(bounds)) {
layer.resize(width, height, dx, dy);
} else {
layer.setOffset(layer.bounds.x + dx, layer.bounds.y + dy);
}
}
... |
6b370758-09ed-4c04-a583-bbfba2130c3f | 2 | @Test
public void testGetChannel() {
System.out.println("getChannel");
LocationHeader instance;
//Test with well-formed header
String expResult = "channel";
try {
instance = new LocationHeader("GET /channel HTTP/1.1");
String result = instance.getChannel();
assertEquals(expResult, result);
} ca... |
ed6939d5-ec89-496a-b735-e52879939bc7 | 2 | private static double dist(
double a,
double b )
{
double r;
if ( Math.abs(a) > Math.abs(b) )
{
r = b / a;
return(Math.abs(a) * Math.sqrt(1 + r * r));
}
else
if ( b != 0 )
{
r = a / b;
return(Math.abs(b) * Math.sqrt(1 + r * r));
}
else
return(0.0);
} |
f7ec9b59-ca97-4414-9dd1-29dc4976e5f8 | 4 | public static String getSuffix(final String name) {
try {
String s = "";
if (MonsterIRC.getHookManager() != null) {
if (MonsterIRC.getHookManager().getChatHook() != null) {
if (MonsterIRC.getHookManager().getChatHook()
.getP... |
8db055ad-4291-4556-b4b8-d9ddf342e70c | 7 | public void translateCell(Object cell, double dx, double dy)
{
mxGeometry geo = model.getGeometry(cell);
if (geo != null)
{
geo = (mxGeometry) geo.clone();
geo.translate(dx, dy);
if (!geo.isRelative() && model.isVertex(cell)
&& !isAllowNegativeCoordinates())
{
geo.setX(Math.max(0, geo.getX... |
e70af813-787c-4d0a-84d6-61375e757365 | 5 | @Override
public void propertyChanged(String id, String value)
{
switch (id)
{
case PRP_LANGUAGE_CODE:
setToolTips();
break;
case PRP_MODE:
switch (value)
{
case CMD_PHYSI... |
f6e57c4b-fb49-4049-b25e-2263f45230db | 6 | private void getFollowees(String name, String post, long time) {
for (User user : users) {
if (!user.getName().equals(name)) {
for (User followee : user.getFollowers()) {
if (followee.getName().equals(name)) {
String newPost = name + ": ";
... |
943c3850-cab5-474a-927c-45abdb934972 | 2 | public static String userList(Channel channel) {
PacketBuilder buffer = new PacketBuilder(
SendOpcode.USER_LIST.getValue());
buffer.writeByte(0x00);
buffer.writeString(channel.getName());
for (Client client : channel.getClients()) {
buffer.writeByte(0x00);
buffer.writeString(client.getName());
bu... |
880b0144-033f-4df0-a5c1-726890831d93 | 4 | public boolean addItem(Item item){
int i = 0;
while(getItem(i) != null){
i++;
}
if(i > 15){
return false;
}
items.set(i, item);
while(items.size() != 16){
if(items.size() < 16){
items.add(null);
}else{
items.remove(15);
}
}
return true;
} |
0bc83d26-6402-4685-9192-973ef375cd89 | 7 | public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line = "";
StringBuilder out = new StringBuilder();
all();
solve();
while ((line = in.readLine()) != null && line.length() != 0) {
int n = Integer.parseInt(line.tri... |
5165afe4-57cb-48fe-bb4b-29052e45db65 | 5 | public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
Player player = (Player)sender;
if(commandLabel.equalsIgnoreCase("fly")) {
if(sender.hasPermission("basics.command.fly.self")) {
if(args.length == 0) {
final float fall = player.getFallDistance();
if(e... |
ac299aba-4732-4d1c-9202-21107efbde86 | 6 | @Override
public StringBuffer getOOXML( String catAxisId, String valAxisId, String serAxisId )
{
StringBuffer cooxml = new StringBuffer();
// chart type: contains chart options and series data
cooxml.append( "<c:bar3DChart>" );
cooxml.append( "\r\n" );
cooxml.append( "<c:barDir val=\"bar\"/>" );
cooxml.a... |
1a4261a3-d24c-491d-a3e9-e5efd2116363 | 0 | public void setReserve(byte[] reserve) {
Reserve = reserve;
} |
45eb5905-e117-456a-ae6b-c43bedef4e8a | 2 | public static void main(String[] args){ //Main Method
AG_Captor_Original cap = new AG_Captor_Original(); //Creates a new captor object
cap.openDevice(1); //Opens the device 1
List<Packet> buffer = Collections.synchronizedList(new ArrayList<Packet>()); //Creates a new list for the packets
cap.acquirePackets(buff... |
73d1dfb7-7563-4e69-a438-6284d28d85d9 | 6 | public void overwriteTRNS(byte r, byte g, byte b) {
if(hasAlphaChannel()) {
throw new UnsupportedOperationException("image has an alpha channel");
}
byte[] pal = this.palette;
if(pal == null) {
transPixel = n... |
8c052715-5d5e-4388-9292-dae40fef6203 | 3 | public boolean stateCollapse(State state) {
if (currentStep != COLLAPSE_STATES) {
outOfOrder();
return false;
}
if (automaton.getInitialState() == state) {
JOptionPane.showMessageDialog(frame,
"The initial state cannot be removed!",
"Initial State Selected", JOptionPane.ERROR_MESSAGE);
retur... |
87803326-cd24-433d-9271-6eba6a21bacb | 3 | @Override
public void run()
{
try
{
String message = input.nextLine(); //IMPORTANT blocking call
String [] stringarray = message.split("#");
String protocolcommand = stringarray[0];
if (message.equals("CONNECT#"))
{
Chat... |
ed259bd2-b871-4405-90aa-d46d2c0765f7 | 8 | public void nextMode(){
mode++;
if(mode > 6){
mode = 2;
}
if(mode == 0){
gameState.setText("|| " +"Claim territory phase");
} else if(mode == 1){
gameState.setText("|| " +"Initial Reinforcement Phase");
} else if(mode == 2){
gameState.setText("|| " +"Reinforcement Phase." + " You have " + curren... |
367f9f2f-b524-494b-b814-6addf18fa6d5 | 9 | private void showMenu()
{
int choice;
boolean quit;
quit = false;
try
{
// disable auto commit mode
con.setAutoCommit(false);
while (!quit)
{
System.out.print("\n\nPlease choose one of the following: \n");
System.out.print("1. Insert branch\n");
System.out.print("2. Delete branc... |
9a0d4056-6cb5-44df-9f85-676ed6ec8640 | 4 | public static String convertToHex(byte[] data)
{
StringBuilder buf = new StringBuilder();
for (int i = 0; i < data.length; i++)
{
int halfbyte = (data[i] >>> 4) & 0x0F;
int two_halfs = 0;
do
{
if ((0 <= halfbyte) && (halfbyte <= 9))
{
buf.append((char) ('0' + halfbyte));
}
else... |
aeb0b63b-d167-464f-8131-5f96c2f87831 | 9 | @Override
public Parameter getParameter(final int parameterIndex) {
Parameter parameter;
switch (parameterIndex) {
case 0:
case 1:
parameter = super.getParameter(parameterIndex);
break;
case 2:
parameter = size;
... |
2ab50add-df0e-42d3-b5df-eccc9b432922 | 2 | public void visitMethodInsn(final int opcode, final String owner,
final String name, final String desc) {
checkStartCode();
checkEndCode();
checkOpcode(opcode, 5);
checkMethodIdentifier(version, name, "name");
checkInternalName(owner, "owner");
checkMethodDesc(desc);
if (opcode == Opcodes.INVOKEDYNAMIC... |
fb15aa3e-d0b7-42a6-b67f-5e5d851b34c0 | 4 | public int indexOfSocket(CustomSocket socket) {
int result = 0;
while ((result < this.adapters.size()) && (this.adapters.get(result).getSocket() != socket))
result++;
// create a new frame adapter
if (result == this.adapters.size()) {
AuthFrameAdapter newAdapter = new AuthFrameAdapter(socket, adapterLis... |
f6f367db-4fe1-48b7-90c8-abf0e3b1fd4d | 6 | public static byte[] encodeAnimationBytes(CHREditorModel modelRef){
// numAnimations (1 byte)
// for each animation
// Num Frames (1 byte)
// for each frame: 0 for no change, N for the index of the keyframe data to use (N bytes)
byte b[] = new byte[4096];
int n... |
d3d63eaf-f00a-47b2-959e-47e1fc6c487a | 1 | @Override
public final void run() {
while (true) {
idle();
execute();
}
} |
acfaae65-e5bc-4cac-a3b9-98c191f3e503 | 4 | private static void showRS(ResultSet rs, int num)
{
try {
while ( rs.next() )
{
ResultSetMetaData rsmd = rs.getMetaData();
for(int i = 1; i<=num; ++i)
{
System.out.print(rsmd.getColumnName(i) + ":" + rs.getString(i) + " ;");
}
System.out.println("");
}
}
catch (SQLExcepti... |
abfd0dc3-43ea-45e0-8dca-3a5e3b9368d4 | 9 | public void onPlayerDamageBlock(int par1, int par2, int par3, int par4)
{
if (this.blockHitWait > 0)
{
--this.blockHitWait;
}
else
{
if (par1 == this.curBlockX && par2 == this.curBlockY && par3 == this.curBlockZ)
{
int var5 ... |
8695fdf8-a490-48d1-b83b-f1a5a999f9f8 | 0 | public Vehicle findUserCar(){
return vehicleMap.get('A');
} |
dff07d79-a630-4e6e-ba3e-bce9b4904f1b | 0 | public void basic() {
List<Character> chars = new ArrayList<Character>(Arrays.asList('a', 'b', 'c'));
String actual = permutation.permute(chars).toString();
String expected = "[[a, b, c], [a, c, b], [b, a, c], [b, c, a], [c, b, a], [c, a, b]]";
assertEquals(expected, actual);
} |
c8ecf15c-891a-468c-89ec-e2639e57ae63 | 8 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
PhpposBoxEntity that = (PhpposBoxEntity) o;
if (Double.compare(that.amount, amount) != 0) return false;
if (boxId != that.boxId) return false;
... |
51f62b62-c1b8-4b32-a72f-151d8de00d70 | 2 | @Override
public boolean decideDraw(int turn){
DataInstance d = getHistory(game.deck.peek(true), true);
drawNet.compute(d.inputs);
boolean actual = drawNet.getOutput() > .5;
//Train
if (model_mimic != null){
boolean target = model_mimic.decideDraw(turn);
drawNet.trainBackprop(0.01, target ? 1 : 0);
}... |
da617218-3463-4aa3-9133-76946d53918e | 3 | public void warAddtoPlayer2(int s, ArrayList p1, ArrayList p2)
{
//Adds card to the player 2 pile
for(int i=0; i<s; i++)
{
if(i<p1.size())
{
Object obj1 = p1.get(0);
Card c1 = (Card)obj1;
player2.addCard(0,c1);
}
if(i... |
23fb2482-5eae-493e-9f4c-b6fe7d0f8099 | 1 | public void placeOrders() {
for (Order order : orders) {
order.execute();
}
} |
7342c8c7-a785-40cd-bee0-79b70a607fb7 | 9 | public ParserNode(XMLParser xmlParser, Class<?> clazz)
throws XMLStructureException
{
XMLNode node = clazz.getAnnotation(XMLNode.class);
if (node == null)
throw new XMLStructureException("Trying to register class " + clazz.getSimpleName()
+... |
125cf723-6c22-4d99-ad7a-06499c02f243 | 4 | public String interpret() {
String result = "";
if (host != null)
if (hostString.startsWith("\"smtp"))
result += "\tprops.put(\"mail.smtp.host\", " + host.toString() + ");\n";
else
Main.error("Your mail protocol is not supported yet.");
else if (username != null)
result += "\tfinal String usernam... |
bb0ac51c-656d-4d2a-a5ad-8becbf6d5bfe | 9 | void merge(final double low, final double high)
{
if(list.isEmpty()) {
list.add(new Interval(low, high));
} else {
final double eps = 0.01;
// try to merge first
boolean newShadow = true;
for(Interval interval : list) {
if(... |
3dd1dcac-a81a-4134-bfb6-037092d6ebc0 | 2 | public String getBookingDate(){
String day, month, year;
day = Integer.toString(date.get(5));
if (day.length()==1)
day = "0" + day;
month = Integer.toString(date.get(2)+1);
if (month.length()==1)
month = "0" + month;
year = Integer.toString(date.get(1));
return (day+"/"+month+"/"+year);
} |
509b3859-19ee-4551-8d2e-519beecbbe59 | 7 | public void run() throws FatalError, RestartLater {
printJump();
try {
// first get info
info(0);
// is time for dice?
dice();
// print info about cards
printCards();
boolean next = false;
do {
next = false;
info(0);
int pos = Integer.valueOf(lastChar.getString("figur_pos"... |
510375ec-ea80-40b2-af0d-057d677c106f | 5 | public void applyChanges() {
Constants.PROJ_VIEW_WIDTH = (Integer) pvWidthSpinner.getValue();
Constants.PROJ_VIEW_HEIGHT = (Integer) pvHeightSpinner.getValue();
Constants.TABLE_COLOR = curTableColor;
Constants.PROJ_VIEW_BACK_COLOR = curPVBackColor;
Constants.TABLE_SPEED = (Integer) tSpeedSpinner.getValue();
... |
fb6cb7e8-4d11-4b6f-a932-0706e9b1345d | 5 | protected String reversePos(String pos){
if (pos == null) {
return null;
}
if (pos.charAt(0) == 'A') {
return pos.replace('A', 'E');
}
else if (pos.charAt(0) == 'E') {
return pos.replace('E', 'A');
}
else if (pos.charAt(0) == 'B') {
return p... |
4633a409-1ea2-4b06-af16-d4a75d4d2cc7 | 9 | public int getYOffset(int i) {
if (offsets == null)
return 0;
if (i >= 0 && i < offsets.length) {
if (offsets[i] == null)
return 0;
return offsets[i].y;
}
if (i < 0) {
if (offsets[0] == null)
return 0;
return offsets[0].y;
}
if (i >= offsets.length && offsets.length > 0) {
if (offs... |
ec9b135e-6639-4d0b-91c9-9a83a6b7fc08 | 6 | public static final void UseChair(final int itemId, final MapleClient c, final MapleCharacter chr) {
final IItem toUse = chr.getInventory(MapleInventoryType.SETUP).findById(itemId);
if (toUse == null || toUse.getItemId() != itemId) {
chr.getCheatTracker().registerOffense(CheatingOffense.USING_UNAVAILABLE_ITEM, I... |
58b8f4e8-6ed2-48f2-8f12-5baeb744b0e5 | 6 | * @return Cons
*/
public static Cons allTypes(Stella_Object self) {
{ MemoizationTable memoTable000 = null;
Cons memoizedEntry000 = null;
Stella_Object memoizedValue000 = null;
if (Stella.$MEMOIZATION_ENABLEDp$) {
memoTable000 = ((MemoizationTable)(Logic.SGT_LOGIC_F_ALL_TYPES_MEMO_TA... |
6e8049a2-c4bb-4b9d-a302-04a8debe99d0 | 6 | public void setPosition (String name)
{
Point l = getLocation();
Dimension d = getSize();
Dimension dscreen = getToolkit().getScreenSize();
int x = Global.getParameter(name + ".x", l.x);
int y = Global.getParameter(name + ".y", l.y);
int w = Global.getParameter(name + ".w", d.width);
int h = Global.getPa... |
f802db31-2075-4022-b32d-54ae3e51cfcf | 1 | private int getGid(Tile tile) {
TileSet tileset = tile.getTileSet();
if (tileset != null) {
return tile.getId() + getFirstGidForTileset(tileset);
}
return tile.getId();
} |
5cd6a4d9-5c28-421e-a188-91fd988c81e2 | 2 | @Override
public boolean subscribe(Client client, SubscribeMessage message) throws Exception {
String[] topics = message.getTopics();
QoS[] qoses = message.getRequestedQoSes();
List<String> allowedTopics = new ArrayList<String>();
List<QoS> allowedQoses = new ArrayList<QoS>();
int index = 0;
for (St... |
8aa50877-f28f-407e-a110-dc7aa07fcfc7 | 4 | public void checkSkillInput(GameContainer gc) {
if (gc.getInput().isKeyPressed(Input.KEY_Q)) {
skillQ.execute(this);
}
if (gc.getInput().isKeyPressed(Input.KEY_W)) {
skillW.execute(this);
}
if (gc.getInput().isKeyPressed(Input.KEY_E)) {
skillE.execute(this);
}
if (gc.getInput().isKeyPressed(Input... |
c2e151c7-74d0-476c-bdde-56195ae882f9 | 9 | public void doGet(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException
{
ServletPrinter sp = null;
Connection conn = null;
PreparedStatement stmt = null;
sp = new ServletPrinter(response, "Author");
conn = getConnection();
// int s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.