method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
e6ae15be-b482-461d-a207-2a227a7208a9 | 2 | public INIParameter getParameter(String name){
for(INIParameter param : params){
if(param.getName().equals(name)){
return param;
}
}
Debug.error("INI Parameter '" + name + "' does not exist in section '" + this.name + "'");
return INIParameter.N... |
152fa9df-4561-4930-b4f9-ad9bc0730e5d | 4 | public void decryptFile(EncryptedDocument doc){
try {
BufferedReader br = new BufferedReader(new FileReader(doc.getId()+".txt"));
StringBuilder sb = new StringBuilder();
File file = new File(doc.getId()+"-original.txt");
// if file doesnt exists, then create... |
1e2e3903-a604-40d5-aed4-f91d67e36b42 | 1 | public void setMatch(Match match) {
if (this.currentMatch != null) {
super.remove(this.currentMatch.getPanel());
// TODO: Dispose of the old match.
}
this.currentMatch = match;
match.getPanel().setVisible(false);
super.add(match.getPanel(), BorderLayout.CENTER);
} |
c376b69d-f0c3-47f2-b535-f40894c13e4e | 5 | String[] makeToken(String input){
char[] inputArray = input.toLowerCase().toCharArray();
List<Character> inputList = new ArrayList<Character>();
for(int i = 0; i < inputArray.length; i++){
if((int)inputArray[i] >= 97 && (int)inputArray[i] <= 122 || (int)inputArray[i] == 32){
inputList.add(inputArray[i]);
... |
bd0d307d-daca-4101-9300-343227d961ec | 1 | private void showResults()
{
//delete old data
results.clear();
//make panels from result
for (int i = 0; i < videoSections.size(); ++i)
{
results.add(new VideoSectionPanel(videoSections.get(i)));
}
//show them
showTimes();
} |
423794cd-9260-4dd2-ad78-bee5d7345afc | 7 | private static boolean getRotationMatrix(float[] R, float[] I, float[] gravity, float[] geomagnetic) {
float Ax = gravity[0];
float Ay = gravity[1];
float Az = gravity[2];
final float Ex = geomagnetic[0];
final float Ey = geomagnetic[1];
final float Ez = geomagnetic[2];
float Hx = Ey * Az - Ez * Ay;
flo... |
ad4c1bed-d59a-4951-873a-be6dbbe70687 | 0 | private StopRouter() {
// JFormDesigner - Action initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
putValue(NAME, "Detener Router");
putValue(SHORT_DESCRIPTION, "Detener Router");
putValue(LONG_DESCRIPTION, "Detener Router");
putValue(SMALL_ICON, new ... |
0d99ddd9-3398-41c7-a6a7-848bc77d65eb | 0 | @Override
public void setBirth(String birth) {
super.setBirth(birth);
} |
7131c344-c5bd-427b-ae68-c2af6e9c96e6 | 0 | private NoteEditorController() {
noteEditorFrame = NoteEditorFrame.getInstance();
addActions();
fillTextFields();
} |
b2dbee69-7e19-4829-8dd7-ee770256210b | 2 | public char[][] floodFill(int x, int y, int exitX, int exitY, char[][] floodedLayout)
{
if(floodedLayout[x][y] == '.' || floodedLayout[x][y] == 'F')
{
floodedLayout[x][y] = '-';
floodFill(x+1, y, exitX, exitY, floodedLayout);
floodFill(x-1, y, exitX, exitY, floodedLayout);
floodFill(x, y+1, exitX, exit... |
671a95cb-77f9-4f6c-aeed-e506bbbf5c97 | 2 | public boolean terminateVirtualMachine(String id) throws Exception
{
CloudStackApiClient client = new CloudStackApiClient(DESTROY_VIRTUALMACHINE, apiKey, secretKey, apiUrl);
client.addParam("id", id);
String response = client.execute();
if (containsErrorMessage(response))
{
List<String> vms = listServerI... |
e0175e5f-f855-4885-a488-aa4d68961e7d | 2 | public void close() {
try {
if (reader != null) reader.close();
} catch (IOException e) {
}
reader = null;
line = null;
lineNum = 0;
next = null;
} |
d4fbdce6-e39c-4ce1-b0b1-76ded2d551db | 0 | public void setName(String name) {
this.name = name;
} |
4c5cb31d-01cf-4548-89f8-ae5a7ed921f1 | 3 | @DBCommand
public boolean spawn(CommandSender sender, Iterator<String> args) {
if(!sender.hasPermission("db.setspawn")) {
sender.sendMessage(RED + "You don't have permission to use this command!");
return true;
}
if(!(sender instanceof Player)) {
sender.se... |
dc3a523c-7f59-4f4c-972b-472177e54f4c | 3 | @Override
public void run() {
try {
input = new BufferedReader(new InputStreamReader(socket.getInputStream()));
while (true) {
try {
client.onReadLine(input.readLine());
} catch (IOException e) {
e.printStackT... |
dffa41e4-805a-49e7-b099-8ea78966064a | 0 | public String getFund() {
return fund;
} |
e09f6970-acf3-45ed-a0d2-9bbb88353c2d | 5 | public AccountServiceError getUser(String login, String password) {
if (isConnectionClosed())
openConnection();
if (isConnectionClosed())
return new AccountServiceError(AccountServiceError.Type.DB_noConnection);
UserDataSetDAO dao = new UserDataSetDAO(dbconn);
U... |
a909c38e-6c5c-40e3-9bc0-f6f09a3dd974 | 8 | private void testBrackets(String str, boolean valid) throws IllegalAccessException {
Stack<Character> stack = createCharStack();
boolean isValid = true;
try {
for(int i = 0; i < str.length(); i++) {
char a = str.charAt(i);
switch(a) {
... |
576a4a61-fae2-4a9f-b9d1-a06f9c17b9a7 | 6 | public void save()
{
//W klasie docelowej należy sprawdzić, czy row.isEmpty()
//jeśli tak, to należy nadać nazwę tabeli, do ktrej zostanie wstawiony wiersz
//należy to zrobić za pomocą row.setTableName(<nazwa>);
//Dopiero potem należy wywołać save z klasy bazowej
if(row.isEmp... |
7f1b0e98-64db-439e-bfd1-76cb322b8f61 | 2 | public void parseMultiple(){
String[][] inputs = myModel.getInputs();
row=-1;
while(row < (inputs.length-1))
{
//System.out.println("ROW = "+row);
row++;
//System.out.println("String is = "+inputs[row][0]);
if (myParser.solve(inputs[row][0]))
myModel.setResult(row, "Accept", null, environmen... |
87091cc9-c7c7-4d9a-8e0c-8e6d4fc2eed5 | 8 | public final int partitionByName(int left, int right) // used by sort by name
{
int max = logicalSize;
Product pivotElement = products[left]; //Store the left most product as the object that all other objects will be tested against
int lb = left, ub = right; // store imovable places which are used for the final... |
dc91b70c-94f2-4cf9-8f68-2bc6126dbcd9 | 2 | public static void clear() {
Keyboard.destroy();
try {
Keyboard.create();
} catch (LWJGLException e1) {
e1.printStackTrace();
}
for(Keybinds e : Keybinds.values()) {
e.key.setPressed(false);
}
} |
e59ad2b8-abd5-4bdd-b6c6-83bb81056ac3 | 7 | @Override
public void write(char[] c, int off, int len) throws IOException{
if(closed){
throw new IllegalStateException();
}
if (off < 0 || off > c.length || len < 0 ||
off + len > c.length || off + len < 0) {
throw new IndexOutOfBoundsException();
}
synchronized(lock){
char[] buf = new char[len... |
af4eff29-fd64-4389-b66f-4daa12e29284 | 9 | @Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (obj instanceof AttributeSource) {
AttributeSource other = (AttributeSource) obj;
if (hasAttributes()) {
if (!other.hasAttributes()) {
return false;
}
if ... |
92819db2-6719-49fa-9623-5bb3653b3966 | 8 | private ArrayList<Parameter> suggestParameters(CommandInvocation invocation, List<Parameter> positional,
List<Parameter> nonPositional, List<Parameter> flags,
Parameter greedy)
{
ArrayList<Parameter> sugges... |
cffb253e-6c6e-44a9-9141-0ed4b9dff4f1 | 8 | @Override
public String toString() {
StringBuffer retVal = new StringBuffer();
// generate the field list part of the SQL insert statement
retVal.append("(");
boolean first = true;
for (String key : keySet()) {
if (first) {
first = false;
} else {
retVal.append(",");
}
retVal.... |
77560e86-6974-4f02-868c-61861b9b3884 | 3 | void updateNames () {
// Collect the names of each player.
ArrayList namesList = new ArrayList(players.size());
for (Player player : players)
if (player.name != null) namesList.add(player.name);
// Set the names on everyone's chat frame.
String[] names = (String[])namesList.toArray(new String[namesList.siz... |
78113d6a-db5b-4611-92fc-115686c322bd | 5 | * @param var2 The second list represents exponent number n2
* @return The list corresponding to n1^n2
*/
static LinkedList<Integer> power(LinkedList<Integer> var1, LinkedList<Integer> var2){
// If exponent is 0, return 1
if((var2.size() == 1)&&(var2.get(0) == 0)){
return StrToNum("1");
}
// If expon... |
9633909d-0af9-4e94-8bcc-c27fc3ee11ee | 6 | public void run()
{
while (true)
{
try
{
byteArray = new byte[1024];
receivePacket = new DatagramPacket(byteArray, byteArray.length);
ds.receive(receivePacket);
String data = new String(receivePacket.getData(), "UTF-8").trim();
st = new StringTokenizer(data, Protocol.DELIMITER);
Strin... |
d8e42f5d-e33e-40e5-9f30-6fd75385adfa | 4 | @Override
public void process(SimEvent event) {
NodeReachedEvent _event = (NodeReachedEvent) event;
this.setPosition(_event.getNode()); // Sets the actual position to the reached node.
System.out.println(getName() + "@" + getEngine().getCurrentTime() + ": reached node " + getPosition());
getLog().addNode(getPo... |
2a3847fb-79ec-483b-96df-abd6ffe00a9b | 6 | public static Expr array_bound(Context ctx, String type, String name, Expr f_array_bound) throws Z3Exception{
if(type.equals("int") || type.equals("double") || type.equals("boolean"))
return f_array_bound;
else if(type.equals("int_array") || type.equals("double_array")){
if(f_array_bound == null)
... |
41360f7b-b453-4fde-8412-51c1208ab5f4 | 0 | private Application() {
} |
1569745c-feca-4e29-9f76-72124fdf148c | 7 | public Object nextValue() throws JSONException {
char c = nextClean();
String string;
switch (c) {
case '"':
case '\'':
return nextString(c);
case '{':
back();
return new JSONObject(this);
case '[':
... |
2a5b1c89-ed65-4215-b63d-7213c9a2b0e6 | 5 | String flowToString(int flowControl) {
switch(flowControl) {
case SerialPort.FLOWCONTROL_NONE:
return "None";
case SerialPort.FLOWCONTROL_XONXOFF_OUT:
return "Xon/Xoff Out";
case SerialPort.FLOWCONTROL_XONXOFF_IN:
return "Xon/Xoff In";
case SerialPort.FLOWCONTROL_RTSCTS_IN... |
97fea70c-0656-4c4a-a4be-f947678704d3 | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
RenderingTile other = (RenderingTile) obj;
if (x != other.x)
return false;
if (y != other.y)
return false;
if (z != other.z)
return ... |
dcf7fca3-7b86-4cf2-9949-b7bafff9dd31 | 7 | public void warn(Event event) {
switch(event.getTypeEvent())
{
case USECLAWS_END :
case ROTATE_END :
end=true;
break;
case BUMP :
if(state==2){
state=3;
}
else
ignore();
break;
case WAIT_END :
if(state == -1) {
state = 0;
}
else if(state != 1)
ignore();
break;
... |
b7deec0c-693e-484f-bc41-437adec716de | 9 | public static Map<Dimension, Integer> consolidate(Map<Dimension, Integer> product) {
LinkedHashMap<Dimension, Integer> consolidatedProduct = new LinkedHashMap<Dimension, Integer>();
for (Map.Entry<Dimension, Integer> entry : product.entrySet()) {
final Map<Dimension, Integer> productDimensi... |
4bdc048f-9be0-42db-bfb0-d84e9f840686 | 3 | public List<GenericObject> getControlled() {
final List<GenericObject> controlled = new ArrayList<GenericObject>();
final String tag = getTag();
for (int i = 1; /* loop until broken */; i++) {
GenericObject prov = dataSource.getProvince(i);
if (prov == null)
... |
85b3eff0-73bc-48e9-9104-db8f92b677be | 6 | public static void expand() {
String[] st = new String[L];
int i; // next available codeword value
for (i = 0; i < R; i++)
st[i] = "" + (char) i;
st[i++] = ""; // termination codeword
int codeword = BinaryStdIn.readInt(W);
if (codeword == R) return; // if empty message
String val = st[codewor... |
43a300e6-4745-4178-9a73-52e2cf7b34c6 | 9 | private int compute(String line1, String line2) {
// setup
int b = Integer.parseInt(line1.split("\\s")[0]);
int n = Integer.parseInt(line1.split("\\s")[1]);
String tokens[] = line2.split("\\s");
int barberTimes[] = new int[tokens.length];
for (int i=0; i<barberTimes.leng... |
83a3bd1d-5cb7-4699-93e9-027bcafffbfd | 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... |
a53d46e7-b17b-492d-b9e4-be439a35bc05 | 7 | public static String createFaceHtml(String text, String imageClass, HorizontalAlignmentConstant align) {
StringBuffer sb = new StringBuffer();
if (align == HasHorizontalAlignment.ALIGN_LEFT) {
if (ClientStringUtil.isNotEmptyOrWhitespaceOnly(text)) {
sb.append(text.trim());
... |
83ae5f86-bdda-42b0-9659-7ef04de0ff32 | 9 | @SuppressWarnings("rawtypes")
private void handleMultipartRequest(HttpServletRequest request,
HttpServletResponse response, HttpSession s) throws IOException {
ServletFileUpload servletFileUpload = new ServletFileUpload(
new DiskFileItemFactory());
String ret = "";
// Extract file from request
try {
... |
8301bb8b-a4e7-475b-81ee-62a1198c4fca | 8 | public E readNext() throws IOException {
if (strategy.isSkipHeader() && !firstLineRead) {
reader.readLine();
}
E entry = null;
boolean validEntry = false;
do {
String line = readLine();
if (line == null) {
return null;
}
if (line.trim().length() == 0 && strategy.isIgnoreEmptyLines()) {
... |
b1488e6e-b96a-4170-848f-534cb25ebf2e | 0 | public void setFunUnidad(String funUnidad) {
this.funUnidad = funUnidad;
} |
6ad96985-7aff-43ee-b4dd-3d3aba6dad12 | 6 | private final void method2701(KeyEvent keyevent, int i, int i_2_) {
anInt6538++;
int i_3_ = keyevent.getKeyCode();
if (i_3_ != 0) {
if (i_3_ >= 0
&& (i_3_ ^ 0xffffffff) > (Class285_Sub2.anIntArray8507.length
^ 0xffffffff)) {
i_3_ = Class285_Sub2.anIntArray8507[i_3_];
if (i_2_ == 0 && (i_3_ & 0x80) ... |
6ce2651f-e0af-4106-b2ee-5900e9fa8ad3 | 9 | public boolean validateConnection(AbstractTile.Rotation rotation, AbstractTile.Rotation other_rotation, AbstractTileObject other) {
if (!isSameObject(other) || !containsSide(rotation) || !other.containsSide(other_rotation)) {return false;}
List<Position> position = getPositionForSide(rotation);
List<Position> oth... |
aa8de00d-b26d-4e65-9ffc-5ebfbb939d30 | 6 | private static boolean isIdentifier(String lexeme) {
char firstChar = lexeme.charAt(0);
if (!(Character.isLetter(firstChar) || firstChar == '_')) {
return false;
}
char[] lexemeArray = lexeme.toCharArray();
for (char c : lexemeArray) {
if (!(Character.isDigit(c) || Character.isLetter(c) || c == '_')... |
adef73ec-d02f-4343-9ea7-082d7cb78efb | 4 | public void move() {
if (direction == Direction.LEFT)
setLocation(location().x - 1, location().y);
else if (direction == Direction.RIGHT)
setLocation(location().x + 1, location().y);
else if (direction == Direction.UP)
setLocation(location().x, location().y - 1);
else if (direction == Direction.DOWN)
... |
fb0be51f-55cb-48e3-a9c0-e30879d85e18 | 3 | public boolean write_serialize(String fileName){
boolean writeSuccessful = false;
FileOutputStream oStream = null;
try {
oStream = new FileOutputStream(fileName);
ObjectOutputStream objStream = new ObjectOutputStream(oStream);
objStream.writeObject(p);
//objStream.writeObject(cc);
objS... |
5cb598b9-7300-4206-bc99-e5a0c18a3794 | 8 | public void searchCSVinDirectory() throws NewCustomException {
try {
File file = new File(Constants.CSV_FILES_URL);
List<String> updatedFiles = new ArrayList<String>();
String[] filenames = file.list();
/*
* Filter out all the csv files newly added csv files and setting
* their last modified tim... |
1d34e620-016c-4243-ab4f-b3c9213bb074 | 2 | int intMax(int R[]) {
int RMax = Integer.MIN_VALUE;
for (int i = 0; i < R.length; i++) {
if (RMax < R[i]) {
RMax = R[i];
}
}
return RMax;
} |
fde51838-96f8-429a-9181-5a748c5482df | 7 | public void inxbuild() {
int i, j, smallpos, smallval;
int[] p;
int[] q;
int previouscol, startpos;
previouscol = 0;
startpos = 0;
for (i = 0; i < netsize; i++) {
p = network[i];
smallpos = i;
smallval = p[1]; /* index on g */
/* find smallest in i..netsize-1 */
for (j = i + 1; j < netsiz... |
4a0b4492-be27-438a-b226-f451faa1f2bd | 5 | public WorldFileHandler(String WorldName,int w,int h,int layers,String name){
WrittenWorldW=w;
WrittenWorldH=h;
WrittenWorldName=name;
WrittenWorldLayers=layers;
dir1= new File("res/worlds/"+WorldName);
dir2= new File("res/worlds/"+WorldName+"/"+name);
world = new File("res/worlds/"+WorldName+"/"+name+"/m... |
489ec623-ef66-4e0a-82c4-0c2cf6de71c3 | 9 | public ArrayList<Chemin> getChemins(Station depart, Station arrivee, Chemin chemin, ArrayList<Station> stationsVisitees) {
if(depart == null || arrivee == null || chemin == null) return null;
if(!depart.isOuvert()) return null;
chemin.ajouterStation(depart);
// Condition de fin on a trouve la station d'arriv... |
8d391d42-52f5-4e8f-a15d-27c5f07867d3 | 0 | public QueueArray(){
arr = (E[]) new Object[2];
} |
a1197e65-e6b0-42ff-a3a3-bc9c7d9eb92e | 6 | @Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
{
Date date = new Date();
Date date1 = new Date();
if (value != null)
{
setText(value.toString());
}
if... |
4947db57-7ad5-475e-a460-3219e0c9f3bc | 7 | protected static Ptg calcRoundUp( Ptg[] operands ) throws CalculationException
{
if( operands.length < 1 )
{
return PtgCalculator.getNAError();
}
double[] dd = PtgCalculator.getDoubleValueArray( operands );
if( dd == null )
{
return new PtgErr( PtgErr.ERROR_NA );//20090130 KSC: propagate error
}
... |
0a59c2a4-d241-4a35-94ba-3d4c20e79884 | 7 | public static void createStats(ArrayList<State> states) {
State prev = states.remove(0);
for(State s : states) {
// If the state was in burst, and is now in sleep, it executed burst_time
for(ProcessState p : s.sleep_queue.getProcesses()) {
ProcessState prev_state = prev.queue.findProcessState(p.process);
... |
ccc71523-ed13-48f9-bab5-b45e7bac069f | 1 | protected void readDataToKeyInfo() throws RuntimeException
{
String psw1 = this.edPsw1.getText().trim();
String psw2 = this.edPsw2.getText().trim();
if ( !( psw1.equals( psw2 ) ) ) {
throw new RuntimeException( "passwords do not match" );
}
this.keyInfo = new K... |
d90eecec-6d0b-4130-8c5c-365da8992207 | 4 | private void initDisplayNames() {
displayNames = new HashMap<String, String>();
for (File f : resolver.listFiles("localisation")) {
try {
BufferedReader r = new BufferedReader(new FileReader(f), (int)f.length());
String line;
while ((l... |
1b81b339-f751-40fe-bdb8-d150213325ac | 7 | public static String doubleToString(double d) {
if (Double.isInfinite(d) || Double.isNaN(d)) {
return "null";
}
// Shave off trailing zeros and decimal point, if possible.
String string = Double.toString(d);
if (string.indexOf('.') > 0 && string.indexOf('e') < 0
... |
eef768c6-e97a-4f30-861c-719aeceac00d | 0 | public ByteBuffer getPeerId() {
return this.peerId;
} |
af6eb71b-dc75-4913-84f7-2f24a9a3f3ae | 4 | public String getLocatonDetails(String ipAddress) {
String output = "";
String result = "";
try {
URL url = new URL("http://www.geoplugin.net/json.gp?ip=" + ipAddress);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod(... |
a3a75cbb-fc66-4f3c-a61a-98e127217c49 | 6 | public Card disproveSuggestion(String person, String room, String weapon) {
ArrayList<Card> possible = new ArrayList<Card>();
for (Card c : cards) {
if (c.getName().equals(person)) {
possible.add(c);
} else if (c.getName().equals(room)) {
possible.add(c);
} else if (c.getName().equals(weapon)) {
... |
ed39a20e-86af-4007-9196-8cec227fb95d | 0 | public String getButtonName(int index) {
return buttons.get(index).getName();
} |
78e4fd56-7b61-46d3-92ba-8d2787c19bb6 | 7 | public Map<Entity, Location> getSquareNeighborLocations(int row, int col,
int dist) {
Map<Entity, Location> neighborLocations = new HashMap<>();
for (int x = row - dist; x <= row + dist; x++) {
if (isInBounds(x)) {
... |
16ad73a9-61aa-401e-a837-c4e3f57dfeeb | 4 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
HourForm hourForm = (HourForm) o;
if (monday != hourForm.monday) return false;
return true;
} |
bd553292-f655-4520-bf21-9c0fcdbae421 | 1 | public void visit_lastore(final Instruction inst) {
stackHeight -= 4;
if (stackHeight < minStackHeight) {
minStackHeight = stackHeight;
}
} |
739a381a-cdd5-4f1f-aefa-cf681707e11e | 2 | private static void dBConnect(){
try {
CONN = DriverManager.getConnection(URL, USERNAME, PASSWORD);
} catch (SQLException ex) {
handleSqlExceptions(ex);
} catch (Exception ex) {
System.out.println("Exception: " + ex.getMessage());
}
} |
f19d1670-da7e-4571-aea0-e5e20f5e192f | 7 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final ValidateUser_Result other = (ValidateUser_Result) obj;
if (this.valid != other.valid) {
retur... |
9a12f2d4-ba5f-4cd2-876f-292bba9523fc | 8 | protected final int getNextMatchPosImpl(String searchFor,
String searchIn, boolean goForward,
boolean matchCase, boolean wholeWord) {
if (wholeWord) {
int len = searchFor.length();
int temp = goForwar... |
46ee42b9-482d-47a5-84cc-eb4645eafde3 | 0 | public static <T> T getService(Class<T> serviceType) {
return (T) services.get(serviceType);
} |
90912403-23f7-4b7c-ac0f-a7fa07d779b0 | 6 | public boolean ExecuteCommand(String execStr)
{
//Runtime runtime = Runtime.getRuntime();
String outInfo="";
String tmp;
InputStream errstream = null;
try
{
//execute linux command
String[] args = new String[] {"sh", "-c", execStr};
ProcessBuilde... |
f35f64cc-3d4e-45a2-89a4-6648a9908a1a | 3 | public JSONWriter array() throws JSONException {
if (this.mode == 'i' || this.mode == 'o' || this.mode == 'a') {
this.push(null);
this.append("[");
this.comma = false;
return this;
}
throw new JSONException("Misplaced array.");
} |
978575f9-e2d2-41f3-9369-e1a335ddb5b2 | 9 | private boolean isDataValid(String itemName, String category, String costString, String priceString,
String dateString, String rateString) {
if (itemName.trim().equals(DEFAULT_ITEM)) {
JOptionPane.showMessageDialog(null,
"Please select an Item from the list or create a new one by typing on the listbox.",
... |
f20e0c55-fec6-4df0-92d0-bd7daf2a03be | 8 | public void executeOperation(ALUControl aluControl){
switch(aluControl.getOutputOperation()){
case FUNC_CODE_ADD:
_outputAluResult = _inputReadData1 + _inputReadData2;
break;
case FUNC_CODE_SUB:
_outputAluResult = _inputReadData1 - _inputReadData2;
_outputZero = (_outputAluResult == 0) ? true : false;... |
86abd405-9c44-4a8f-b26a-56f636f1906d | 4 | @RequestMapping("/list.do")
public ModelAndView showAllList(Device device, HttpServletRequest req)
throws Exception {
// 한 페이지에 보여질 공연 목록 수
int rows = 16;
// 페이지 블락 지정(1~10 페이지까지 하단에 보여짐)
int pageBlock = 10;
// 요청 주소에 따라 페이징을 달리하기 위한 변수
String path = "list.do";
String pageCode;
// 현재 페이지
String cP... |
c179d9a5-d412-44de-86d7-16b4bafd9e78 | 4 | public void readInputFile(String fileName) throws IOException {
BufferedReader reader = new BufferedReader(
new InputStreamReader(
new BufferedInputStream(
new FileInputStream(fileName)), "UTF-8"));
List<ArrayList<WorkUnit>> personWorkLists =
new ArrayList<ArrayList<WorkUnit>>();
S... |
a93697e8-0b21-4863-b03e-8a4c02e0da0f | 1 | public ResizingByteBuffer fill(int numBytes, byte b) {
for(;numBytes>0;numBytes--) {
this.put(b);
}
return this;
} |
3da604dc-54b8-4f80-b492-93a95e9cd321 | 2 | public static PlaceMode parse(byte mode) {
switch (mode) {
case 0:
return BREAK;
case 1:
return PLACE;
default:
return BREAK;
}
} |
5adc5a6c-9773-4090-a816-673283edecae | 7 | static void testValidity(Object o) throws JSONException {
if (o != null) {
if (o instanceof Double) {
if (((Double)o).isInfinite() || ((Double)o).isNaN()) {
throw new JSONException(
"JSON does not allow non-finite numbers.");
... |
13ad887d-00a5-4e7c-8a51-46d555c89de0 | 4 | @Test
public void fuzzyTest() {
final int n = 200_000;
final ArrayList<Integer> list = new ArrayList<Integer>(n);
for(int i = 0; i < n; i++) list.add(i);
IntArray arr = IntArray.from(list);
final Random rng = new Random(42);
for(int i = 0; i < n; i++) {
final int delPos = rng.nextInt(n... |
be83a1b3-fb02-4183-9ea6-1e789d1a46f8 | 2 | @Override
public void mousePressed(MouseEvent e) {
for (Field field : this.fields) {
if (e.getSource() == field) {
this.game.clickField(field);
}
}
} |
658ff316-4aca-43de-8148-cce54d4059a7 | 6 | @Override
public synchronized void run() {
long timeLeft = getRemainingTime();
Iterator<Action> actions = this.actions.iterator();
List<OrderDependentAction> orderedActions = new ArrayList<OrderDependentAction>();
while(actions.hasNext()) {
Action action = actions.next();
if(action.activate(timeLeft)) {
... |
ee930071-5fd1-4e67-8d1c-ba2e089fd80e | 7 | public boolean calcParameters(boolean lastSample, double[] speeds, double[] radiuses, double[] angles, int len) {
double maxRealAngle = 0;
double minRealAngle = 0;
for (int i = 0; i < len; i++) {
double angle = angles[i];
if (angle > maxRealAngle) {
maxRea... |
d02626e8-ed0d-45a2-bf78-d6f72192b8df | 2 | public PanneauJeu(Carte map, FrameJeu fenetre) throws HeadlessException {
super();
/* map du jeu */
this.map = map;
this.Fenetre = fenetre;
this.setFocusable(true);
/* Configuration du panel : taille, layout*/
this.setPreferredSize(new Dimension(
... |
02cc5cc4-3ae8-48cd-8fd7-7d999f7a8d5d | 7 | public void write(int bits, int width) throws IOException {
if (bits == 0 && width == 0) {
return;
}
if (width <= 0 || width > 32) {
throw new IOException("Bad write width.");
}
while (width > 0) {
int actual = width;
if (actual > t... |
217629c0-2818-4408-b77d-f3f3c43f558d | 8 | public void updatePoint(NewtonSim integrador) {
int i;
if (integrador != null && this.centerPoint != null
&& this.plotPoint != null) {
for (i = 0; i < 1; i++) {
getParam().reference.project(i, integrador.position, this.centerPoint, this.plotPoint[i]);
if (this.plotPoint[i].x > Integer.MIN_VALUE) {
... |
29401353-9844-440d-9f95-77f7ff0779a8 | 1 | public String mapFieldName(String owner, String name, String desc) {
String s = map(owner + '.' + name);
return s == null ? name : s;
} |
06671ddc-68bc-4619-bc78-30091029b684 | 2 | public static void LogResult(String Step, String TestName, String Status, String startTime, String endTime)
{
//String STestName = System.getProperty("user.dir")+"\\target\\"+TestName+".html";
// String STestName = "C:\\Abdul kadir khan1\\Selenium Architecture\\WorkSpace\\MavenSaleForcePageFactories\\targe... |
e84b6606-086f-459c-9079-571e0a5b7bfd | 4 | public static void main(String args[]) {
BufferedReader br;
Tokenizer tok;
Synthesizer syn;
ArrayList<Token> tokenList = new ArrayList<>();
SymbolTable symbolTable = new SymbolTable();
try {
br = new BufferedReader(new FileReader(args[0]));
tok = new Tokenizer(br);
tok.run(tokenList, symbolTabl... |
9fd1e974-ae54-445f-af56-e0c7ac914a3d | 5 | public boolean isFree(XY xy) {
if (
(xy.getX() < 0) ||
(xy.getX() >= this.width) ||
(xy.getY() < 0) ||
(xy.getY() >= this.height) ||
(this.get(xy) != null)
) {
return fals... |
34eba958-1309-4f85-aef7-146de8135a70 | 2 | private void inv1ActionPerformed(java.awt.event.ActionEvent evt)
{
if(!game.getInBattle())
{
outputText.setText(game.useItem(0) + "\n" + game.getCurrentRoom().getExitString());
if(game.itemRemoved())
inv1.setText... |
af491b65-7d0f-42d8-8fe1-06a8fa2f2d12 | 2 | public static Restaurant getInstance()
{
if (uniqueInstance == null) {
synchronized (Restaurant.class) {
if (uniqueInstance == null) {
uniqueInstance = new Restaurant();
}
}
}
return uniqueInstance;
} |
31508a11-6df1-449b-8aa2-60cd51f57064 | 8 | private void drawUState(UGraphic ug, final double x, final double y, HtmlColor borderColor, DotData dotData) {
final Dimension2D total = new Dimension2DDouble(maxX - minX, maxY - minY);
final double suppY;
if (title == null) {
suppY = 0;
} else {
suppY = title.calculateDimension(ug.getStringBounder()).get... |
11c1b908-a1f9-4c7a-b6bc-7aeb85966367 | 3 | public static void excluiContato(String nome) throws FileNotFoundException, IOException {
StringBuilder sb = new StringBuilder();
InputStream is = new FileInputStream("Contatos.txt");
PrintStream qs = new PrintStream("Auxiliar.txt");
Scanner entrada = new Scanner(is);
String l, t... |
6257948c-22ea-44cc-9721-b0f252913a16 | 4 | public Map<String, Town> getTownsFromConfig() {
final ConfigurationSection townConfigSection = new ConfigUtils(plugin).getConfigSection(PATH);
final Map<String, Town> townsFromConfig = new HashMap<>();
final Set<String> townKeys = new HashSet<>(townConfigSection.getKeys(false));
for (St... |
378899c1-3efb-49cf-b0b7-a44a2bf6b8f7 | 2 | public void putoa(){
tormays();
if (putoaa){
for (Palikka palikka : palikat) {
palikka.putoa();
}
}
} |
6c16bb30-8ad4-46cb-9fbb-6beb0cc5681c | 9 | public ArrayList<ImageIcon> loadImagesFromDirectory(String absolutePath) {
// We check to see if there *are* any images in this directory; if
// there are, load them
File imgDirectory = new File(absolutePath);
File[] files = imgDirectory.listFiles(new FilenameFilter() {
//@Override //TODO Java 1.5 screa... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.