method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
6c9d6804-d9a8-4fd0-92c6-6d406e6bdb03 | 3 | public final String getClen() {
if (StringUtils.isEmpty(clen)) {
String[] temp = url.split("&");
for (String s : temp) {
if (s.contains("clen=")) {
clen = StringUtils.substringAfter(s, "=");
}
}
}
return cl... |
a53840cc-975a-4659-aa1c-0263b2b21403 | 8 | @Override
public void displayProbabilities(double[][] probabilities, int[] knownRoles) {
System.out.println("\nPLAY GOOD EVIL LIVE DEAD");
for (int i = 0; i < players; i++) {
System.out.print(pad(i + 1));
for (int j = 0; j < 4; j++) {
System.out.print(pad((int) Math.round(probabilities[i][j])));
}... |
e6545c78-523e-46a4-8af8-d5b9bbb3e30e | 1 | public void visitAttribute(final Attribute attr) {
if (attr.isCodeAttribute()) {
attr.next = cattrs;
cattrs = attr;
} else {
attr.next = attrs;
attrs = attr;
}
} |
2c27686b-8abd-411a-9b77-ce903c354490 | 0 | public boolean getTurn(){
return turn%2==0;
} |
372b36f9-fa6e-4691-b83f-18b6a048beb1 | 5 | public void readAndExecute(InputStream in) {
BufferedReader reader = null;
String line = null;
try {
reader = new BufferedReader(new InputStreamReader(in, Charset.defaultCharset()));
while (true) {
LOGGER.debug("Reading console input...");
LOG.debug(Constants.PROMPT);
line = reader.readLine();
... |
60981708-30a5-4311-a389-f96ac99bebd4 | 0 | @Override
public String toString() {
return "[helloWorld=" + helloWorld + ", author=" + author + ", email="
+ email + "]";
} |
354a261c-d756-4fea-8dbe-b10b6d047eb1 | 6 | * @param arguments
* @param updatemode
* @return Proposition
*/
public static Proposition updateTuple(Surrogate relation, Cons arguments, Keyword updatemode) {
{ boolean holdsP = relation == Logic.SGT_PL_KERNEL_KB_HOLDS;
NamedDescription description = (holdsP ? Logic.getDescription(arguments.value)... |
219c71c0-413e-4004-b06f-6c7e5df07c07 | 8 | public void output(int key, int move){
String line = MOVE+" "+move;
switch(key){
case InteractivePanel.SHOOT:
line = KICK+" "+owner.isLookRight();
int x= owner.onKick(owner);
int y = (int) owner.getY();
for(Player player : players){
x = player.onKick(owner);
}
for( int[] loc : kickLocs){
... |
8f628e1a-8a76-483c-89f0-3e72e4c15044 | 7 | static final String encode(final String s) {
StringBuffer sb = new StringBuffer();
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
if (c == '\\') {
sb.append("\\\\");
} else if (c < 0x20 || c > 0x7f) {
sb.append("\\u");
... |
1286a81f-ee5e-41f4-b786-93a4edb25fab | 8 | @Override
public void run() {
System.out.println("connection accepted");
do {
try {
Object o = sktReader.readObject();
if (o != null) {
if (o instanceof SocketCMD) {
cmd = (SocketCMD) o;
i... |
10ec075f-dab9-4c5e-a35b-8289d3be5677 | 3 | public static void saveSettings(){
//Check if the settings folder exist, if not create it
File settingsFolder = new File("settings");
if(!settingsFolder.exists()){
settingsFolder.mkdir();
}
//create and fill the ini file
File iniFile = new File("setti... |
67c343a2-4d3f-4b6f-9c12-70f69017d8e1 | 4 | protected void send(String line) {
if (socket == null)
throw new SMTPDisconnectedException("Not connected in the first place.");
try {
if (write == null)
write = new OutputStreamWriter(socket.getOutputStream());
write.write(line);
if (debug... |
3e594530-3820-4bbd-8030-b6f842497b1f | 3 | public Point[] getPoints() {
Model model = getModel();
if (model == null || !model.isValid()) {
return null;
}
List<Point> points = new ArrayList<Point>();
/*
* Generate a list of all model vertices
*/
//instead of using getvectors we can deal directly with vertex arrays, but no point yet
Vec3[]... |
63daadf3-84bf-4500-aefe-0c1971b398cc | 0 | public EnumerationIterator(Enumeration<E> enumeration) {
this.enumeration = enumeration;
} |
942d7113-44cd-4106-9b4b-a37d3b1896d3 | 9 | public ArrayList<String> goodsDisp() {
ArrayList<String> goodsInfo = new ArrayList<String>();
String[] goods = new String[5];
while (true) {
try {
// ID
goods[0] = String.valueOf(this.inputID);
System.out.println("i͂Ă");
goods[1] = br.readLine();
while (true) {
System.out.println("li... |
e37721cd-45f5-4115-b88b-7024f655dfcd | 2 | public boolean exists(String value) {
boolean answer = false;
for (int i = 0; i < length; i++) {
if (hashTable[i].exists(value)) {
answer = true;
}
}
return answer;
} |
d321713c-f5ce-4191-a5d2-5d1ef704b843 | 2 | public String findString(String expr)
throws XPathExpressionException
{
// First assume that the expression returns a Node or NodeList
try
{
List<String> list = findStrings(expr);
return list.isEmpty() ? null : list.get(0);
}
catch(XPathExp... |
a22cc39f-e8f7-45bc-9d1a-2771474c2a6a | 7 | protected boolean trainCorpus(List<List<Acronym>> corpus, List<Map<String, String>> trueLabels){
boolean converge = false;
// Unsupervised
trueLabels = null;
initModelParamsAndCounters();
int n = corpus.size();
int c = 1;
Double change;
System.out.print("training:");
while(!converge){
for ... |
dd7fc76e-ee87-4ae1-a27a-3411b9d370f6 | 6 | @Override
public void run() {
//while we're not in exit mode
while(active){
//if there are no message to be sent, sleep for a second
if(peer.messageQueue.size() == 0){
try {
Thread.sleep(1000 * 1);
this.end = System.currentTimeMillis();
publishUploadSpeed();
publishDownloadSpeed();
... |
3987025c-f882-4bb8-bb7f-fc7b7a58f636 | 0 | private void loadAccessCommands() {
accesscommands = configmanager.getPermissionCommand();
} |
267b64ba-3643-4566-af2f-66eea9ee7fe5 | 1 | public String procura(String nome) throws RemoteException,
NenhumServidorDisponivelException, ObjetoNaoEncontradoException
{
//Looking for the object
Integer id = objects.get(nome);
//InterfaceReplicacao s = servers.get(id);
//If there is not a object named nome, it throws exception
if(id == null)
{
... |
436b9578-8be2-4431-98f3-0f7d16bf7694 | 8 | @Override
public void characters(char ch[], int start, int length) throws SAXException {
// modified by Adeesha
if (isTopicDiscovered) {
isTopicDiscovered = false;
BufferedWriter writer = null;
try {
databaseTopic.append(ch, start, length);
... |
864f18b7-52b2-408a-8303-5c79213ad38e | 8 | void generateRandomNet(BayesNet bayesNet, Instances instances) {
int nNodes = instances.numAttributes();
// clear network
for (int iNode = 0; iNode < nNodes; iNode++) {
ParentSet parentSet = bayesNet.getParentSet(iNode);
while (parentSet.getNrOfParents() > 0) {
parentSet.deleteLastParent(instances);
... |
56e0711f-90ee-470f-86d4-52a4d180b28a | 8 | @Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if(!(affected instanceof MOB))
return true;
final MOB mob=(MOB)affected;
// when this spell is on a MOBs Affected list,
// it should consistantly prevent the mob
// from trying to do ANYTHING except sleep
if(msg.amITarg... |
23633ce1-d0c3-4524-bfbe-db3b7a6650eb | 1 | private boolean isAlertPresent() {
try {
driver.switchTo().alert();
return true;
} catch (NoAlertPresentException e) {
return false;
}
} |
cb8b6746-6ae6-4148-9902-045fb19c2958 | 1 | @Override
public double arvo() throws IllegalStateException {
if (!super.laskettavatAsetettu()) {
throw new IllegalStateException();
}
return Math.pow(super.getEtujasen().arvo(), super.getTakajasen().arvo());
} |
a2cebb82-b978-4ea0-b437-da0b58c01d37 | 0 | public ArrayList viewStatus() {
ArrayList al = new ArrayList();
al = shsmb.viewMyBookingStatus();
return al;
} |
ac831606-75d7-441e-84fe-35fba829c7dd | 5 | private int getSet(String lineType) {
int retVal = -1;
while (retVal < 0) {
// 標準出力
System.out.println(lineType + "座標を入力してください(0~7)");
// キーボードから文字を入力する時に、記述する
BufferedReader obj_br = new BufferedReader(new InputStreamReader(System.in));
//、キーボードから入力された文字を代入
try {
String str = obj_br.readLi... |
8d866c47-850f-41ce-a74a-de29204ea891 | 0 | @Test
public void getNeighbourhoodTestNoNeighours() {
City_Graph city_graph2 = new City_Graph();
city_graph2.loadMap("res/singleCity.mp");
City testCity = city_graph2.getCity(0);
VertexSet emptySet = new VertexSet();
assertTrue(city_graph2.getNeighbourhood(testCity).equals(emptySet));
} |
26975482-cae1-4aff-83a2-e3aba2bb967f | 5 | public void load()
throws SoundSystemUnavailableException {
int max = this.numberChannel;
// At present, ALAW and ULAW encodings must be converted
// to PCM_SIGNED before it can be played
this.audioFormat = this.audioInputStream[0].getFormat();
if (this.audioForm... |
229ccfbd-e490-4e60-acb1-9bda7c79ef3b | 1 | public void save() {
if (writter == null) {
throw new IllegalArgumentException("DeviceWritter needed...");
}
writter.saveToDevice();
} |
17be31b4-9912-4193-a82e-d497da089c80 | 6 | final void method3049(ByteBuffer class348_sub49, int i, int i_0_) {
anInt9100++;
int i_1_ = i;
while_132_:
do {
do {
if (i_1_ != 0) {
if ((i_1_ ^ 0xffffffff) != -2) {
if ((i_1_ ^ 0xffffffff) == -3)
break;
break while_132_;
}
} else {
anInt9099 = class348_sub49.getUByte();
... |
5810d2ac-b51b-432a-b7cd-a47c3fa593dc | 1 | public synchronized String getLocationsJson() {
StringBuilder sb = new StringBuilder();
sb.append(String.format("{x: %d, y: %d}",
Integer.valueOf(head.x), Integer.valueOf(head.y)));
for (Location location : tail) {
sb.append(',');
sb.append(String.format("... |
e2288ff1-3e18-4849-8556-65eb2c3c6361 | 4 | public void calcFreq()
{
for(int i=0; i<g.getBoard().length; i++)
{
for(int j=0; j<g.getBoard()[0].length; j++)
{
for(int k=0; k<chroms.size(); k++)
{
chroms.get(k).checkChrom(g.getBoard()[i][j]);
}
... |
8ac6a938-897d-4ba1-8fbd-597ac1784b6c | 1 | public double countDistanceDelta(Organism organism2) {
double delta;
int E = this.getNumberExcess(organism2);
int D = this.getNumberDisjoint(organism2);
double W = this.averageWeigthDiff(organism2);
int N;
if (this.getGenome().getNumberGenes() >= organism2.getGenome().get... |
a7dc63d0-f490-42f8-bd74-feebe387f5a3 | 1 | @Override
public void open() throws IOException {
try {
this.namedPipe = new RandomAccessFile(this.namedPipeLocation, "rw");
} catch (FileNotFoundException ex) {
// Convert the FNF
throw new IOException(ex.getMessage(), ex);
}
} |
8f37be93-61f1-416e-9bbc-6fbff09ead30 | 5 | public static void main(String[] args)
{
if (args.length == 1)
{
try
{
timeTCP(args[0]);
}
catch (IOException e)
{
e.printStackTrace();
System.exit(1);
}
}
else if... |
5caa9c60-44ca-4064-ada9-a3abb876c89a | 4 | public final void paint(Graphics g)
{
switch(dir)
{
case NORTH:
draw(g,x*Main.tileWidth,(y-progress)*Main.tileHeight);
break;
case SOUTH:
draw(g,x*Main.tileWidth,(y+progress)*Main.tileHeight);
break;
case WEST:
draw(g,(x-progress)*Main.tileWidth,y*Main.tileHeight);
break;
case EAST:
dr... |
3ab8d270-3754-4976-b6f2-1d5d90d47ceb | 5 | private void setTileAt(int x, int y, ETile ETile) {
if ((x >= 0) && (x < width) && (y >= 0) && (y < height) && (!ETile.equals(null))) {
maze[x][y] = ETile;
}
} |
b01753a9-9565-4f32-b68f-74486fef516d | 0 | public String getTime() {
return time;
} |
a31d9ad6-aa3a-4194-a00a-6951a3f7efc0 | 5 | public static IdentifierUse fromCode(String codeString) throws Exception {
if (codeString == null || "".equals(codeString))
return null;
if ("usual".equals(codeString))
return usual;
if ("official".equals(codeString))
return official;
if ("temp".eq... |
7f86b017-4f93-4867-b576-12eb6acac94e | 1 | @Override
public void close() throws ChannelException {
try {
receiver.stop();
out.close();
in.close();
super.close();
}
catch (IOException ex) {
throw new ChannelException(ex);
}
} |
23409804-528b-4e42-bf29-f101492a921f | 5 | private void processIndexBytes(byte[] data)
throws UnsupportedEncodingException {
int currentIndex = 0, dataIndex = 0, dataSize;
byte[] wordBytes, dataOffsetBytes, dataSizeBytes;
while (currentIndex < data.length) {
if (data[currentIndex] == Constant.INDEX_FILE_SPLIT_BYTE) {
if (currentIndex + 8 < data... |
d5c665aa-5d41-4b49-a6b3-ca2f5909a5de | 1 | public boolean thirsty() {
if(iThirst >= ThirstLevel){return true;}
return false;
} |
db5aff0c-a937-4601-8ea3-4c84336f34ae | 8 | public void countBagReferences(Instance bag){
int index = 0, referencesIndex = 0;
if(m_TrainBags.numInstances() < m_NumReferences)
referencesIndex = m_TrainBags.numInstances() - 1;
else
referencesIndex = m_NumReferences;
if(m_CitersDebug == true){
System.out.println("-------Reference... |
e952d4ef-4ba2-4f93-b28d-042dc2b3179e | 7 | private static boolean readBoolean(String prompt, boolean defaultVal) {
boolean val = false;
boolean set = false;
while (!set) {
String s = readString(prompt + " (T/F) (default " + (defaultVal ? "T" : "F") + ")");
if (s.length() > 0) {
if (s.charAt(0) == 't' || s.charAt(0) == 'T') {
val = true;
... |
f0b59729-c965-40b2-a568-61ecf977b513 | 8 | private SceneGraphPath[] pickGeomAllSorted(int xpos, int ypos)
{
Node obj;
int i, cnt=0;
double dist[] = new double[1];
// System.out.print("In pickGeomAllSorted\n");
pickRay = (PickRay) generatePickRay(xpos, ypos);
sceneGraphPathArr = pickRoot.pickAll(pickRay);
if(sceneG... |
ccade080-f61e-4a52-a1b3-7a5bbc25d1c2 | 3 | protected Object getFirstSelectableCell(Object[] cells)
{
if (cells != null)
{
for (int i = 0; i < cells.length; i++)
{
if (graph.isCellSelectable(cells[i]))
{
return cells[i];
}
}
}
return null;
} |
922698ed-7b65-4790-bc1c-8fa7564ade47 | 7 | public static boolean ismetabolite(PathCaseNodeRole r) {
return r == PathCaseNodeRole.SUBSTRATEORPRODUCT || r == PathCaseNodeRole.REGULATOR || r == PathCaseNodeRole.INHIBITOR || r == PathCaseNodeRole.ACTIVATOR || r == PathCaseNodeRole.COFACTOR || r == PathCaseNodeRole.COFACTORIN || r == PathCaseNodeRole.COFACTO... |
6655c134-80ff-4d21-9ea6-21fb25f2b9d2 | 7 | @Override
public void run() {
HashMap<String, Posting> pList = new HashMap<String, Posting>();
for (String docId : input.get(term)) {
if (!pList.containsKey(docId)) {
pList.put(docId, new Posting(docId));
}
pList.get(docId).increaseTf();
}
ArrayList<Posting> result = new ArrayList<Posting>(pList.... |
3cb4e806-61b0-44b4-b703-9716f0997d52 | 2 | public void clear() {
entities.clear();
for(int i=0; i<nodes.length; i++) {
if(nodes[i] != null) {
nodes[i].clear();
nodes[i] = null;
}
}
} |
d31cfe0a-05b8-41fb-b47c-201db211ac11 | 6 | @Override
public void update()
{
sea_level_ = map_.getSeaLevel();
remainder_ = 1.0f - sea_level_;
Map<WorldGenerationCell> map = map_.getMap();
int width = map.getWidth();
int height = map.getHeight();
// init rainfall
rainfall_ = new float[width][height];
for(int y = 0; y < height; y++... |
de8b6d57-581f-4eea-80e6-dff2bfa1cdf9 | 6 | private static void parseRelationEndPoint(Relationship.EndPoint endPoint, String expr) {
String label = encryptStereotypeDelimiters(expr);
Styles.Decoration decoration = Styles.Decoration.None;
if(expr.contains("<>")) {
decoration = Styles.Decoration.Aggregation;
label ... |
572632ec-64cf-4a06-a6bb-560c19881633 | 0 | protected JTable initParseTable() {
return null;
} |
3d376ea2-9ecb-47bd-b027-15558606bcd2 | 8 | public static void main(final String[] args) {
final CodeSource codeSource = OneJarStartup.class.getProtectionDomain()
.getCodeSource();
System.out.println("alphaForms OneJar");
String jarDir = null;
String jarFileName = null;
try {
final String jar = codeSource.getLocation().toURI().toString()
.... |
cd0c178f-565f-4f2e-933f-3128e0b04b19 | 8 | protected String toUnderscoreFromCamel(String camelCase) {
int lastUpper = -1;
StringBuffer sb = new StringBuffer();
for (int i = 0; i < camelCase.length(); i++) {
char c = camelCase.charAt(i);
if ('_' == c) {
// Underscores should just be passed through
sb.append(c);
l... |
0063e00b-6f30-447e-98a8-5febc53cf032 | 1 | public void preencher()
{
list = new ArrayList();
jlist = new JList(new DefaultListModel());
adicionar = new JButton("Adicionar");
adicionar.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent arg0)
{
inserir();
}
});
remover = new JButton("Remover");
remover.... |
b9be40d2-bd3d-407d-a7b5-4b843e50d84a | 3 | private boolean validPosition(int i, int j) {
System.out.println(i);
System.out.println(j);
return i >= 0 && i < model.getHeight() && j >= 0 && j < model.getWidth();
} |
ca568ae5-b5d1-408e-b862-2705e9a6e4ac | 9 | public void addAttribute(String attribute, String value) {
if (value == null) {
value = "";
}
if (attribute.equals(FILL) ) {
value = morphColor(value);
}
if (attribute.equals(STROKE_OPACITY)) {
if (value.equals("0")) {
props.setProperty(STROKE, "none");
}
}
if (attribute.equals(STROKE_W... |
66ae6c41-6803-4274-b7d6-c33142296297 | 6 | public static double getPredictedScore(User user, Business business){
String u_id = user.u_id;
String b_id = business.id;
String ubKey = u_id + ";" + b_id;
Double star = ubStar.get(ubKey);
if (star == null)
return -2.0;
for (HashSet<User> cluster : clusters.values()){
if (cluster.contains(user)){
... |
7b230cbf-2f75-40b8-871b-3713d1a3054a | 6 | public void renderTile(int xx, int yy, Tile tile){
xx *= 32;
yy *= 32;
for(int y = 0; y < tile.sprite.SIZE; y++){
int ya = y + yy - yOffset;
for(int x = 0; x < tile.sprite.SIZE; x++){
int xa = x + xx - xOffset;
if(xa < 0 || xa >= width || ya < 0 || ya >= height) continue;
pixels[xa + ya * width]... |
c1e29c7e-2f2f-4f3e-989a-ed66a0753fb8 | 3 | public static File showOpenDialog(String title) {
final ExtensionFileFilter filter = new ExtensionFileFilter();
JFileChooser Open = new JFileChooser();
if (title.compareTo("Importer") == 0) {
filter.setDescription(Tools.getLocalizedString("FILE_TYPE_TXT"));
filter.addExtension(".txt");
Open.setFileFilter... |
14265054-7797-457b-be95-6d485ccdae0a | 4 | protected boolean isOperational(ArithmeticElement element, boolean includeMinus) {
switch (element) {
case MODULO: case MULTIPLY:
case DIVISION:
return true;
case MINUS:
return includeMinus;
default:
return false;
}
} |
a3c43fb8-cca0-4979-bb38-a69867a852d2 | 7 | public static Date parseDate( String s, int pat )
{
if( s.equals( "" ) )
{
return null;
}
//SimpleDateFormat sdf = new SimpleDateFormat();
try
{
switch( pat )
{
case 0xe:
WorkBookHandle.simpledateformat.applyPattern( "dd/MM/yy" );
return WorkBookHandle.simpledateformat.parse( s );
... |
c76922ef-f1ce-4d01-8735-f2ab2d11b467 | 3 | public int isGemCollision(int x, int y, ArrayList gems)
{
Gem tempGem;
int number;
for (int i = 0; i < gems.size(); i++)
{
tempGem = (Gem) gems.get(i);
if(tempGem.x == x && tempGem.y == y)
{
number = i;
... |
8ab9c084-5a1e-46b6-90ab-c517785f821a | 4 | @Test
public void removeHistoricalOfProductsPurchasedOfCustomers() {
List<Product> listClient = null;
Map<Client, List<Product>> listAllClient = null;
Product book = new Product("Book", 1234, 2.30, 100);
Product table = new Product("Table", 1234, 2.30, 100);
Client client = new Client("Diego", "3423-1435",
... |
d508b19f-9b35-420a-86b8-5cffb100a269 | 2 | public List<ClientInfo> getServers(){
List<ClientInfo> list = new ArrayList<ClientInfo>();
NodeList nodeList = doc.getElementsByTagName("server");
for (int i = 0; i < nodeList.getLength(); i++) {
Node n = nodeList.item(i);
if (n.getNodeType() == Node.ELEMENT_NODE) {
Element e = (Element) n;
Buil... |
3b86e42d-ee6c-4f04-bd72-f6f2c25feffb | 3 | @Override
public Class getColumnClass(int column) {
Class returnValue;
if ((column >= 0) && (column < getColumnCount())) {
if(getValueAt(0, column)==null)
return String.class;
returnValue = getValueAt(0, column).getClass();
... |
c7c68b16-b97a-467a-9630-10c97f59c3df | 7 | private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
try {
//cargo Parametros del Reporte
Map parametros = new HashMap();
parametros.put("name_empresa", r_con.getRazon_social());
if (jCheckBox1... |
dff34f0e-efaf-4147-a5d2-37b1d4b5d917 | 0 | public static void main(String[] args) {
ADriver aDriver = new ADriver();
aDriver.run();// 调用模板方法
System.out.println("============华丽的分割线================");
BDriver bDriver = new BDriver();
bDriver.run();
} |
58900082-f621-4add-9c89-472575dde44f | 5 | public static void main(String[] args) {
int sum = 0;
for (int i = 0; i < 1000000; i++)
// check if base 10 is palindromic
if (isPalindrome(i))
// check if base 2 is palindromic
if (!(Integer.numberOfLeadingZeros(i) > 0 && Integer
.numberOfTrailingZeros(i) > 0))
/*
* NOTE: Solution ca... |
180c35ed-1597-4a23-ad51-bd1fdf6960b8 | 4 | double EStep(Collection<_Doc> trainSet) {
double likelihood = 0;
for(_Doc doc: m_trainSet){
score(doc, 0);//to compute p(x|y)p(y) and store it in m_cProbs
if (doc.getSourceType()==1) {//unlabeled data
double sumY = Utils.logSumOfExponentials(m_cProbs);
for(int i=0; i<m_classNo; i++) {
doc.m_s... |
73e300d2-1dd8-4e2e-9a5e-9bc62a367f11 | 8 | @Override
public void run() {
initializeLogger();
this.log.info("Start chat server");
this.currentThread = Thread.currentThread();
if (this.currentThread.isInterrupted()) {
this.log.info("current Thread is Interrupted");
this.log.severe("finish -1");
return;
}
ServerSocket serverSocket = createSer... |
b85461da-b874-43b0-8bda-591ddfd76e54 | 9 | static final void method112() {
int i = Class328_Sub1.onscreenGpiOffset;
int[] is = Class286_Sub7.onscreenGpiList;
int i_92_ = MouseMovementListener.aBoolean7444 ? i : i + Class150.anInt2057;
for (int i_93_ = 0; i_93_ < i_92_; i_93_++) {
Mob class318_sub1_sub3_sub3;
if (i_93_ < i)
class318_sub1_sub3_sub... |
f7c58188-457a-4d0b-b528-a6e91a0d312a | 7 | @SuppressWarnings("deprecation")
public void processLoginRequest(OMMSolicitedItemEvent event)
{
OMMMsg msg = event.getMsg();
Token token = event.getRequestToken();
byte msgType = msg.getMsgType();
System.out.println(_instanceName + " Received Login " + OMMMsg.MsgType.toString(ms... |
f53cd44f-b77e-4ef3-846d-495665d32896 | 7 | public void filterValues(double minValue, double maxValue) throws IOException {
for (int i = 0; i < rows; i++) {
double value = values.get(column, i);
if (!Double.isNaN(minValue) && !Double.isNaN(value) && minValue > value) {
values.set(column, i, Double.NaN);
... |
1686db72-7be0-4280-b10f-4fae8983ed23 | 7 | public Departamento selectTodosDepartamentos() throws SQLException {
Connection conexao = null;
PreparedStatement comando = null;
ResultSet resultado = null;
Departamento DEP = null;
try {
conexao = BancoDadosUtil.getConnection();
comando = conexao.prep... |
3c3928d7-fd66-4a9b-8598-ff74a91a9a6f | 2 | public static void main(String[] args) {
File file = new File("D:/aaa");
// String name[] = file.list();
//
// for(String na :name)
// {
// if(na.endsWith(".java"))
// {
// System.out.println(na);
// }
// }
String[] names = file.list(new FilenameFilter() {
public boolean accept(File d... |
116fd7a2-7053-4282-9029-6ede04a0831f | 9 | public static void rememberUnitDamageValues() {
for (UnitTypes unitTypes : UnitTypes.values()) {
if (!unitTypes.name().startsWith("Terran") && !unitTypes.name().startsWith("Protoss")
&& !unitTypes.name().startsWith("Zerg")) {
continue;
}
UnitType type = UnitType.getUnitTypeByID(unitTypes.ordinal())... |
4909902c-3349-4e3d-aa5f-16dafa2893ef | 5 | public CheckResultMessage checkDayofMonth7() {
int r1 = get(10, 5);
int c1 = get(11, 5);
date();
if (checkVersion(file).equals("2003")) {
try {
in = new FileInputStream(file);
hWorkbook = new HSSFWorkbook(in);
if (!(getValueString(r1 - 1, c1 + maxDay, 2).equals(maxDay
+ "日"))) {
return... |
d08ec8f1-9aa2-4e69-a578-315637cf463c | 3 | public void initializeBrokers() {
int loadBalancerPort = 7000;
String ipAddress = "localhost";
BrokerNode[] brokers = new BrokerNode[6];
for (int i = 0; i < 6; i++) {
BrokerNode broker = null;
try {
broker = new BrokerNode(ipAddress, loadBalancerPo... |
bc28312c-973e-4ac7-9a1c-c2bee356959e | 6 | private int findScore(State state, int alpha, int beta, int depth, char colorToPlay) {
nodeCount++;
if (depth == maxSearchDepth) { //Once at leaf, return the score of that state
return state.score();
}
List<Integer> legalMoves = state.legalMoves();
if (colorToPlay == 'X') {
for (int currentMove : legal... |
48a0558e-2111-48e2-ac25-5d4458400023 | 5 | public static ResponseQuestion getResponseQuestionByXMLElem(XMLElement root, Quiz quiz, int pos) {
int quizID = quiz.quizID;
int position = pos;
Object question = null;
Object answer = null;
double score = 10;
for (int i = 0; i < root.childList.size(); i++) {
XMLElement elem = root.childList.get(i);
i... |
a8cdfd6a-2276-43ce-b996-eb5ebc224344 | 2 | public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse res)
{
LogonForm af = (LogonForm) form;
String username = af.getUsername();
String password = af.getPassword();
if(username.equals("asd") && password.equals("asd"))
{
HttpSession session = req.... |
4d26b2b3-f442-4075-942a-606002921835 | 8 | public static ExecutorService evaluateExecutorParam(String arg) {
int finderImpl = Integer.parseInt(arg);
if (finderImpl < 1 || 5 < finderImpl) {
System.out.printf("Unknown executor : %d%n", finderImpl);
System.exit(-1);
}
ExecutorService executor = null;
int availableProcessors = Runtime.getRuntime().a... |
a08ba7e2-1c97-4e22-aa93-53bd4c1b7ee0 | 6 | protected final void checkSliderPosition()
{
if (orientation == VERTICAL)
{
if (slider.y < y + 25)
slider.y = y + 25;
else if (slider.y > y + length - (25 + sliderSize))
slider.y = y + length - (25 + sliderSize);
}
else if (orientation == HORIZONTAL)
{
if (slide... |
5d2217a6-0205-4093-b467-f8169a4cc469 | 3 | protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
response.setContentType("audio/mpeg3");
response.reset();
OutputStream out = response.getOutputStream();
AWSCredentials s3Credentials = Transfer... |
5b135eee-c1ec-454d-8cc0-0ae3e0a3a67f | 8 | private void scanForAttackers(){
// Check for attackers
for (int x = tower.x - tower.range; x <= tower.x + tower.range; x++) {
for (int y = tower.y - tower.range; y <= tower.y + tower.range; y++) {
if (x < TilePanel.getInstance().tileMap.getGameBoard().size()
&& x >= 0
&& y < TilePanel.... |
97b301ab-6564-4a25-8256-940af4558105 | 8 | public void run() {
Scanner scanner = new Scanner(System.in);
System.out.println("Do you want to load an previously saved game?(y/n)");
String a = scanner.next();
if(a.equalsIgnoreCase("y")){
System.out.println("Please enter filepath");
loadLevel(scanner.next());
}
System.out.println("***Enter \... |
db204a9f-5c99-4d23-a03a-31a6164f36fd | 9 | public boolean equals(Object rhs) {
if (rhs instanceof TokenInfo) {
TokenInfo rhsTok = (TokenInfo) rhs;
return this.id == rhsTok.id &&
(this.word != null && this.word.equals(rhsTok.word)) &&
(this.lemma != null && this.lemma.equals(rhsTok.lemma)) &&
this.charOffset... |
c13389da-e446-443b-ac5c-e1709f261361 | 9 | private void choosePrintSize() {
final String s = ( String ) JOptionPane.showInputDialog( this,
"Please enter values for width and height,\nseparated by a comma.\n"
+ "[curre... |
35e34b07-e03d-4a92-8bfe-a1bd9464c21e | 2 | @Override
public void salvar(Evento evento) {
try {
conn = ConnectionFactory.getConnection();
String sql = "INSERT INTO EVENTO (id, nome, dataevento) "
+ "VALUES ((SELECT NVL(MAX(id),0)+1 FROM evento), ?, to_date(?, 'yyyy/mm/dd'))";
ps ... |
ad49c6b8-09e3-482d-9ae6-fbea0dee133e | 3 | public String displayGameHelp(HelpType command) throws Connect4Exception {
String helpText = "";
switch (command) {
case INSTRUCTIONS:
case ONE_PERSON_GAME:
case TWO_PERSON_GAME:
helpText = command.displayGameHelp();
break;
... |
877b29b4-9de7-482a-8c44-64cb2328f627 | 1 | private static boolean isMultiValued(final Field field) {
return isCollection(field) || isArray(field);
} |
0fd8de9f-394f-4317-90d2-3df4f78b4340 | 1 | public MapViewer(int[][] rgbArray, String title, Dimension dmx) {
this.rgbAr = rgbArray;
this.setTitle("MapViewer- " + title);
this.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
if (dmx == null) {
dmx = new Dimension(rgbArray[0].length, rgbArray.length);
}
... |
9f9b0241-a9cc-4c0b-97b7-0a6096624a98 | 9 | final private boolean jj_scan_token(int kind) {
if (jj_scanpos == jj_lastpos) {
jj_la--;
if (jj_scanpos.next == null) {
jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken();
} else {
jj_lastpos = jj_scanpos = jj_scanpos.next;
}
} else {
jj_scanpos... |
3df0c01e-d836-4261-9339-d9f398a1eef6 | 4 | public void createRandomGraph(int nrVertices) {
clearGraph();
int max_x = width - SQUARE_SIZE;
int max_y = height - SQUARE_SIZE;
int min_x = SQUARE_SIZE;
int min_y = SQUARE_SIZE;
Random rand = new Random();
Set<Point> pts = new HashSet<Point>();
while ... |
df0d0b91-2801-4676-b841-08865cc83c94 | 4 | @Override
public V put(K key, V value) {
V oldValue = null;
int index = Math.abs(key.hashCode()) % SIZE;
if(buckets[index] == null) {
buckets[index] = new LinkedList<MapEntry<K, V>>();
}
LinkedList<MapEntry<K, V>> bucket = buckets[index];
MapEntry<K, V> ... |
481d18d5-d6a6-4579-8493-3d96bc715c07 | 4 | @SuppressWarnings("static-access")
@EventHandler(priority = EventPriority.HIGH)
public void onMobDeath (EntityDeathEvent event) {
Entity entity = event.getEntity();
World world = event.getEntity().getWorld();
if (entity instanceof Wolf) {
Wolf hound = (Wolf) entity;
... |
c0b21790-85b7-4f18-b7dd-ed65cb07c596 | 5 | public boolean getPartyState(int i) {
if (i == 1) {
bm.setIsAlive();
return bm.isAlive();
}
else if (i == 2) {
n.setIsAlive();
return n.isAlive();
}
else if (i == 3) {
w.setIsAlive();
return w.isAlive();
}
else if (i == 4) {
d.setIsAlive();
return d.isAlive();
}
else if (i == 5... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.