method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
15dfc978-3ec6-41f1-b0d9-3b61ede8aa8f | 9 | public static String encode(String str) {
if (str.matches("[a-zA-Z0-9 ]*"))
return str;
StringBuilder builder = new StringBuilder(str.length() * 3);
for (int i = 0; i < str.length(); ++i) {
char c = str.charAt(i);
if ('a' <= c && c <= 'z' || 'A' <= c && c <= 'Z' || '0' <= c &&
c <= '9' || c == ' ... |
14f8605c-856d-4315-ba1a-300df9afd1e7 | 5 | private String constructQuery(String indexedRule) {
ArrayList<String> RPNRule = translateToRPN(indexedRule);
ArrayList<Boolean> translatedFlagList = new ArrayList<Boolean>();
for (int i = 0; i < RPNRule.size(); i++)
translatedFlagList.add(false);
if (RPNRule.size() == 1)
RPNRule.set(0, translateInde... |
1ee7b7b3-a19c-4352-b31f-0846eabf88d8 | 1 | public static Prevention getInstance() {
if (instance == null) {
instance = new Prevention();
}
return instance;
} |
695be82f-9d2d-4b61-8846-d08aaad43dbb | 5 | public static void main(String[] args)
{
// Retrieve command line arguments
if (args.length < 4)
{
System.out.println("Usage: java EmployeeUpdater <EmployeeObjectName> <Forename> <HourlyRate> <HoursPerWeek>");
return;
}
// Validate command line arguments
double hourlyRate = 0.0;
int hoursPerWeek = ... |
5972a763-8636-45c4-96b6-91905248dcaf | 2 | public boolean testXML(String xmlFile, String validationFile, int mode) throws Exception {
if (VALID_DTD == mode) {
return validateXMLByDTD(xmlFile, validationFile);
} else if (VALID_XSD == mode) {
return validateXMLBySchema(xmlFile, validationFile);
}
return true;
} |
4d355633-86af-4446-bdec-a98b087b1d74 | 4 | private void gameLoop() {
isLooping = true;
long currentTime;
gui.update(System.currentTimeMillis());
while (isLooping) {
currentTime = System.currentTimeMillis();
if (Dealer.isDealing()) {
Dealer.continueDealing(currentTime);
}
... |
79a15f43-6966-433e-a8ce-66472a493e83 | 4 | public BrowseFrame(Title myTitle, TrainSchedule TS) throws IOException {
setBackground(new Color(173, 216, 230));
setLayout(null);
txtBrowse = new JTextField();
txtBrowse.setText("Browse...");
txtBrowse.setBounds(495, 340, 200, 20);
add(txtBrowse);
txtBrowse.setColumns(10);
JLabel label = new J... |
2d36ed46-149e-4bb9-845a-3397a98b0f2a | 0 | Decoder2() {
} |
c513065a-64f4-4c02-bebc-34aa2953dea8 | 7 | private static Class<?> determineArrayItemType(Class<?> clazz){
if(clazz.isArray()){
return clazz.getComponentType();
}
ParameterizedType parameterizedType = getParameterizedType(clazz);
if(parameterizedType!=null && parameterizedType.getActualTypeArguments().length==1){
try{
return (Class<?>) ... |
b1284137-3ef4-4765-815d-69f8cd5bcda4 | 4 | public final static String getFileContents(String path) {
StringBuffer stringBuffer = new StringBuffer();
InputStreamReader inputStream = null;
try {
String nextLine;
inputStream = new InputStreamReader(FileManager.class.getResourceAsStream(path));
BufferedReader bufferReader = new BufferedReader(inpu... |
863976a1-9f10-43a5-b65a-f5e208e18bf0 | 5 | public boolean permGen(int[] array) {
// Find longest non-increasing suffix
int i = array.length - 1;
while (i > 0 && array[i - 1] >= array[i])
i--;
// Now i is the head index of the suffix
// Are we at the last permutation already?
if (i <= 0)
return false;
... |
68d91cc1-35f0-4534-b3cd-78e45663fb30 | 9 | public static boolean isInterleave(String s1, String s2, String s3) {
int len1 = s1.length();
int len2 = s2.length();
int len3 = s3.length();
if ((len1+len2) != len3)
return false;
boolean [][] dp = new boolean[len1+1][len2+1];
for (boolean[] row : dp)
{
... |
78d2b115-068b-41d3-85cf-13613c3828b1 | 2 | public ArrayList<Pesquisa> listar(String condicao) throws Exception
{
String sql = "SELECT * FROM pesquisa " + condicao;
ArrayList<Pesquisa> listaPesquisa = new ArrayList<Pesquisa>();
try
{
PreparedStatement stmt = ConnectionFactory.getConnection().prepareStatement(sql);
ResultSet rs = stmt.executeQue... |
d352a386-e3a0-4d07-862c-960ff8872e68 | 3 | public void nuevo(int n){
Menu menu = new Menu();
Statement consulta = menu.conexion();
String nombre = txt2.getText();
String descripcion = txt3.getText();
try{
int cantidad = Integer.parseInt(txt4.getText());
int precio = Integer.parseInt(txt5.getText());
... |
a67f661f-329b-442d-abb3-6bff9956490f | 9 | public TimerEvent(int type, long millisec) {
this.type = type;
if (type != TYPE_PERIODIC_REL && type != TYPE_PERIODIC_OVERLAP_REL &&
type != TYPE_APPOINTED_REL &&
type != TYPE_APPOINTED_ABS) {
throw new IllegalArgumentException("Invalid Type Value : " + type);
}
isRelative = (type == TYPE_PERIODIC_... |
8e962c8c-c75c-417a-a9f7-7630acb8251e | 1 | private void copySelectedRiver() {
for (River r:((JList<River>) riverList).getSelectedValuesList()) {
riverListModel.insertElementAt(MainWindow.riverDB.cloneRiver (r), riverList.getSelectedIndex()+1);
}
} |
23018edc-0334-47ba-bb26-e8d306430a90 | 0 | public Parabola(Excel ex, double p, int size)
{
begin = ex;
this.p = p;
this.size = size;
setColoredExes();
} |
aeb789f2-16a9-4c14-b748-775f9f9163fc | 5 | public synchronized void tellTo(final String message, final String permission){
// System.out.println("tellTo() from ClientMap");
new Thread(new Runnable(){
public void run(){
try{
for(ClientCluster c: ClientClusterMap.values()){
if(c.Alive()){
if(ClientHandler.getDataQueuer().isRealUser(c.g... |
48cb37a1-a977-4509-b7a9-2aaadbbe872e | 5 | static final int method1032(int i) {
anInt1701++;
int i_1_ = 0;
if (i != -1)
readClassCheckPacket(117, null, null, 29);
Field[] fields = (aClass1713 != null ? aClass1713
: (aClass1713 = method1037("Class348_Sub51")))
.getDeclaredFields();
Field[] fields_2_ = fields;
for (int i_3_ = 0;
(i_3... |
8ab642fb-392a-45ed-87d7-584301c78843 | 2 | @Override
public Person delete(long id) {
for (int i = 0; i < persons.size(); i++) {
if (persons.get(i).getId() == id) {
return persons.remove(i);
}
}
return null;
} |
cca76373-bc24-4300-96f9-df014c6cc0de | 6 | public String loginBis() throws IOException {
InputStreamReader isr=new InputStreamReader(System.in);
BufferedReader br=new BufferedReader(isr);
String inputLine;
System.out.println("Entrez votre login : ");
inputLine = br.readLine();
String login = inputLine;
System.out.println("Entrez votre mot de ... |
595436fa-d5d2-40c9-9075-704341ac3573 | 2 | private void readFully(byte[] buffer, int offset, int length) throws IOException {
do {
int read = input.read(buffer, offset, length);
if(read < 0) {
throw new EOFException();
}
offset += read;
length -= read;
} while(length > 0... |
f0040918-f8e9-4243-95b4-b30eb4e3bc4e | 1 | @Override
public AbstractActionPanel getAction() {
if ( owner.getSelected() ) {
return new ActionPanelMilitaryUnit();
} else {
return new ActionPanelBlank();
}
} |
6276cde4-9e51-4859-ac78-85cb0cf9d5ae | 9 | private double randomSimulate(State s){
while(true){
Move m = s.findSmartRandomMove(s.whoseTurn());
if(m==null){
if(s.getnBlue()+s.getnRed() == 58){
if(me.equals("red")){
//return s.getnRed()>s.getnBlue()?1:0;
return sigmoid(s.getnRed()-s.getnBlue());
}
... |
d2e1b82d-6db0-4c83-8629-a1148d154170 | 3 | private void register(Map<String, Object> jsonrpc2Params) throws Exception{
Map<String, Object> params = getParams(jsonrpc2Params,
new NullableExtendedParam(Constants.Param.Name.USERNAME, false),
new NullableExtendedParam(Constants.Param.Name.DESCRIPTION, true),
n... |
4d372041-115a-48e8-9639-14917efb6b31 | 7 | public void moveComponents() {
synchronized(movings) {
for (CityComponent c:movings) {
if (c.isActive()) c.updatePosition();
}
}
synchronized (intersections) {
for (CityIntersection ci : intersections) {
ci.setOccupant(null);
synchronized (movings) {
for (CityComponent cc : movings) {... |
7ee1a502-a71b-4676-8da6-b2b70406d7fc | 9 | @Override
public void update(Observable o, Object arg) {
if (arg instanceof GameDescriptorPlayerUpdatePacket) {
GameDescriptorPlayerUpdatePacket packet = (GameDescriptorPlayerUpdatePacket) arg;
// If it was this game.
if (packet.id == gameDescriptorId) {
// If it was us, go back to the lobby
if (pac... |
2c196d5c-bf48-4c48-a917-8e458a2d3ffe | 3 | private boolean isEnPrison(){
if(getToursPrison()>0){
setToursPrison(getToursPrison()-1);
if(getToursPrison()==0){
this.setCash(this.getCash()-50);
}
if(getDes()[0]==getDes()[1]){
setToursPrison(0);
return false;
... |
1cc86606-ab24-4775-ad66-5dc76cd06177 | 7 | public static void main(String[] args) throws Exception {
File f = new File("D:\\data\\Lda\\ap.txt");
FileInputStream input = new FileInputStream(f);
// Begin by importing documents from text to feature sequences
ArrayList<Pipe> pipeList = new ArrayList<Pipe>();
// Pipes: lower... |
cb7c2b62-194a-4bf6-b3e7-8b02e783c74a | 4 | public double attributeValueChance(Integer featureId, String value) {
double result = 0D;
for (String fValue : Feature.possibleFeatures.get(featureId).getPossibleValues()) {
if (fValue.equals(value)) {
double positive = 0.0;
double negative = 0.0;
for (ClassifiableObject co : partitionedObjects.get(f... |
e849a161-09fc-468d-b2b7-c2a33752025f | 2 | void configureEditor(ComboBoxEditor newEditor) {
if (editor != null) {
editor.removeKeyListener(editorKeyListener);
editor.removeFocusListener(editorFocusListener);
}
if (newEditor != null) {
editor = (JTextComponent) newEditor.getEditorComponent();
... |
c000f07e-b0d9-45f0-b35f-0e18549cd82f | 2 | private Classe getClasseByModel(Model m, String str){
Classe res = null;
for(Classe c : m.getClasse()){
if(c.getIdentifier().trim().equals(str.trim())){
res = c;
}
}
return res;
} |
19f0d9fd-3212-457c-81db-208fd6134f66 | 4 | protected void whenDragged() {
if (initScrollPos == -1 || ! showScroll) return ;
final Vec2D mP = myHUD.mousePos(), dP = myHUD.dragOrigin() ;
final float mapRatio = Math.min(mapRatio(), MAX_GRAB_PORTION) ;
final float stretch = (mP.y - dP.y) / (ydim() * (1 - mapRatio)) ;
scrollPos = initScrollPos + ... |
2b949c47-5bc5-4082-80d5-f5c8858859a2 | 0 | public void removeSelectionListener(ConfigurationSelectionListener listener) {
selectionListeners.remove(listener);
} |
2ab2afac-a314-4b1d-9c01-58b9c57f8b72 | 9 | private void collideFireballAndPlayer(Fireball f, Player p, int delta) {
double ballWidth,ballCenterX,shieldWidth,shieldCenterX;
if(p.getCurrentFacing() == FACING.UP || p.getCurrentFacing() == FACING.DOWN) {
// get fireball colbox width
ballWidth = f.getCollisionRect().getWidth();
// get the center of t... |
c28c78e4-0341-41a8-9bd5-4cd7646b86f8 | 5 | private static void merge(myLinkedList left, myLinkedList right)
{
Node currentLeft = left.head; //The first possible insertion position
Node currentRight = right.head.next; //First node
//Merge the right list into the left list (in place)
while (currentLeft.next != null && currentRight != null) ... |
38c1aa10-707a-4b2b-a600-a921dab0d69a | 9 | static void test_11() {
System.out.print("test 11...");
Term tuple = new Compound("t", new Term[] { new Atom("a"), new Atom("b"), new Atom("c"), new Atom("d"), new Atom("e") });
try {
Variable X = new Variable("X");
Query q11 = new Query("tuple", new Term[] { X });
Term result = q11.oneSolution().get("X"... |
100c457c-ccb4-4ca1-8ebb-c0242c273454 | 6 | public final void setOptions(Map<String, ?> options) {
/* Is verification of YubiKey owners enabled? */
this.verify_yubikey_owner = true;
if (options.get(OPTION_YUBICO_VERIFY_YK_OWNER) != null) {
if ("false".equals(options.get(OPTION_YUBICO_VERIFY_YK_OWNER).toString())) {
this.verify_yubikey_owner = false;... |
1515efee-49b5-42ea-b0dd-0e291655be03 | 4 | @Override
protected void drawLayoutObject(Graphics g, Tile t){
Rectangle rect = getTileRectangle(t);
if (t.isVisited()){
drawTileBase(g, rect, getTileColor(t));
if (t.hasItems()){
drawItems(g, rect);
}
if (t.hasCharacter()){
if (t.getCharacter() instanceof Player){ //TEMP to replac... |
8b1a4cfc-177b-472b-9556-988c7a0e788f | 5 | private void showBubble(Bubble b) {
final float fontScale = LINE_HIGH / FONT.map[' '].height ;
float width = 0 ;
for (char c : b.phrase.toCharArray()) {
Alphabet.Letter l = FONT.map[c] ;
if (l == null) l = FONT.map[' '] ;
width += l.width * fontScale ;
}
//
// You also need to... |
6113270e-dce4-45c7-9d93-6b83c17d60b2 | 3 | protected int readBooleanArray(boolean[] b) throws IOException {
byte[] bx = new byte[b.length];
if (read(bx, 0, bx.length) < bx.length) {
primitiveEOFThrower();
}
for (int i=0; i < b.length; i += 1) {
if (bx[i] == 1) {
b[i] = true;
}... |
b9e8ef64-70ac-4efb-a862-4d115afa38ca | 1 | @Override
public void render(GameContainer gc, Graphics g) throws SlickException {
for (TileMapLayer tileMapLayer : getLayersOrderedByImportance()) {
tileMapLayer.render(gc, g);
}
} |
7a6cedf7-52e2-4b5c-9152-c2940a8a799b | 4 | public void add(Node node) {
if (q.size() == 0) {
q.addElement(node);
} else {
int i;
for (i = 0; i < q.size(); i++) {
Node holder = (Node) q.elementAt(i);
if (holder.totalCost >= node.totalCost) {
q.insertElementAt(node, i);
break;
}
}
if (i == q.size()) {
q.ad... |
cd27e3d7-dc94-4e24-8e44-4848cec93cd4 | 6 | @Override
public Imagem aplica(Imagem imagem) {
Imagem novaImagem = new Imagem(imagem.getWidth(), imagem.getHeight());
int metadeTamanho = (int) Math.floor((float)getTamanho() / 2);
for(int x = metadeTamanho; x < imagem.getWidth() - metadeTamanho; x++) {
for(in... |
79738183-035b-4a2c-9409-f795019da349 | 9 | @Override
public double[] intersect(Ray ray) {
double a, b, c; // Quadratic equation coefficients
Vector3 AO = ray.getFrom().subtract(bottom);
Vector3 AOxAB = AO.crossProduct(direction);
Vector3 VxAB = ray.getDirection().crossProduct(direction);
a = VxAB.dotProduct(VxAB);... |
d3d0ff5c-70ff-42eb-b529-a3d632e8401d | 1 | public int singleNumber(int[] A) {
int res = 0;
for(int a : A){
res ^= a;
}
return res;
} |
06428a73-49de-403a-87f5-e4f52446da56 | 9 | public void fixDataForComponents(int[][] data, List<Object> componentsFoundList)
{
if((componentsFoundList==null)||(componentsFoundList.size()==0))
return;
if((data[0][FOUND_CODE]==0)&&(data[1][FOUND_CODE]==0))
{
final List<Integer> rscs=myResources();
for(final Object o : componentsFoundList)
{
... |
3fbeb71c-74d0-49c9-bca8-1782e3be2ed2 | 1 | public void enter(Miner miner){
if(miner.getLocation() != Location.shack){
System.out.println(miner.getName() + " Walkin' home");
miner.changeLocation(Location.shack);
}
} |
145d538b-7360-47aa-aff3-c52b49d6af1a | 4 | @Override
public void execute() {
if (itemscroll == 0)
seqEflButton(A);
else if (itemscroll == 1)
seqEflButton(A | DOWN);
else if (itemscroll == 2)
seqEflScrollFastAF(itemscroll);
else
seqEflScrollFastA(itemscroll);
if (scroll == 0)
seqEflButton(A, PRESSED);
else
seqEf... |
3498a422-4ca0-46c7-84ee-58a93aee013d | 2 | public static YamlConfiguration loadFile(String pathTo, String internalPath) {
File conf = new File(plugin.getDataFolder() + File.separator + pathTo);
if (!conf.exists()) {
//saveResource("config.yml", true);
try {
InputStream stream = getInputFromJar(internalPath);
copy(stream, conf);
} catch... |
fa9bb012-8691-4600-ae87-040d815e9f45 | 8 | public Updater(Plugin plugin, int id, File file, UpdateType type, boolean announce) {
this.plugin = plugin;
this.type = type;
this.announce = announce;
this.file = file;
this.id = id;
this.updateFolder = plugin.getServer().getUpdateFolder();
final File plu... |
e759f780-a6ee-4bf1-9a10-3dd07a3ddaa0 | 0 | public Permission getPerm() {
return permission;
} |
73db7c07-6e53-42ab-9ddf-9bf1216528dd | 2 | private static Map<? extends Attribute, ?> xlate(Font f, Color defcol) {
Map<Attribute, Object> attrs = new HashMap<Attribute, Object>();
attrs.put(TextAttribute.FONT, f);
attrs.put(TextAttribute.FOREGROUND, defcol);
return(attrs);
} |
40c57cf4-be45-4acb-8857-98525926543f | 1 | public String[] getProjNameComboBoxesData() {
String[] projNameList = new String[numrows];
for (int row = 0; row < numrows; row++) {
projNameList[row] = getValueAt(row, 1).toString();
}
return projNameList;
} |
e8e1de51-7df0-4fde-813c-3f97f96fb39c | 7 | public static void makeCompactGrid(Container parent,
int rows, int cols,
int initialX, int initialY,
int xPad, int yPad) {
SpringLayout layout;
try {
layout = (SpringLayout)pa... |
cc9bfb27-8900-4c00-b9ac-e2744be476b4 | 7 | private void statisticsAnomaliesTerminalShutdown(PrintWriter outFile)
{
ArrayList<ArrayList<String>> labels = null;
ArrayList<Integer> numbers1633 = null;
ArrayList<Integer> numbers1634 = null;
ArrayList<Integer> numbers1635 = null;
ArrayList<ArrayList<String>> pctLabels = null;
ArrayList<In... |
b4f83846-49c2-413f-bd4f-48f05506b37e | 8 | public String ArrayToString(Integer[] bestMove) {
if (bestMove[0] == 0 && bestMove[1] == 1)
return "Click Up";
if (bestMove[0] == 0 && bestMove[1] == -1)
return "Click Down";
if (bestMove[0] == 1 && bestMove[1] == 0)
return "Click Left";
if (bestMove[0] == -1 && bestMove[1] == 0)
return "Click Right... |
eed5069f-6c3d-4ce2-b5ec-5622c37c87d4 | 3 | private void createPassTypePage()
{
composite = new Composite(shlNewAccount, SWT.NONE);
composite.setLayout(new FormLayout());
Label lblNextUpSetting = new Label(composite, SWT.NONE);
FormData fd_lblNextUpSetting = new FormData();
fd_lblNextUpSetting.right = new FormAttachment(0, 603);
fd_lblNextUpSetti... |
0374cc94-91fb-4de6-8cfd-bb5745ad1863 | 3 | public ChampionList (FilterListModel listModel, CustomCellRenderer cellRenderer) {
setModel (listModel);
setSelectionMode (ListSelectionModel.SINGLE_SELECTION);
setLayoutOrientation (JList.HORIZONTAL_WRAP);
setVisibleRowCount (-1);
setBackground (Color.BLACK);
setCellRenderer (cellRenderer);
Champion f... |
d5a8c5b0-2295-4fa1-8fd8-d63ec9fe148d | 3 | private static void computePaths(Vertex source) {
source.minDistance = 0;
PriorityQueue<Vertex> vertexQueue = new PriorityQueue<Vertex>();
vertexQueue.add(source);
while (!vertexQueue.isEmpty()) {
Vertex u = vertexQueue.poll();
for (Edge e : u.adjacencies) {
... |
b9285aa8-6e33-499e-a14c-0351f5e8c0bc | 9 | private void updateGUI() {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
List<String> keys = new LinkedList<String>();
synchronized (swimming) {
keys.addAll(inst().logs.keySet());
}
Collections.sort(keys, new Comparator<String>() {
public int compare(String a, String b) ... |
bbfed97b-f629-47d2-9400-856caaa77399 | 9 | private void elfCollision()
{
for(int i = 0; i < TestState.elves.size(); i++)
{
if(dir.equals("right"))
{
Rectangle r = new Rectangle(x + w/2, y - 1, w, 3);
if(TestState.elves.get(i).getRec().intersects(r))
{
TestState.elves.get(i).playSound();
TestState.elves.remove(i);
i--;
... |
3e3d1066-98dd-4e10-a9ce-6175f33bfd11 | 3 | public static void komponenten(Container cp) {
jLabelRestkartenTisch.setBounds(25, 10, 100, 30);
cp.add(jLabelRestkartenTisch);
jLabelRestkartenGast.setBounds(25, 35, 100, 30);
cp.add(jLabelRestkartenGast);
jLabelRestbarplaetze.setBounds(25, 60, 120, 30);
cp.add(jLabelRestbarplaetze);
jL... |
2b9abfb3-7bdf-42e2-98a2-3c404d144da3 | 3 | public void updContactName(InetAddress iaIn, String strName)
{
InetAddress iaTmp = this.normalizeAddressIfLocal(iaIn);
int iIdx = this.idxContact(iaTmp);
if (iIdx > -1)
{
EzimContact ecTmp = this.getElementAt(iIdx);
if (ecTmp != null && ecTmp.getAddress().equals(iaTmp))
{
ecTmp.setName(strName);... |
7a860ea0-5c83-4364-8451-3adc60122e9b | 3 | public void close() {
stop = true;
if (!socket.isClosed())
try {
// Interrupt the incoming thread immediately
in.interrupt();
// But join the outgoing thread to let it finish serving the queue.
out.join();
// Finally, close the socket
socket.close();
} catch (final InterruptedExcept... |
ac176f34-2acc-4f67-9c71-6b484d203aa4 | 5 | public void dfsIter(String label, Function<Vertex, Vertex> action) {
boolean foundUnVisted = false;
Vertex v = getVertex(label);
while(v != null) {
foundUnVisted = false;
if(!v.wasVisited()) {
action.apply(v);
v.setVisited(true);
stackVertices.push(v);
}
JList<Vertex> listOfAdjacent = g... |
efe204c9-da44-46dc-9d12-9d827ce70908 | 2 | public LinkInfo setCommonPathSuffix(String s) {
if (s == null) return this;
commonPathSuffix = s;
if (cnrlink == null) cnrlink = new CNRLink();
lif.setCommonNetworkRelativeLinkAndPathSuffix();
return this;
} |
01fadc08-cdd4-4193-ac48-e29d625bf645 | 9 | public static boolean isOnlyInString(String strReturn, String strToContain){
// fucntion checks to see if strings meet initial requirements
if(strReturn.isEmpty())return false;
if(strReturn.length()< 1)return false;
if(strToContain.isEmpty())return false;
if(strReturn.length()<1)... |
63038b40-bcf5-4b96-a4f2-7baf195285ee | 5 | @Override
public void actionPerformed(ActionEvent e) {
String val = box_.getSelectedItem().toString();
if (setting_.getType() == ValueType.ENUM) {
if (!setting_.getValue().getString().equals(val))
try {
@SuppressWarnings("unchecked")
Enum<?> t = Enum.valueOf(setting_.getValue().getEnum()
.g... |
17b54050-fd24-49ba-80a3-1282f09d7310 | 0 | public static void send_message(String message){
messages_list.add(message);
} |
4f41bda2-b026-463d-9fd6-5be123b82704 | 1 | public static JoeTree newTree(OutlinerDocument document) {
// JoeTree currently implemented by TreeContext
if (document == null) {
return new TreeContext();
} else {
return new TreeContext(document);
}
} |
b5596965-039f-49ad-9e7e-3a95920b61c9 | 0 | public int getY(){
return y;
} |
5c418ab4-60a0-46aa-b42a-1a9fcc22093c | 4 | public void validate(Object param, Object value) {
if (param instanceof String) {
isLessThanString((String) param, value);
} else if (param instanceof Integer) {
isLessThanInteger((Integer) param, value);
} else if (param instanceof Boolean) {
throw new IllegalArgumentException();
} else if (param inst... |
e15863ab-96e5-4a36-ac20-a4df8a123952 | 6 | public static List getPhoneBook() {
Connection conn = null;
List<Contact> listPhoneBook = null;
try {
conn = DBConnection.getConnection();
String query = "SELECT * FROM `mobilephone`";
Statement stat = conn.createStatement();
ResultSet result = stat.executeQuery(query);
int numberOfRecords = 0... |
b99bd996-7e07-4c1f-9087-aeeb3e095c27 | 2 | public String getRegistro(String url) {
HttpURLConnection conexao;
BufferedReader rd;
String linha;
capturaJson = "";
try {
System.out.println("GET : " + url);
this.urlConsulta = new URL(url);
conexao = (HttpURLConnection) urlConsulta.openConnection();
conexao.setRequestMethod("GET");
rd = new ... |
5680cd0f-f473-479f-a689-c07c8c48503d | 7 | protected String modelToString(DefaultListModel m) {
String result;
String tmpStr;
int i;
int n;
boolean quote;
result = "";
for (i = 0; i < m.size(); i++) {
if (i > 0)
result += ",";
tmpStr = m.get(i).toString();
quote = (tmp... |
e6002250-8243-4489-9586-7f8c59acb2b0 | 6 | public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... |
d1e3e1e6-8ad8-4fd8-a6a1-4eb2cd8e7ce5 | 3 | public boolean ApplyRingOfLife() {
if (IsDeadTimer == false) {
actionAmount++;
actionTimer = 4;
ResetAttack();
setAnimation(0x718);
sendMessage("Ring of Life saved your life !");
deleteequiment(2570, playerRing); //2570 = ring of life
IsDeadTimer = true;
}
if (actionTimer == 0 && IsDeadTimer ... |
dcaa65f7-1eb8-49d8-9d46-f389ea2d3d30 | 5 | public boolean setReservation(int theaterID, int seat) throws RemoteException{
if(this.lastRequest == -1)
this.lastRequest = System.currentTimeMillis();
if(connectionTimout())
return false;
this.reservationTheater = theaterID;
if(this.reservation == seat)
return true;
if(this.reservation ... |
e49ac45e-3779-4f02-883c-50e1414fc834 | 0 | public final void unBan(String channel, String hostmask) {
this.sendRawLine("MODE " + channel + " -b " + hostmask);
} |
5c843ab3-5027-425c-bb02-8c34c720110c | 3 | public void setPtySize(int col, int row, int wp, int hp){
setPtyType(this.ttype, col, row, wp, hp);
if(!pty || !isConnected()){
return;
}
try{
RequestWindowChange request=new RequestWindowChange();
request.setSize(col, row, wp, hp);
request.request(getSession(), this);
}
... |
42d61d3c-e0b6-4c9e-992a-a2bcc6aff765 | 5 | public static void unzip(File zipfile, File directory)
{
ZipFile zfile;
try
{
zfile = new ZipFile(zipfile);
final Enumeration<? extends ZipEntry> entries = zfile.entries();
while (entries.hasMoreElements())
{
final ZipEntry entry = entries.nextElement();
final File file = new File(directory, ... |
306ed05f-c4b7-4938-a290-089cc778b5c8 | 5 | public static void main(String[] args) {
Scanner inputScanner = null;
try {
inputScanner = new Scanner(new File(args[0]));
}
catch (Exception e) {
System.err.println("Invalid file input");
}
while (inputScanner.hasNextLine()) {
String line = inputScanner.nextLine();
int x = Integer.parseInt(line... |
0ea8059e-01d1-4013-b51e-9467345dfdfc | 9 | public void bind(SocketAddress address, IoHandler handler,
IoServiceConfig config) throws IOException {
if (handler == null)
throw new NullPointerException("handler");
if (address != null && !(address instanceof VmPipeAddress))
throw new IllegalArgumentException("addr... |
ddad1c6a-43f0-40cf-9267-28ac0db5cbe6 | 9 | public List<Status> queryUserStatusFromSlave(String uid, Integer page, Integer size) {
List<Status> userStatusIDList = new ArrayList<Status>();
Integer start_status = (page - 1) * Constants.STATUS_COUNT_PERPAGE;
Integer end_status = start_status + size;
//通过二级索引查询请求的用户的微博所发表的月份,通过月份避免全表查询
//表名:USER_STATUS_COU... |
172d04ea-125b-4591-ae25-9afbd2110396 | 6 | @Override
public void ParseIn(Connection Main, Server Environment)
{
Room Room = Environment.RoomManager.GetRoom(Main.Data.CurrentRoom);
if (Room == null || !Room.CheckRights(Main.Data, true) || Room.Event != null || Room.State != 0)
{
return;
}
int category... |
1ff56974-e073-4b56-b598-1ef0875efc04 | 6 | public static InferenceLevel getInferenceLevel(Keyword levelkeyword) {
if (levelkeyword == Logic.KWD_NORMAL) {
return (Logic.NORMAL_INFERENCE);
}
else if (levelkeyword == Logic.KWD_SHALLOW) {
return (Logic.SHALLOW_INFERENCE);
}
else if (levelkeyword == Logic.KWD_ASSERTION) {
return... |
05e7a83f-3054-4058-8db5-4bb1a91dbf60 | 2 | public AnyType getLast()
{
if(head == null) throw new NoSuchElementException();
Node<AnyType> tmp = head;
while(tmp.next != null) tmp = tmp.next;
return tmp.data;
} |
01822802-5be6-4faa-a6a6-dd70eadc961b | 9 | public void putObjects(String bucket, String destination, List<String> listFiles) throws Exception {
if(destination.trim().equalsIgnoreCase("/")){
destination="";
}
if(destination.startsWith("/")){
destination = destination.substring(destination.indexOf("/")+1);
}
i... |
fde730a5-b469-447d-bf36-0204630bc963 | 9 | @Override
public long write(be.nabu.utils.io.api.ByteBuffer target) throws IOException {
long length = target.remainingData();
// the connect has to be done
if (connect != null && !connect.isDone())
return 0;
// if we have a write pending, stop
if (write != null && !write.isDone())
return 0;
// or if... |
b933f5c2-b6b9-4d19-b1ef-b6701dba8fde | 4 | public static String parseFileDir(String s) {
String fileDir = s;
fileDir = fileDir.replace('/', File.separatorChar);
fileDir = fileDir.replace('\\', File.separatorChar);
int i = fileDir.lastIndexOf('.');
if (i > 0) {
fileDir = fileDir.substring(0, i).replace('.', File.separatorCh... |
d2a428d8-39bf-4648-b335-3b289bb4c434 | 9 | private Token num(String s) {
int i = 0;
boolean negative = false;
if (s.charAt(0) == '-') {
negative = true;
s = s.substring(1);
}
if (Character.isDigit(s.charAt(i))) {
while (i < s.length() && (Character.isDigit(s.charAt(i)) || s.charAt(i) =... |
2688f99d-ab42-4e9e-8e03-7ae7691cbaf6 | 8 | public void loadFromInt(int RxdBuffer[], int pRxData) {
if (allAttribs != null && allAttribs.size() > 0) {
int offset = 0;
for (c_int c : allAttribs) {
c.loadFromInt(RxdBuffer, pRxData + offset);
offset += c.getLength() / 8;
}
Runna... |
cc7254fd-0909-4f74-94fd-cc8fdb2782fd | 4 | @Override
public void run() {
try{
long timeout = 60000; // 60 Second time out if queue is empty
long waittime = 0;
long lastResult = System.currentTimeMillis();
BasicDBObject dbo= new BasicDBObject();
while(waittime<timeout){
dbo = ResultQueue.getResult();
if(dbo==null){
System.... |
3618a8cb-5010-462f-87a3-84d521dd1cfd | 6 | @Override
public void init(GameContainer gameContainer) throws SlickException {
player = new BasicEntity((1*32), (1*32), level);
int w = 0;
int h = 0;
try {
Scanner scanner = new Scanner(new File("hitbox.txt"));
int y = 0;
ArrayList<Point> points ... |
52297e40-bce3-4666-9af2-f8acda22db54 | 4 | private void readFile(File diffMapperFile) {
try {
BufferedReader reader = new BufferedReader(new FileReader(diffMapperFile));
String[] title = reader.readLine().split("\t");
String line;
while((line = reader.readLine()) != null) {
String[] value = line.split("\t");
for(int i = 0; i < title.le... |
2804e567-cc28-4621-a3fb-5120ddaac52c | 2 | public void onLogout() {
try {
logout();
} catch (RemoteException e) {
if(connect()) {
exit();
return;
}
System.out.println("Error on logout");
System.out.println(e.getMessage());
}
clearConversations();
showLogin();
} |
e09d7c06-98f3-439d-aefc-e02de184c5fa | 6 | @Override
public void run() {
MessageFromTablet messageFromTabletAux = null;
MessageFromTablet lightsOffMessageFromTabletAux = null;
gson = new Gson();
log.log("Hijo - Thread lanzado con éxito");
try {
in = new BufferedReader(new InputStreamReader(
tabletSocket.getInputStream()));
out = new Buffer... |
2ee6dc01-5289-4102-90dc-32365a0e8716 | 2 | public FlowBlock getNextFlowBlock(StructuredBlock subBlock) {
for (int i = 0; i < caseBlocks.length - 1; i++) {
if (subBlock == caseBlocks[i]) {
return null;
}
}
return getNextFlowBlock();
} |
eaa07b29-5a05-46b9-a1ba-57ec44be2bc9 | 6 | public Void visitUnit(UnitTree tree) {
ClassWriter clz = new ClassWriter(ClassWriter.COMPUTE_FRAMES);
String name = options.getOutputName();
if (name == null) {
name = tree.getSource();
int dot = name.lastIndexOf('.');
if (dot > 0) name = name.substring(0, dot);
}
clz.visit(JAVA_1_5, ACC_PUBLIC | ACC... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.