method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
14194efa-e6f3-49bb-af84-bf4f0c8e36bd | 4 | public boolean verifyConnection(){
try{
Class.forName("com.mysql.jdbc.Driver").newInstance();
this.connect=DriverManager.getConnection("jdbc:mysql:"+this.link,this.username, this.passwd);
this.statement=this.connect.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
... |
41d4dc84-1438-43fa-8184-cb124f74a121 | 0 | public static void main(String[] args) {
System.out.println(ternary(9));
System.out.println(ternary(10));
System.out.println(standardIfElse(9));
System.out.println(standardIfElse(10));
} |
8d0d1c56-d8d2-4417-90d3-a58513abf135 | 7 | public static void main(String[] args)
{
try
{
if (System.getProperty("os.name").equals("Linux"))
{
for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels())
if ("Nimbus".equals(info.getName()))
{
UIManager.setLookAndFeel(info.getClassName());
... |
03a52262-b14c-451f-9ecb-4e55141a5078 | 2 | public double[][] rawCorrelationCoefficients(){
if(!this.dataPreprocessed)this.preprocessData();
if(!this.covariancesCalculated)this.covariancesAndCorrelationCoefficients();
return this.rawCorrelationCoefficients;
} |
cd2a2a8b-b73b-4350-838e-6cbad0101161 | 9 | public void renderSubScreens()
{
for (SubScreen ss : subScreens)
{
if(ss.isVisible())
{
ss.render();
int[] image = ss.pixels;
for (int x = 0; x < ss.getWidth(); x++)
{
for (int y = 0; y < ss.getHeight(); y++)
{
if (ss.getY() + y >= 0 && ss.getY() + y < height && ss.getX() + x ... |
8c0dd33e-282d-4d92-ad7e-8fdcc8f0dbbd | 9 | public static void setToolbarShortcut(String buttonName) {
if (buttonName.equals(Utility.getPropertyValue(Constants.billing))) {
button.setMnemonic(java.awt.event.KeyEvent.VK_B);
}
if (buttonName.equals(Utility.getPropertyValue(Constants.category))) {
button.setMnemonic(java.awt.event.KeyEvent.VK_C);
}
... |
7b5b32f8-c08f-4752-8636-17a719bdc24f | 9 | public void animate(){
// If we are moving right, then facing left is false
if (dx > 0) {
facingLeft = false;
} else if (dx < 0) {
facingLeft = true;
}
// If we aren't moving, then don't animate
// and set frame to right facing and not moving
// unless we are facing left, then face it left
if (dx ... |
8960d1e4-8004-4ca1-8e15-d808cec174e8 | 1 | @Test
public void test() {
GameConfiguration conf = new GameConfiguration();
conf.setAgentCount(1);
conf.setInitialFoodAmount(1);
conf.setFoodAmountIncrese(1);
conf.setHiddenLayers(1);
conf.setNodesPerHiddenLayer(1);
conf.setWorldSize(1000);
WorldDescriptor wd = new WorldDescriptor(conf);
try {
Fi... |
6600d809-a8ad-4d44-891d-ed1ffffed9a0 | 3 | public static String[] GetFileSystemList()
{
String sDisk[] = new String[]{"/","","","",""} ;
LOGGER.debug("Read CDiskSpaceUtil Properties");
try{
Configuration config = new PropertiesConfiguration("caspermon.properties");
for(int i=0 ; i<6 ; i++)
{
if(config.containsKey("diskutils.DISK"+... |
575cf435-24cf-4681-bbbb-18627c3a8be5 | 2 | public Reference getReferenceAlias(Reference ref) {
Reference alias = (Reference) aliasesHash.get(ref);
if (alias == null) {
Identifier ident = getIdentifier(ref);
String newType = getTypeAlias(ref.getType());
if (ident == null)
alias = Reference.getReference(ref.getClazz(), ref.getName(),
newTyp... |
455180be-7b2d-4905-b9ee-0161e572a18a | 0 | public String toString() {
String affiche = "message capteur";
return affiche;
} |
60ae8cd7-0b0f-4776-979d-e305d3e5132d | 6 | public List<NasdaqSymbolDto> getNasdaqSymbols() {
if (this.nasdaqSymbols == null || this.nasdaqSymbols.isEmpty()) {
this.nasdaqSymbols = new ArrayList<NasdaqSymbolDto>();
InputStream inputStream = null;
try {
URL url = new URL(NASDAQ_STOCK_LIST_CSV);
URLConnection connection = url.openConnection()... |
e6ea9a1d-717d-4b3d-989a-7f482bb9e052 | 2 | public void init() throws ELMException, IOException {
InputStream inputStream = _socketAdapter.getInputStream();
OutputStream outputStream = _socketAdapter.getOutputStream();
if (inputStream == null || outputStream == null)
throw new ELMException();
_connectionSingleton.setInputStream(inputStream);
... |
2aa537b2-8dcb-4e2b-9d7c-55b413bc6ebb | 1 | public static short readShort() {
short x = 0;
for (int i = 0; i < 2; i++) {
char c = readChar();
x <<= 8;
x |= c;
}
return x;
} |
21cfcd72-4b49-4657-86b5-8d6a4eb8c754 | 2 | public static void main(String[] args)
{
if (args.length != 1)
{
log.info("Unbundled usage: java PasswordStrengthIndicator <password>");
System.exit(1);
}
if (PasswordStrengthIndicator.isValidPassword(args[0]))
log.info("Password meets or exceeds defined security rules.");
else
log.info("Pas... |
332d2a8c-d91b-4e8d-9138-b3d27bef6feb | 0 | public HDFS() {
} |
d4c4f58f-9fdd-4216-b00c-0b319ae5c0c2 | 1 | @Override
public Auction bid(String username, int itemId) {
// searches.get(itemId));
Auction a = searches.get(itemId);
if(a != null){
a.setCurrentBid(a.getCurrentBid()+1);
a.setOwner(username);
// return a;
}
return a;
} |
da939443-38f1-4730-8434-96cf359c42d7 | 5 | static public Class<?> getTypeFromString(String str) {
str = str.trim();
// Does it contain anything other then numbers or a decimal point?
if (Pattern.matches("[\\d]+((([\\.]){1}[\\d]+)|(L))?", str)) {
if (str.contains(".")) {
return Double.TYPE;
}
if (str.contains("L")) {
return Long.TYPE;
... |
99c7a47a-6a2f-4012-a51c-84b8d905e32b | 9 | protected int require (int required) throws KryoException {
int remaining = limit - position;
if (remaining >= required) return remaining;
if (required > capacity) throw new KryoException("Buffer too small: capacity: " + capacity + ", required: " + required);
int count;
// Try to fill the buffer.
if (rem... |
41eb6929-85ef-45f0-a7b4-9a56d70a71ad | 5 | protected ArrayList<int[]> getCharacterSetList() {
ArrayList<int[]> alphabets = new ArrayList<int[]>();
if(allowAscii) alphabets.add(getAsciiCharArray());
if(allowSpaces) alphabets.add(getSpaceArray());
if(allowNumbers) alphabets.add(getNumericArray());
if(allowWhiteSpaces) alphabets.add(getWhiteSpaceArray())... |
6f4c6a01-b492-44ea-aab3-9f8afd31876b | 7 | private void printNaryRelHelp(ORASSNode node1, ORASSNode node2, String relName, int node2Index, List<String> entityOrder, CachedRowSet data, String id, int indentation) throws MainException{
try{
String table1 = node1.getName();
String table2 = node2.getName();
List<String> cols1 = keyMaps.get(table1);
Li... |
ddbde6ed-fbf7-461a-ac95-d770397a9f2b | 8 | public void TempData()
{
//Getting the Soil Information
String filename = "rainfall.cdf";
NetcdfFile ncfile = null;
try {
ncfile = NetcdfDataset.openFile(filename, null);
} catch (IOException ioe) {}
try{
String varName = "aprod";
Variable v = ncfile.findVariable(varN... |
e04bdcbe-2457-4c9c-b98e-b0e75f5cb8fa | 2 | public URL[] getUrls() {
URL[] urls = new URL[_elements.size()];
int index = 0;
for (File file : _elements) {
try {
urls[index++] = file.toURI().toURL();
} catch (MalformedURLException e) {
e.printStackTrace();
return new UR... |
a88bbd43-7695-468c-b102-2ccee1bd5815 | 8 | public List<String> findPath(String[] wordPair, Lexicon lexicon) {
// Null if the word pair is valid. Otherwise contains the invalid word(s)
List<String> isValidWordPair = lexicon.isValidWordPair(wordPair);
// Check to see if word pair is valid
if (isValidWordPair != null) {
// The word pair isn't vali... |
7249db33-fc71-4e3c-8057-3920b050e9c2 | 0 | public Point getCoords() { return loc; } |
2a689bf6-210e-4f9c-9992-e0b61351d441 | 7 | @Override
public void mousePressed(MouseEvent e) {
switch (global) {
case EditMode:
if (e.getButton() == MouseEvent.BUTTON1) {
switch (mode) {
case EditPoly:
//System.out.println("ASDASD");
... |
73506947-bba3-4b96-9079-e0bb142266df | 0 | public static void main(String[] args) throws IOException {
OutputStream out = new FileOutputStream("/tmp/filter.data");
BufferedOutputStream bos = new BufferedOutputStream(out);
// ZipOutputStream zip = new ZipOutputStream(bos);
DataOutputStream dos = new DataOutputStream(out);
dos.writeInt(10);
dos.w... |
694f8bef-2e40-4923-b2f2-6389f72f318c | 9 | private void postPlugin(final boolean isPing) throws IOException {
// The plugin's description file containg all of the plugin data such as name, version, author, etc
final PluginDescriptionFile description = plugin.getDescription();
// Construct the post data
final StringBuilder data =... |
c4d3fcc9-c76a-4631-b42d-b18a142ac400 | 8 | protected boolean verificarConvergencia() {
boolean converge = false;
for (int i = 0; i < this.matriz.linhas && !converge; i++) {
for (int j = i + 1; j < this.matriz.linhas && !converge; j++) {
if (this.criterioLinhas() && this.sassenfeld()) {
converge = true;
... |
e97515de-5a48-4d43-81ef-55b23d4e1028 | 1 | public boolean kontroliertNordamerika(Spieler s) {
boolean res = true;
if(!s.fraktion.equals(laenderGraph.getLaenderList().getLandByID(0).getOwner())) {
res = false;
}
return res; } |
b3367167-39ab-45ab-8d66-5c06df47f66f | 7 | private JSONWriter append(String string) throws JSONException {
if (string == null) {
throw new JSONException("Null pointer");
}
if (this.mode == 'o' || this.mode == 'a') {
try {
if (this.comma && this.mode == 'a') {
this.writer.write('... |
910ae48b-df98-438c-9081-34e03ca9f2ac | 1 | public ThreadSpiderTest(String hostName, String startSite, String dirPath, Cobweb spiderEngine) {
this.hostName = hostName;
this.dirPath = dirPath;
File indexDirectory = new File(dirPath);
if (!indexDirectory.exists()) {
indexDirectory.mkdirs();
}
this.spiderEngine = spiderEngine;
// ... |
1b203e24-a1e0-4738-82a8-1321a277ec66 | 0 | public void mouseEntered(MouseEvent e)
{
String str = "The mouse has entered the Frame !";
System.out.println(str);
} |
40432d7e-c1c2-43d7-8c12-89b055d71eb0 | 1 | public static GameInfo getInstance() {
if(instance == null)
instance = new GameInfo();
return instance;
} |
f813510b-3d0f-4024-92d0-8ce85842f414 | 0 | public POSTerminal () {
this.orderTotal = BigDecimal.valueOf(0);
this.products = new TreeMap<Character, Product>();
this.order = "";
this.lastErrors = new ArrayList<String>();
UUID idOne = UUID.randomUUID();
this.terminalID = idOne.toString();
} |
9442b38a-fdc9-4760-abe2-c1d548aaba76 | 8 | public int numDecodings(String s) {
if(s.length() == 0) return 0;
int[] num = new int[s.length()];
if(s.charAt(0)>'0')
num[0]=1;
else
num[0]=0;
for(int i=1; i<s.length(); i++)
{
int path1 = 0, path2=0;
if(s.charAt(i)>'0') path1 = num[i-1];
if((s.cha... |
6d39b280-fd97-4f5e-8ba1-325aa172d9a9 | 6 | public void run() {
for(int i = 0; i < 16; i++) {
for(int j = 0; j < 128; j++) {
for(int k = 0; k < 16; k++) {
BlockState block = chunk.getBlock(i,j,k).getState();
org.bukkit.Locati... |
6b9641a3-f8f6-408e-b49e-10b2a46a9a19 | 1 | public static int noRecursionFib(int position)
{
int num1, num2, num3;
num1 = -1; num2 = 1;
for (int i = 0; i <= position; i++)
{
num3 = (num1 + num2);
num1 = num2;
num2 = num3;
}//end for loop
return num2;
}//end method |
2813f2f5-5f62-47b2-9c35-6310ab5958f1 | 7 | private Scriptable js_getClass(Context cx, Scriptable scope, Object[] args)
{
if (args.length > 0 && args[0] instanceof Wrapper) {
Scriptable result = this;
Class<?> cl = ((Wrapper) args[0]).unwrap().getClass();
// Evaluate the class name by getting successive properties... |
6a9d7e6a-9942-47de-8e6c-5ffb42f42bff | 6 | private boolean checkALError()
{
switch( AL10.alGetError() )
{
case AL10.AL_NO_ERROR:
return false;
case AL10.AL_INVALID_NAME:
errorMessage( "Invalid name parameter." );
return true;
case AL10.AL_INVALID_ENUM:
... |
f56c9404-3003-4d64-9769-ebee9469ceaf | 9 | void compress( int init_bits, OutputStream outs ) throws IOException
{
int fcode;
int i /* = 0 */;
int c;
int ent;
int disp;
int hsize_reg;
int hshift;
// Set up the globals: g_init_bits - initial number of bits
g_init_bits = init_bits;
// Set up the ... |
e090c8f5-bcf5-4f6d-9823-fbba8549386f | 0 | public List findByAuther(Object auther) {
return findByProperty(AUTHER, auther);
} |
4d51cf8c-8718-432f-bf7c-b523d6d33d89 | 3 | public <T> T readValueFromJsonString(String response, Class<T> clazz) {
try {
return OBJECT_MAPPER.readValue(response, clazz);
} catch (JsonParseException e) { log.error("{}", e);
} catch (JsonMappingException e) { log.error("{}", e);
} catch (IOException e) { log.error("{}", e); }
return null;
} |
d672126f-f587-44c9-86bc-3ab5ccfbc11f | 7 | public LevelGen(int w, int h, int featureSize) {
this.w = w;
this.h = h;
values = new double[w * h];
for (int y = 0; y < w; y += featureSize) {
for (int x = 0; x < w; x += featureSize) {
setSample(x, y, random.nextFloat() * 2 - 1);
}
}
int stepSize = featureSize;
double scale = 1.0 / w;
dou... |
55d2d020-e060-4fa8-aef3-b66784267b6f | 4 | @Override
public void onAutoCompleteCreateReplacement(InterfaceController controller, SimpleAutoCompleteEntry entry) {
Construct construct = entry.create(mDocument, this.construct.parent);
ConstructEditor editor = mDocument.editorsFromConstruct(construct);
WeakReference<ConstructEditor> weakParentEditor = mBound... |
4b77c281-9c8f-4381-b790-9653e53af47e | 4 | public boolean equals(Object obj) {
if (!(obj instanceof Book))
return false;
Book book = (Book) obj;
return (this.ISBN == book.getISBN()
&& this.getTitle().equals(book.getTitle())
&& this.getAuthor().equals(book.getAuthor()) && this.getPrice() == book
.getPrice());
} |
cb0eed01-24cd-49cb-8517-51b9d7080c84 | 6 | public static void main(String[] args) {
roubaix = new City("Roubaix");
for (int i = 1; i < NUMBER_OF_INHABITANTS + 1; i++) {
Inhabitant p = new Inhabitant(("inhabitant_" + i));
roubaix.addInhabitant(p);
}
int week = 6;
for (int i = 1; i <= week; i++) {
for (int j = 0; j < 60; j++) {
System.out.p... |
fb7d501f-8083-4f88-ade5-07326c266c67 | 9 | public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while(true){
char[] s = sc.next().toCharArray();
if(s[0]=='0')break;
int a = 0;
int b = 0;
for(int i=1;i<s.length;i++){
if(s[i]=='A')a++;
else b++;
}
if(a>b)a++;
else b++;
System.out.println(a+" "+b);
... |
7ca3521e-80e7-497a-a1a3-c32fc96b16f8 | 7 | private boolean isStraight(Card[] h) {
boolean straight = false;
Card[] hand;
hand = h;
int startValue = hand[0].getValue();
// if statement to ensure that ace can be high or low (A2345 as well as
// 10JQKA are straights)
if (hand[0].getValue() == 0 && hand[1].getValue() == 9
&& hand[2].getValue() ==... |
7114016c-4d50-4f2a-9829-6f09eaaf9184 | 0 | public int getSequence_Id() {
return sequence_Id;
} |
2fbbe2ca-a361-4550-b0c0-ccdc27ffa479 | 2 | public void setMovingLeft(boolean isMovingLeft) {
this.isMovingLeft = isMovingLeft;
this.isMovingRight = isMovingLeft ? !isMovingLeft : this.isMovingRight;
this.xSpeed = !isMovingLeft ? 0 : this.xSpeed;
} |
6d9b2c5e-427b-4f60-be5c-4ab268089ce3 | 9 | public static void main(String[] args) throws ClassNotFoundException,
FileNotFoundException, IOException, InstantiationException,
IllegalAccessException {
resource = ResourceBundle.getBundle("data_en_EN");
if (!isArgsValid(args))
return;
boolean seeHints = false;
JarLoader jarClassLoader = n... |
643cc1ea-fe29-4a14-9085-86816a25094e | 7 | public static List<String> topologicalSort(Graph graph)
{
if(!graph.getDirected())
throw new UnsupportedOperationException("Graph is undirected");
int counter = 0;//To determine whether the graph is cyclic
LinkedList<Vertex> queue = new LinkedList<Vertex>();
LinkedList<Vertex> vertices = new LinkedList<Ver... |
e65d883e-f758-472a-9749-87956585fc04 | 7 | public Object invoke(Object proxy, Method method, Object[] args) {
/* Business method logic: this should implement it */
if (method.isAnnotationPresent(BusinessLogic.class))
return execMethod(this, method, args);
/* Getters */
if (CommonStatic.isAGetter(method)){
String mN = factory.getCache().fi... |
de569600-1380-4da5-ad1b-81dbe5749142 | 7 | private void sendBiColorLine(int[] pixels, int width, int y, int toX,
int toY, int c0, int c1, DisplayMessage m) {
int offset = y * width;
int count = 0;// number of contiguous pixels
int currentColor = pixels[offset];
Vector<Integer> counts = new Vector<Integer>();
// System.out.println("Analysing line")... |
83868322-047a-4aaf-97fa-a38525575df5 | 3 | private static void calcNoOfNodes(Node node) {
if (node instanceof Parent) {
if (((Parent) node).getChildrenUnmodifiable().size() != 0) {
ObservableList<Node> tempChildren = ((Parent) node).getChildrenUnmodifiable();
noOfNodes += tempChildren.size();
f... |
9b69c855-7831-4528-8f46-211b426a5223 | 5 | public StringEncryptor() {
// if there is not default key create one
if (StringEncryptor.defaultKey == null) {
try {
KeyGenerator keyGen = KeyGenerator.getInstance("AES");
keyGen.init(128);
StringEncryptor.defaultKey = (SecretKeySpec) keyGen
.generateKey();
} catch (NoSuchAlgorithmException ... |
ea504249-9c89-4310-a3ac-c8f737f58a0d | 7 | void leganim(int offset) {
if(world.isRemote)
if(onGround){
if(leganimstat){
leganim -=offset;
} else {
leganim +=offset;
}
if(leganim>52||leganim<15){
SoundHandler.playSound("/sound/effects/step/metal"+((int)(Math.random()*2)+1)+".wav");
leganimstat = !leganimstat;
if(leganim>52)leganim = 52... |
cac165bd-da5a-4ec1-88e0-dcd2bb10f4ee | 3 | public int getStrength() {
int sum = 0;
int[] weights = {0,1,10,50,600};
for (int i = 0; i < cl.length; i++) {
sum += (getScore(cl[i]) > 0) ? weights[Math.abs(getScore(cl[i]))] : -weights[Math.abs(getScore(cl[i]))];
}
return sum + (currentPlayer == PLAYER_ONE ? 16 : -16);
} |
ace5c922-453f-4134-bfe0-2f7939ee256c | 3 | public static Map<String, Player> createIdMap(Iterable<? extends Player> database, IdReader idReader) {
Map<String, Player> mergeMap = Maps.newHashMap();
for (Player p : database) {
String key = null;
try {
key = idReader.getId(p);
} catch (Exception e... |
aca0d357-38a6-428f-97c9-bc3952affcdd | 6 | public final SymbolraetselASTSolver.number_return number() throws RecognitionException {
SymbolraetselASTSolver.number_return retval = new SymbolraetselASTSolver.number_return();
retval.start = input.LT(1);
CommonTree syms=null;
List list_syms=null;
try {
// C:\\Use... |
774e3e03-8405-462c-9a08-ef4dc52c1001 | 2 | private synchronized int getNextIdAndIncrement() {
int nextId = 0;
try (Connection connection = DriverManager.getConnection(connectionString);){
Statement statement = connection.createStatement();
ResultSet rs = statement.executeQuery("select max(id) as maxRec from recipe");
if (rs.next()) {
nextId = r... |
2d20af2d-bd59-4586-b324-ec0400d3da7e | 6 | public static UndirectedGraphNode cloneGraph(UndirectedGraphNode node) {
if(node == null) {
return node;
}
Queue<UndirectedGraphNode> nextNode = new LinkedList<UndirectedGraphNode>();
boolean[] created = new boolean[10000];
for(int i=0;i<10000;i++) {
created[i] = false;
... |
320c16f9-bba8-4263-b1b0-54678157f72b | 8 | public void eliminarMaterialImproprioCompartilhado(Artigo art) {
String palavra = " RR ";
List<Artigo> artigosRemover = new LinkedList<Artigo>();
for (int i = 0; i < artigo.size(); i++) {
if ((artigo.get(i).getResumo().contains(palavra) || artigo.get(i)
.getResumo().equals("RR"))
|| (artigo.get(i).g... |
13882fd9-2c98-4d70-94f5-35688cd187e1 | 6 | protected Context generateContext(Context parent)
{
final Context funcContext = new Context(returnType.getName(), parent);
Block block = (Block) children.get(0);
for (AbstractSyntaxNode child : block.getChildren())
{
if (child instanceof Creation)
{
... |
42a268a3-46a4-40ac-b333-5d2e196795bf | 2 | public boolean isGhost(Player player) {
return player != null && hasPlayer(player) && ghosts.contains(player.getName());
} |
93cf6934-2a5f-453d-ab28-34b483ab17f1 | 4 | public void loadOrFail(final String fileName) throws IOException {
// set the current picture's file name
this.fileName = fileName;
// set the extension
int posDot = fileName.indexOf('.');
if (posDot >= 0) {
this.extension = fileName.substring(posDot + 1);
}
// if the current title is null use the fi... |
0d3d0f7a-be48-42b3-bf6d-d26e605191b8 | 5 | public Bucket split() {
int mc = -1;
int maxDiff = Integer.MIN_VALUE;
for (int c = 0; c < 3; c++) {
int diff = maxC[c] - minC[c];
if (diff > maxDiff) {
maxDiff = diff;
mc = c;
}
}
final int fmc = mc;
Collections.sort(colors, (o1, o2) -> Col... |
048b6a03-e0e7-4942-a535-92b6b469fd1a | 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... |
8f8b1cc0-2fee-4192-befd-e81d0f7e8bce | 0 | public String getNom() {
return nom;
} |
c3c2c17a-7be4-4f25-9534-943217b8c068 | 6 | public T elementAt(int index) throws Exception
{
if(this._source instanceof List<?>)
{
return ((List<T>)this._source).get(index);
}
else if(this._source instanceof ArrayIterable<?>)
{
return ((ArrayIterable<T>)this._source).getSource()[index];
}
else
{
int i = 0;
for(T item : this._source)
... |
41c568b5-6266-4151-879c-0ed276947073 | 9 | public void addMaquina(AbstractRolamento r, String s)
{
if(s.equals("Torno") )
{
for(torno t : maquinaTorno)
{
if(t.getStatus()==0)
{
t.addRolamento(r);
t.setStatus(1);
break;
}
}
}
if(s.equals("Fresa") )
{
for(fresa f : maquinaFresa)
{
if(f.getStatus()==0)... |
f697ee3b-8f98-4271-9253-ceebdf027c1b | 1 | public static synchronized BoxedDropShadowBorder get() {
if (INSTANCE == null) {
INSTANCE = new BoxedDropShadowBorder();
}
return INSTANCE;
} |
4211fdab-f48e-4dcf-8274-d6222ea8953e | 2 | @Override
public void shutdown() {
FileUtil.setProtection(this.authuiSystemfilePath, true);
FileUtil.setProtection(this.basebrdSystemfilePath, true);
if (Files.exists(Constants.PROGRAM_TMP_PATH, LinkOption.NOFOLLOW_LINKS)) { // and deletes the temporary files.
try {
... |
b6d4feb0-123c-406f-a6f4-3aa00dd8bd1f | 0 | private void onCorrect()
{
isCorrect = true;
dispose();
} |
969a47d6-b01b-4992-92d0-f5b43f4da01e | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Userpass)) {
return false;
}
Userpass other = (Userpass) object;
if ((this.username == null && other.username !... |
df60b238-b7e8-4bb7-b9d0-1eb0b753286b | 8 | private State run2(final String program, final State s) {
String java = convert2Java(program, s instanceof StatusState);
StringBuilder builder = new StringBuilder();
builder.append(
"import de.vonloesch.brainfuck.State;import de.vonloesch.brainfuck.StatusState;\npublic class Hell... |
574c16c5-1253-432c-a588-ebb963dba45c | 6 | public Node reverseAlter2KNodes(Node head, int k){
//process 2K nodes at a time
//reverse till k nodes and set the the pointer to k+1
int x = k;
Node moving = head;
Node head_prev = null;
Node head_next = null;
while(x>0 && moving!=null){
head_next = moving.next;
moving.next = head_prev;
head_p... |
24e3700e-ab12-40ae-8a8d-75d7f2ba0802 | 0 | public OpenAction() {
super("Open...", null);
putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_O,
MAIN_MENU_MASK));
this.fileChooser = Universe.CHOOSER;
//this.fileChooser = new JFileChooser (System.getProperties().getProperty("user.dir"));
} |
70f30132-1fc8-4252-aa74-8fd10172e0e3 | 6 | public int largestRectangleArea(int[] height) {
Stack<Integer> stack = new Stack<Integer>();
int i = 0;
int maxArea = 0;
//push in order, increase
//if smaller than previous one, pop and calculate
while (i < height.length) {
if (stack.isEmpty() || height[stac... |
9e81b922-5c1c-4d6a-b425-a447e74d0733 | 6 | @Override
public boolean hasData() {
if (this.windowSize == null &&
this.windowLocation == null &&
this.horizontalDividerLocation == 0 &&
this.verticalDividerLocation == 0 &&
this.selectedEntryTab == 0 &&
this.selectedE... |
4660df2c-d4ad-4818-9956-93d60d4787bb | 4 | public boolean adicionarProduto(Produto p) throws ExceptionGerenteEstoque {
if(p.getNome() == null || p.getCodigo() == null){
throw new ExceptionGerenteEstoque("Nome ou Codigo n��o inicializados");
}
if (!contensProduto(p.getCodigo()) && !contensProduto(p.getNome())) {
re... |
6d65a340-4c5d-438b-b1f8-723227308d60 | 4 | public void addEvent(Job event) throws Exception{
if(!(event instanceof DatedEvent) || !(event instanceof SimpleEvent)){
throw new IllegalEventTypeException();
}
if(event instanceof DatedEvent){
if(((DatedEvent)event).getDate().before(new Date(System.currentTimeMillis()))... |
75ac0ccf-34aa-4af9-8f8f-e4cd84c5e830 | 1 | public Object getConstValue() {
if (Debug.enabled)
Debug.check(constValue!=null);
return constValue;
}; |
16939451-c288-42e2-b1f0-3e49b174ddde | 8 | public static void UTF8toUTF16(final byte[] utf8, final int offset, final int length, final UTF16Result result) {
final int end = offset + length;
char[] out = result.result;
if (result.offsets.length <= end) {
int[] newOffsets = new int[2*end];
System.arraycopy(result.offsets, 0, newOffsets, 0... |
812ac100-f553-4665-ad55-2a5f93a10d2a | 8 | private Result pStructureDeclaration(final int yyStart) throws IOException {
Result yyResult;
int yyBase;
int yyRepetition1;
boolean yyRepeated1;
int yyOption1;
String yyOpValue1;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternati... |
2a2b1caf-15d1-42f0-8153-0d414beecc25 | 5 | public void setState(int state) {
this.state=state;
// Change the status label
if (state==1) theApp.setStatusLabel("Start Tone Hunt");
else if (state==2) theApp.setStatusLabel("Sync Hunt");
else if (state==3) theApp.setStatusLabel("Sync Found");
else if (state==4) theApp.setStatusLabel("Decoding");
else i... |
95916398-0e0f-440d-b072-a664d804bb65 | 5 | public static void main(String[] args) {
Client client = new Client();
try {
client.setDaemon(true);
client.setPriority(NORM_PRIORITY);
client.start();
System.out.print("Please enter your name:");
client.out.println("");
while (!cl... |
3fb29f13-c9aa-49d7-a8fa-e57d2a68e014 | 9 | private synchronized void handleConnectionProperty(INDISwitchElementAndValue[] newEvs, Date timestamp) {
for (int i = 0 ; i < newEvs.length ; i++) {
INDISwitchElement el = newEvs[i].getElement();
SwitchStatus s = newEvs[i].getValue();
if (el == connectedE) {
if (s == SwitchStatus.ON) {
... |
ef869ee0-68d9-4f1b-a5fa-6122ca564df0 | 8 | protected void _putcatalog() {
this._out("/Type /Catalog"); //$NON-NLS-1$
this._out("/Pages 1 0 R"); //$NON-NLS-1$
if ((this.zoomMode == null) && (this.zoomFactor > 0)) {
this._out("/OpenAction [3 0 R /XYZ null null " //$NON-NLS-1$
+ this.zoomFactor / 100 + "]"); //$NON-NLS-1$
} else if (Zoom.FULLPAGE.e... |
1724079a-ab6d-44fd-8a0c-a8debadf76db | 2 | public static Performance getLatest(Connection con)
{
Performance perf = null;
try
{
ResultSet result = con.createStatement().executeQuery(
"SELECT ID FROM " + tableInfo.tableName + " ORDER BY LastFail DESC { LIMIT 1 }");
result.next();
perf = new Performance(con, result.getString(1));
result.... |
9fdc3f29-1995-4a5c-a245-1bbdfd1cfb30 | 9 | public static Hand evaluate(List<Card> sourceCards) {
final Holder<Hand> handHolder = new Holder<Hand>();
final HandCombinationSink handCombinationSink = new HandCombinationSink() {
@Override
public void setBestHand(Hand hand) {
assert handHolder.value == null;
... |
cf14cf5f-a44a-44bb-9587-564de7588700 | 9 | public boolean write() throws IOException {
SelectionKey key = this.channel.keyFor(this.nioEngineImp.getSelector());
if(currentStateWrite == WRITING_DONE){
if(listBuffer.size() > 0){
bufferWrite = listBuffer.get(0);
listBuffer.remove(0);
bufferWrite.position(0);
lengthBufferWrite.position(0);... |
abfa9f3a-ef6c-4ca9-a2d8-e8483092ccec | 1 | @Test (expected = IllegalArgumentException.class)
public void testEmptyTypes() throws IOException {
List<Class<?>> types = new ArrayList<>();
Table table = provider.createTable("simple", types);
} |
f8f67ae0-df50-496e-b984-453468056fd3 | 3 | private void btnAceptarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAceptarActionPerformed
for (int i = 0; i < Obj.principal.mes[Obj.principal.mesActual].getN(); i++) {
Obj.principal.diaActual = i;
Obj.principal.mes[Obj.principal.mesActual].dia[i].calHoras(Obj.p... |
39d131b1-8923-4068-b734-36bc435cf7e0 | 8 | private String biGramUnderWord(char word, String spelling) {
char[] words1 = new char[1];
words1[0] = word;
char[] words2 = findWaitingWords(spelling).toCharArray();
char word1 = ' ';
char word2 = ' ';
if(words1.length < 1 || words2.length < 1) {
System.out.println("spelling Error: biGram()");
return ... |
f3f4520e-a295-4a00-9cbe-1376f1847686 | 7 | public static boolean createDefaultTradingStrategy(String name,
ArrayList<String> ruleList) {
initialise();
// Check ts name is unique
boolean uniqueName = true;
for (TradingStrategy ts : strategyList) {
if (ts.getName().equals(name) && ts.getUserAccount() == null) {
uniqueName = false;
}
}
... |
10ff5cf4-d2ef-4dd8-99f7-646c6944e772 | 7 | public JsonWriter value (Object value) throws IOException {
if (current != null) {
if (current.array) {
if (!current.needsComma)
current.needsComma = true;
else
writer.write(',');
} else {
if (!named) throw new IllegalStateException("Name must be set.");
named = false;
}
}
if (v... |
e634deb9-76b4-4dbc-a79a-9c42b1d5e852 | 9 | public void load(InputStream input, int size) throws IOException {
this.size = size;
if (input == null) {
throw new IllegalArgumentException("input cannot be null.");
}
readTableDirectory(input);
if (headOffset == -1) {
throw new IOException("HEAD table no... |
785ae383-48a7-47ac-9ce2-a25665990a9f | 0 | public String[] getPathArray()
{
return pathArray;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.