method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
4af09fb6-a566-4431-a244-b892af984a44 | 7 | private int findBinary(int val, int low, int up, boolean index) {
Integer sel = (up + low) / 2;
Integer curr = arr[sel];
// System.out.printf("Sel %d, Curr %d, Low %d, Up %d\n", sel, curr, low,
// up);
if (curr == null || idx == 0 || low > up) {
return index ? low : -1;
} else if (curr == val) {
retur... |
d988e1c4-8cdb-4a65-b5d7-ea6c44505c12 | 9 | public static void linkBA(Object obj, Object fieldName, Object stream, int size) {
if (stream instanceof OutputStream) {
try {
Object val = null;
if (fieldName instanceof String) {
val = getField(obj.getClass(), (String) fieldName).get(obj);
... |
2a8910b7-9a84-4627-b82c-c97b1affa91a | 5 | @EventHandler(priority = EventPriority.NORMAL)
public void onPlayerChat(AsyncPlayerChatEvent event)
{
try
{
final Player player = event.getPlayer();
String message = event.getMessage().trim();
String[] args = message.split(".");
PlayerData playerd... |
d33f963b-996b-42b8-9e12-ba8d08f6e876 | 1 | public void process(final long ms) {
process += ms;
if (process >= build_time) {
isComplete = true;
}
} |
ca4a0895-a8a8-455c-a14c-2286c60c2de0 | 7 | public static void lock(long t) {
int tId = (int) t;
choosing.set(tId, 1);
ticket.set(tId, nextTicket());
choosing.set(tId, 0);
for (int i = 0; i < ticket.length(); i++) {
if (i != tId) {
while (choosing.get(i) == 1) { Thread.yield(); }
... |
ea50623f-7332-4528-afe8-e972a7faeb5e | 7 | protected static boolean coplanarTriangles( Vector3f n, Triangle t1, Triangle t2 )
{
// First project onto an axis-aligned plane that maximizes the are of the triangles.
int i0;
int i1;
float[] a = new float[]{ Math.abs( n.getX() ), Math.abs( n.getY() ), Math.abs( n.getZ() ) };
if ( a[0] > a[1] ) // X > Y
... |
6cf79ede-3810-411b-8a9f-032bf5314e28 | 0 | public void addPacket(OSCPacket packet) {
packets.add(packet);
} |
9845bd8f-979e-428e-af92-53b38531534f | 3 | public void addMoveButton(){
panel=0;
MovePanel = new JPanel();
final JButton BackButton = new JButton("назад");
BackButton.setPreferredSize(new Dimension(190,60));
BackButton.setFont(arrFont);
BackButton.setEnabled(false);
final JButton ForwardButton = new JButton("вперёд");
... |
50459ed2-60b1-4a41-9346-1d49b5cbf2cc | 5 | private void labelNimGraph() {
System.out.println();
System.out.println("The node labels in the NIM graph for n = " + initialMatchsticks + ":");
System.out.println();
LinkedList<NimVertex> sortedList;
try {
sortedList = (this.nimGraph != null) ?
NimAlgorithms.labelNimGraph(nimGraph) :
... |
932576ec-4e62-41ef-ac09-e8df58d19a01 | 3 | public boolean isOutsideBounds(EnemyBullet b){
if( b.pointY > 640 || b.pointX > 480 || b.pointY < 0 ){
return true;
}
else return false;
} |
8c76f737-e4d6-4905-9fb4-c2dbac59d959 | 7 | static final public void expression() throws ParseException {
simpleExpr();
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 56:
case 57:
case 58:
case 59:
case 60:
case 61:
opRel();
simpleExpr();
expression.controleType(); yvm.opRel();
break;
default:
jj_la1[1... |
890f0c83-e44b-4d1b-8dbf-9d3889e9d0ea | 5 | public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int slotsFilled = 0;
final int NUMBER_OF_SLOTS = 9;
String boardArray[][] = new String[3][4];
String player;
int row;
int column;
do {
player = whichPlayer(boardArray);
System.out
.print("Enter a row (0, 1, 2) ... |
50d634a8-5d79-40c2-bd7c-fb7e52c867d0 | 9 | SystemInfoDialog(Modeler modeler) {
super(modeler, "System Information", false);
String s = Modeler.getInternationalText("SystemInfo");
if (s != null)
setTitle(s);
final JTabbedPane tabbedPane = new JTabbedPane();
getContentPane().add(BorderLayout.CENTER, tabbedPane);
JPanel panel = new JPanel(new Flo... |
dc5cd03d-190f-4315-a637-2d2a64bc1d42 | 7 | @Override
public int doEndTag() throws JspException {
try {
if(this.getEmail() == null || this.getEmail().isEmpty()){
this.setEmail("image-not-informed@gravatar-fail.com");
}
String hash = MD5.criptografa(this.getEmail());
String url = "http://www.gravatar.com/avatar/" + hash + "?s=" + imageS... |
3f601d30-578a-4e14-bef1-e8eb45fd6b67 | 1 | private boolean greater(Item i, Item j)
{
if (i.compareTo(j) > 0)
return true;
return false;
} |
95d5da29-ce32-484b-b105-9eed1bdeda20 | 4 | public static void mms_convert(List<String> files) {
for (String s : files) {
String res;
if (s.endsWith("statvar")) {
res = Convert.statvar(s);
} else if (s.endsWith("params")) {
res = Convert.param(s);
} else if (s.endsWith("dat... |
cd2136ad-cb6b-4ff8-8fd0-4ffe436fe013 | 6 | protected void handleAndroidResourceFiles(String apk, Set<String> fileNameFilter,
IResourceHandler handler) {
File apkF = new File(apk);
if (!apkF.exists())
throw new RuntimeException("file '" + apk + "' does not exist!");
try {
ZipFile archive = null;
try {
archive = new ZipFile(apkF);
Enume... |
34792a53-c58f-494c-8191-63c646eb29c8 | 1 | public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
int testCases = Integer.parseInt(in.readLine());
while (testCases > 0) {
validUsername(in.readLine());
testCases--;
}
} |
42260311-45f3-48c5-a0dd-c62f8bc4a8d7 | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Users other = (Users) obj;
if (users == null) {
if (other.users != null)
return false;
} else if (!users.equals(other.users))
return ... |
5974e945-f6d8-471b-81d5-be2686b9c51e | 1 | @Override
public void init( CapabilityHandlerSite<ConnectionableCapability> site ) {
this.site = site;
site.addMouseListener( mouseListener() );
site.addMouseMotionListener( mouseMotionListener() );
site.addKeyListener( keyListener() );
if( factory != null ){
trigger();
}
openEnded.setParent( site ... |
744a790f-89da-418a-bcb6-a8721e17a7b3 | 3 | public static IanaCountryTldEnumeration fromString(String v) {
if (v != null) {
for (IanaCountryTldEnumeration c : IanaCountryTldEnumeration.values()) {
if (v.equalsIgnoreCase(c.toString())) {
return c;
}
}
}
throw new IllegalArgumentException(v);
} |
f1aa8303-06e5-4abb-aa48-442833e9c464 | 7 | public TreeSet<Long> getFactorsSet(Long b){
ArrayList<Long> lcm = new ArrayList<Long>();
TreeSet<Long> factors = new TreeSet<Long>();
Map<Long, Boolean> factorsMap = new HashMap<Long, Boolean>();
double sqrt = Math.sqrt(b);
Long init = System.nanoTime();
Long remain = b.longValue();
for (int i=0; i<primes... |
a6bfdca0-be0d-4bea-a7e5-1c742b8feb8e | 5 | public void eventMenuFileSaveAs() {
int overwrite = JOptionPane.YES_OPTION;
JFileChooser chooser;
int result;
File selectedFile;
String fileName;
if ( Data.getInventoryFile() != null ) {
chooser = new JFileChooser();
chooser.setFileFilter( new FileNameExtensionFilter( "Inve... |
e31f7232-1bfa-4a94-891e-4f9d97716734 | 9 | public void expandTree(Node<MorrisNodeData> crtNode, int depth) {
int expectedDep = depth;
if (crtNode.getDepth() < expectedDep) {
MorrisBoard crtBd = crtNode.getData().getBoard();
List<MorrisBoard> subBd = generateAction(crtBd);
if (subBd.size() == 0) {
//current node is leaf, set estimation, the exp... |
242b7cbe-0f4f-43cf-826b-a5ad2fcc8e92 | 9 | private boolean r_Step_4() {
int among_var;
int v_1;
// (, line 140
// [, line 141
ket = cursor;
// substring, line 141
among_var = find_among_b(a_7, 18);
if (among_var == 0) {
return false;
}
// ], line 141
bra = cursor;
// call R2, line 141
if (!r_R2()) {
return false;
}
switch (am... |
d93f1b98-c17e-40f0-ae2c-560bf825cd6d | 5 | public double getSerendipity(List<Map<Integer, Double>> resourceTopics, List<Integer> knownResources) {
double serendipity = 0.0;
if (this.predictionData == null || this.predictionData.size() == 0) {
return serendipity;
}
if (knownResources == null || knownResources.size() == 0) {
return 1.0;
}
for... |
89789769-0e9e-42af-ba26-11f8a2a04196 | 1 | public static void isDividendLessZero(int dividend, int divisor, ArrayList<String> pseudographics) {
if (dividend < 0) {
pseudographics.add(" " + dividend + "|" + divisor);
pseudographics.add(" -" + signPerDigits(howMuchDigits(dividend), " "));
} else {
pseudographics.add(" " + dividend + "|" + divisor);
... |
75f098fc-88ce-4443-aedd-7dc7a4b0ce65 | 7 | public void addClassesSummary(ClassDoc[] classes, String label,
String tableSummary, String[] tableHeader, Content summaryContentTree) {
if(classes.length > 0) {
Arrays.sort(classes);
Content caption = getTableCaption(new RawHtml(label));
Content table = HtmlTree.... |
eaca5944-b850-4501-8059-d3d5adf9642b | 1 | public void notifyPropertyChangeListeners(PropertyChangeEvent event) {
for(PropertyChangeListener listener:listeners) {
listener.propertyChange(event);
}
} |
fefe70c3-01d2-4948-a2e8-912f99c7f13a | 8 | @Override
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null) return false;
if (getClass() != obj.getClass()) return false;
DownloadRecord other = (DownloadRecord) obj;
if (fileLength != other.fileLength) return false;
if (threadCount != other.threadCount) return false;
if ... |
ac4017e3-4ba6-439d-996e-1064737f759e | 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 &&
... |
ef210aaf-65cc-4fa1-9840-83679617c506 | 6 | @Override
protected void toXMLImpl(XMLStreamWriter out, Player player,
boolean showAll, boolean toSavedGame)
throws XMLStreamException {
PlayerExploredTile pet;
out.writeStartElement(getXMLElementTagName());
super.writeAttributes(out);
out.write... |
c4fb766a-be7d-48b8-b422-7f8db4df8acc | 2 | private void acao129() throws SemanticError {
if (tipoExpressao != Tipo.BOOLEANO && tipoExpressao != Tipo.INTEIRO)
throw new SemanticError("Tipo inválido de expressão");
// Gerar código
} |
19e9d9cd-fb1e-43fe-850c-c4821ef7e1d0 | 1 | public static boolean getPropertyDefaultAsBoolean(PropertyContainer container, String key) {
if (container != null) {
Object value = container.getPropertyDefault(key);
return convertObjectToBoolean(value);
} else {
throw new IllegalArgumentException("Provided PropertyContainer was null.");
}
} |
3bbaa2d1-acab-47ca-b721-6efc66a5260f | 0 | public void piirra(Graphics graphics) {
/**
* ja järjestys tietenkin määrittelee mitkä menevät taka-alalle ja mitkä
* etualalle. Pelaaja piirretään ennen tasoa, koska pelaajan hahmo on
* (tarkoituksella) hieman isompi kuin sen logiikan määrittelemät rajat,
* jotta se ei ikinä... |
a252aa8e-27de-47ee-8ed5-d9211eb8cd17 | 5 | public static <A> Ord<List<A>> listOrd(final Ord<A> oa) {
return ord(l1 -> l2 -> {
if (l1.isEmpty())
return l2.isEmpty() ? Ordering.EQ : Ordering.LT;
else if (l2.isEmpty())
return l1.isEmpty() ? Ordering.EQ : Ordering.GT;
else {
final Ordering c = oa.compa... |
6c4b38be-d948-48f1-a85b-8e6bf9f89cc0 | 9 | @Override
protected boolean onCreate(ThreadMsg msg) {
boolean ret;
ret = super.onCreate(msg);
if (ret) {
if (m_logFile != null) {
try {
printInfo("Start log thread creation procedure...");
m_logThreadLock.lock();
if (m_logThread == null) {
m_logPath = Paths.get(m_logFile);
... |
1f86f2a3-9a5b-41f0-b4a4-94b2607b5c4c | 3 | public boolean isSingleton() {
int count = 0;
for (VcfGenotype gen : this) {
if (gen.isVariant()) count++;
if (count > 1) return false;
}
return count == 1;
} |
f1be8b3d-0c29-4f21-b4f1-8348f18932c0 | 9 | @Override
public double[] calculateJulia3DWithoutPeriodicity(Complex pixel) {
iterations = 0;
Complex[] complex = new Complex[2];
complex[0] = new Complex(pixel);//z
complex[1] = new Complex(seed);//c
Complex zold = new Complex();
if(parser.foundS()) {
... |
0464b83d-178d-4afa-91d3-511ab2c3055f | 9 | public synchronized void loadMultiPinyin(InputStream inStream) throws IOException {
BufferedReader bufferedReader = null;
InputStreamReader inputStreamReader = null;
try {
inputStreamReader = new InputStreamReader(inStream);
bufferedReader = new BufferedReader(inputStream... |
53a238eb-0edc-4d15-ada9-bc27f23a4392 | 4 | private int findType(Object auto){
int type = 0;
if(auto instanceof TuringMachine) type = 1;
else if(auto instanceof PushdownAutomaton) type = 2;
else if(auto instanceof FiniteStateAutomaton) type = 3;
else if(auto instanceof Grammar) type = 4;
return type;
} |
d7e967db-0280-4c61-a3d9-dfad88083a7e | 6 | private void procuraActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_procuraActionPerformed
// TODO add your handling code here:
calendario = a.getCalendarioCompeticao("Escalao." + Escalao_ComboBox2.getSelectedItem().toString());
int i = 0;
Collection<String> classi = ... |
1fae1a46-30d8-4745-b71a-b376b076afcf | 6 | public Disk() {
this.colour = null;
this.opacityPercent = 0;
this.os = TintedWindow.getOS();
if (os == OS.LINUX || os == OS.OSX || os == OS.UNKNOWN)
this.dataFile = new File(System.getProperty("user.home"), ".tintedwindow");
else {
this.dataDirectory = n... |
e0c1a16c-9a91-4971-81ce-663df905136f | 6 | public boolean gameOver() {
for (int r = 0; r < WIDTH; r++) {
for (int c = 0; c < WIDTH; c++) {
if (squares[r][c] == '.') {
for (int[] offset : OFFSETS) {
int dr = offset[0];
int dc = offset[1];
if (flips(r, c, dr, dc) > 0) {
return false;
}
colorToPlay = opposite(colo... |
44fcc339-2e73-47fb-abfd-69c3bbea9b01 | 3 | public void set(int pos, int val) {
if (start == end && start == pos) {
minVal = maxVal = val;
sumVal = val;
} else {
int mid = (start + end) / 2;
if (pos <= mid)
left.set(pos, val);
else
right.set(pos, val);
minVal = Math.min(left.minVal, right.minVal);
maxVal = Math.max(left.maxVal, r... |
3b57c2c8-c5e5-4cad-96f7-ccae18b6a2bb | 1 | public static void main(String[] args) throws IOException {
// Show what command line arguments to use
if (args.length == 0) {
System.err.println("Usage: java ArithmeticDecompress InputFile OutputFile");
System.exit(1);
return;
}
// Otherwise, decompress
File inputFile = new File(args[0]);
File ... |
044638b9-598f-4d29-a236-5811064a8e95 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ClassField other = (ClassField) obj;
if (descriptor == null) {
if (other.... |
67f826a7-b9d7-437b-a308-cbea625d492f | 0 | public MainFrame() {
this.addComponentListener(this);
//setResizable(false);
setTitle(" ----=== binary 0x63 0x6c 0x6f 0x63 0x6b ===---- ");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, WINDOW_WIDTH, WINDOW_HEIGHT);
contentPane = new JPanel();
contentPane.setBorder(new... |
75654ef1-0309-47c3-abc4-2e91ff6845eb | 0 | @Override
public void appletResize(int paramInt1, int paramInt2) {/**/} |
5fb05fb3-1771-4ee5-9dc0-50a4193ca49b | 4 | public boolean isLoggedIn(HttpServletRequest request, HttpServletResponse response) throws Exception {
if (request.getSession() != null && request.getSession().getAttribute(Constants.Session.CURRENT_USER) != null) {
return true;
} else {
Cookie authCookie = CookieUtils.getCookie(... |
ab681243-3edb-4bc8-95b9-167dfcf23bba | 1 | public void disconnect(){
try {
createSocketAndSend("Disconnection Request From : " + myName, DISCONNECT);
}
catch (Exception e) {
e.printStackTrace();
}
} |
a0c94c89-956c-4510-9a53-44c2f82885ec | 2 | public int[] getCheckedIndices() {
int[] result = new int[getCheckedCount()];
int index = 0;
for (int i = 0; i < checkedItems.length; i++) {
if (checkedItems[i]) {
result[index] = i;
index++;
}
}
return result;
} |
f906377a-57b9-4f42-b780-3c2c9d26ef5f | 5 | @Override
public void run()
{
log.info("working");
Map<String, Object> data = new HashMap<>();
int id = Helpers.queryGetInt(rx, "id", 0); //TODO: default? i dont think so. Spit an error.
String back_url = Helpers.queryGetString(rx, "back_url", "/orders");
Order o = OrdersCache.get(id);
List<Histor... |
4833c72f-3aa2-4fe2-967f-94dca141a44f | 4 | private void HTTPVariables2SQLQueries() {
Connection conn = null;
Statement s = null;
try {
if ((conn = this.JavaDBAccess.setConn()) != null) {
System.out.println("Connected to database " + JavaDBAccess.getDatabaseName());
} else {
throw n... |
6bb4d90b-b843-4c15-8c22-3a730973448f | 0 | public String getPassword() {
return password;
} |
1aea27a2-e896-4151-a846-23e17f283bcd | 8 | public static void main(String[] args) {
// TODO code application logic here
// 5. Escriba una función para eliminar los duplicados de una matriz ordenada de enteros en una línea de código. (Usted puede usar tantas declaraciones como sea necesario, pero el código debe ser escrito en una sola línea).
//Ejemplo:... |
61e07db7-c405-42ca-bfd0-38f87ff80db3 | 4 | private void step(GameGrid grid) {
for (int i = 0; i < grid.getTotalGridSize(); i++) {
for (int j = 0; j < grid.getGridCellContents().get(i)
.getCellNeighbours().size(); j++) {
gameRules.deadWithThreeLivingNeighboursSpawn(grid
.getGridCellContents().get(i));
gameRules.tooManyOrTooLittleNeighbour... |
98f42cc5-60b0-4a71-9915-1c392d2cbce6 | 1 | public void operateMatrix (Matrix[]... srcs) {
Matrix[] src = srcs[0];
stackToOneCol(src[0].getArray(), super.arrY, src[0].getColumnDimension(), src[0].getRowDimension());
if (super.codeCbCr) {
stackToOneCol(src[1].getArray(), super.arrCb, src[1].getColumnDimension(), src[1].getRowDi... |
3b1993d3-1808-41e3-8b5f-ee93cefc857a | 9 | public boolean columnsExist(String tableName, String... columns) throws SQLException {
if (isConnected()) {
String[] tcols = getColumnNames(tableName);
// for each column checking, scan if that column name exists
for (String c : columns) {
boolean exists = false;
for(String tc : tcols) {
if((tc ... |
2a28b027-5f19-459e-98c3-338518e9e04c | 6 | public synchronized List<EventSet> findCorrelatingEventSets(String variableName, Object data, String inboundCorrelationToken) {
List<EventSet> eventSetSearchedIn = eventSets;
if (inboundCorrelationToken != null && inboundCorrelationToken.length() > 0) {
eventSetSearchedIn = correlationTokens.get(inboundCor... |
42f48830-51f5-4839-bc51-b6237f585a5d | 4 | private OSCMessage convertMessage() {
OSCMessage message = new OSCMessage();
message.setAddress(readString());
List<Character> types = readTypes();
if (null == types) {
// we are done
return message;
}
moveToFourByteBoundry();
for (int i = 0; i < types.size(); ++i) {
if ('[' == types.get(i).charV... |
266b4ecf-89b6-46ab-a339-6d84d3f9e3e3 | 1 | public boolean removeWatcher(WatchKey watchKey) throws IOException {
boolean isRemoved = notifier.removeWatcher(watchKey);
if (isRemoved) {
registeredWatchers.remove(watchKey);
}
return isRemoved;
} |
011a1f47-02b3-4ec8-bd7b-ac120466a7f5 | 3 | public void print(int n)
{
// There got to be a more efficient way to print n spaces.
if (n > 0)
{
for (int i = 0;i < n; i++)
System.out.print(" ");
}
if (booleanVal)
{
System.out.print("#t");
}
el... |
473f2c9e-1bdd-41b5-8fed-3481240646d8 | 4 | @Override
public boolean checkGuess(String question, String answer) {
if (currentgame == null)
{
return false;
}
for (int i = 0; i < currentgame.getQuestions().size(); i++) {
if (currentgame.getQuestions().get(i).getQuestion().equalsIgnoreCase(question) && ... |
054d6394-8337-45aa-84a5-dcb3e8719dba | 5 | public static String replaceSpaces(String s) {
// count the spaces in the original string
int nSpaces = 0;
for(int i = 0; i < s.length(); i++) {
if(s.charAt(i) == ' ') {
nSpaces++;
}
}
if(nSpaces == 0) {
return s;
... |
6fe06650-a586-4e25-aa3c-8898c704e040 | 0 | public Minecraft getMinecraft(){
return minecraft;
} |
ec5f3567-2657-4d6d-8b5f-c55583e48223 | 8 | public ProductViewHelper getProductViewHelper(String type,
HttpServletRequest req) throws UnsupportedEncodingException {
ProductViewHelper productViewHelper = new ProductViewHelper();
if (req.getParameter("n") != null) {
productViewHelper.setCurrentPage(
Integer.parseInt(req.getParameter("n")));
... |
0657f2db-0dd2-4f83-8aa6-d2eef14cdb8a | 9 | public static int[] twoSum(int[] numbers, int target) {
int n = numbers.length;
int []sorted = new int[n];
System.arraycopy(numbers, 0, sorted, 0, n);
Arrays.sort(sorted);
int []result = {-1,-1};
int start = 0;
int end = n-1;
while (sorted[end]>target){
... |
a877a981-1a00-424c-9275-b487646a8179 | 8 | static final public void instruction() throws ParseException {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case ident:
affectation();
break;
case LIRE:
lecture();
break;
case ECRIRE:
case ALALIGNE:
ecriture();
break;
case TANTQUE:
iteration();
break;
... |
39a5fd09-4c62-403d-8b0e-63d96cc72175 | 6 | private boolean command(String query) throws SQLException, InterruptedException {
if(!query.startsWith("+"))
return false;
query = query.substring(1);
if (query.equalsIgnoreCase("cleanall")) {
new TableManager().cleanAllTmpTables(dbManager, allNodes);
System.out.println("Cleaned all");
} else if (quer... |
3b688e8c-a6bf-4c15-a419-9b9e1a77ee5b | 4 | protected boolean decodeFrame() throws JavaLayerException
{
try
{
AudioDevice out = audio;
if (out == null) return false;
Header h = bitstream.readFrame();
if (h == null) return false;
// sample buffer set when decoder constructed
SampleBuffer output = (SampleBuffer) decoder.decodeFrame(h, bits... |
dd518125-e534-4f47-892a-54e2561d59ca | 7 | private void OKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_OKActionPerformed
int returnValue = fs.showSaveDialog(encryptFrame.this);
if(returnValue == JFileChooser.APPROVE_OPTION)
{
savefile = fs.getSelectedFile();
String saveFileName = "" +savefile;
... |
c31950a1-2e9f-406b-816a-a63d241d70e0 | 8 | public void addWalletMenu(final Wallet w) {
jm = new JMenu(w.getName());
balanceItem = new JMenuItem("Balance : " + w.getBalance() + "€");
balanceItem.setEnabled(false);
jm.add(balanceItem);
addMoneyItem = new JMenuItem("Add money");
addMoneyItem.addActionListener(new ... |
0466a9bc-5879-4ee1-9b58-e1c941d7ab78 | 6 | public Integer seekArr(int [] arr){
if(arr == null || arr.length < 1 || arr.length % 2 == 0){
return null;
}
int arrLength = arr.length;
if(arrLength == 1 || arr[0] != arr[1]){
return arr[0];
}
if(arr[arrLength - 1] != arr[arrLength - 2]){
... |
c367e18e-602c-4790-9111-a7b2047ec857 | 3 | public static String intListToString(List<Integer> list) {
if (list == null) {
return null;
}
String out = "";
for (Integer i : list) {
if(out.length() > 0) {
out += ", ";
}
out += i;
}
return out;
} |
961b6ef6-ae29-4b51-b54a-409e921e3ed8 | 0 | private static String urlEncode(final String text) throws UnsupportedEncodingException {
return URLEncoder.encode(text, "UTF-8");
} |
c7950623-87f2-4801-8a33-415523a9ee0b | 1 | @Override
public List<Integer> save(List<Direction> beans, GenericSaveQuery saveGeneric, Connection conn) throws DaoQueryException {
try {
return saveGeneric.sendQuery(SAVE_QUERY, conn, Params.fill(beans, (Direction bean) -> {
Object[] objects = new Object[6];
obj... |
6de87fd5-805e-435c-ac79-744f3d041c38 | 5 | public final static boolean playerOwnsTask(CommandSender sender, String taskName) {
FileConfiguration structConfig = BasePlugin.getInstance().getStorageManager().getStructureFile().getConfig();
String playerName = sender.getName().toLowerCase();
if (taskName.contains(playerName)) {
return true;
}
... |
62cebe44-d409-45f8-96f6-34d75bb30b4c | 6 | private String getAllMealsName(CanteenData canteenData) {
String meals = "{";
try {
for( LineData ld : canteenData.getLines()) {
for( MealData md : ld.getTodayMeals()) {
if( !ld.getTodayMeals().isEmpty()) {
if(( ld.getLineID() == (canteenData.getLines().size() - 1))
&& ( md.getMealID() == (ld.ge... |
350a89dd-797c-4e80-9889-61c3f15e9095 | 8 | public void attack( Territory defender, Player attacker, int invaders )
{
//Do Calculations here
//bonuses??
//simple substraction:
double bonusMultiplicator = 1;
if(defender.getClass().getName() == "Woodland")
{
bonusMultiplicator += 0.3... |
75b51dc3-29af-4f28-89d3-1a2204f52618 | 4 | public static void main(String[] args) {
// -------------------------Initialize Job Information------------------------------------
/*********************************Big Experiments*********************************/
String bigJobName = "Big-uservisits_aggre-pig-50G";
//String bigJobName = "BigBuildInve... |
d7232af7-eae8-4b8e-98dd-2a7505bf6fd9 | 1 | public Recipe getRecipe(){
Recipe recipe = new Recipe();
recipe.setName(name);
recipe.setNumPersons(numPersons);
recipe.setPrepTime(prepTime);
recipe.setRestTime(restTime);
recipe.setCookingTime(cookingTime);
HashMap<Ingredient, Quantity> ingredients = new HashMap<Ingredient,Quantity>();
for(int i = 0; ... |
3a87663e-4969-4b3e-b253-3a3083100b12 | 5 | private void btnEvaluateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEvaluateActionPerformed
if(this.currentTree.getCurrentRegExp()!= null && this.currentTree.getCurrentRegExp().equals(txtRegularExpression.getText())){
if(this.chkboxRevert.isSelected() != this.currentTree.isInverted... |
96512266-edc4-41e9-8164-bdc677e49c27 | 7 | public void deParse(Replace replace) {
buffer.append("REPLACE " + replace.getTable().getWholeTableName());
if (replace.getItemsList() != null) {
if (replace.getColumns() != null) {
buffer.append(" (");
for (int i = 0; i < replace.getColumns().size(); i++) {
... |
3dea709a-f474-43df-a8d8-f1b9ec920d1f | 6 | public boolean onEdge( double x, double y, double z ) {
return boundingBoxContains(x,y,z) && (
x == x0 || x == x1 ||
y == y0 || y == y1 ||
z == z0 || z == z1
);
} |
e2ae6af0-9523-44f0-9ae1-7399ba28e80e | 6 | public int getRequiredDistance() {
if (c.followId > 0 && c.freezeTimer <= 0 && !c.isMoving)
return 2;
else if(c.followId > 0 && c.freezeTimer <= 0 && c.isMoving) {
return 3;
} else {
return 1;
}
} |
5c6ef6e9-e8f6-433d-9629-fad69908f758 | 4 | @Override
public boolean onCommand(CommandSender sender, Command cmd,
String commandLabel, String[] args) {
try {
if (sender instanceof Player) {
Player player = (Player) sender;
if (cmd.getName().equalsIgnoreCase("warp")) {
World w = WorldUtils.GetWorld(args[0]);
if(w != null)
{
p... |
d8575c55-8134-43e3-a0a6-99abb8a204b5 | 4 | private DefaultMutableTreeNode loadModelTreeView(){
algo = new DefaultMutableTreeNode("Algorithms");
sort = new DefaultMutableTreeNode("Sorts");
search = new DefaultMutableTreeNode("Search");
ArrayList<DefaultMutableTreeNode> listSorts = new ArrayList<DefaultMutableTreeNode>();
... |
c7ab3fb1-03e5-45ef-89fb-2003f564babf | 6 | private int GetPreBlockLength(String blname,int nStartLine,int nbindex) throws RemoteException {
int nRepeat = -1;
int nLineCount = -1;
int nBlockLineCount = 0;
boolean bblCount = false;
String linetxt =null;
BufferedReader br = new BufferedReader(new StringReader(confText));
try {
while( (... |
f2b4255a-6dbe-49bd-8584-f53a81bf61d6 | 3 | private static Object createTestObject(Method creator) {
if(creator != null) {
try {
return creator.invoke(testClass);
} catch(Exception e) {
throw new RuntimeException("Couldn't run " +
"@TestObject (creator) method.");
}
} else { // Use the default constructor:
... |
db9dce3d-7a85-44ec-bd33-4e5119ae9327 | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
RequestMessage other = (RequestMessage) obj;
if (correlationId == null) {
if (other.correlationId != null)
return false;
} else if (!cor... |
7ec5c320-bc3e-4c5f-84a9-33d6426eb5aa | 8 | static private int first_node(float[] t0, float[] tm){
float tmax = DwVec3.maxComponent(t0);
if( t0[0] == tmax) return ((tm[1]<t0[0])?2:0) | ((tm[2]<t0[0])?1:0); // YZ:tx0=max
if( t0[1] == tmax) return ((tm[0]<t0[1])?4:0) | ((tm[2]<t0[1])?1:0); // XZ:ty0=max
return ((tm[0]<t0[2])?4:0)... |
21337ee7-7162-4be8-be73-1c0a0ee3f2c7 | 3 | @Override
public void run() {
char[] b = new char[4096];
int n;
try {
while ((n = r.read(b)) != -1) {
w.write(b, 0, n);
}
} catch (IOException ex) {
ex.printStackTrace(System.err);
} f... |
dc0559f8-26ba-48b2-901a-7e1bb43308f1 | 4 | public int getGreen(int x, int y) {
int value = 0;
if ((x >= 0) && (y >= 0) && (x < im.getWidth()) && (y < im.getHeight())) {
value = ((im.getRGB(x, y) >> 8) & 255);
}
return value;
} |
92040a0b-6c89-4a04-ac83-f0d90e84772c | 8 | public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int TC = sc.nextInt();
for (int t = 1; t <= TC; t++) {
int N = sc.nextInt();
int M = sc.nextInt();
int K = sc.nextInt();
boolean[] added = new boolean[N];
for... |
8f392a29-ea19-4c81-abc5-f1dbe3f3929f | 7 | public void outMoveResult(MoveResult[] moveResults)
{
for(MoveResult mr : moveResults) {
if (mr.getDamage() != -1) {
System.out.print("Player " + mr.getName().toUpperCase());
switch (mr.getAttackResult()) {
case Not_realised:
... |
d87690d0-318e-4683-b4b1-dc5f4ffdb75a | 1 | private static void initMedianGaussian(Composite inComposite, int heightHint) {
final Composite toolbar5 = new Composite(inComposite, SWT.BORDER);
final Composite medianGaussion = new Composite(inComposite, SWT.BORDER);
createToolbarGridData(toolbar5);
toolbar5.setLayout(new GridLayout(1, false));
Button bu... |
1f3c461d-4cd8-4464-aa48-f437eedf00d4 | 3 | private boolean checkFilenameExtension(String filename) {
boolean isAcceptable = false;
for (int i = 0; i < m_extensionList.size(); i++) {
String ext = m_extensionList.get(i);
if (!ext.startsWith("."))
ext = "." + ext;
isAcceptable = filename.endsWith(ext);
if (isAcceptable)
... |
d948b63e-48af-4b1c-bff8-0890e0a0baf3 | 0 | public Course(int x, int y, int img) {
Initialize(x, y);
LoadContent(img);
} |
e8805357-39ed-4b4c-aa74-00ba5d13891e | 8 | protected void reheapVoronoi(int i, int k) {
int j = i;
int son;
while (2*j <= k) {
if (2*j+1 <= k)
if ( (vsites[2*j].coord.y > vsites[2*j+1].coord.y) ||
(vsites[2*j].coord.y == vsites[2*j+1].coord.y &&
vsites[2*j].coord.x > vsites[2*j+1].coord.x) )
son = 2*j;
else
son = 2*j + 1;... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.