method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
bf9cff3d-278b-4142-81b3-7c2ddebae49f | 9 | private void setUpPrettyFullBuffers(final int type, final int valueLength, boolean discontinuous)
throws PersistitException {
b1.init(type);
b2.init(type);
final boolean isData = type == Buffer.PAGE_TYPE_DATA;
int a, b;
// load page A with keys of increasing length
... |
bcc7f7b6-bedd-4982-883f-f3efd78ca045 | 1 | @Test
public void testContactIDs()
{
testSetUp();
cmInst.addNewContact("new contact", "new contact notes");
Set<Contact> thisSet = cmInst.getContacts(2, 8);
Set<Contact> thatSet = cmInst.getContacts("Syd");
// IDs 2 and 8 are two contacts
Assert.assertEquals(2, thisSet.size());
// two contacts con... |
f3682511-c9ae-4053-b350-eb18ba663473 | 4 | public static boolean downloadPage(String path)throws HttpException,IOException{
InputStream input=null;
OutputStream output=null;
//õpost
PostMethod postMethod=new PostMethod(path);
//postIJ
NameValuePair[] postData=new NameValuePair[2];
postData[0]=new NameValuePair("name","lietu");
postData[1]=n... |
55277e72-bfd9-4647-8557-066b98f08130 | 2 | public static <T extends Number> T toNumber(Number number, Class<T> target) {
if (number == null) {
return null;
}
try {
return target.getConstructor(String.class).newInstance(number.toString());
} catch (Exception e) {
throw new RuntimeException(e);
}
} |
6521ec0b-cb61-4c46-b4f9-393ce46ca34f | 0 | public SummaryRanges() {
} |
7af5a4ba-f7ec-4a11-bb92-6589eecfe553 | 9 | private OutRec GetLowermostRec(OutRec outRec1, OutRec outRec2) {
// work out which polygon fragment has the correct hole state ...
if(outRec1.bottomPt == null)
outRec1.bottomPt = GetBottomPt(outRec1.pts);
if(outRec2.bottomPt == null)
outRec2.bottomPt = GetBottomPt(outRec2.pts);
OutPt bPt1 = outRec1.bottom... |
440213dc-1f5c-4646-b910-9296267a1145 | 8 | public int[][] init() {
int[][] binds = new int[17][9];
for (int[] row : binds)
Arrays.fill(row, Engine.INVALID);
for(int i = 0; i < hexList.size(); i++) {
Hex h = hexList.get(i);
int code = Engine.BLANK;
if(i == 0 || i == 32 || i == 53 )
code = Engine.RED;
else if( i == 4 || i == 25 || i ==... |
0fb29411-f4cf-4099-8442-5b92f633f201 | 1 | public static void main(String[] args) {
// Colection of CreditCards
ArrayList<CreditCard> cards = new ArrayList<CreditCard>();
// Our CreditCard objects
CreditCard card1 = new CreditCard("Madalin Ignisca", 2500);
CreditCard card2 = new CreditCard("John Doe", 1400);
CreditCard card3 = new CreditCard("Jane... |
40f3afc2-a6e1-4fea-821c-06a04b239511 | 3 | public static String getVariableThatBelongsInUsefulVariableSet(
Grammar grammar, Set set) {
String[] variables = grammar.getVariables();
for (int k = 0; k < variables.length; k++) {
if (belongsInUsefulVariableSet(variables[k], grammar, set)
&& !set.contains(variables[k]))
return variables[k];
}
r... |
586d23f3-fe9d-4f1f-a2ad-1a020ae01c12 | 9 | void run(){
Scanner sc = new Scanner(System.in);
h = sc.nextInt(); w = sc.nextInt(); N = sc.nextInt();
char[][] m = new char[h][], t = new char[h][w];
for(int i=0;i<h;i++)m[i]=sc.next().toCharArray();
boolean ok = false;
for(int i=0;i<h&&!ok;i++)for(int j=0;j<w-1&&!ok;j++){
if(m[i][j]!=m[i][j+1]){
fo... |
c6a40707-4de3-4b15-b6c1-b7763fac308b | 7 | private static String guessNested(String mvcName) {
StringBuffer result = new StringBuffer(mvcName.length());
char[] source = mvcName.toCharArray();
for (int i =0; i < source.length; i++) {
char ch = source[i];
if (Character.isUpperCase(ch)) {
// customerName -> customer.name
result.append("." + Cha... |
7d8d2ae7-9fd8-41e9-b5f0-c64e60d10a97 | 2 | public Object getVariable(String name) {
if(variables.containsKey(name)) {
return variables.get(name);
}
else if(parent!=null) {
return parent.getVariable(name);
}
else
throw new RuntimeException("Variable <" + name + "> undefined");
} |
43990c2f-1ad1-4dc2-b0ce-9758bd89a0f2 | 3 | public void display() {
// Instantiate an Entry
BufHTEntry cur;
System.out.println("HASH Table contents :FrameNo[PageNo]");
// Interate through the Page Table array
for (int i = 0; i < HTSIZE; i++) {
System.out.println("Array Index: " + i);
if (ht[i] != null) {
// ... |
e499bd2f-4ba8-434b-90ab-0bef9f61399b | 1 | public void add(final LocalExpr use, final Instruction inst) {
final Node def = use.def();
if (def != null) {
map.put(inst, def);
}
} |
eb232d0d-4bad-40ff-8f5d-2eced1c774f7 | 5 | public void merge (int[] array, int a, int b, int x, int y, int w) {
int i = a, j = x;
int temp = 0;
while (i<=b && j <= y) {
if (array[i] < array[j]) {
temp = array[i];
array[i] = array[w];
array[w] = temp;
... |
c75c6aff-b090-4803-a8a5-0455e6b586d5 | 9 | private int evalFunctions(List<Token> formula, int offset, int length) {
for (int i = offset + length - 2; i >= offset; i--) {
for (Function function : Tokens.function(formula.get(i))) {
if (i == offset ||
(!(formula.get(i - 1) instanceof NumberToken) &&
... |
fb429f50-d9cc-4944-a8f2-2708c667368f | 0 | public DiagnosticoFacade() {
super(Diagnostico.class);
} |
85a7305d-54c7-429f-862e-91f17019de0e | 6 | private void processSuperClazzes(Class<?> clazz) {
List<Class<?>> superClazzes;
superClazzes = new ArrayList<Class<?>>();
while (clazz != null && clazz != this.getUpToClass()) {
superClazzes.add(clazz);
clazz = clazz.getSuperclass();
}
for (int i = superClazzes.size() - 1; i >= ... |
f0f38843-2c86-471d-a664-2e6f3b355af6 | 5 | public static void main(String[] args) throws UnknownHostException,
IOException {
int localVersion = getLocalVersion();
if (localVersion == -1
|| !InetAddress.getByName(SERVER).isReachable(5000)
|| (args.length > 1 && args[1].equals("ultraulf"))) {
System.out.println("Starting local version.");
st... |
8b402d2c-ff1e-4807-908c-6c400fb1ceaf | 2 | protected void saveFile() {
List<Variable> variableList = obfuscator.getProjectVariableList();
if (variableList != null) {
String fileName = saveFileDialog();
if (fileName != null) {
int fileSize = McbcFileUtils.saveVariableList(fileName, variableList);
MessageDialog.displayMessageDialog(this, "INFORM... |
a9d8f046-c350-43bf-9f12-13525f0dbd63 | 1 | @Test
public void validateBudgetBreakdownThrowExceptionIfNull() {
Budget budget = createAnnualBudget("Annual Budget", new BigDecimal("2000"));
try {
calculateBudgetBreakdown.calculateBreakdown(budget, null);
fail("BudgetBreakdown Object Is Null.");
} catch(Exception... |
2f1bc90f-e5c5-4417-b82b-d660c7a09a65 | 3 | private static Method getMethod (Class<?> clazz, String method)
{
for (Method m : clazz.getMethods())
{
if (m.getName().equals(method))
{
return m;
}
}
return null;
} |
791685aa-b6bb-4959-a935-bc47880eb650 | 8 | public static boolean checkInterrupts() {
if (NMIEnable && intVBlank) {
if (!Settings.isTrue(Settings.CPU_ALT_DEBUG)) {
Log.debug("Running vblank handler: " + Integer.toHexString(Core.mem.get(Size.SHORT, 0, 0xFFEA)));
} else {
Log.instruction("*** NMI");
}
stackPush(Size.BYTE, pbr.getValue())... |
9a4c1a30-6061-477f-a7f3-3eeeec046287 | 0 | public List findByPassword(Object password) {
return findByProperty(PASSWORD, password);
} |
7b269add-5209-424e-a8e9-38abe508f325 | 2 | public Metrics(final Plugin plugin) throws IOException {
if (plugin == null) {
throw new IllegalArgumentException("Plugin cannot be null");
}
this.plugin = plugin;
// load the config
configurationFile = new File(CONFIG_FILE);
configuration = YamlConfiguratio... |
0a716653-53ff-4869-9328-32c7649ece3c | 4 | private void showStorage (StringBuffer buf, boolean external)
throws IOException
{
int temp = rio.getFreeMemory (external);
MemoryStatus mem = rio.getMemoryStatus (external);
// basic memory statistics
buf.append ("<em>");
buf.append (external ? "SmartMedia" : "Built-in Memory");
buf.append ("</em>");
... |
f25183c2-d4c7-419e-9eba-10b89976ed0d | 0 | @Override
public void setBoard (Board board){
field=board;
} |
da086da6-8f3d-4c81-9009-a5d67f380d59 | 0 | */
private static int randomDirection() {
return (int) (Math.random() * Direction.values().length);
} |
a37826b2-2eb8-4c59-84f1-4137c288a99c | 7 | public double target(double[] x, double[][] X, int rowpos, double[] Y){
double y = Y[rowpos], result=0;
for(int i=0; i < X.length; i++){
if((i != rowpos) && (X[i] != null)){
double var = (y==Y[i]) ? 0.0 : Math.sqrt((double)m_Dimension - 1);
double f=0;
for(int j=0; j < m_Dimension... |
bf1e17fd-be0f-4fe4-bb1b-2b48edb56be9 | 2 | public static void loadAllAchievements() {
String statement = new String("SELECT * FROM " + DBTable + " WHERE type = ?");
PreparedStatement stmt;
try {
stmt = DBConnection.con.prepareStatement(statement);
stmt.setInt(1, QUIZ_TAKEN_TYPE);
ResultSet rs = stmt.executeQuery();
while (rs.next()) {
Quiz... |
4635ac64-fcec-4669-b4e4-d8bc11d36aa4 | 2 | private void updateTitle(){
File file = getProgram().getFile();
String title;
if (file != null){
title = file.getName();
} else {
title = "Unsaved Program";
}
if (getProgram().isDirty()){
title+=" *";
}
setTitle("LOGO - "+title);
} |
6084d3ab-61ea-41c5-a80a-7b274f5cca9e | 2 | public void setAppliedVoltage(double voltage){
this.appliedVoltage = new Complex(voltage, 0.0D);
this.appliedVoltageError = new Complex(0.0D, 0.0D);
this.appliedVoltageSet = true;
if(this.referenceSet && this.frequenciesSet)this.calculateExperimentalImpedances();
} |
5d1e2061-993d-48f8-a212-86fdd8a02e4e | 4 | public static String substringBeforeLast(String sourceStr, String expr) {
if (isEmpty(sourceStr) || expr == null) {
return sourceStr;
}
if (expr.length() == 0) {
return sourceStr;
}
int pos = sourceStr.lastIndexOf(expr);
if (pos == -1) {
return sourceStr;
}
return sourceStr.substring(0, pos);
... |
a25a9510-1c09-4caa-a404-1cafa6d31a5b | 3 | public void actionPerformed(ActionEvent e) {
Grammar grammar = environment.getGrammar();
if (grammar == null)
return;
if (grammar.getProductions().length == 0) {
JOptionPane.showMessageDialog(Universe
.frameForEnvironment(environment),
"The grammar should exist.");
return;
}
// Create the i... |
e4afe280-5b42-4bf3-a9bf-396b72db60fd | 2 | public Game build() {
if (rolls_list.isEmpty()) {
throw new AnyRollToPlay();
}
if (player_list.size() < 2) {
throw new NotEnoughtPlayersToPlay();
}
return new Game(this);
} |
d51aa091-eda0-4af2-bf2b-3bda2b37ae3d | 7 | public static boolean nodeEquals(Node<Integer, String> a,
Node<Integer, String> b) {
Deque<Tuple<Node<Integer, String>, Node<Integer, String>>> nodesToVisit
= new ArrayDeque<Tuple<Node<Integer, String>, Node<Integer, String>>>();
nodesToVisit.addLast(new Tuple<Node<Integer, String>, Node<Integer, ... |
489da7b4-2a69-41d3-95c0-3a3ef540ac93 | 2 | public static GUIAbsTemplate getInstance(){
switch(showGUITypeAsk()){
case 0:
return GUIAbsTemplate.getChainInstance(GUIImplCommandLine.getInstance());
case 1:
return GUIAbsTemplate.getChainInstance(GUIImplGPopupWindow.getInstance());
default:
... |
0339a99e-5a44-4617-b4f6-65755d64b710 | 4 | private String[] getNameFromCookie(Cookie[] cookies){
String name = "";
if(cookies != null){
for (Cookie ck : cookies) {
if ("CILOGON-USER_NAME".equals(ck.getName()) && !ck.getValue().equals("")) {
name = (String)ck.getValue();
}
}
return name.split(" ");
}
return null;
} |
6b32cef7-1438-4476-a06d-7bac9dec8501 | 7 | boolean validateMove(movePair movepr, Pair pr) {
// This is also from dumbPlayer, and seems like something we won't have to use
Point src = movepr.src;
Point target = movepr.target;
boolean rightposition = false;
if (Math.abs(target.x-src.x)==Math.abs(pr.p) && Math.abs(target.y-src.y)==Math.abs(pr.q)) {
ri... |
f7fa2623-d023-4929-a317-846faf47c065 | 1 | public static void playSound(String path){
try {
Clip clip = AudioSystem.getClip();
InputStream is = GameManager.class.getResourceAsStream(path);
BufferedInputStream bIs = new BufferedInputStream(is);
AudioInputStream aIs = AudioSystem.getAudioInputStream(bIs);
clip.open(aIs);
clip.start();
}
ca... |
a029edda-4736-4e23-b9ac-5141b5065e77 | 2 | private <T> T[] ensureIndex( T[] array, int index, T ... emptyArray )
{
if (array == null)
{
array = Arrays.copyOf( emptyArray, index + 1 );
}
else if (index >= array.length)
{
array = Arrays.copyOf( array, index + 1 );
}
return array;... |
fc221b16-0370-463c-86ab-9897df895aa7 | 6 | public boolean deplacementPossible(Point2D point) {
Path2D p = _bateau.boundingsPosition(point);
boolean dansEau = false;
boolean dansShape = false;
for(Forme forme:_formes) {
if(forme.getPathOriginal().intersects(p.getBounds2D())) {
if (forme.getTypeForme()==... |
b668d7ce-113c-4e96-b0ed-615b5b432fcb | 7 | private RdpPacket_Localised receiveMessage(int[] type, Options option,
Rdp rdpLayer) throws IOException, RdesktopException,
OrderException, CryptoException {
// logger.debug("ISO.receiveMessage");
RdpPacket_Localised s = null;
int length, version;
next_packet: while (true) {
// logger.debug("next_pack... |
0804f469-81c3-45cb-8c63-f8f95499bdef | 1 | public static float[] normalize(float[] arr){
float sum = sum(arr);
for (int i = 0 ; i < arr.length; i++){
arr[i] = arr[i] / sum;
}
return arr;
} |
6734d4c2-f7be-4e1b-b84c-ef60ddb1bdec | 9 | @Override
public void caseADeclSeDefinicaoComando(ADeclSeDefinicaoComando node)
{
inADeclSeDefinicaoComando(node);
if(node.getSe() != null)
{
node.getSe().apply(this);
}
if(node.getLPar() != null)
{
node.getLPar().apply(this);
}
... |
683cfd25-94e8-4425-8b90-966e82eacedd | 9 | private boolean binarySearch(int[] A, int start, int end, int target) {
if (start > end) {
return false;
}
int middle = start + (end - start) / 2;
if (A[middle] == target) {
return true;
}
// Find the correct sequenc... |
93975734-edcc-468f-9eb6-2f3b93018b00 | 4 | private boolean checkLineForm(String line, int parameterNumber)
{
switch(parameterNumber)
{
case 0:
if(line.indexOf(FIRST_PARAMETER) == 0)
return true;
else
return false;
case 1:
if(line.indexOf(SECOND_PARAMETER) == 0)
return true;
else
return false;
default:
return false;
}... |
c9645e16-7e05-4c40-bf33-6507491958af | 8 | public static long getSize(Object object) {
if (object == null) {
return 0;
} else if (object instanceof SizeObject) {
return ((SizeObject) object).getSize();
} else if (object instanceof Boolean) {
return 1;
} else if (object instanceof String) {
... |
8adfce99-0794-4ce2-9f32-55fde35a053d | 4 | private DragSource createTableDragSource(final Table table) {
DragSource dragSource = new DragSource(table, DND.DROP_MOVE | DND.DROP_COPY);
dragSource.setTransfer(new Transfer[] { FileTransfer.getInstance() });
dragSource.addDragListener(new DragSourceListener() {
TableItem[] dndSelection = null;
String[] s... |
f7d0baa3-9d1e-4a93-82d4-5c93e8b3dba5 | 6 | static public short getCRC(byte[] buf, int len)
{
short i;
short crc = 0x7fff;
boolean isNeg = true;
for(int j = 0; j < len; j++) {
crc ^= buf[j] & 0xff;
for (i = 0; i < 8; i++) {
if ((crc & 1) == 0) {
crc >>= 1;
if (isNeg) {
isNeg = false;
crc |= 0x4000;
}
} else {
... |
9e36311e-29a5-407f-9492-708a61aafcf8 | 6 | public ArrayList<Node> extractComponent(ArrayList<Node> in, int n){
Set<Integer> S = new HashSet<>();
ArrayList<Integer> D = new ArrayList<>();
int d;
D.add(n);
Node N;
int p;
while(!D.isEmpty())
{
d = D.remove(0);
S.add(d);
... |
3da9e6a4-8b76-4746-9aff-efbf95fe8f54 | 1 | public FunctionalList rest() {
FunctionalArrayList output = new FunctionalArrayList();
for (int i = 0; i < size(); i++) {
Object currentElementValue = array[i];
output.add(currentElementValue);
}
output.remove(0);
return output;
} |
5a65bc2b-4b4a-4345-8848-ee32d42d4d53 | 9 | @Override
public boolean equals(Object obj)
{
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
final Parameter that = (Parameter) obj;
i... |
37b59cc2-453e-4431-a3cf-3b15dcd80662 | 5 | protected void take(Player winner, Player loser, int amount,boolean ron)
{
if (amount % 100 != 0)
amount = amount + 100 - (amount % 100);
String claimer=winner.name;
if(!winner.in || !ron){
claimer=Console.POT;
}
if(winner.score < 0){
if(amount+winner.score <=0){
claimer=Console.POT;
}
... |
fd819831-4413-4d8f-9216-0f79b21d925d | 5 | public static List<List<Integer>> levelOrder(TreeNode root) {
List<List<Integer>> res = new ArrayList<List<Integer>>();
List<TreeNode> stack = new ArrayList<TreeNode>();
int start = 0;
int end = 0;
if (null != root) {stack.add(root);end = 1;}
while (end > start) {
L... |
66e9488a-4dcc-4812-a0a9-3a353d2b10d1 | 4 | public HashMap<Integer, Integer[]> countOfPassengerOnEveryStation(Train train) {
log.debug("Start countOfPassengerOnEveryStation select");
List stationFrom = em.createQuery("select station.id, 0, count(ticket.id), schedule.seqNumber " +
"from Train train " +
"left join tr... |
44f293b2-9727-4d55-bc94-14816a64d6f2 | 3 | private void loadDomain(String domaine_selection) {
try {
ObjectInputStream input_domain = new ObjectInputStream(new FileInputStream(domaine_selection+FILE_EXTENSION));
domaine = (Domaine) input_domain.readObject();
input_domain.close();
} catch (FileNotFoundException e) {
javax.swing.JOptionPane.showMe... |
8f1b2ea8-89c2-425d-813d-4079dafca872 | 1 | public int minX() {
int m = coords[0][0];
for (int i = 0; i < 4; i++) {
m = Math.min(m, coords[i][0]);
}
return m;
} |
5482953a-278b-459c-9a31-4033ea86acd4 | 0 | @Override
public void getUsernameFromUI(String username) {
this.username = username;
ClientFinder.init(username, interfaceName);
} |
246e1d47-349c-4f55-beef-bd29fdec9a81 | 9 | private boolean jj_scan_token(int kind) {
if (jj_scanpos == jj_lastpos) {
jj_la--;
if (jj_scanpos.next == null) {
jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken();
} else {
jj_lastpos = jj_scanpos = jj_scanpos.next;
}
} else {
jj_scanpos = jj_... |
2c8fc0ca-bfca-45de-bbde-2fd8723e090b | 5 | public void print() {
// prints the BigInt as a integer
int len = this.length();
if(len == 0) {
System.out.println("0");
return;
}
for(int i = len - 1; i >= 0; i--) {
String zfill = "";
for(int j = power_ - 1; j > 0; j--) {
if(getDigit(i).value() < (long)Math.pow(10, ... |
1a20eb52-32c5-4ac7-afea-f71f0d681400 | 5 | private static HashMap<Integer, HashMap<Color, Integer>> createSilverMap()
{
HashMap<Integer, HashMap<Color, Integer>> map = new HashMap<Integer, HashMap<Color, Integer>>();
map.put(1, new HashMap<Color, Integer>());
map.get(1).put(Faction.YELLOW, 1);
map.get(1).put(Faction.RED, 2);
map.get(1).put(Fact... |
bd70ef33-1b99-46b0-84b6-b9e627b080c8 | 8 | private boolean r_prelude() {
int among_var;
int v_1;
// repeat, line 36
replab0: while(true)
{
v_1 = cursor;
lab1: do {
// (, line 36
... |
7fa375b6-c460-42bc-b8ec-86be0967b424 | 2 | private boolean withinBounds(int pointer, ArrayList<Rod> rodList) {
int currentLength = 0;
for(int i = 0; i < pointer; i++) {
currentLength += rodList.get(i).getLength();
}
return currentLength <= totalLength && pointer < rodList.size();
} |
12d64cd9-79d0-436c-b686-7a062a4629f7 | 6 | public static RelationTableInfo getRelationTableInfo(NamedDescription tablerelation) {
{ MemoizationTable memoTable000 = null;
Cons memoizedEntry000 = null;
Stella_Object memoizedValue000 = null;
if (Stella.$MEMOIZATION_ENABLEDp$) {
memoTable000 = ((MemoizationTable)(RDBMS.SGT_RDBMS_F_GET... |
9f318c4c-df4b-4aaa-b24c-687280a8bde4 | 8 | public QRDecomposition (Matrix A) {
// Initialize.
QR = A.getArrayCopy();
m = A.getRowDimension();
n = A.getColumnDimension();
Rdiag = new double[n];
// Main loop.
for (int k = 0; k < n; k++) {
// Compute 2-norm of k-th column without under/overflow.
double n... |
9a2b9f35-9384-4d0a-8d14-c9b176721d1b | 0 | public String getName() {
return name;
} |
0ccd5685-fdfe-44ac-aba4-17bbc136287b | 2 | public void paintComponent(Graphics g)
{
// base
g.setColor(Color.black);
g.drawLine(centerX - width/2, centerY, centerX + width/2, centerY);
g.drawLine(centerX, centerY, centerX, centerY - height);
g.drawString(name, centerX - 5, centerY + 15);
for (int i = 0; i < d... |
23c6527b-8df3-4c61-817d-6d8f8937ddfd | 6 | @EventHandler
public void CaveSpiderHunger(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getCaveSpiderConfig().getDouble("CaveSpi... |
256c645e-fbda-463f-9efc-639c715ddcf1 | 5 | String change2str(ChangeEffect change) {
String str = effTranslate(change.getEffectType());
if (change.getCodonsOld().isEmpty() && change.getCodonsNew().isEmpty()) str += " -";
else str += " " + change.getCodonsOld() + "/" + change.getCodonsNew();
if (change.getAaOld().isEmpty() && change.getAaNew().isEmpty()... |
135bfe29-43b1-4f6b-b39a-e2e2eb670b33 | 1 | public void printObjectState(){
for(Map.Entry<String, Object> entry : objectManager.objects.entrySet()){
Object object = entry.getValue();
System.out.println(object.name + "has value: " + object.value);
}
} |
a5d8dca9-6c47-4761-81aa-05cb6550ebe6 | 7 | protected void validateBasicAuthentication(OAuth2Message message, OAuth2Accessor accessor)
throws IOException,OAuth2Exception {
String authz = message.getHeader("Authorization");
if (authz != null) {
if(authz.substring(0,5).equals("Basic")){
String userPass = new String(B... |
2268f488-3a57-49fa-a037-9ec8c7de412f | 9 | private int alphabetaCardPicking(GameState state,
ArrayList<Color> playerList, ArrayList<Card> choiceList, int alpha, int beta, Color faction, int depth)
{
//Base case, if there aren't any more players we go to the first action
if(playerList.size() == 0)
{
GameState tempState = new GameState(state);
fo... |
f9301742-d586-45ec-bd62-3656e3c0757d | 8 | private void estimateDistribution(int[] bowl, int bowlId, int round, int bowlSize){
// Initially, create a uniform distribution
for (int i=0; i < NUM_FRUITS ; i++) {
originalDistribution[i] = Math.round(n_fruits/NUM_FRUITS);
// Assign uniform probability
if (bowls_seen[0] == 0 || bowls_seen... |
faa45143-c1e0-48dd-a580-02dd7f8fb632 | 9 | public List<String> fetchCategories(String userId, String type){
List<String> unsubCat = new ArrayList<String>();
ResultSet rs=null;
Connection con=null;
PreparedStatement ps=null;
List<String> result=new ArrayList<String>();
try{
String sql;
if(type.equals("NotSubscribed")){
sql="SELECT DISTI... |
136620ba-5c4b-4b8d-84a7-d56edc0e3630 | 5 | private static Color getColor(int selection) {
switch (selection) {
case RED:
return Color.RED;
case WHITE:
return Color.WHITE;
case YELLOW:
return Color.YELLOW;
case GREEN:
return Color.GREEN;
... |
913bfd39-6b0b-4821-a9a1-177801100b1a | 3 | private void key(byte key[]) {
int i;
int koffp[] = { 0 };
int lr[] = { 0, 0 };
int plen = P.length, slen = S.length;
for (i = 0; i < plen; i++)
P[i] = P[i] ^ streamtoword(key, koffp);
for (i = 0; i < plen; i += 2) {
encipher(lr, 0);
P[i] = lr[0];
P[i + 1] = lr[1];
}
for (i = 0; i < slen;... |
bc511af5-a7d9-493d-a54d-337d8061942d | 2 | private void setFlag(State s, StateFlag flag) {
switch (flag) {
case INITIAL:
initialStates.add(s);
break;
case ACCEPT:
acceptStates.add(s);
}
} |
97bf3c37-d8b9-4945-a67a-95dcb173869b | 8 | @SuppressWarnings("unchecked")
public void init() throws Exception {
RecorderServlet.recording = Boolean.parseBoolean(server.prop
.getProperty("homecam.Capturer.recording"));
RecorderServlet.maxRecord = Integer.parseInt(server.prop
.getProperty("homecam.Capturer.maxRecord"));
RecorderServlet.recordedDire... |
54fc9668-91fe-4de8-9721-9d45b646d51c | 0 | public int getLength() {
return this.length;
} |
3cadad70-0426-4550-ba72-89abf2cd1802 | 6 | public ProbChar[] determineCharaterProbability(Individual[] fitIndividuals) {
//keep track of the most probable character in each index of the individuals
ProbChar[] mostProbableChars = new ProbChar[TARGET_STRING.length()];
//keep track of the fitness of each character that we might have in each index
//chang... |
accf312b-6af9-4531-9d20-df5240bbcd25 | 4 | public void insertAbove(String filter) {
gui.addToHistory(filter);
if (filter != null && !filter.trim().equals("")) {
JList list = (JList) filterLists.elementAt(currentFilterIndex);
int i = list.getSelectedIndex();
if (i < 0) {
i = 0;
}
... |
3d1c42a0-8018-4991-83bf-3964c3843143 | 5 | public static void main(String[] args){
Document doc = null;
try {
doc = Jsoup.connect("http://lyrics.wikia.com/Adele:Rolling_In_The_Deep").get();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Cleaner cleaner = new Cleaner(new Whitelist().simpleText());
... |
2acb0e4c-6202-4f9b-8f10-b45850461048 | 6 | AboutDialog( JDialog parent ) {
super( parent, Utils.getResource( "about" ), true );
Utils.setDialogIcon( this );
setDefaultCloseOperation( JDialog.DISPOSE_ON_CLOSE );
Container content = getContentPane();
content.setLayout( new GridBagLayout() );
GridBagConstraints gbc =... |
042d513c-89d5-4896-8376-3b976e58b728 | 0 | public String getCharSet() {
return charSet;
} |
74dd79e1-23aa-42f8-8f84-88388c591605 | 4 | public boolean execute(CommandSender sender, String identifier,
String[] args) {
List<Command> sortCommands = plugin.getCommandHandler().getCommands();
List<Command> commands = new ArrayList<Command>();
for (Command command : sortCommands) {
if (command.isShownOnHelpMenu()
&& DonorTitles.perms.has(se... |
08f6957d-c5a4-49b0-a4cf-2385590c4e90 | 4 | public void clipSourceDest(CPRect srcRect, CPRect dstRect) {
// FIXME:
// /!\ dstRect bottom and right are ignored and instead we clip
// against the width, height of the layer. :/
//
// this version would be enough in most cases (when we don't need
// srcRect bottom and right to be clipped)
// it's left... |
f528b62f-ff0f-470e-b8ef-7d8c03518dc6 | 2 | @Override
public void huolehdi(){
h1.kiihdyta(tila.getKiihtyvyys1X(), tila.getKiihtyvyys1Y());
h2.kiihdyta(tila.getKiihtyvyys2X(), tila.getKiihtyvyys2Y());
for (Raaja raaja : h1.getRaajat()){
raaja.setLiikkuuko(tila.getKulmankasvatus(h1));
}
for (Raaja raaja : h2... |
92cbf2d2-aaf0-4d68-96bc-f43f3bcd4681 | 2 | public int[] selectRandom(){
calculateMoleculeID(0,0, new int[0]);
ArrayList<Molecule> arr = new ArrayList<Molecule>();
Molecule selected = new Molecule();
int n;
double rand;
//Sorts THIS molecule into an array
arr = sortIntoArray(arr);
for(int i=0; i<arr.size(); i++){
/... |
0b999d2a-fa1c-46d8-84b8-367441477432 | 3 | public void setCaracter(TCaracter node)
{
if(this._caracter_ != null)
{
this._caracter_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
node.parent(... |
a9a8fbf7-0422-4329-a946-8cf747ea6df0 | 3 | public String getServerVersion(String serverPropertyType, String serverVersionPath) throws Exception {
final Properties prop = new Properties();
URL svp = new URL(serverVersionPath);
InputStream input = svp.openStream();
try {
prop.loadFromXML(input);
} catch (IOException ex) {
ex.printStackTrace();
... |
5786198e-9322-4698-ab75-8610e73431b8 | 7 | @Override
public String runMacro(HTTPRequest httpReq, String parm, HTTPResponse httpResp)
{
final java.util.Map<String,String> parms=parseParms(parm);
final String last=httpReq.getUrlParameter("BEHAVIOR");
if(last==null)
return " @break@";
if(last.length()>0)
{
final Behavior B=CMClass.getBehavior(las... |
0a227e08-b141-4715-8838-7ea61e198dd2 | 2 | public static void main(String[] args){
int total = 0;
for(int i=1;i<10000;i++){
if(isAmicable(i)){
total += i;
System.out.println(i);
}
}
System.out.println(total);
} |
0eb17da3-6b53-4c0d-bba9-7ab28a2985d6 | 6 | private static char[] removeFrontZero(char[] number, boolean minus) {
int i=0;
for(;i<number.length;i++) {
if(number[i]!='0' && number[i]!='\u0000') {
break;
}
}
if(i==number.length) {
return "0".toCharArray();
}
number = Arrays.copyOfRange(number, i, number.length);
if(minus){
numb... |
8dbd1113-4547-4cf1-b0cd-8e8a9262be3e | 8 | private double painoArvo(int x, int y) {
if((x == 3 || x == 4) && (y == 3 || y == 4)) return 0.5;
if((x <= 5 && x >= 2) && (y <= 5 && y >= 2)) return 0.25;
return 0.0;
} |
cd6575b4-07c6-4453-a339-3c1a9aca13e1 | 7 | public void run() {
this.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent we) {
saver.savePref(Width, Height, winZoom);
System.exit(0);
}
});
long before;
long after;
long start;
init();
befo... |
17a3a881-5fda-4c47-9704-599d3d174de9 | 9 | public static int getRow(int selection) {
int row = 100;
// Calculates
if (selection == 1 || selection == 2 || selection == 3) {
row = 0;
}
if (selection == 4 || selection == 5 || selection == 6) {
row = 1;
}
if (selection == 7 || selection == 8 || selection == 9) {
row = 2;
}
return row;
} |
118c7a3b-e154-4464-bac4-ec75c15d9eb9 | 1 | public void setShowColumnDivider(boolean visible) {
if (visible != mShowColumnDivider) {
mShowColumnDivider = visible;
notify(TreeNotificationKeys.COLUMN_DIVIDER, Boolean.valueOf(mShowColumnDivider));
}
} |
1733d36c-cfdf-4ce9-800a-b11a6cf4669f | 5 | @Override
public void actionPerformed(ActionEvent e) {
JMenuItem menuItem = (JMenuItem)e.getSource();
if(menuItem == exitItem){
System.exit(0);
}
else if(menuItem == aboutItem){
JOptionPane.showMessageDialog(this, "Java PE reader v1.0.");
... |
75ddb6a9-ee52-4602-b942-888916b79af7 | 0 | public int getJaar() {
return jaar;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.