method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
b840822e-38dc-4dd0-a0be-ad6f49448fc5 | 3 | static long Evclid(long a, long b) {
long mult = a * b;
while (a != 0 && b != 0) {
if (a >= b) {
a = a % b;
} else {
b = b % a;
}
}
long NOK = (mult / (a + b));
return NOK; // Одно - ноль
} |
1a34152b-ead9-41cf-aa29-1b7186a399c8 | 6 | public void add() throws IOException, JSONException, NullPointerException
{
try{
long StartTime = System.currentTimeMillis();
String keyvalue = null;
if(Table == null)
{
System.err.println("Table name not set");
}
else if(ColumnFamily == null)
{
System.err.println("Column family not set");
}
... |
ce6a9d8f-dc0c-4bc6-824d-6805f906c234 | 8 | private static void readUnifiedNums(String str, int off, int[] values) throws NumberFormatException {
while (str.charAt(off) == ' ' || str.charAt(off) == '-') off++;
int end = str.indexOf(CONTEXT_MARK_DELIMETER, off);
if (end > 0) {
values[0] = Integer.parseInt(str.substring(off, end... |
de339362-0d86-43bd-9de2-a60245204bb7 | 0 | @BeforeClass
public static void setUpClass() {
} |
12756c46-a19d-4e4b-b9a1-adbd5c9f27d8 | 2 | double residualCapacityTo(int vertex) {
if (vertex == v) return flow; // backward edge
else if (vertex == w) return capacity - flow; // forward edge
else throw new IllegalArgumentException();
} |
fdf2d218-dd6a-4507-9b56-64a1c6577fbe | 3 | public String genKeywords(){
if(keywords.size() > 0){
StringBuffer impKeywords = new StringBuffer();
Iterator<String> i = this.keywords.iterator();
while(i.hasNext()) {
impKeywords.append(i.next());
if(i.hasNext()) impKeywords.append(",");
}
return impKeywords.toString();
}
return null;
} |
2c75a8f3-2a66-4e64-ab06-44281fc2e578 | 7 | public static Iterator allDirectSupercollections(LogicObject self, boolean performfilteringP) {
if (Stella_Object.isaP(self, Logic.SGT_LOGIC_DESCRIPTION)) {
Description.deriveDeferredSatelliteRules(((Description)(self)));
}
{ Iterator directlylinkedobjects = Logic.allDirectlyLinkedObjects(self, Logic.... |
0545aca1-3ac6-463f-b239-e9e1f251dbd3 | 2 | public static void main(String args[]) {
Servidor servidor = new Servidor(PUERTO);
Cliente cliente = null;
String ip = "";
try {
servidor.conectar();
System.out.println("Conectado");
while (servidor.estaConectado()) {
cliente = new Cliente(servidor.escuchar(),servidor);
cliente.se... |
160b0dc5-c1bf-4e55-99d9-3182a7ecfa5d | 2 | public SkiPass getFirstHalfDaySkiPass(Date currentDate) {
if (currentDate == null) {
throw new IllegalArgumentException("Current date is null");
}
Calendar calendar = new GregorianCalendar();
calendar.setTime(currentDate);
calendar.set(Calendar.HOUR_OF_DAY, 9);
... |
1663c252-edc9-4956-bba1-976af10ad695 | 8 | public void newArray(final Type type){
int typ;
switch(type.getSort())
{
case Type.BOOLEAN:
typ = Opcodes.T_BOOLEAN;
break;
case Type.CHAR:
typ = Opcodes.T_CHAR;
break;
case Type.BYTE:
typ = Opcodes.T_BYTE;
break;
case Type.SHORT:
typ = Opcodes.T_SHORT;
break;
case Type.INT:
typ... |
dbad06c2-0fc0-4901-8246-f191ddbc2ace | 1 | public void shoot() {
if (readyToFire) {
Projectile p = new Projectile(centerX + 50, centerY - 25);
projectiles.add(p);
}
} |
622fcccf-bbc6-4d38-aa55-99209cef513b | 2 | public void paint(Graphics2D g) {
if(animated) g.drawImage(game.bitmapFact.getEntityImage(name + animFrame), drawX, drawY, null);
else g.drawImage(game.bitmapFact.getEntityImage(name), drawX, drawY, null);
if(game.getDevMode()) g.drawRect(drawX, drawX, getBounds().width, getBounds().hei... |
32148c54-a935-4d4b-8f94-ec40e1c6811b | 2 | public static LinkedList<String> computeDifference(LinkedList<String> A, LinkedList<String> B)
{
LinkedList<String> diff = new LinkedList<String>();
for(int i =0; i<A.size(); i++)
{
String item = A.get(i);
if(!B.contains(item))
{
diff.add(i... |
02b02cf1-2059-4d5e-9f10-a9d861e446ef | 9 | public static void main(String[] args) throws Exception
{
HashMap<String, Integer> barcodeMap = getBarcodeToSampleMap();
HashMap<String, Integer> expectedMap = getExpectedSubjectID();
System.out.println("got " + expectedMap.size());
BufferedReader reader = new BufferedReader(new FileReader(new File(
Conf... |
998d0bf9-e512-4f68-8a75-c4f048a99307 | 8 | private JTable initTable() {
JTable table = null;
if (numberOfUsers == 3) {
titels = new Object[4];
titels[0] = "";
inhalt = new Object[20][4];
}
if (numberOfUsers == 4) {
titels = new Object[5];
titels[0] = "";
inhalt = new Object[15][5];
}
if (numberOfUsers == 5) {
titels = new Object... |
9d8417f6-dfba-4f8f-ab48-3d542d402c75 | 8 | public static File getLauncherDir()
{
File dir = null;
File root = new File(System.getProperty("user.home", ".") + "/");
final String appName = "mclauncher";
switch (SystemUtils.getSystemOS())
{
case linux:
case solaris:
... |
aaed2f32-9e3d-43b7-a11b-ee7b558acaa9 | 0 | public Account getNewAccount() {
return new HumanAccount();
} |
b5e9b14a-85fa-4132-b060-3bd8ef8e3e14 | 8 | private void parsejButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_parsejButtonMouseClicked
// long startTime = System.currentTimeMillis();
if (selectedCheckboxCount == 0) {
JOptionPane.showMessageDialog(null, "至少要选择一个语言", "信息提示", JOptionPane.ERROR_MESSAGE);
r... |
a2e04c58-6a34-4782-bdea-bbc91be7fa23 | 2 | public void paintShape(Graphics2D g2)
{
Dimension dim = label.getPreferredSize();
// System.out.println(dim);
if (dim.width > 0 && dim.height > 0)
{
label.setBounds(0, 0, dim.width, dim.height);
g2.translate(getX(), getY());
g2.scale((image.... |
0c008f8f-eca3-4492-99a0-c18b9515edd1 | 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... |
deeeeaa4-46d6-4309-b622-6d2f7312a89f | 8 | public String KonversiKwitansi (double doubleAngka){
String [] bil ={"","satu","dua","tiga","empat","lima","enam","tujuh","delapan","sembilan","sepuluh","sebelas"};
String x=" ";
int intAngka = (int) doubleAngka;
if (doubleAngka<12){
x = " " + bil[intAngka];
} else i... |
36bf2d83-a193-4e04-b9cd-1bf9a9f24635 | 9 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
MOB target=mob;
if((auto)&&(givenTarget!=null)&&(givenTarget instanceof MOB))
target=(MOB)givenTarget;
if(target==null)
return false;
if(target.fetchEffect(ID())!=null)
{
mob.tell(targ... |
f34f90bf-b627-435d-95c5-fe3221ee88a8 | 3 | void setSelectionForeground () {
if (!instance.startup) {
tabFolder1.setSelectionForeground(selectionForegroundColor);
}
// Set the selection foreground item's image to match the foreground color of the selection.
Color color = selectionForegroundColor;
if (color == null) color = tabFolder1.getSelectionFor... |
83b90337-ae1b-4b67-a448-37904d31fdda | 3 | protected <R> R openStatement(final Connection db, JdbcCallback<R> callback, Sql sql)
{
PreparedStatement stmt = null;
try
{
stmt = db.prepareStatement(sql.toSql());
return callback.connected(stmt);
}
catch (SQLException e) {
throw new Runt... |
31ed80e2-15f3-4ac5-aba5-bad29ed646ee | 8 | public void renderMiniMapResources(Graphics g, int mx, int my, int cx, int cy, int w, int h, int x, int y, String resourceName) {
HashMap<String, Resource> rs = new HashMap<String, Resource>(resources);
Resource resource = null;
int[] xy = null;
try {
for (String key : rs.ke... |
1e4c8427-142f-48fb-872a-aa03859cc38d | 5 | public static void main (String args[]) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int t = Integer.parseInt(reader.readLine());
int currentOperation;
int currentNumber;
boolean isQueue;
StringTokenizer st;
for (int i=0; i<t; i++) {
isQueue = true;
... |
5713a44f-e281-4992-8a29-760106f92ef2 | 9 | protected void detect() {
monitor.println("\nDerivation length: " + length);
AbstractWorker workerPool[] = new AbstractWorker[workers];
startTime = System.currentTimeMillis();
Job j = new Job(length, newStackFrame(dfa.startState));
// have one worker hand out a predefined number of jobs
AbstractWorker ... |
87bf72e7-d44e-407b-af1d-24c9c856a2ee | 2 | @Override
public boolean isFull() {
for (int i = 0; i < buffer.length; ++i) {
if (buffer[i] == null) {
return false;
}
}
return true;
} |
a587115c-61cc-4a28-8082-c5328e1148fb | 5 | static public Direction getDirectionFromString(String str) {
if (str.equals("UP")) {
return UP;
}
else if (str.equals("DOWN")) {
return DOWN;
}
else if (str.equals("LEFT")) {
return LEFT;
}
else if (str.equals("RIGHT")) {
... |
ae968149-132a-415a-b011-c18628b3e8ce | 9 | public boolean searchMatrix(int[][] matrix, int target) {
// Note: The Solution object is instantiated only once and is reused by each test case.
if(matrix==null || matrix.length==0)
return false;
int low = 0, high = matrix.length-1;
while(low<high){
int mid = (lo... |
31229ac5-edd9-4391-8200-582587fb7cac | 9 | private void applyGamma(Delta currentDelta, ASTNode node, Environment currentEnv, Stack<ASTNode> currentControlStack){
ASTNode rator = valueStack.pop();
ASTNode rand = valueStack.pop();
if(rator.getType()==ASTNodeType.DELTA){
Delta nextDelta = (Delta) rator;
//Delta has a link to the env... |
4f66246a-fead-4ff8-a3be-be663569a1d5 | 6 | @Override
public void run() {
if (Updater.this.url != null &&
(Updater.this.read() && Updater.this.versionCheck(Updater.this.versionName))) {
// Obtain the results of the project's file feed
if ((Updater.this.versionLink != null) && (Updater.this.t... |
bad2537d-6041-4cea-923c-83e395ce0d9d | 1 | public void addPoly(List<Position> coords, String tooltip) {
Polygon shape = new Polygon(coords);
shape.setAltitudeMode(WorldWind.RELATIVE_TO_GROUND);
shape.setAttributes(attrPoly);
if (tooltip != null) {
shape.setValue(AVKey.HOVER_TEXT, "hover: " + tooltip);
shap... |
01f08c65-8f68-47a1-9170-5f1041c61436 | 7 | private Object openInputGUI(final Component component, String title, final int tapes) {
// TODO Auto-generated method stub
JPanel panel;
JTextField[] fields;
//for FA, PDA
if (tapes==0)
{
panel = new JPanel(new GridLayout(3, 1));
fields = new JTextField[1];
for (int i = 0; i < 1; i++) {
pane... |
ae481f94-4566-442c-81bc-c8010599f945 | 3 | private List<Repository> getRepositories(final String organizationName) throws IOException {
try {
return repoListCache.get(organizationName, new Callable<List<Repository>>() {
@Override
public List<Repository> call() throws IOException {
logger.l... |
44157da3-19e7-4aca-b76f-8b5c1c298032 | 3 | private void initComponents() {
JMenuBar menuBar1 = new JMenuBar();
JMenu menu1 = new JMenu();
JMenuItem menuItem1 = new JMenuItem();
pauseButton = new JButton();
JButton stopButton = new JButton();
JButton screenshotButton = new JButton();
JButton resetButton = n... |
b5932041-5869-4063-b533-310d48f2d70c | 6 | public void addZombieAtCanvasLocation(int canvasX, int canvasY)
{
// FIRST MAKE SURE THE ENTIRE INTERSECTION IS INSIDE THE LEVEL
if ((canvasX - 17.5) < 0) return;
if ((canvasY - 17.5) < 0) return;
if ((canvasX + 17.5) > viewport.levelWidth) return;
if ((canvasY + 17.5) > view... |
14358d62-bd1a-4f57-b170-fbd4cb449655 | 9 | public double getMeasure(String measureName) {
if (measureName.equals("measureExtraArcs")) {
return measureExtraArcs();
}
if (measureName.equals("measureMissingArcs")) {
return measureMissingArcs();
}
if (measureName.equals("measureReversedArcs")) {
return measureReversedArcs();
... |
00904f93-401f-4b98-9b24-62d8ed3b6cd9 | 6 | static public Object getLowestDegreeVertex(mxAnalysisGraph aGraph, Object[] omitVertex)
{
Object[] vertices = aGraph.getChildVertices(aGraph.getGraph().getDefaultParent());
int vertexCount = vertices.length;
int lowestEdgeCount = Integer.MAX_VALUE;
Object bestVertex = null;
List<Object> omitList = null;
... |
294b57d5-bd6a-4291-b00f-529aa20cfaf5 | 4 | public void swap(String name, String name2) {
int one;
String oneTemp = "";
for(one = 1; one< getCount(); one++){
if(get(one).endsWith(name)){
oneTemp = get(one);
list.remove(one);
break;
}
}
int two;
String twoTemp = "";
for(two = 0; two< getCount(); two++){
if(get(two).endsWith(name... |
b7b8223f-d70b-4acd-8fb6-51c52730ae4b | 3 | private void newPassword() {
JPasswordField cPass = new JPasswordField();
JPasswordField nPass = new JPasswordField();
JPasswordField qPass = new JPasswordField();
JOptionPane.showConfirmDialog(null, cPass, "Enter current password", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
JOptionPane.show... |
15cd8123-fc29-4921-a87d-626c7dc2de1f | 4 | public ArrayList<Actor> getObjectsInRect(Rectangle rect, Class<? extends Actor> actorClass)
{
ArrayList<Actor> objectsAtPosition = new ArrayList<>();
for (Actor actor : actorList)
{
if(actor.getClass().isAssignableFrom(actorClass))
continue;
if(acto... |
ab3e0d1e-0ae7-42b8-9074-b14e878a84da | 6 | public int longestValidParentheses_4(String s) { // DP solution, take advantage of the computed DP value, it is the distance to the index we want to look at
int [] DP = new int[s.length()];
int res = 0;
for(int i = 0; i < DP.length; ++i){
if(s.charAt(i) == ')' && i > 0){
int j = i - 1 - DP[i-1];
if(j >... |
9dbd2d80-2803-4137-a813-5edf5b74f00a | 3 | public boolean generate(World world, Random random, int x, int y, int z){
for (int l = 0; l < 64; ++l){
int i1 = x + random.nextInt(8) - random.nextInt(8);
int j1 = y + random.nextInt(4) - random.nextInt(4);
int k1 = z + random.nextInt(8) - random.nextInt(8);
if (world.isAirBlock(i1, j1, k1) && this.bloc... |
d25247bb-e120-46f1-9f1f-7a1c36d8c231 | 2 | public static void main (String[] args) throws IOException {
File file = new File("C:/1.txt");
BufferedReader in = new BufferedReader(new FileReader(file));
String line;
int sum = 0;
while ((line = in.readLine()) != null) {
String[] lineArray = line.split("\n");
if (lineArray.le... |
81551624-ac35-4efb-b145-8312b190a621 | 8 | String anonymizeString(String input,String nameToBeAnonymized)
{
//extract name terms
String nameTerms[] = nameToBeAnonymized.split(" ");
String textTerms[] = input.split(" ");
String output = null;
//go through input, replace name term sequences with substitute
boolean lastTermWasName = false;
for(int ... |
55047cd2-2926-4016-ae3c-fdea04070b4a | 8 | private Map<String, int[]> generateRewardTable(GemEventReward rewards) {
ArrayList<Integer> levels = new ArrayList<Integer>(rewards.getLevels());
Collections.sort(levels);
Map<String, int[]> table = new HashMap<String, int[]>();
boolean hasBonusGem = false;
Iterator<Integer> levelIter = levels.iterator();
// sca... |
119a5fac-ee0c-48c6-a84b-a23e8fce7e4f | 8 | public void writeLine(String s) throws IOException
{
for (int i = 0; i < s.length(); i++)
{
char c = s.charAt(i);
switch (c)
{
case '\\':
super.write("\\\\");
break;
case '\t':
... |
78781f83-c9ce-4692-8ea7-60f91f9dadb4 | 9 | static final public Map<String, Object> asNestedMap(Map<? extends Object, ? extends Object> flattenMap){
Map<String, Object> nestedPropMap = new HashMap<>();
Map<String, Map<String,Object>> mapByPath = new HashMap<>();
for (Map.Entry entry : flattenMap.entrySet()){
Object keyObj = entry.getKey();
String k... |
c46d92b8-1fb5-40f7-9ade-f23764f073b9 | 3 | public void refreshImg(RefreshEvent event) {
WorldModel wm = (WorldModel)event.getSource();
int win = wm.getWin();
switch (win) {
case -1:
this.imgButton.setImg(GraphicalGameView.loseImg);
break;
case 0:
this.imgButton.setIm... |
4d4bf2df-bea1-4fa4-827f-f2552d9df98e | 3 | @Test(expected = ImpossibleSolutionException.class)
public void test_singular_matrix_solve() throws
ImpossibleSolutionException,UnsquaredMatrixException,
ElementOutOfRangeException{
int height=2;
int width=2;
System.out.print("Testing singular matrix solve m... |
3b5b6190-c62b-4032-bfdf-db226a758212 | 2 | public static void main(String[] args) {
for(char c = 0; c < 128; c++)
if(Character.isLowerCase(c))
System.out.println("value: " + (int)c + " character: " + c);
} |
f4404620-f0c8-4c25-81bb-2bbf55294abf | 3 | private ArrayList<Worker> jobWorkers(String job, Day day, ArrayList<String> workersWorking) {
ArrayList<Worker> workersForJob = new ArrayList<Worker>();
for (Worker worker : this.workerIndices.get(this
.numForName(day.getNameOfDay()))) {
Day workerDay = worker.... |
beb6fea2-882a-43f4-8cb3-5b2a9341efda | 1 | public static final int StateUpdateShortRep(int index)
{
return index < 7 ? 9 : 11;
} |
de32a3cb-2e49-4d24-9a5c-8ec1e0b50b2e | 4 | @SuppressWarnings("unchecked")
protected T findOneResult(String namedQuery, Map<String, Object> parameters) {
T result = null;
try {
Query query = manager.createNamedQuery(namedQuery);
// Method that will populate parameters if they are passed not null and empty
if (parameters != null && !parameters.isE... |
4d8eed5a-d234-4598-bba1-208c369a890a | 0 | public String toString() {
return "waiting for user to start the game";
} |
de80abe0-8ee1-40fe-8832-adede8edccca | 9 | public boolean leaveMessage(Info info)
{
String message = info.getMessage();
String sender = info.getSender();
String channel = info.getChannel();
String stripped = message.substring( message.indexOf(" ") ).trim( );
int breakpt = stripped.indexOf( ' ' );
String who ... |
1e2d7f89-af50-4354-93af-c10604d94311 | 6 | public int getMossaMinAvvicinando(){
int minAvv = 16;
if(desmosse!=null)
//Trovo il minimo tra i vmax
for(DescrittoreMossa dm : desmosse)
if(dm!=null && dm.getAvvicinando()<minAvv && dm.getAvvicinando()!= -1)
minAvv = dm.getAvvicinando();
//Restituisco il vmin se è valido
return minAvv!=16?m... |
186a8da1-0684-4663-a496-9cfe08cc3ab6 | 4 | public BTXEvent next() throws IOException {
ParseEventData cur = eventStack;
if (cur == null) {
// If there's nothing left in the stack, we're at the end of the file!
return BTXEvent.EOF;
}
if (cur.attrsLeft > 0) {
cur.attrsLeft--;
cur.curAttr = BTXHelp_0.readAttribute(f);
return BTXEvent.ATTR... |
805aa175-5756-4ca1-8533-438c4846016c | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
EdgeMarker other = (EdgeMarker) obj;
if (_source == null) {
if (other._source != null)
return false;
} else if (!_source.equals(other._s... |
188dea8c-4016-4329-8ca4-915e5cc70124 | 1 | private boolean canHaveAsTeleporter(Position pos) {
return pos != null && grid.getElementsOnPosition(pos).isEmpty();
} |
40a7d9b2-71d8-422b-8304-875635aa6b88 | 8 | public TileColor getLeft(TileColor top){
TileColor[] whiteL = {red,blue,orange,green};
TileColor[] blueL = {red,yellow,orange,white};
TileColor[] redL = {blue,white,green,yellow};
TileColor[] L = {};
if(top.equals(white)){
L = whiteL;
} else if(top.equals(blue)){
L = blueL;
} else if(top.equals(red)... |
11fef561-6a71-462a-8b86-4dc50ce878f5 | 4 | private void delete(File file) throws Exception {
File[] inners = file.listFiles();
if (null != inners && inners.length > 0) {
for (File inner : inners) {
delete(inner);
}
}
if (!file.delete()) {
throw newIOException(file);
}
} |
48c53d6a-b6aa-4ce6-a4b6-0d11c50e12ed | 0 | public void begin() {
started = System.currentTimeMillis();
} |
a29b1dee-978f-4014-977c-037de71a9e1c | 1 | private void order(int start, int end) {
if(start >= end) return;
int separatorPos = divide(start, end);
order(start, separatorPos - 1);
order(separatorPos + 1, end);
} |
f97d50ba-3ca4-4991-b20f-d1e899684978 | 3 | private static String LoadShader(String fileName)
{
StringBuilder shaderSource = new StringBuilder();
BufferedReader shaderReader = null;
final String INCLUDE_DIRECTIVE = "#include";
try
{
shaderReader = new BufferedReader(new FileReader("./res/shaders/" + fileName));
String line;
while((line = sh... |
41aff04d-e9e8-47ad-8a0f-e5371d8e7ab3 | 2 | private void setParameterValue(final PreparedStatement ps, final List<Object[]> argsList, int idx)
throws SQLException {
Object[] args = argsList.get(idx);
if (args != null) {
for (int index = 0; index < args.length; index++) {
Object arg = args[index];
JdbcUtils.setParameterValue(ps, index + 1, arg);... |
86fb1298-b727-4b85-8731-0382ec32c6f5 | 6 | public ItemEditor(int ID) {
setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
System.setProperty("resources", System.getProperty("user.dir") + "/resources");
this.ID = ID;
setTitle("Item Editor");
setBounds(100, 100, 600, 500);
getContentPane().setLayout(new BorderLayout());
contentPanel.setBorder(new E... |
f76b41bd-47f1-42ec-9b58-a83dcabd979d | 3 | *
* @throws UnknownHostException if cyc server host not found on the network
* @throws IOException if a data communication error occurs
* @throws CycApiException if the api request results in a cyc server error
*/
public CycConstant makeCycConstant(String name)
throws UnknownHostException, IOExc... |
68544f33-d270-4541-93b9-86fb5c9447ec | 9 | @Override
public String runMacro(HTTPRequest httpReq, String parm, HTTPResponse httpResp) throws HTTPServerException
{
if(!CMProps.getBoolVar(CMProps.Bool.MUDSTARTED))
return "false;";
if(!initialized)
{
initialize();
}
if((httpReq.getHeader("upgrade")!=null)
&&("websocket".equalsIgnoreCase(httpR... |
5a1e5207-69fa-429a-8f59-e5f5b7efea14 | 1 | public String toString()
{
String listArray = "";
for(int index = 0; index < manyItems; index++)
{
listArray += String.valueOf(data[index])+ ",";
}
/* WONG VERSION
for(int index = 0; index < data.length; index++)
{
listArray += String.valueOf(data[index]) + "\n";
}
*/
return "{"+ listArr... |
1d28c806-60ab-4325-b118-63b16a7d59de | 8 | public void siteUnreachable(String site) {
lock.lock();
try {
for(Map.Entry<Address,Rsp<T>> entry : rsps.entrySet()) {
Address member=entry.getKey();
if(!(member instanceof SiteAddress))
continue;
SiteAddress addr=(SiteAddre... |
a27fc899-5596-4512-af8b-14bb2bb16043 | 5 | @Override
public void executeTask() {
try {
sendingSocket = new DatagramSocket(SENDING_PORT);
sendingSocket.setBroadcast(true);
client = new Client();
client.setCurrentIP(InetAddress.getLocalHost().getHostAddress());
client.setHostname(InetAddress.getLocalHost().getHostName());
client.setReceiving... |
56584501-222d-4f69-94ae-cfb9d1552b0b | 7 | @Override
protected Control createContents(Composite parent) {
Composite container = new Composite(parent, SWT.NONE);
container.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
container.setLayout(null);
txtBalance = formToolkit.createText(container, "New Text", SWT.NONE);
txtBalance.setBounds(8... |
0a511ba2-a3f1-42ae-8abb-8379f0ebb82f | 1 | public void redo() {
revising = true;
if (!TEXT_FUTURE.isEmpty()) {
String restoreText = TEXT_FUTURE.pop();
TEXT_HISTORY.push(restoreText);
textLower.setText(restoreText);
// gui.TEXT_HISTORY.tailMap(fromKey)
}
} |
537ff6f8-bcba-4dfb-8221-3107f68b36d0 | 2 | public static List<Player> getNearbyPlayers(Location l, int range) {
List<Player> players = new ArrayList<Player>();
for (Entity e : getNearbyEntities(l, range)) {
if (e instanceof Player) {
players.add((Player) e);
}
}
return players;
} |
ec6c8916-636d-4b6a-bae9-248700600c90 | 0 | protected void initialize() {} |
ff1687b6-ac86-442d-ae5b-d6d100d9e973 | 7 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Article other = (Article) obj;
if (!Objects.equals(this.id, other.id)) {
return false;
... |
04791985-66c8-4c1b-be2d-e2247866cd36 | 0 | public int getDestinationEnd() {
return this._destinationEnd;
} |
231dce82-00ed-483d-b3cf-5f22ff68b44e | 6 | public void purgeOperation() {
try {
Iterator iterator = mapTtl.keySet().iterator();
String key = null;
Date expTime;
Date currentTime = new Date();
while (iterator.hasNext()) {
key = (String) iterator.next();
expTime = (Date) mapTtl.get(key);
if(expTime==null) {
continue;
}
i... |
e2de0259-c0fd-4224-9b3b-e569cee71c1f | 7 | public static TreeNode lowestCommonAncestor(TreeNode root, TreeNode a,
TreeNode b) {
TreeNode left = null;
TreeNode right = null;
if (root == null || root == a || root == b) {
return root;
}
left = lowestCommonAncestor(root.left, a, b);
right = lowestCommonAncestor(root.right, a, b);
if (left != nul... |
2903c199-5f2e-4b48-9ea1-cc9fac2c92f4 | 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... |
8f13bff8-9e21-425e-a453-c299bb98415f | 0 | public static float getFovX() {
return fovX;
} |
48e2e126-bcc4-4298-b11a-b4a71adf8141 | 0 | @Override
public void changedMostRecentDocumentTouched(DocumentRepositoryEvent e) {
calculateEnabledState(e.getDocument());
} |
c01b0adf-07fa-4456-844c-6b23ae105a51 | 1 | public Rank getFourthRank() {
return (ranks.size() < 4 ? Rank.Null : ranks.get(3));
} |
a2f7d88b-64b6-409a-9bd3-28a16fe6a7e8 | 4 | public boolean isChar(int token) {
return (token == 0x09 || token == 0x0A || token == 0x0D || token >= 0x20
&& token <= 0xFF);
} |
1a80621e-b1da-4785-b2e2-b3f480dc4162 | 0 | @Test
public void testGetHig() {
System.out.println("getHig");
assertEquals(3.0, new Cylinder(3,1,2.8).getHig(), 0.00001);
} |
7ed70b45-31bf-4631-833d-29afbcd93515 | 4 | public void exitRoutine()
{
boolean exit = true ;
TGlobal.config.setDirectInt( "mainWidth", this.getWidth() ) ;
TGlobal.config.setDirectInt( "mainHeight", this.getHeight() ) ;
// ask - save data ?
if ( TGlobal.projects.isProjectChanged() )
{
int result = JOptionPane.showConfirmDialog( ... |
e86175e8-5775-4f1b-b348-3d7d28255625 | 4 | @Override
public BMPImage apply(BMPImage image) {
Filter grey = new Grey();
image = grey.apply(image);
BMPImage filteredImage = new BMPImage(image);
BMPImage.BMPColor[][] bitmap = image.getBitMap();
BMPImage.BMPColor[][] filteredBitmap = filteredImage.getBitMap();
for... |
78c5858e-e899-45b9-9a2f-2134a3a92846 | 6 | public boolean handleRightClick(Point clickPoint) {
HUD hud = null;
boolean doUpdate = !gameController.getIsMasterPaused();
//start from the top and work our way down to "layer" the huds
for (int i = (huds.size() - 1); i >= 0; i--) {
hud = huds.get(i);
if (doUpd... |
217e492a-b035-45e4-857e-774df182ee99 | 4 | @Override
public boolean containsValue(Object value)
{
String key = (String) value;
boolean res = false;
for (Map.Entry<String, String> e : entries)
{
if (key == null)
{
if (e.getValue() == null)
{
res = true;
break;
}
}
else if (key.equalsIgnoreCase(e.getValue()))
{
r... |
f8a3b191-3a05-46bb-8b29-093aeee1d3b9 | 2 | public void print() {
// check if read in
if(!treeHeader.isHeaderOK()){
int badMagic = treeHeader.getMagic();
log.error("Error reading B+ tree header: bad magic = " + badMagic);
return;
}
// print B+ tree header
treeHeader.print();
// pr... |
1a1b6475-1cf7-4da2-968b-d24ceea76bfc | 5 | public void signAndSaveMessage(String message) {
// die Nachricht als Byte-Array
byte[] msg = message.getBytes();
Signature rsaSig = null;
byte[] signature = null;
try {
// als Erstes erzeugen wir das Signatur-Objekt
rsaSig = Signature.getInstance("SHA1wi... |
d7fb2c37-a82e-477e-8393-a783d214e0f3 | 6 | private boolean versionCheck(String title) {
if (type != UpdateType.NO_VERSION_CHECK) {
String version = plugin.getDescription().getVersion();
if (title.split(" v").length == 2) {
String remoteVersion = title.split(" v")[1].split(" ")[0]; // Get
// the
// newest
// file's
// version
// n... |
7f5e94fc-12cc-47c9-8df4-be19446160ea | 2 | *
* @throws UnknownHostException if cyc server host not found on the network
* @throws IOException if a data communication error occurs
* @throws CycApiException if the api request results in a cyc server error
*/
public CycObject converseCycObject(Object command)
throws UnknownHostException, IO... |
cbff88fd-6f9d-4d32-a05c-56db749a2d49 | 6 | public void actionPerformed(ActionEvent ae) {
double x = 0.0, y = 0.0;
Double d;
try {
d = new Double(eastings.getText());
x = d.doubleValue();
} catch (NumberFormatException nfe) {
eastings.setText("0");
x = 0.0;
}
try {
d = new Double(northings.getText());
y = d.doubleValue();
} catc... |
97e5328d-3cc4-4590-9619-ef1c73c82650 | 2 | public static URI loadResourceAsUri(String resourcePath) {
URI resourceAsURI = null;
if(resourcePath.startsWith("/")){
try {
resourceAsURI = loadResourceAsURL(resourcePath).toURI();
} catch (URISyntaxException e) {
e.printStackTrace();
}
return resourceAsURI;
}else{
System.err.println("A re... |
748bedd1-ecc8-41a0-9728-cee331efd405 | 2 | public void test_09() {
// Create pvalues
ScoreList pvlist = new ScoreList();
int max = 1000;
for (int i = 0; i < max; i++) {
double quantile = ((double) i) / max;
pvlist.add(quantile);
}
// Test
for (int i = 0; i < max; i++) {
double quantile = ((double) i) / max;
double pval = pvlist.cdf(q... |
07c34dee-ff53-460c-9ad6-1774cc271505 | 4 | public Projectile(float x, float y, boolean goingUp, boolean friendly) {
super(TextureManager.loadTexture(friendly ? PROJECTILE_TEX : PROJECTILE_TEX_ENEMY),
"none", x, y, PROJECTILE_WIDTH, PROJECTILE_HEIGHT);
if(goingUp) {
this.velocity.y = PROJECTILE_VEL;
}
e... |
fdbb7889-7b78-405a-9a47-0a5fa7c79462 | 4 | @Override
public boolean equals(Object other) {
if (other == this)
return true;
if (other == null || other.getClass() != this.getClass())
return false;
final Position pos = (Position) other;
return this.xCoordinate == pos.xCoordinate && this.yCoordinate == pos.yCoordinate;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.