method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
c7c7f21b-3fdf-4f80-8ae6-03dce994bef3 | 6 | public Trace getTrace_v4(int xStart, int yStart, int sourceID, int threshold)
{
// a query to be created based on threshold:
String query = "locking row for access SELECT "
+ X_COLUMN + "," + Y_COLUMN + "," + PROPERTY_VALUE_COLUMN
+ " FROM " + DATABAS... |
9bff399f-17a9-4317-98a6-2b7f2e739310 | 1 | @Override
public void notifyObservers() {
for (UpdateObserver observer : updateObservers) {
observer.update(this);
}
} |
7424ac58-4197-4dee-a5b3-2ef062318763 | 3 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final OutputCanDDeliveryOrder other = (OutputCanDDeliveryOrder) obj;
if (!Objects.equals(this.szDocId, other.sz... |
3f229e2c-50b9-4cb3-b062-e6c801ae21ae | 7 | String checkSecurity(int iLevel, javax.servlet.http.HttpSession session, javax.servlet.http.HttpServletResponse response, javax.servlet.http.HttpServletRequest request){
try {
Object o1 = session.getAttribute("UserID");
Object o2 = session.getAttribute("UserRights");
boolean bRedirect = false;
... |
e778a549-0a1e-4571-96d4-9f01be8432d0 | 7 | @Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{
Context context;
Connection connection = null;
try {
context = new InitialContext();
DataSource dataSource = (DataSource)context.lookup("jav... |
1a5d5685-49aa-43be-8511-4dea8c93ce2c | 2 | public void keyReleased(KeyEvent e) {
int code = e.getKeyCode();
if (code > 0 && code < keys.length) {
keys[code] = false;
isMovingWithKey = true;
}
} |
71cd2fa5-6d4a-4d1c-9de4-5027139becf6 | 9 | @Override
protected void announce(AnnounceEvent event) {
List<Peer> peers = new LinkedList<Peer>();
try {
boolean received = false;
for (int rounds = 0; !received && rounds < MAX_ROUNDS; ++rounds) {
int transaction_id = random.nextInt();
byte[] msg = getRawAnnounceMessage(event, this.connecti... |
755c55b5-824f-425c-8116-35a75f9998bc | 4 | @Override
public Event next() {
try {
input = br.readLine();
} catch (IOException e1) {
}
if(input == null || input.equals(""))
{
return new UserHomeState(as, name);
}
else{
try{
as.bid(name, Integer.parseInt(input));
}
catch(Exception e){
// System.out.println("somet... |
75a463bd-393e-40c8-b9a4-4ffce33469b9 | 1 | private void createCopiesField(PrintRequestAttributeSet set) {
PrintService service = getService();
if (service.isAttributeCategorySupported(Copies.class)) {
mCopies = new EditorField(new DefaultFormatterFactory(new IntegerFormatter(1, 999, false)), null, SwingConstants.RIGHT, new Integer(PrintUtilities.getCopie... |
2dcd43d7-1a60-4899-b1e9-7eb43a7e2f6b | 7 | @Override
public File getLocationToDownloadOnDisk(String targetDownloadFolder) throws IOException {
File file = new File(targetDownloadFolder).getParentFile();
if (file.exists() && !file.isDirectory()) {
file = file.getParentFile();
}
if (file == null) {
Objec... |
c9a21a9f-7bd1-46ee-af6a-9b1f59c6b83a | 8 | public static final synchronized double[] readDoubleArray(String mess){
String line="";
double[] darray = null;
boolean finish = false;
System.out.flush();
String mess0 = "";
if(Db.inputTypeInfo)mess0 = "Input type: double[]... |
fb434a3b-4c36-45c2-b279-9401578ad96d | 5 | public void actionOfPlayer(Dealer dlr,Table tbl,int index){
System.out.println('\n'+"player "+name);
if(tbl.getHighsBet()>cash){
System.out.println("you have only "+cash);
System.out.println("4 for all in-put the all mony in hand to table");
System.out.println("3 for fold -exit the curnnt round");
}else... |
80f6a797-d843-4e94-a72a-563323bbcc0a | 0 | private void onException(Exception e) {
exception_at = System.currentTimeMillis();
this.exception = e;
} |
b2c200ca-94e5-4153-ab94-c6aca1032dec | 8 | @Override
public ExecutionReport handleCommand(ClientCommand clientQuery, ServerSession clientSess)
{
if(clientQuery.getCmd().equalsIgnoreCase("mkdir")) {
ExecutionReport report = new ExecutionReport();
if(clientQuery.getOptions().size() > 0 ||
clientQuery.g... |
c1310550-61b5-422a-b3c4-d45f24a01be4 | 5 | public String addComment() {
// on récupère les données du formulaire
String cmtTitle = comment.getCmtTitle();
String cmtContent = comment.getCmtContent();
Integer cmtOpinion = comment.getCmtOpinion();
Integer cmtCommented = comment.getCmtCommented();
Integer cmtWrite = comment.getCmtWrite();
i... |
0e7e6a22-7490-4301-9304-ef10d0142ab7 | 5 | public CheckResultMessage checkF02(int day) {
int r1 = get(10, 2);
int c1 = get(11, 2);
int r2 = get(13, 2);
int c2 = get(14, 2);
if (checkVersion(file).equals("2003")) {
try {
in = new FileInputStream(file);
hWorkbook = new HSSFWorkbook(in);
if (0 != getValue(r1 + 1, c1 + day, 2).abs().compare... |
6696ffb5-e016-41a3-af9a-b5dd6a61aa18 | 9 | public static void main(String[] args)
{
String personPlay; //User's play -- "R", "P", or "S"
String computerPlay = ""; //Computer's play -- "R", "P", or "S"
int computerInt; //Randomly generated number used to determine
//computer's play
Scanner input = new Scanner(System.in)... |
317090e8-22b4-427c-a631-d0987c8380fa | 6 | @Override
public JSONObject main(Map<String, String> params, Session session)
throws Exception {
JSONObject rtn = new JSONObject();
long activeUserId = session.getActiveUserId();
User activeUser = User.findById(activeUserId);
if(!activeUser.isAdmin) {
rtn.put("rtnCode", this.getRtnCode(405));
return ... |
e765c316-a5b5-40e1-a40e-d1b8dbc07d63 | 6 | private void init()
{
for(int i = 0; i < sizex; i++)
{
for(int j = 0; j < sizey; j++)
{
evaluationMap[i][j] = map.isWall(i*32+16, j*32+16)?WALL_VALUE:0;
}
}
int n = listElements.size();
Element e;
for(int i = 0; i < n; i++)
{
e = listElements.get(i);
if(e.isSolid())
{
try... |
052a8da5-8334-4b29-954e-720cfaba2c3e | 1 | public double calcExpectedScore(int[] bowl)
{
double sum=0, sumDist=0;
double expectedScore = 0;
for(int i=0;i<12;i++)
{
expectedScore = expectedScore + (dist[i]*preferences[i]);
sumDist+=dist[i];
sum += bowl[i];
}
double rat=sum/sumDist;
expectedScore = expectedScore * rat;... |
debbbcec-dbbb-46bd-b7bd-e850d173a843 | 1 | public synchronized List<Long> getWaysIds(int pos) {
if (nodes.size()>pos)
return ways.get(pos);
else
return new ArrayList<Long>();
} |
462ee060-3d9a-4bc3-84bd-f9fe5f4559d1 | 0 | protected House(ArrayList<Villager> people) {
this.addPeople(people);
} |
ea247bed-b97c-4a91-b70e-5134f01b4baf | 6 | public static VariantType findByType(byte type)
{
switch (type)
{
case 2:
return DOUBLE;
case 3:
return BOOL;
case 4:
return VLQ;
case 5:
return STRING;
case 6:
return VARIANTARRAY;
case 7:
return DICTIONARY;
default:
return NULL;
}
} |
efd5e2f3-71f7-4947-9e67-6a2350851400 | 1 | public void listarAtividadesPesquisadasGETSAO() {
AtividadeBO atividade = new AtividadeBO();
try {
tblAtividades.setModel(DbUtils.resultSetToTableModel(atividade.preencherTabelaAtividadesPesquisadasGESTAO(cmbBuscarProjeto.getSelectedItem() + "",
UserLogado.getDepartament... |
598249a4-ae6c-4fb7-aaf3-98bd7ad89934 | 8 | private void scan(double lastRadarHeading, List<RobotPeer> robots) {
if (statics.isDroid()) {
return;
}
double startAngle = lastRadarHeading;
double scanRadians = getRadarHeading() - startAngle;
// Check if we passed through 360
if (scanRadians < -PI) {
scanRadians = 2 * PI + scanRadians;
} else i... |
7c3aca5f-6e81-4d6e-98eb-8e453fb25e77 | 0 | public FileFormatManager() {} |
341ed913-64f9-4a82-93ac-c53b1880b389 | 8 | public boolean create(String username, String album_name) {
PreparedStatement stmt = null;
Connection conn = null;
ResultSet rs = null;
try {
conn = DbConnection.getConnection();
stmt = conn.prepareStatement(GET_USERID_STMT);
stmt.setString(1, username);
rs = stmt.executeQuery();
if (r... |
d7f8b764-b37c-48f1-b329-562881c2dda8 | 9 | private void balanceClusters() {
findAllClusters();
step = 0;
boolean somethingMoved = false;
for (int i = 0; i < allClusters.size();) {
NodeCluster c = (NodeCluster) allClusters.get(i);
int delta = c.getPull();
if (delta < 0) {
if (c.leftFreedom > 0) {
c.adjustRank(Math.max(delta, -c.leftF... |
4dd9d9f2-b1a1-46e6-ad5d-f5e6b88ec42f | 9 | public void loadConfig(String[] args) throws IOException, FileNotFoundException {
if (args.length == 1)
confFilename = args[0];
if (args.length <= 1) {
logger.info("lade config aus " + confFilename);
config.load(new FileReader(confFilename));
} else {
for (int i = 0; i < args.length; i++) {
if (i ... |
3836f34f-acc8-45b8-8f77-010180f33648 | 3 | protected Object getDropTarget(mxGraphComponent graphComponent,
mxGraphTransferable gt)
{
Object[] cells = gt.getCells();
Object target = null;
// Finds the target cell at the given location and checks if the
// target is not already the parent of the first imported cell
if (location != null)
{
targ... |
35b55a0d-2907-453c-9823-ce8f7b02291f | 2 | public boolean getConnexion(String login, String password, Object user) throws RemoteException {
boolean b=ldapTemplate.authenticate("", "(uid="+login+")", password);
if(b){
Person p=dao.findByPrimaryKey(login);
if(!userOnLineLogin.containsKey(p.getUid())){
u... |
71a23c0d-c5f3-4dee-9f08-52ba9a333cc5 | 0 | @Override
public String toString() {
return "field1=" + aField1 + ",field2=" + aField2 +",obj=" + internalObject;
} |
d7ae73f2-2229-485b-bce6-fd98543f6fd0 | 3 | @Override
public void render(Document html, Element node) {
// nothing gets rendered here
// a choice indicates a text box with a default value
// must have one child element with one child text, and one child text to be valid
boolean handledChild = false;
for (Component child : getChildren()) {
... |
f66a8e8e-ebda-458f-8d2a-72e003a67910 | 9 | @Override
public void mouseDragged(MouseEvent e)
{
if (!e.isConsumed() && first != null)
{
Rectangle oldBounds = new Rectangle(bounds);
bounds = new Rectangle(first);
bounds.add(e.getPoint());
if (graphComponent.isSignificant(bounds.width, bounds.height))
{
mxGraphControl control = graphCompon... |
0c5b4410-176c-4644-9906-d30b4594198a | 5 | @Override
public boolean onCommand(CommandSender sender, Command cmd, String label,
String[] args) {
tickets = plugin.getTicketHandler();
if (sender instanceof Player) {
Player p = (Player) sender;
if (p.hasPermission("modreq.request")) {
if (args.... |
688420e8-912c-4d46-b6fd-4420fe575b87 | 2 | public static void main(String[] args) {
//HOW TO CREATE AN OPTIONAL
//Wrapper for apple
Optional<Apple> optionalApple = Optional.empty();
Optional<Apple> greenOptionalApple = Optional.of(Apple.newApple(Apple.AppleColor.GREEN, 35));
System.out.println(greenOptionalApple);
... |
e1d7001b-3c2c-4f1d-95cf-579a06d48a3d | 9 | @SuppressWarnings("unchecked")
public List<Object> getObjectList(final String entityName,
final int pageNum, final int countOfOnePage,
final List<String> orderby, final List<String> conditionQuestion,
final List<Object> conditionAnswer) throws Exception {
@SuppressWarnings("rawtypes")
List list = null;
... |
683cdc2a-43e2-46e0-8f4b-bd3d50905600 | 5 | private Method[] findAllMethods(Class<?> c) {
Class<?> classToSurvey = c;
ArrayList<Method> list = new ArrayList<Method>();
// While we have a class to examine
while (classToSurvey != null && classToSurvey != Object.class) {
// Get all public and private methods
Method[] allMethods = classToSurvey.getDec... |
3f8dcc57-62d7-4f6e-9538-6519142943af | 7 | public static void main(String[] args) throws Exception
{
HashMap<String, FastaSequence> map =
FastaSequence.getFirstTokenSequenceMap(
ConfigReader.getCREOrthologsDir() +
File.separator +"carolina" + File.separator
+ "klebsiella_pneumoniae_chs_11.0.scaffolds.fasta");
BufferedReader reader = ... |
52f96b60-588f-4819-9ecd-83721b93ee3e | 0 | public int getBalance() {
return this.balance;
} |
f3dd69db-110d-472c-bfee-c76e5916ed9d | 7 | static final void method3320(Entity class318_sub1_sub3,
boolean bool) {
for (int i = ((Entity) class318_sub1_sub3).aShort8743;
i <= ((Entity) class318_sub1_sub3).aShort8751; i++) {
for (int i_0_
= ((Entity) class318_sub1_sub3).aShort8750;
i_0_ <= ((Entity) class318_sub1_sub3).aShort8747;
i... |
eb5752d0-fb0c-4d01-87a2-db76bcda0e4d | 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:barChart>" );
cooxml.append( "\r\n" );
cooxml.append( "<c:barDir val=\"bar\"/>" );
cooxml.app... |
cb550a5d-bb87-441b-8267-207c15e88d0f | 9 | public void createStreets(ArrayList<Node> node, int numNodes, int level, int columns){
int n=0;
while(n<numNodes){
Street left, right, up, down= null;
for(int r=0; ; r++){
if(r!=0){
// new Street (start node, end node (this node), name of stre... |
420ec75e-7c5c-46cd-a9e9-f5e37c5074a5 | 4 | private static void verifyProperty1(RBTreeNode<?, ?> node) {
//Check ourselves
assert nodeColor(node) == Color.RED || nodeColor(node) == Color.BLACK;
//If we're not null, check our (potential) children
if (node == null) return;
//Null children will read as black, due to how tree ... |
1b2549f9-1ade-4893-ac1d-333041b09302 | 1 | @Override
public Object execute(HttpServletRequest request, HttpServletResponse response) throws Exception {
Contexto oContexto = (Contexto) request.getAttribute("contexto");
oContexto.setVista("jsp/hilo/form.jsp");
HiloBean oHiloBean;
HiloDao oHiloDao;
oHiloBean = ne... |
6858f902-38fe-4a3c-8765-1ee4bb89585a | 2 | public static void chooseSave(Component c){
final JFileChooser fc = new JFileChooser();
FileFilter filter = new ExtensionFileFilter("Nightmare Level File (*.nml)", new String[] {"nml"});
fc.setFileFilter(filter);
int returnVal = fc.showSaveDialog(c);
if (returnVal == JFileChooser.APPROVE_OPTION){
String fP... |
37d23808-4d83-42d2-866e-26e3fed98c31 | 8 | @Override
public String getAnswer() throws Exception {
/* Not gonna lie, I found the current solution from the forums and found it great
* I left the old recursive calls below for reference.
*/
int N = 13000;
int[] minSum = new int[N];
List<HashSet<Integer>> sums ... |
567c2461-ed78-44d0-8319-d38ae1f13180 | 5 | private List<PowerFailure> getPowerFailureList() {
Set<PowerFailure> res = new HashSet<>();
for (int x = 0; x < grid.width; x++) {
for (int y = 0; y < grid.height; y++) {
if (Math.random() * 100 <= chance) { // 5% chance of adding a powerfailure
Position position = new Position(x, y);
for (Posit... |
5f19c6d5-7f7e-430e-8a65-1ffa983cb07b | 9 | public static BufferedImage Maska(BufferedImage in,int... param){
long start_time = System.currentTimeMillis();
BufferedImage out = new BufferedImage( in.getWidth(), in.getHeight(), in.getType());
int width;
int heigth;
width = in.getWidth(... |
6548082b-fe7a-4332-9194-d50d990e229e | 0 | public DocumentAttributesView() {
super(false, false, false, INITIAL_WIDTH, INITIAL_HEIGHT, MINIMUM_WIDTH, MINIMUM_HEIGHT);
Outliner.documentAttributes = this;
Outliner.documents.addDocumentRepositoryListener(this);
} |
4fb4e7c0-be72-4dab-834a-920318699c63 | 7 | private boolean isTagChar(int ch)
{
return (ch >= 'a' && ch <= 'z' ||
ch >= 'A' && ch <= 'Z' ||
ch >= '0' && ch <= '9' ||
ch == ':' || ch == '-');
} |
4bd6ada4-ee2a-4cc0-8f78-d5205b637117 | 4 | static public <K,V> K array_search(V needle, Map<K,V> haystack) {
if (haystack == null) return null;
if (needle == null) return null;
// Get the key set of linkedHashMap
K retObj = null;
Set<K> keySet = haystack.keySet();
// Get Iterator of keySet
Iterator<K> iterator = keySet.iterator();
while(iterator... |
3e26ad47-de7a-441b-bd21-2b94be2a54ae | 7 | @Override
public void actionPerformed(ActionEvent e) {
if ("export test".equals(e.getActionCommand())) {
try {
Control.GedExportTest(dwarfList);
} catch (SAXException e1) {
e1.printStackTrace();
} catch (IOException e1) {
e1.printStackTrace();
}
}
if ("import debug legends".equals(e.getAc... |
09724149-acc7-4a6e-a014-574d935593c9 | 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 Paciente)) {
return false;
}
Paciente other = (Paciente) object;
if ((this.inhusa == null && other.inhusa != nu... |
c7217b6d-23a8-4fb8-99db-f10f7b76c07d | 7 | private boolean buildAugPath(int[][] mask, int[][] c, int Astart, EdgeSet path){
print2DArray(mask);
for(int j = 0; j < mask[0].length; j++){
if(c[Astart][j] == 0 && mask[Astart][j] == 2){
c[Astart][j] = 1; // can't visit this twice.
if(!BisInMatching(j, mask)... |
f0102d37-245b-43c1-a73e-cd4ab0c59148 | 2 | protected void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
AutoTotaalDienst atd = (AutoTotaalDienst) getServletContext().getAttribute("atdRef");
String dag = req.getParameter("dag");
String maand = req.getParameter("maand");
String jaar = req.getParam... |
06f00e1c-68cf-44f5-bcd4-a7e1d93ac8a8 | 1 | @Override
public void viewPropertyChange(PropertyChangeEvent pce) {
try {
MainWindowModel.class.getMethod("set"+pce.getPropertyName(), String.class).invoke(this, pce.getNewValue());
} catch (NoSuchMethodException | SecurityException | IllegalAccessException | InvocationTargetException ex... |
fbdc7792-5b81-433e-93f4-5bd550e9d361 | 2 | public boolean stand(Hero hero, Player player)
{
System.out.println("resource stand");
if (type == ResourceType.ARTIFACT) {
Mission.getLastInstance().setWon(hero.getColor());
if (player instanceof PlayerHuman) {
QMessageBox.about(WindowStack.getLastInstance(), "Artefakt", "Zdobyłeś poszukiwany artefakt!"... |
1645d973-e73e-4028-98b6-1e43cdcb70a1 | 8 | public static void main(String[] args) {
Scanner in = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
int n = in.nextInt();
int[][] req = new int[n][3];
for (int i = 0; i < n; i++) {
req[i][0] = i+1;
req[i][1] = in.nextInt()... |
c6be69c4-71bc-4198-afa5-e3695f1487dd | 0 | @Override
public String toString() {
return "[x=" + x + ",y=" + y + "]";
} |
816c0b70-a67d-4c17-953e-308ad6f99fb7 | 7 | public void undo(CardGame game) {
switch (moveType) {
case FROM_DECK:
//This sucks a bit
LinkedList<Card> queueList = (LinkedList<Card>) game.getDeck();
if (topRow) {
List<Card> pile = game.getTopRow().get(boardIndexTo);
... |
e9396213-df52-46f6-a92f-ab721648ebf1 | 6 | protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException
{
String p;
if ((p = request.getParameter("delete_username")) != null)
{
User u = userRepo.getByPK(p);
if (u != null && u.equals(request.getUserPrincipal()))
{
userRepo.deleteU... |
a13a9982-ad98-46df-bd04-f3110f4517ce | 1 | private void onRemove() {
if (!downloadsTable.getSelectionModel().isSelectionEmpty()) {
//int row = downloadsTable.getSelectedRow();
int id = downloadsTable.convertRowIndexToModel(downloadsTable.getSelectedRow());
Integer gid = (Integer) downloadsTable.getModel().getValueAt(i... |
9e2c8e1a-4f58-46b1-b7cb-d9a9953e1da5 | 3 | public static int fibonacci(int term){
int n=0;
int temp1=0;
int temp2=0;
for(int i=1;i<=term;i++){
if(i==1){
n=1;
temp2=temp1;
temp1=n;
}else if(i==2){
n=2;
temp2=temp1;
temp1=n;
}else{
n=temp1+temp2;
temp2=temp1;
temp1 = n;
}
}
return n;
... |
56bb0c5d-4996-4d8d-bfbe-3cda748dec45 | 1 | protected void calcDIR_LstAccDate() {
byte[] bTemp = new byte[2];
for (int i = 18;i < 20; i++) {
bTemp[i-18] = bytesOfFAT32Element[i];
}
Integer temp = byteArrayToInt(bTemp);
DIR_LstAccDate = (temp & 0b11111) + "." + ((temp & 0b111100000) >> 5) + "." + (((temp & ... |
86ece5cf-c555-4aef-94ef-b6f4cd9c019c | 9 | private String generateText(String key, String[] params) {
if (key.equals("forwardRREP")) {
return translator.translateMessage("forwardRREP", new String[]{nodeIdentifier});
} else if (key.equals("forwardRREQ")) {
return translator.translateMessage("forwardRREQ", new String[]{node... |
9382c2a4-499c-4385-b09a-64bd1239fe23 | 2 | private int checkMaxHeight() {
int currMax = 0;
for (int i = 0; i < width; i++) {
int colHeight = checkColumnHeight(i);
if (colHeight > currMax) currMax = colHeight;
}
return currMax;
} |
1b6cd151-775f-4e35-93bc-b0dce09f7574 | 5 | @Override
public String execute(SessionRequestContent request) throws ServletLogicException {
String page = ConfigurationManager.getProperty("path.page.editcountry");
resaveParamsSaveCountry(request);
try {
Criteria criteria = new Criteria();
Country country = (Countr... |
05359a70-6689-4809-a7bc-68414633b465 | 8 | public GameState getGameState(BufferedImage screenshot) {
// pixel colour deviation threshold for valid detection
final int avgColourThreshold = 5;
// check for main menu or episode menu or level selection
BufferedImage wnd = screenshot.getSubimage(636, 24, 192, 26);
int numBytes = 3 * wnd.getWidth() * ... |
404abfcc-94a4-4e96-b71b-f18a518209e2 | 6 | public PageFetcher(CrawlConfig config) {
super(config);
HttpParams params = new BasicHttpParams();
HttpProtocolParamBean paramsBean = new HttpProtocolParamBean(params);
paramsBean.setVersion(HttpVersion.HTTP_1_1);
paramsBean.setContentCharset("UTF-8");
paramsBean.setUseExpectContinue(false);
params.setP... |
660a6acc-c60b-49c9-9967-5bbf03d0cef7 | 4 | public void assignAction(Action action) {
if (verbose && I.talkAbout == this) {
I.say(" ASSIGNING ACTION: "+action) ;
if (action != null) I.add(" "+action.hashCode()+"\n") ;
}
world.activities.toggleAction(actionTaken, false) ;
this.actionTaken = action ;
if (actionTaken != null) actio... |
939afe52-a30f-4c14-8c50-b5db3be85303 | 4 | protected void altTransform(int kc) {
if (kc == forwardKey) {
rotateUp();
} else {
if (kc == backKey) {
rotateDown();
} else {
if (kc == leftKey) {
moveLeft();
} else {
if (kc == rightKey) {
moveRight();
}
}
}
}
} |
b9078a9c-a532-4b65-b864-d64ece6c1821 | 1 | public static void writeRouteLog(MessageEvent e, String msg) throws IOException{
buf.setLength(0);
buf.append(getCurrentTime());
buf.append(" Данные обработаны для ");
buf.append(e.getRemoteAddress());
buf.append(" Message: ");
buf.append(msg);
buf.append... |
069b40ca-03e6-4679-b74b-eb5511341a17 | 8 | public final WaiprParser.invals_return invals() throws RecognitionException {
WaiprParser.invals_return retval = new WaiprParser.invals_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
Token char_literal66=null;
ParserRuleReturnScope inval65 =null;
ParserRuleReturnScope inval67 =null;
Co... |
626a1e7c-3e54-4714-b845-ef51975504a0 | 4 | public Vector2 getZInterval(int xPosition, int yPosition, int width, int height)
{
// The min and max values.
double min = Double.MAX_VALUE;
double max = Double.MIN_VALUE;
// Iterate through all pixels in the sprite.
for (int y = yPosition; y < height; y++)
{
for (int x = xPosition; x < width; x++)
... |
fc250891-37d5-4d47-b9e8-9bc37f61e70d | 2 | public void filterGreyScale(int option){
if (img == null) return;
if (option==1){
ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB);
ColorConvertOp op = new ColorConvertOp(cs, null);
img = op.filter(img, new BufferedImage(img.getWidth(), img.getHeight(),
BufferedImage.TYPE_BYTE_GRA... |
20a508e6-60f7-4bf5-8cca-893325d5fb11 | 3 | public void setMaxDayCharacters(int maxDayCharacters) {
if (maxDayCharacters == this.maxDayCharacters) {
return;
}
if (maxDayCharacters < 0 || maxDayCharacters > 4) {
this.maxDayCharacters = 0;
} else {
this.maxDayCharacters = maxDayCharacters;
... |
57e42e71-c70c-4b9c-ab6e-b61af508f0a8 | 3 | @SuppressWarnings("rawtypes")
public static Throwable findrootexc(Throwable t) {
if(t.getCause() == null)
return(t);
for(Class b : boring) {
if(t.getClass() == b)
return(findrootexc(t.getCause()));
}
return(t);
} |
9b73c38b-cdba-41ad-b6fc-84f189275c38 | 9 | public static Vector<Assignment> tryAssign(Variable assignedVar, int varSign) {
if(SsatSolver.DEBUG) System.out.println("Assigning variable " + assignedVar.getName() + " to " + (varSign==Variable.TRUE?"True":"False"));
//assign the variable
assignedVar.setAssignment(varSign);
//make sure all the clauses update... |
0f2142a9-27cf-470c-b869-535647fd9a93 | 8 | public static void main(String args[]) throws IOException{
clusters = new ArrayList<String> ();
BufferedReader br = new BufferedReader(new FileReader("clusters.txt"));
BufferedWriter bw = new BufferedWriter(new FileWriter("edges.txt"));
String newLine;
ArrayList<String> edges = new ArrayList<String>();
int ... |
b78e5531-a353-49ea-b1db-2a40ef62ef92 | 6 | static protected void UpdateLineColumn(char c)
{
column++;
if (prevCharIsLF)
{
prevCharIsLF = false;
line += (column = 1);
}
else if (prevCharIsCR)
{
prevCharIsCR = false;
if (c == '\n')
{
prevCharIsLF = true;
}
else
line += (column = ... |
da2d5b83-3b9d-4188-ba3e-0e3bd11ad797 | 2 | public void run() {
while (true) {
messages = Controller.getRawMessages(); //retrieve messages from twitter
Controller.setMessages(messages); //save messages to controller
try {
Thread.sleep(10000); //sleep 10 seconds then try again
... |
58e0aa7b-a74f-41b5-ab15-0fab680785b2 | 3 | @Override
public void translate(int deltaX, int deltaY) {
super.translate(deltaX, deltaY);
if (solidified) {
for (GUIComponent component : subComponents) {
component.translate(deltaX, deltaY);
}
}
else {
for (GUIComponent component... |
78978d8b-bab1-4522-9c19-628c81a2ff74 | 7 | public int mostVisitedAction() {
int selected = -1;
double bestValue = -Double.MAX_VALUE;
boolean allEqual = true;
double first = -1;
for (int i=0; i<children.length; i++) {
if(children[i] != null)
{
if(first == -1)
fi... |
d4c61732-dd1b-4821-a28a-5337eadc9e00 | 1 | public FormasPagamento Abrir(int id){
try{
FormasPagamento fp = new FormasPagamento();
PreparedStatement comando = banco.getConexao()
.prepareStatement("SELECT * FROM tipos_pagamento WHERE id = ? ");
comando.setInt(1, id);
ResultSe... |
f575a577-7904-425c-8e43-8ee14db07154 | 1 | public void haeKerrattavat(){
kertain.haeKerrattavat(kerrattavienTunniste, osaamistasonTunniste);
if (kertain.getKerrattavienMaara()==0){
yhtaanKerrattavaaEiValittu();
} else {
ekaTekstikentta.setText("Aloita kertaaminen valitsemalla seuraava");
tokaTekstikent... |
425357ed-2e04-4989-8ecc-71511b7a2e2e | 9 | public void filterSecondary(){
if(filterSecondaryValue>0){
for(int i=0; i<twitterLeads.size(); i++){
ArrayList<Tweet> tempList = new ArrayList<Tweet>();
for (int j = 0; j < twitterLeads.get(i).getFilteredTweets().size(); j++) {
if(twitterLeads.get(... |
bd3036da-594f-4ffa-80eb-0cbd38e54c0f | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Branch other = (Branch) obj;
if (no == null) {
if (other.no != null)
return false;
} else if (!no.equals(other.no))
return false;
r... |
2d24b4a4-31dd-4b04-bdde-a03021bf2e97 | 6 | public void getKingGraph(mxAnalysisGraph aGraph, int xDim, int yDim)
{
if (xDim < 2 || yDim < 2)
{
throw new IllegalArgumentException();
}
int numVertices = xDim * yDim;
mxGraph graph = aGraph.getGraph();
Object parent = graph.getDefaultParent();
Object[] vertices = new Object[numVertices];
for ... |
4a5b01c7-32a8-4b31-a96b-105acb7cfc2f | 8 | private static HashMap <String, Object> getParameters(String[] args) throws InvalidParameterException {
HashMap <String, Object> arguments = new HashMap <String, Object>();
if ((args.length < 3) || (args.length > 5)) {
throw new InvalidParameterException("Invalid number of parameters!");
... |
a398bddc-1a9d-485f-a8d1-f68b8d34b7b5 | 1 | public static Long StringToLong(String date) {
try {
return DATE_FORMAT.parse(date).getTime();
} catch (ParseException e) {
e.printStackTrace();
return StringToLong("1970/01/01 09:00:00 000");
}
} |
67611267-7029-4555-93d3-f3788e481ba4 | 4 | @Override
public String toString()
{
String returnMe = "";
if(a.doubleValue() == 0)
{
if(b.doubleValue() == 0)
{
return "0";
}
else
{
return b + "i";
}
}
returnMe += a... |
cc7cbe6a-c92b-41aa-b29d-07518c07b489 | 7 | public static ArrayList<Question> findById_AllQuestions(int id, BaseSetting bs) {
Connection connection = bs.getConnection();
ArrayList<Question> alq = new ArrayList<Question>();
try {
String query = "SELECT * FROM Contains WHERE id_e = ?";
PreparedStatement p_statement... |
fada7ec6-4c0e-436f-b323-65b43109df7a | 6 | public String ShowTable(String TableName) {
String showtableOutput = null;
try {
/*
The connection specifies create=true to cause
the database to be created. To remove the database,
remove the directory AttackDB and its contents.
The directory ... |
78fb9a44-3cc9-4f7f-b4b6-a39dd4a4a0db | 1 | public RepoService() {
try {
dao = new GitHubDao();
}
catch (Exception e) {
logger.log(Level.SEVERE, "Could not load GitHubDao: {0}", e.getMessage());
throw new RuntimeException("Could not load GitHubDao: " + e.getMessage());
}
} |
30b594d7-b1b9-43a9-b357-20d4f8f65dc9 | 4 | public synchronized void mouseMoved(MouseEvent e) {
// this event is from re-centering the mouse - ignore it
if (isRecentering &&
centerLocation.x == e.getX() &&
centerLocation.y == e.getY())
{
isRecentering = false;
}
else {
int dx... |
1af2a097-e305-47c4-8526-7b3a55f5fbe4 | 5 | @Override
public void setup() {
if(!finished){
entitiesarray = new entity[particles];
//filling the array with particle entities
for(int i = 0; i<particles; i++){
//creating the particle
particle tempent = new particle(maingame.mainscreen, x, y, getparticlecol());
//setting up size and direction... |
3b28fbb4-07b6-4a8c-b2e6-851e26180f10 | 1 | public void play() {
if (player != null) {
player.close();
} else {
playfile();
}
} |
7de3f1aa-5849-49f6-b898-8163823251a9 | 0 | @Override
public Item copyItem() {
return armorItem;
} |
0dca8b4f-958b-4958-92c9-70ecde35220d | 5 | public static void main(String[] args) throws IOException
{
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
ArrayList<String> list = new ArrayList<String>();
while (true)
{
String s = reader.readLine();
if (s.isEmpty()) break;
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.